* testsuite/Makefile.am: Add incremental_copy_test,
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-06-07  Cary Coutant  <ccoutant@google.com>
2
3         * testsuite/Makefile.am: Add incremental_copy_test,
4         incremental_common_test_1.
5         * testsuite/Makefile.in: Regenerate.
6         * testsuite/common_test_1_v1.c: New source file.
7         * testsuite/common_test_1_v2.c: New source file.
8         * testsuite/copy_test_v1.cc: New source file.
9
10 2011-06-07  Cary Coutant  <ccoutant@google.com>
11
12         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
13         update, allocate common from bss section's free list.
14         * incremental-dump.cc (dump_incremental_inputs): Print flag for
15         linker-defined symbols.
16         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
17         Skip GOT and PLT entries that are no longer referenced.
18         (Output_section_incremental_inputs::write_info_blocks): Mark
19         linker-defined symbols.
20         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
21         * output.cc (Output_section::allocate): New function.
22         * output.h (Output_section::allocate): New function.
23         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
24         linker-defined symbols.
25         (Symbol::override_base_with_special): Copy is_predefined_ flag.
26         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
27         (Symbol::init_base_output_data): Likewise.
28         (Symbol::init_base_output_segment): Likewise.
29         (Symbol::init_base_constant): Likewise.
30         (Sized_symbol::init_output_data): Likewise.
31         (Sized_symbol::init_output_segment): Likewise.
32         (Sized_symbol::init_constant): Likewise.
33         (Symbol_table::do_define_in_output_data): Likewise.
34         (Symbol_table::do_define_in_output_segment): Likewise.
35         (Symbol_table::do_define_as_constant): Likewise.
36         * symtab.h (Symbol::is_predefined): New function.
37         (Symbol::init_base_output_data): Add is_predefined parameter.
38         (Symbol::init_base_output_segment): Likewise.
39         (Symbol::init_base_constant): Likewise.
40         (Symbol::is_predefined_): New data member.
41         (Sized_symbol::init_output_data): Add is_predefined parameter.
42         (Sized_symbol::init_output_segment): Likewise.
43         (Sized_symbol::init_constant): Likewise.
44         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
45
46 2011-06-07  Cary Coutant  <ccoutant@google.com>
47
48         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
49         instead of emit_copy_reloc.
50         (Copy_relocs::emit_copy_reloc): Refactor.
51         (Copy_relocs::make_copy_reloc): New function.
52         (Copy_relocs::add_copy_reloc): Remove.
53         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
54         section.
55         (Copy_relocs::make_copy_reloc): New function.
56         (Copy_relocs::add_copy_reloc): Remove.
57         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
58         unchanged input files.
59         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
60         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
61         Reserve BSS space for COPY relocations.
62         (Sized_incremental_binary::do_emit_copy_relocs): New function.
63         (Output_section_incremental_inputs::write_info_blocks): Record
64         whether a symbol is copied from a shared object.
65         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
66         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
67         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
68         (Incremental_input_entry_reader::get_output_symbol_index): Add
69         is_copy parameter.
70         (Incremental_binary::emit_copy_relocs): New function.
71         (Incremental_binary::do_emit_copy_relocs): New function.
72         (Sized_incremental_binary::Sized_incremental_binary): Initialize
73         new data member.
74         (Sized_incremental_binary::add_copy_reloc): New function.
75         (Sized_incremental_binary::do_emit_copy_relocs): New function.
76         (Sized_incremental_binary::Copy_reloc): New struct.
77         (Sized_incremental_binary::Copy_relocs): New typedef.
78         (Sized_incremental_binary::copy_relocs_): New data member.
79         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
80         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
81         * target.h (Sized_target::emit_copy_reloc): New function.
82         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
83
84 2011-06-02  Cary Coutant  <ccoutant@google.com>
85
86         PR gold/12163
87         * gold/archive.cc (Archive::Archive): Initialize new data member.
88         (Archive::include_all_members): Return if archive has already been
89         included.
90         * gold/archive.h (Archive::include_all_members_): New data member.
91
92 2011-06-02  Nick Clifton  <nickc@redhat.com>
93
94         * dynobj.h: Fix spelling mistake in comment.
95         * output.cc: Likewise.
96
97 2011-05-31  Doug Kwan  <dougkwan@google.com>
98             Asier Llano
99
100         PR gold/12826
101         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
102         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
103         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
104         redundant arm_exidx_test.so.
105         * testsuite/Makefile.in: Regenerate.
106         (check_SCRIPTS): Add pr12826.sh
107         (check_DATA): Add pr12826.stdout
108         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
109         * testsuite/pr12826.sh: New file.
110         * testsuite/pr12826_1.s: Ditto.
111         * testsuite/pr12826_1.s: Ditto.
112
113 2011-05-30  Ian Lance Taylor  <iant@google.com>
114
115         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
116         sections.
117
118 2011-05-29  Ian Lance Taylor  <iant@google.com>
119
120         PR gold/12804
121         * testsuite/Makefile.am: Use different file name for two_file_test
122         temporary file for each incremental test.
123         * testsuite/Makefile.in: Rebuild.
124
125 2011-05-29  Ian Lance Taylor  <iant@google.com>
126
127         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
128         binary input file is empty.
129
130 2011-05-27  Ian Lance Taylor  <iant@google.com>
131
132         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
133         (ver_test_9.so): Likewise.
134         * testsuite/Makefile.in: Rebuild.
135
136 2011-05-26 Cary Coutant  <ccoutant@google.com>
137
138         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
139         * incremental.cc (Incremental_inputs::report_input_section): Fix
140         comment, indentation.
141         (Incremental_inputs::report_comdat_group): New function.
142         (Output_section_incremental_inputs::set_final_data_size): Adjust size
143         of data for incremental input file entry.
144         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
145         group count, COMDAT group signatures.
146         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
147         an unchanged input file.
148         * incremental.h (Incremental_object_entry::Incremental_object_entry):
149         Initialize new data member.
150         (Incremental_object_entry::add_comdat_group): New function.
151         (Incremental_object_entry::get_comdat_group_count): New function.
152         (Incremental_object_entry::get_comdat_signature_key): New function.
153         (Incremental_object_entry::groups_): New data member.
154         (Incremental_inputs::report_comdat_group): New function.
155         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
156         data for incremental input file entry.
157         (Incremental_input_entry_reader::get_comdat_group_count): New function.
158         (Incremental_input_entry_reader::get_input_section): Adjust size of
159         data for incremental input file entry.
160         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
161         (Incremental_input_entry_reader::get_comdat_group_signature): New
162         function.
163         * object.cc (Sized_relobj::include_section_group): Report kept
164         COMDAT groups for incremental links.
165
166 2011-05-24  David Meyer  <pdox@google.com>
167
168         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
169         with name parameter.  Add found_name parameter.
170         * fileread.cc (Input_file::find_file): Adjust code accordingly.
171         * dirsearch.h (class Dirsearch): Update declaration.
172
173 2011-05-24  Ian Lance Taylor  <iant@google.com>
174
175         * archive.cc (Library_base::should_include_member): Pull in object
176         from archive if it defines the entry symbol.
177         * parameters.cc (Parameters::entry): New function.
178         * parameters.h (class Parameters): Declare entry.
179         * output.h (class Output_file_header): Remove entry_ field.
180         * output.cc (Output_file_header::Output_file_header): Remove entry
181         parameter.  Change all callers.
182         (Output_file_header::entry): Use parameters->entry.
183         * gold.cc (queue_middle_tasks): Likewise.
184         * plugin.cc (Plugin_hook::run): Likewise.
185
186 2011-05-24 Cary Coutant  <ccoutant@google.com>
187
188         * gold.cc (queue_initial_tasks): Pass incremental base filename
189         to Output_file::open_base_file; don't print error message.
190         * incremental-dump.cc (main): Adjust call to
191         Output_file::open_for_modification.
192         * incremental-dump.cc (main): Likewise.
193         * incremental.cc (Incremental_inputs::report_command_line):
194         Ignore --incremental-base option when comparing command lines.
195         Ignore parameter when given as separate argument.
196         * options.h (class General_options): Add --incremental-base.
197         * output.cc (Output_file::Output_file):
198         (Output_file::open_base_file): Add base_name and writable parameters;
199         read base file into new file; print error message here.
200         (Output_file::map_no_anonymous): Add writable parameter; adjust all
201         callers.
202         * output.h (Output_file::open_for_modification): Rename to...
203         (Output_file::open_base_file): ...this; add base_name and
204         writable parameters; adjust all callers.
205         (Output_file::map_no_anonymous): Add writable parameter; adjust all
206         callers.
207         * testsuite/Makefile.am (incremental_test_4): Test
208         --incremental-base.
209         * testsuite/Makefile.in: Regenerate.
210
211 2011-05-24 Cary Coutant  <ccoutant@google.com>
212
213         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
214         incremental_test_4.
215         * testsuite/Makefile.in: Regenerate.
216         * testsuite/two_file_test_1_v1.cc: New test source file.
217         * testsuite/two_file_test_1b_v1.cc: New test source file.
218         * testsuite/two_file_test_2_v1.cc: New test source file.
219
220 2011-05-24 Cary Coutant  <ccoutant@google.com>
221
222         * dynobj.h (Dynobj::do_dynobj): New function.
223         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
224         flag and soname for shared objects.
225         * incremental.cc (Incremental_inputs::report_object): Make
226         either Incremental_object_entry or Incremental_dynobj_entry; add
227         soname to string table.
228         (Incremental_inputs::report_input_section): Add assertion.
229         (Output_section_incremental_inputs::set_final_data_size): Adjust
230         type of input file entry for shared libraries; adjust size of
231         shared library info entry.
232         (Output_section_incremental_inputs::write_input_files): Write
233         as_needed flag for shared libraries.
234         (Output_section_incremental_inputs::write_info_blocks): Adjust type
235         of input file entry for shared libraries; write soname.
236         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
237         soname from incremental info.
238         * incremental.h (enum Incremental_input_flags): Add
239         INCREMENTAL_INPUT_AS_NEEDED.
240         (Incremental_input_entry::Incremental_input_entry): Initialize new
241         data member.
242         (Incremental_input_entry::set_as_needed): New function.
243         (Incremental_input_entry::as_needed): New function.
244         (Incremental_input_entry::do_dynobj_entry): New function.
245         (Incremental_input_entry::as_needed_): New data member.
246         (Incremental_object_entry::Incremental_object_entry): Don't check
247         for shared library.
248         (Incremental_object_entry::do_type): Likewise.
249         (class Incremental_dynobj_entry): New class.
250         (Incremental_input_entry_reader::as_needed): New function.
251         (Incremental_input_entry_reader::get_soname): New function.
252         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
253         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
254         size of shared library info entry.
255         * layout.cc (Layout::finish_dynamic_section): Don't test for 
256         incremental link when adding DT_NEEDED entries.
257         * object.h (Object::Object): Initialize new data member.
258         (Object::dynobj): New function.
259         (Object::set_as_needed): New function.
260         (Object::as_needed): New function.
261         (Object::do_dynobj): New function.
262         (Object::as_needed_): New data member.
263
264 2011-05-24 Cary Coutant  <ccoutant@google.com>
265
266         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
267         info; adjust display of GOT entries.
268         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
269         vector of input objects; remove file_status_.
270         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
271         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
272         got_plt reader; call target hooks to reserve GOT entries.
273         (Output_section_incremental_inputs::set_final_data_size): Adjust size
274         of input file info header and GOT info entry.
275         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
276         relocation info.
277         (Got_plt_view_info::got_descriptor): Remove.
278         (Got_plt_view_info::sym_index): New data member.
279         (Got_plt_view_info::input_index): New data member.
280         (Local_got_offset_visitor::visit): Write input file index.
281         (Global_got_offset_visitor::visit): Write 0 for input file index.
282         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
283         with sym_index and input_index.
284         (Output_section_incremental_inputs::write_got_plt): Adjust size of
285         incremental info GOT entry; replace got_descriptor with input_index.
286         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
287         map from input file index to object.
288         (Sized_relobj_incr::do_layout): Replace direct data member reference
289         with accessor function.
290         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
291         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
292         Adjust size of input file info header.
293         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
294         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
295         (Incremental_input_entry_reader::get_input_section): Adjust size of
296         input file info header.
297         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
298         of incremental info GOT entry.
299         (Incremental_got_plt_reader::get_got_desc): Remove.
300         (Incremental_got_plt_reader::get_got_symndx): New function.
301         (Incremental_got_plt_reader::get_got_input_index): New function.
302         (Sized_incremental_binary::Sized_incremental_binary): Remove
303         file_status_; add input_objects_.
304         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
305         (Sized_incremental_binary::set_file_is_unchanged): Remove.
306         (Sized_incremental_binary::file_is_unchanged): Remove.
307         (Sized_incremental_binary::set_input_object): New function.
308         (Sized_incremental_binary::input_object): New function.
309         (Sized_incremental_binary::file_status_): Remove.
310         (Sized_incremental_binary::input_objects_): New data member.
311         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
312         references.
313         (Sized_relobj_incr::invalid_address): Move to base class.
314         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
315         class.
316         (Sized_relobj_incr::do_output_section_offset): Likewise.
317         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
318         (Sized_relobj_incr::section_offsets_): Likewise.
319         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
320         function.
321         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
322         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
323         with accessor function.
324         (Sized_relobj_file::do_layout): Likewise.
325         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
326         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
327         (Sized_relobj_file::compute_final_local_value): Replace refs to
328         section_offsets_ with accessor function.
329         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
330         * object.h (Relobj::Relobj): Initialize new data members.
331         (Relobj::add_dyn_reloc): New function.
332         (Relobj::first_dyn_reloc): New function.
333         (Relobj::dyn_reloc_count): New function.
334         (Relobj::first_dyn_reloc_): New data member.
335         (Relobj::dyn_reloc_count_): New data member.
336         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
337         references.
338         (Sized_relobj::Address): New typedef.
339         (Sized_relobj::invalid_address): Move here from child class.
340         (Sized_relobj::Sized_relobj): Initialize new data members.
341         (Sized_relobj::sized_relobj): New function.
342         (Sized_relobj::is_output_section_offset_invalid): Move here from
343         child class.
344         (Sized_relobj::get_output_section_offset): Likewise.
345         (Sized_relobj::local_has_got_offset): Likewise.
346         (Sized_relobj::local_got_offset): Likewise.
347         (Sized_relobj::set_local_got_offset): Likewise.
348         (Sized_relobj::do_for_all_local_got_entries): Likewise.
349         (Sized_relobj::clear_got_offsets): New function.
350         (Sized_relobj::section_offsets): Move here from child class.
351         (Sized_relobj::do_output_section_offset): Likewise.
352         (Sized_relobj::do_set_section_offset): Likewise.
353         (Sized_relobj::Local_got_offsets): Likewise.
354         (Sized_relobj::local_got_offsets_): Likewise.
355         (Sized_relobj::section_offsets_): Likewise.
356         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
357         references.
358         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
359         class.
360         (Sized_relobj_file::sized_relobj): New function
361         (Sized_relobj_file::local_has_got_offset): Move to base class.
362         (Sized_relobj_file::local_got_offset): Likewise.
363         (Sized_relobj_file::set_local_got_offset): Likewise.
364         (Sized_relobj_file::get_output_section_offset): Likewise.
365         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
366         (Sized_relobj_file::do_output_section_offset): Likewise.
367         (Sized_relobj_file::do_set_section_offset): Likewise.
368         (Sized_relobj_file::Local_got_offsets): Likewise.
369         (Sized_relobj_file::local_got_offsets_): Likewise.
370         (Sized_relobj_file::section_offsets_): Likewise.
371         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
372         (all constructors).
373         (set_needs_dynsym_index): Convert relobj to derived class pointer.
374         (Output_reloc::get_symbol_index): Likewise.
375         (Output_reloc::local_section_offset): Likewise.
376         (Output_reloc::get_address): Likewise.
377         (Output_reloc::symbol_value): Likewise.
378         (Output_data_got::reserve_slot): Move to class definition.
379         (Output_data_got::reserve_local): New function.
380         (Output_data_got::reserve_slot_for_global): Remove.
381         (Output_data_got::reserve_global): New function.
382         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
383         (all constructors, two instantiations).
384         (Output_reloc::get_relobj): New function (two instantiations).
385         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
386         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
387         (Output_data_reloc::add_global): Adjust type of relobj.
388         (Output_data_reloc::add_global_relative): Likewise.
389         (Output_data_reloc::add_symbolless_global_addend): Likewise.
390         (Output_data_reloc::add_local): Likewise.
391         (Output_data_reloc::add_local_relative): Likewise.
392         (Output_data_reloc::add_symbolless_local_addend): Likewise.
393         (Output_data_reloc::add_local_section): Likewise.
394         (Output_data_reloc::add_output_section): Likewise.
395         (Output_data_reloc::add_absolute): Likewise.
396         (Output_data_reloc::add_target_specific): Likewise.
397         (Output_data_got::reserve_slot): Move definition here.
398         (Output_data_got::reserve_local): New function.
399         (Output_data_got::reserve_global): New function.
400         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
401         section_offsets_ with accessor function.
402         (Sized_relobj_file::write_sections): Likewise.
403         (Sized_relobj_file::do_relocate_sections): Likewise.
404         * target.h (Sized_target::reserve_local_got_entry): New function.
405         (Sized_target::reserve_global_got_entry): New function.
406         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
407         (Target_x86_64::reserve_global_got_entry): New function.
408         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
409
410 2011-05-23 Cary Coutant  <ccoutant@google.com>
411
412         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
413         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
414         bit when checking got_type.
415         * incremental.cc (Sized_incremental_binary::setup_readers):
416         Store symbol table and string table locations; initialize bit vector
417         of file status flags.
418         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
419         unchanged files.
420         (Sized_incremental_binary::do_process_got_plt): New function.
421         (Sized_incremental_binary::get_symtab_view): Use stored locations.
422         (Output_section_incremental_inputs::set_final_data_size): Record
423         file index for each input file.
424         (Output_section_incremental_inputs::write_got_plt): Store file index
425         instead of input entry offset for each GOT entry.
426         * incremental.h
427         (Incremental_input_entry::Incremental_input_entry): Initialize new
428         data member.
429         (Incremental_input_entry::set_offset): Store file index.
430         (Incremental_input_entry::get_file_index): New function.
431         (Incremental_input_entry::file_index_): New data member.
432         (Incremental_binary::process_got_plt): New function.
433         (Incremental_binary::do_process_got_plt): New function.
434         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
435         data members.
436         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
437         (Sized_incremental_binary::set_file_is_unchanged): New function.
438         (Sized_incremental_binary::file_is_unchanged): New function.
439         (Sized_incremental_binary::do_process_got_plt): New function.
440         (Sized_incremental_binary::file_status_): New data member.
441         (Sized_incremental_binary::main_symtab_loc_): New data member.
442         (Sized_incremental_binary::main_strtab_loc_): New data member.
443         * output.cc (Output_data_got::Got_entry::write): Add case
444         RESERVED_CODE.
445         (Output_data_got::add_global): Call add_got_entry.
446         (Output_data_got::add_global_plt): Likewise.
447         (Output_data_got::add_global_with_rel): Likewise.
448         (Output_data_got::add_global_with_rela): Likewise.
449         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
450         (Output_data_got::add_global_pair_with_rela): Likewise.
451         (Output_data_got::add_local): Call add_got_entry.
452         (Output_data_got::add_local_plt): Likewise.
453         (Output_data_got::add_local_with_rel): Likewise.
454         (Output_data_got::add_local_with_rela): Likewise.
455         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
456         (Output_data_got::add_local_pair_with_rela): Likewise.
457         (Output_data_got::reserve_slot): New function.
458         (Output_data_got::reserve_slot_for_global): New function.
459         (Output_data_got::add_got_entry): New function.
460         (Output_data_got::add_got_entry_pair): New function.
461         (Output_section::add_output_section_data): Edit FIXME.
462         * output.h
463         (Output_section_data_build::Output_section_data_build): New
464         constructor with size parameter.
465         (Output_data_space::Output_data_space): Likewise.
466         (Output_data_got::Output_data_got): Initialize new data member; new
467         constructor with size parameter.
468         (Output_data_got::add_constant): Call add_got_entry.
469         (Output_data_got::reserve_slot): New function.
470         (Output_data_got::reserve_slot_for_global): New function.
471         (class Output_data_got::Got_entry): Add RESERVED_CODE.
472         (Output_data_got::add_got_entry): New function.
473         (Output_data_got::add_got_entry_pair): New function.
474         (Output_data_got::free_list_): New data member.
475         * target.h (Sized_target::init_got_plt_for_update): New function.
476         (Sized_target::register_global_plt_entry): New function.
477         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
478         Initialize new data member; call init; add constructor with PLT count.
479         (Output_data_plt_x86_64::init): New function.
480         (Output_data_plt_x86_64::add_relocation): New function.
481         (Output_data_plt_x86_64::reserve_slot): New function.
482         (Output_data_plt_x86_64::free_list_): New data member.
483         (Target_x86_64::init_got_plt_for_update): New function.
484         (Target_x86_64::register_global_plt_entry): New function.
485         (Output_data_plt_x86_64::add_entry): Allocate from free list for
486         incremental updates.
487         (Output_data_plt_x86_64::add_relocation): New function.
488         * testsuite/object_unittest.cc (Object_test): Set default options.
489
490 2011-05-16  Ian Lance Taylor  <iant@google.com>
491
492         * options.h (class General_options): Make -i a synonym for -r.
493
494 2011-05-16  Ian Lance Taylor  <iant@google.com>
495
496         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
497
498 2011-05-10 Cary Coutant  <ccoutant@google.com>
499
500         * object.cc (Sized_relobj::do_count_local_symbols): Check for
501         strip_all (-s).
502
503 2011-05-06  Ian Lance Taylor  <iant@google.com>
504
505         * layout.cc (Layout::layout): If the output section flags change,
506         update the ordering.
507
508 2011-04-25 Cary Coutant  <ccoutant@google.com>
509
510         * incremental-dump.cc (dump_incremental_inputs): Print local
511         symbol info for each input file.
512         * incremental.cc
513         (Output_section_incremental_inputs::set_final_data_size): Add local
514         symbol info to input file entries in incremental info.
515         (Output_section_incremental_inputs::write_info_blocks): Likewise.
516         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
517         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
518         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
519         implementation.
520         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
521         (Sized_incr_relobj::do_relocate): Write the local symbols.
522         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
523         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
524         Adjust size of input file header.
525         (Incremental_inputs_reader::get_local_symbol_offset): New function.
526         (Incremental_inputs_reader::get_local_symbol_count): New function.
527         (Incremental_inputs_reader::get_input_section): Adjust size of input
528         file header.
529         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
530         (Sized_incr_relobj::This): New typedef.
531         (Sized_incr_relobj::sym_size): New const data member.
532         (Sized_incr_relobj::Local_symbol): New struct.
533         (Sized_incr_relobj::do_output_local_symbol_count): New function.
534         (Sized_incr_relobj::do_local_symbol_offset): New function.
535         (Sized_incr_relobj::local_symbol_count_): New data member.
536         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
537         (Sized_incr_relobj::local_symbol_index_): New data member.
538         (Sized_incr_relobj::local_symbol_offset_): New data member.
539         (Sized_incr_relobj::local_dynsym_offset_): New data member.
540         (Sized_incr_relobj::local_symbols_): New data member.
541         * object.h (Relobj::output_local_symbol_count): New function.
542         (Relobj::local_symbol_offset): New function.
543         (Relobj::do_output_local_symbol_count): New function.
544         (Relobj::do_local_symbol_offset): New function.
545         (Sized_relobj::do_output_local_symbol_count): New function.
546         (Sized_relobj::do_local_symbol_offset): New function.
547
548 2011-04-22  Vladimir Simonov  <sv@sw.ru>
549
550         * descriptors.cc (set_close_on_exec): New function.
551         (Descriptors::open): Use set_close_on_exec.
552         * output.cc (S_ISLNK): Define if not defined.
553
554 2011-04-22 Cary Coutant  <ccoutant@google.com>
555
556         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
557         global symbol map.
558         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
559         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
560         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
561         relocations.
562         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
563         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
564         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
565         * incremental.h
566         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
567         function.
568         (Incremental_binary::apply_incremental_relocs): New function.
569         (Incremental_binary::do_apply_incremental_relocs): New function.
570         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
571         data member.
572         (Sized_incremental_binary::add_global_symbol): New function.
573         (Sized_incremental_binary::global_symbol): New function.
574         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
575         (Sized_incremental_binary::symbol_map_): New data member.
576         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
577         * target.h (Sized_target::apply_relocation): New function.
578         * target-reloc.h (apply_relocation): New function.
579         * x86_64.cc (Target_x86_64::apply_relocation): New function.
580
581 2011-04-22  Doug Kwan  <dougkwan@google.com>
582
583         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
584         flag of a SHT_ARM_EXIDX section.
585         * testsuite/Makefile.am (arm_exidx_test): New test rules.
586         * testsuite/Makefile.in: Regenerate.
587         * testsuite/arm_exidx_test.s: New file.
588         * testsuite/arm_exidx_test.sh: Same.
589
590 2011-04-20 Cary Coutant  <ccoutant@google.com>
591
592         PR gold/12689
593         * archive.h (Incremental_archive_entry::Archive_member):
594         Initialize arg_serial_ (second constructor).
595
596 2011-04-17  Ian Lance Taylor  <iant@google.com>
597
598         * object.cc (Relocate_info::location): Simplify location string.
599         * errors.cc (Errors::error_at_location): Don't print program
600         name.
601         (Errors::warning_at_location): Likewise.
602         (Errors::undefined_symbol): Likewise.
603         * testsuite/debug_msg.sh: Update accordingly.
604
605 2011-04-14 Cary Coutant  <ccoutant@google.com>
606
607         * gold/layout.cc (Layout::symtab_section_offset): New function.
608         * gold/layout.h (Layout::symtab_section_offset): New function.
609         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
610
611 2011-04-12  Ian Lance Taylor  <iant@google.com>
612
613         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
614         with MREMAP_MAYMOVE.
615         * output.h (class Output_file): Add map_is_allocated_ field.
616         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
617         not available, provide stubs.  If mremap is not available, #define
618         it to gold_mremap.
619         (MREMAP_MAYMOVE): Define if not defined.
620         (Output_file::Output_file): Initialize map_is_allocated_.
621         (Output_file::resize): Check map_is_allocated_.
622         (Output_file::map_anonymous): If mmap fails, use malloc.
623         (Output_file::unmap): Don't do anything for an anonymous map.
624         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
625         is not available, provide stubs.
626         (File_read::View::~View): Use free rather than delete[].
627         (File_read::make_view): Use malloc rather than new[].  If mmap
628         fails, use malloc.
629         (File_read::find_or_make_view): Use malloc rather than new[].
630         * gold.h: Remove HAVE_REMAP code.
631         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
632         exists.  Rename mremap to gold_mremap.  If mmap is not available
633         don't do anything.
634         * configure, config.in: Rebuild.
635
636 2011-04-11  Ian Lance Taylor  <iant@google.com>
637
638         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
639         initialize local variable v.
640
641 2011-04-11  Cary Coutant  <ccoutant@google.com>
642
643         * archive.cc (Archive::include_member): Adjust call to
644         report_object.
645         (Add_archive_symbols::run): Track argument serial numbers.
646         (Lib_group::include_member): Likewise.
647         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
648         * archive.h (Incremental_archive_entry::Archive_member):
649         Initialize arg_serial_.
650         (Archive_member::arg_serial_): New data member.
651         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
652         (Sized_dynobj::do_add_symbols): Track symbols when doing an
653         incremental link.
654         (Sized_dynobj::do_for_all_local_got_entries): New function.
655         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
656         function.
657         * fileread.cc (get_mtime): New function.
658         * fileread.h (get_mtime): New function.
659         * gold.cc (queue_initial_tasks): Check for incremental update.
660         (process_incremental_input): New function.
661         (queue_middle_tasks): Don't force valid target for incremental
662         update.
663         * incremental-dump.cc (find_input_containing_global): Adjust
664         size of symbol info entry.
665         (dump_incremental_inputs): Dump argument serial number and
666         in_system_directory flag; bias shndx by 1; print symbol names
667         when dumping per-file symbol lists; use new symbol info readers.
668         * incremental.cc
669         (Output_section_incremental_inputs:update_data_size): New function.
670         (Sized_incremental_binary::setup_readers): Setup input readers
671         for each input file; build maps for files added from libraries
672         and scripts.
673         (Sized_incremental_binary::check_input_args): New function.
674         (Sized_incremental_binary::do_check_inputs): Build map of argument
675         serial numbers to input arguments.
676         (Sized_incremental_binary::do_file_has_changed): Rename
677         do_file_is_unchanged to this; compare file modification times.
678         (Sized_incremental_binary::do_init_layout): New function.
679         (Sized_incremental_binary::do_reserve_layout): New function.
680         (Sized_incremental_binary::do_get_input_reader): Remove.
681         (Sized_incremental_binary::get_symtab_view): New function.
682         (Incremental_checker::can_incrementally_link_output_file): Remove.
683         (Incremental_inputs::report_command_line): Exclude --debug options.
684         (Incremental_inputs::report_archive_begin): Add parameter; track
685         argument serial numbers; don't put input file entry for archive
686         before archive members.
687         (Incremental_inputs::report_archive_end): Put input file entry
688         for archive after archive members.
689         (Incremental_inputs::report_object): Add parameter; track argument
690         serial numbers and in_system_directory flag.
691         (Incremental_inputs::report_script): Add parameter; track argument
692         serial numbers.
693         (Output_section_incremental_inputs::set_final_data_size): Adjust
694         size of symbol info entry; check for forwarding symbols.
695         (Output_section_incremental_inputs::write_input_files): Write
696         in_system_directory flag and argument serial number.
697         (Output_section_incremental_inputs::write_info_blocks): Map section
698         indices between incremental info and original input file; store
699         input section index for each symbol.
700         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
701         change operator() to visit().
702         (class Global_got_offset_visitor): Likewise.
703         (class Global_symbol_visitor_got_plt):
704         (Output_section_incremental_inputs::write_got_plt): Use new visitor
705         classes.
706         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
707         (Sized_incr_relobj::do_read_symbols): New function.
708         (Sized_incr_relobj::do_layout): New function.
709         (Sized_incr_relobj::do_layout_deferred_sections): New function.
710         (Sized_incr_relobj::do_add_symbols): New function.
711         (Sized_incr_relobj::do_should_include_member): New function.
712         (Sized_incr_relobj::do_for_all_global_symbols): New function.
713         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
714         (Sized_incr_relobj::do_section_size): New function.
715         (Sized_incr_relobj::do_section_name): New function.
716         (Sized_incr_relobj::do_section_contents): New function.
717         (Sized_incr_relobj::do_section_flags): New function.
718         (Sized_incr_relobj::do_section_entsize): New function.
719         (Sized_incr_relobj::do_section_address): New function.
720         (Sized_incr_relobj::do_section_type): New function.
721         (Sized_incr_relobj::do_section_link): New function.
722         (Sized_incr_relobj::do_section_info): New function.
723         (Sized_incr_relobj::do_section_addralign): New function.
724         (Sized_incr_relobj::do_initialize_xindex): New function.
725         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
726         (Sized_incr_relobj::do_read_relocs): New function.
727         (Sized_incr_relobj::do_gc_process_relocs): New function.
728         (Sized_incr_relobj::do_scan_relocs): New function.
729         (Sized_incr_relobj::do_count_local_symbols): New function.
730         (Sized_incr_relobj::do_finalize_local_symbols): New function.
731         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
732         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
733         (Sized_incr_relobj::do_relocate): New function.
734         (Sized_incr_relobj::do_set_section_offset): New function.
735         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
736         (Sized_incr_dynobj::do_read_symbols): New function.
737         (Sized_incr_dynobj::do_layout): New function.
738         (Sized_incr_dynobj::do_add_symbols): New function.
739         (Sized_incr_dynobj::do_should_include_member): New function.
740         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
741         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
742         (Sized_incr_dynobj::do_section_size): New function.
743         (Sized_incr_dynobj::do_section_name): New function.
744         (Sized_incr_dynobj::do_section_contents): New function.
745         (Sized_incr_dynobj::do_section_flags): New function.
746         (Sized_incr_dynobj::do_section_entsize): New function.
747         (Sized_incr_dynobj::do_section_address): New function.
748         (Sized_incr_dynobj::do_section_type): New function.
749         (Sized_incr_dynobj::do_section_link): New function.
750         (Sized_incr_dynobj::do_section_info): New function.
751         (Sized_incr_dynobj::do_section_addralign): New function.
752         (Sized_incr_dynobj::do_initialize_xindex): New function.
753         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
754         (make_sized_incremental_object): New function.
755         (Incremental_library::copy_unused_symbols): New function.
756         (Incremental_library::do_for_all_unused_symbols): New function.
757         * incremental.h (enum Incremental_input_flags): New type.
758         (class Incremental_checker): Remove.
759         (Incremental_input_entry::Incremental_input_entry): Add argument
760         serial number.
761         (Incremental_input_entry::arg_serial): New function.
762         (Incremental_input_entry::set_is_in_system_directory): New function.
763         (Incremental_input_entry::is_in_system_directory): New function.
764         (Incremental_input_entry::arg_serial_): New data member.
765         (Incremental_input_entry::is_in_system_directory_): New data member.
766         (class Script_info): Move here from script.h.
767         (Script_info::Script_info): Add filename parameter.
768         (Script_info::filename): New function.
769         (Script_info::filename_): New data member.
770         (Incremental_script_entry::Incremental_script_entry): Add argument
771         serial number.
772         (Incremental_object_entry::Incremental_object_entry): Likewise.
773         (Incremental_object_entry::add_input_section): Build list of input
774         sections with map to original shndx.
775         (Incremental_object_entry::get_input_section_index): New function.
776         (Incremental_object_entry::shndx_): New data member.
777         (Incremental_object_entry::name_key_): Rename; adjust all refs.
778         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
779         (Incremental_archive_entry::Incremental_archive_entry): Add argument
780         serial number.
781         (Incremental_inputs::report_archive_begin): Likewise.
782         (Incremental_inputs::report_object): Likewise.
783         (Incremental_inputs::report_script): Likewise.
784         (class Incremental_global_symbol_reader): New class.
785         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
786         and store flags and input file type.
787         (Incremental_input_entry_reader::arg_serial): New function.
788         (Incremental_input_entry_reader::type): Extract type from flags.
789         (Incremental_input_entry_reader::is_in_system_directory): New function.
790         (Incremental_input_entry_reader::get_input_section_count): Call
791         accessor function for type.
792         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
793         function for type; adjust size of global symbol entry.
794         (Incremental_input_entry_reader::get_global_symbol_count): Call
795         accessor function for type.
796         (Incremental_input_entry_reader::get_object_count): Likewise.
797         (Incremental_input_entry_reader::get_object_offset): Likewise.
798         (Incremental_input_entry_reader::get_member_count): Likewise.
799         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
800         (Incremental_input_entry_reader::get_member_offset): Likewise.
801         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
802         (Incremental_input_entry_reader::Global_symbol_info): Remove.
803         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
804         (Incremental_input_entry_reader::get_global_symbol_reader): New
805         function.
806         (Incremental_input_entry_reader::get_output_symbol_index): New
807         function.
808         (Incremental_input_entry_reader::type_): Remove.
809         (Incremental_input_entry_reader::flags_): New data member.
810         (Incremental_inputs_reader::input_file_offset): New function.
811         (Incremental_inputs_reader::input_file_index): New function.
812         (Incremental_inputs_reader::input_file): Call input_file_offset.
813         (Incremental_inputs_reader::input_file_at_offset): New function.
814         (Incremental_relocs_reader::get_r_type): Reformat.
815         (Incremental_relocs_reader::get_r_shndx): Reformat.
816         (Incremental_relocs_reader::get_r_offset): Reformat.
817         (Incremental_relocs_reader::data): New function.
818         (Incremental_binary::Incremental_binary): Initialize new data members.
819         (Incremental_binary::check_inputs): Add cmdline parameter.
820         (Incremental_binary::file_is_unchanged): Remove.
821         (Input_reader::arg_serial): New function.
822         (Input_reader::get_unused_symbol_count): New function.
823         (Input_reader::get_unused_symbol): New function.
824         (Input_reader::do_arg_serial): New function.
825         (Input_reader::do_get_unused_symbol_count): New function.
826         (Input_reader::do_get_unused_symbol): New function.
827         (Incremental_binary::input_file_count): New function.
828         (Incremental_binary::get_input_reader): Change signature to use
829         index instead of filename.
830         (Incremental_binary::file_has_changed): New function.
831         (Incremental_binary::get_input_argument): New function.
832         (Incremental_binary::get_library): New function.
833         (Incremental_binary::get_script_info): New function.
834         (Incremental_binary::init_layout): New function.
835         (Incremental_binary::reserve_layout): New function.
836         (Incremental_binary::output_file): New function.
837         (Incremental_binary::do_check_inputs): New function.
838         (Incremental_binary::do_file_is_unchanged): Remove.
839         (Incremental_binary::do_file_has_changed): New function.
840         (Incremental_binary::do_init_layout): New function.
841         (Incremental_binary::do_reserve_layout): New function.
842         (Incremental_binary::do_input_file_count): New function.
843         (Incremental_binary::do_get_input_reader): Change signature.
844         (Incremental_binary::input_args_map_): New data member.
845         (Incremental_binary::library_map_): New data member.
846         (Incremental_binary::script_map_): New data member.
847         (Sized_incremental_binary::Sized_incremental_binary): Initialize
848         new data members.
849         (Sized_incremental_binary::output_section): New function.
850         (Sized_incremental_binary::inputs_reader): Add const.
851         (Sized_incremental_binary::symtab_reader): Add const.
852         (Sized_incremental_binary::relocs_reader): Add const.
853         (Sized_incremental_binary::got_plt_reader): Add const.
854         (Sized_incremental_binary::get_symtab_view): New function.
855         (Sized_incremental_binary::Inputs_reader): New typedef.
856         (Sized_incremental_binary::Input_entry_reader): New typedef.
857         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
858         (Sized_incremental_binary::do_file_is_unchanged): Remove.
859         (Sized_incremental_binary::do_file_has_changed): New function.
860         (Sized_incremental_binary::do_init_layout): New function.
861         (Sized_incremental_binary::do_reserve_layout): New function.
862         (Sized_input_reader::Inputs_reader): Remove.
863         (Sized_input_reader::Input_entry_reader): Remove.
864         (Sized_input_reader::do_arg_serial): New function.
865         (Sized_input_reader::do_get_unused_symbol_count): New function.
866         (Sized_input_reader::do_get_unused_symbol): New function.
867         (Sized_incremental_binary::do_input_file_count): New function.
868         (Sized_incremental_binary::do_get_input_reader): Change signature;
869         use index instead of filename.
870         (Sized_incremental_binary::section_map_): New data member.
871         (Sized_incremental_binary::input_entry_readers_): New data member.
872         (class Sized_incr_relobj): New class.
873         (class Sized_incr_dynobj): New class.
874         (make_sized_incremental_object): New function.
875         (class Incremental_library): New class.
876         * layout.cc (Free_list::num_lists): New static data member.
877         (Free_list::num_nodes): New static data member.
878         (Free_list::num_removes): New static data member.
879         (Free_list::num_remove_visits): New static data member.
880         (Free_list::num_allocates): New static data member.
881         (Free_list::num_allocate_visits): New static data member.
882         (Free_list::init): New function.
883         (Free_list::remove): New function.
884         (Free_list::allocate): New function.
885         (Free_list::dump): New function.
886         (Free_list::print_stats): New function.
887         (Layout_task_runner::run): Resize output file for incremental updates.
888         (Layout::Layout): Initialize new data members.
889         (Layout::set_incremental_base): New function.
890         (Layout::init_fixed_output_section): New function.
891         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
892         incremental updates.
893         (Layout::create_gold_note): Do not create gold note section for
894         incremental updates.
895         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
896         for incremental updates.
897         (Layout::set_section_offsets): For incremental updates, allocate space
898         from free list.
899         (Layout::create_symtab_sections): Layout with offsets relative to
900         start of section; for incremental updates, allocate space from free
901         list.
902         (Layout::create_shdrs): For incremental updates, allocate space from
903         free list.
904         (Layout::finish_dynamic_section): For incremental updates, do not
905         check --as-needed (fixed in subsequent patch).
906         * layout.h (class Free_list): New class.
907         (Layout::set_incremental_base): New function.
908         (Layout::incremental_base): New function.
909         (Layout::init_fixed_output_section): New function.
910         (Layout::allocate): New function.
911         (Layout::incremental_base_): New data member.
912         (Layout::free_list_): New data member.
913         * main.cc (main): Print Free_list statistics.
914         * object.cc (Relobj::finalize_incremental_relocs): Add
915         clear_counts parameter; clear counts only when clear_counts is set.
916         (Sized_relobj::Sized_relobj): Initialize new base class.
917         (Sized_relobj::do_layout): Don't report special sections.
918         (Sized_relobj::do_for_all_local_got_entries): New function.
919         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
920         symtab_off to all symbol table offsets.
921         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
922         * object.h (class Got_offset_list): Move to top of file.
923         (Object::Object): Allow case where input_file == NULL.
924         (Object::~Object): Likewise.
925         (Object::input_file): Assert that input_file != NULL.
926         (Object::lock): Allow case where input_file == NULL.
927         (Object::unlock): Likewise.
928         (Object::is_locked): Likewise.
929         (Object::token): Likewise.
930         (Object::release): Likewise.
931         (Object::is_incremental): New function.
932         (Object::get_mtime): New function.
933         (Object::for_all_local_got_entries): New function.
934         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
935         (Object::set_is_in_system_directory): New function.
936         (Object::is_in_system_directory): New function.
937         (Object::do_is_incremental): New function.
938         (Object::do_get_mtime): New function.
939         (Object::do_for_all_local_got_entries): New function.
940         (Object::is_in_system_directory_): New data member.
941         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
942         (class Sized_relobj_base): New class.
943         (class Sized_relobj): Derive from Sized_relobj_base.
944         (class Sized_relobj::Symbols): Redeclare from base class.
945         (class Sized_relobj::local_got_offset_list): Remove.
946         (class Sized_relobj::Output_sections): Redeclare from base class.
947         (class Sized_relobj::do_for_all_local_got_entries): New function.
948         (class Sized_relobj::write_local_symbols): Add offset parameter.
949         (class Sized_relobj::local_symbol_offset_): Update comment.
950         (class Sized_relobj::local_dynsym_offset_): Update comment.
951         * options.cc (Input_arguments::add_file): Remove const.
952         * options.h (Input_file_argument::Input_file_argument):
953         Initialize arg_serial_ (all constructors).
954         (Input_file_argument::set_arg_serial): New function.
955         (Input_file_argument::arg_serial): New function.
956         (Input_file_argument::arg_serial_): New data member.
957         (Input_arguments::Input_arguments): Initialize file_count_.
958         (Input_arguments::add_file): Remove const.
959         (Input_arguments::number_of_input_files): New function.
960         (Input_arguments::file_count_): New data member.
961         (Command_line::number_of_input_files): Call
962         Input_arguments::number_of_input_files.
963         * output.cc (Output_segment_headers::Output_segment_headers):
964         Set current size.
965         (Output_section::Input_section::current_data_size): New function.
966         (Output_section::Output_section): Initialize new data members.
967         (Output_section::add_input_section): Don't do merge sections for
968         an incremental link; allocate space from free list for an
969         incremental update.
970         (Output_section::add_output_section_data): Allocate space from
971         free list for an incremental update.
972         (Output_section::update_data_size): New function.
973         (Output_section::set_fixed_layout): New function.
974         (Output_section::reserve): New function.
975         (Output_segment::set_section_addresses): Remove const.
976         (Output_segment::set_section_list_addresses): Remove const; allocate
977         space from free list for an incremental update.
978         (Output_segment::set_offset): Adjust size of RELRO segment for an
979         incremental update.
980         * output.h (Output_data::current_data_size): Move here from
981         child classes.
982         (Output_data::pre_finalize_data_size): New function.
983         (Output_data::update_data_size): New function.
984         (Output_section_headers::update_data_size): new function.
985         (Output_section_data_build::current_data_size): Move to Output_data.
986         (Output_data_strtab::update_data_size): New function.
987         (Output_section::current_data_size): Move to Output_data.
988         (Output_section::set_fixed_layout): New function.
989         (Output_section::has_fixed_layout): New function.
990         (Output_section::reserve): New function.
991         (Output_section::update_data_size): New function.
992         (Output_section::has_fixed_layout_): New data member.
993         (Output_section::free_list_): New data member.
994         (Output_segment::set_section_addresses): Remove const.
995         (Output_segment::set_section_list_addresses): Remove const.
996         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
997         New function.
998         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
999         New function.
1000         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1001         parameter when calling Add_symbols constructor; store argument
1002         serial number for members of a lib group.
1003         (Add_symbols::locks): Allow case where token == NULL.
1004         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1005         (Read_member::~Read_member): New function.
1006         (Read_member::is_runnable): New function.
1007         (Read_member::locks): New function.
1008         (Read_member::run): New function.
1009         (Check_script::~Check_script): New function.
1010         (Check_script::is_runnable): New function.
1011         (Check_script::locks): New function.
1012         (Check_script::run): New function.
1013         (Check_library::~Check_library): New function.
1014         (Check_library::is_runnable): New function.
1015         (Check_library::locks): New function.
1016         (Check_library::run): New function.
1017         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1018         (Add_symbols::library_): New data member.
1019         (class Read_member): New class.
1020         (class Check_script): New class.
1021         (class Check_library): New class.
1022         * reloc.cc (Read_relocs::is_runnable): Allow case where
1023         token == NULL.
1024         (Read_relocs::locks): Likewise.
1025         (Scan_relocs::locks): Likewise.
1026         (Relocate_task::locks): Likewise.
1027         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1028         to clear counters.
1029         (Sized_relobj::incremental_relocs_scan): Fix comment.
1030         (Sized_relobj::do_relocate): Pass output file offset to
1031         write_local_symbols.
1032         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1033         from class declaration.
1034         * script.cc (read_input_script): Allocate Script_info; pass
1035         argument serial number to report_script.
1036         * script.h (class Script_info): Move to incremental.h.
1037         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1038         * symtab.h (Symbol_table::add_from_incrobj): New function.
1039         (Symbol_table::set_file_offset): New function.
1040
1041 2011-04-05  Cary Coutant  <ccoutant@google.com>
1042
1043         * incremental-dump.cc (dump_incremental_inputs): Change signature
1044         to take a Sized_incremental_binary; change caller.  Use readers
1045         in Sized_incremental_binary.
1046         * incremental.cc
1047         (Sized_incremental_binary::find_incremental_inputs_sections):
1048         Rename do_find_incremental_inputs_sections to this.
1049         (Sized_incremental_binary::setup_readers): New function.
1050         (Sized_incremental_binary::do_check_inputs): Check
1051         has_incremental_info_ flag; move setup code to setup_readers;
1052         use input readers.
1053         (Sized_incremental_binary::do_file_is_unchanged): New function.
1054         (Sized_incremental_binary::do_get_input_reader): New function.
1055         * incremental.h (class Incremental_binary): Move to end of file.
1056         (Incremental_binary::file_is_unchanged): New function.
1057         (Incremental_binary::do_file_is_unchanged): New function.
1058         (Incremental_binary::Input_reader): New class.
1059         (Incremental_binary::get_input_reader): New function.
1060         (class Sized_incremental_binary): Move to end of file.
1061         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1062         input section reader classes.
1063         (Sized_incremental_binary::has_incremental_info): New function.
1064         (Sized_incremental_binary::inputs_reader): New function.
1065         (Sized_incremental_binary::symtab_reader): New function.
1066         (Sized_incremental_binary::relocs_reader): New function.
1067         (Sized_incremental_binary::got_plt_reader): New function.
1068         (Sized_incremental_binary::do_file_is_unchanged): New function.
1069         (Sized_incremental_binary::Sized_input_reader): New class.
1070         (Sized_incremental_binary::get_input_reader): New function.
1071         (Sized_incremental_binary::find_incremental_inputs_sections):
1072         Rename do_find_incremental_inputs_sections to this.
1073         (Sized_incremental_binary::setup_readers): New function.
1074         (Sized_incremental_binary::has_incremental_info_): New data member.
1075         (Sized_incremental_binary::inputs_reader_): New data member.
1076         (Sized_incremental_binary::symtab_reader_): New data member.
1077         (Sized_incremental_binary::relocs_reader_): New data member.
1078         (Sized_incremental_binary::got_plt_reader_): New data member.
1079         (Sized_incremental_binary::current_input_file_): New data member.
1080
1081 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1082
1083         PR gold/12640
1084         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1085         violation.
1086
1087 2011-03-30  Cary Coutant  <ccoutant@google.com>
1088
1089         * archive.cc (Archive::include_member): Adjust call to report_object.
1090         (Add_archive_symbols::run): Add script_info to call to
1091         report_archive_begin.
1092         (Lib_group::include_member): Adjust call to report_object.
1093         (Add_lib_group_symbols::run): Adjust call to report_object.
1094         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1095         blocks.  Add object count for script input files.
1096         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1097         script_info parameter; change all callers.
1098         (Incremental_inputs::report_object): Add script_info parameter;
1099         change all callers.
1100         (Incremental_inputs::report_script): Store backpointer to
1101         incremental info entry.
1102         (Output_section_incremental_inputs::set_final_data_size): Record
1103         additional information for scripts.
1104         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1105         * incremental.h (Incremental_script_entry::add_object): New function.
1106         (Incremental_script_entry::get_object_count): New function.
1107         (Incremental_script_entry::get_object): New function.
1108         (Incremental_script_entry::objects_): New data member; adjust
1109         constructor.
1110         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1111         (Incremental_inputs::report_object): Add script_info parameter.
1112         (Incremental_inputs_reader::get_object_count): New function.
1113         (Incremental_inputs_reader::get_object_offset): New function.
1114         * options.cc (Input_arguments::add_file): Return reference to
1115         new input argument.
1116         * options.h (Input_argument::set_script_info): New function.
1117         (Input_argument::script_info): New function.
1118         (Input_argument::script_info_): New data member; adjust all
1119         constructors.
1120         (Input_file_group::add_file): Return reference to new input argument.
1121         (Input_file_lib::add_file): Likewise.
1122         (Input_arguments::add_file): Likewise.
1123         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1124         * script.cc (Parser_closure::Parser_closure): Add script_info
1125         parameter; adjust all callers.
1126         (Parser_closure::script_info): New function.
1127         (Parser_closure::script_info_): New data member.
1128         (read_input_script): Report scripts earlier to incremental info.
1129         (script_add_file): Set script_info in Input_argument.
1130         (script_add_library): Likewise.
1131         * script.h (Script_options::Script_info): Rewrite class.
1132
1133 2011-03-29  Cary Coutant  <ccoutant@google.com>
1134
1135         * archive.cc (Library_base::should_include_member): Move
1136         method here from class Archive.
1137         (Archive::Archive): Initialize base class.
1138         (Archive::should_include_member): Move to base class.
1139         (Archive::do_for_all_unused_symbols): New function.
1140         (Add_archive_symbols::run): Remove redundant access to
1141         incremental_inputs.
1142         (Lib_group::Lib_group): Initialize base class.
1143         (Lib_group::do_filename): New function.
1144         (Lib_group::include_member): Pass pointer to Lib_group to
1145         report_object.
1146         (Lib_group::do_for_all_unused_symbols): New function.
1147         (Add_lib_group_symbols::run): Report archive information for
1148         incremental links.
1149         * archive.h (class Library_base): New base class.
1150         (class Archive): Derive from Library_base.
1151         (Archive::filename): Move to base class.
1152         (Archive::set_incremental_info): Likewise.
1153         (Archive::incremental_info): Likewise.
1154         (Archive::Should_include): Likewise.
1155         (Archive::should_include_member): Likewise.
1156         (Archive::Armap_entry): Remove.
1157         (Archive::Unused_symbol_iterator): Remove.
1158         (Archive::unused_symbols_begin): Remove.
1159         (Archive::unused_symbols_end): Remove.
1160         (Archive::do_filename): New function.
1161         (Archive::do_get_mtime): New function.
1162         (Archive::do_for_all_unused_symbols): New function.
1163         (Archive::task_): Move to base class.
1164         (Archive::incremental_info_): Likewise.
1165         (class Lib_group): Derive from Library_base.
1166         (Lib_group::do_filename): New function.
1167         (Lib_group::do_get_mtime): New function.
1168         (Lib_group::do_for_all_unused_symbols): New function.
1169         (Lib_group::task_): Move to base class.
1170         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1171         function.
1172         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1173         function.
1174         * incremental.cc (Incremental_inputs::report_archive_begin):
1175         Use Library_base; call library's get_mtime; add incremental inputs
1176         entry before members.
1177         (class Unused_symbol_visitor): New class.
1178         (Incremental_inputs::report_archive_end): Use Library_base; use
1179         visitor class to record unused symbols; don't add incremental inputs
1180         entry after members.
1181         (Incremental_inputs::report_object): Use Library_base.
1182         * incremental.h
1183         (Incremental_archive_entry::Incremental_archive_entry): Remove
1184         unused Archive parameter.
1185         (Incremental_inputs::report_archive_begin): Use Library_base.
1186         (Incremental_inputs::report_archive_end): Likewise.
1187         (Incremental_inputs::report_object): Likewise.
1188         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1189         function.
1190         * object.h (Object::for_all_global_symbols): New function.
1191         (Object::do_for_all_global_symbols): New function.
1192         (Sized_relobj::do_for_all_global_symbols): New function.
1193         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1194         function.
1195         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1196         function.
1197
1198 2011-03-27  Ian Lance Taylor  <iant@google.com>
1199
1200         * archive.cc (Archive::interpret_header): Return -1 if something
1201         goes wrong.  Change callers accordingly.
1202
1203 2011-03-25  Cary Coutant  <ccoutant@google.com>
1204
1205         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1206         * testsuite/Makefile.in: Regenerate.
1207
1208 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1209
1210         * plugin.cc (get_view): New.
1211         (Plugin::load): Pass get_view to the plugin.
1212         (Plugin_manager::get_view): New.
1213
1214 2011-03-21  Ian Lance Taylor  <iant@google.com>
1215
1216         * testsuite/final_layout.sh: Rewrite to not use dc.
1217         * testsuite/relro_test.sh: Fail if dc is not present.
1218
1219 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1220
1221         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1222         Change == to -eq.
1223         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1224         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1225         Change == to -eq.
1226         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1227         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1228
1229 2011-03-14  Ian Lance Taylor  <iant@google.com>
1230
1231         * script-sections.cc (Sort_output_sections::script_compare):
1232         Rename from is_before, change return type.
1233         (Sort_output_sections::operator()): Adjust accordingly.
1234
1235 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1236
1237         PR gold/12572
1238         * testsuite/odr_violation2.cc: Add comment to make all error line
1239         numbers double digits.
1240         * testsuite/debug_msg.sh: Adjust expected errors.
1241
1242 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1243
1244         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1245         but mark earlier ones as non-canonical
1246         (offset_to_iterator): Update search target and example
1247         (do_addr2line): Return extra lines in a vector*
1248         (format_file_lineno): Extract from do_addr2line
1249         (one_addr2line): Add vector* out-param
1250         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1251         when a lineno entry appeared last for its instruction
1252         (Dwarf_line_info): Add vector* out-param
1253         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1254         * symtab.cc (Odr_violation_compare): Include the lineno in the
1255         comparison again.
1256         (linenos_from_loc): New. Combine the canonical line for an
1257         address with its other lines.
1258         (True_if_intersect): New. Helper functor to make
1259         std::set_intersection a query.
1260         (detect_odr_violations): Compare sets of lines instead of just
1261         one line for each function. This became less deterministic, but
1262         has fewer false positives.
1263         * symtab.h: Declarations.
1264         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1265         mix an optimized and non-optimized object in the same binary
1266         (odr_violation2.so): Same.
1267         * testsuite/Makefile.in: Regenerate from Makefile.am.
1268         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1269         * testsuite/debug_msg.sh: Update line numbers and add
1270         assertions.
1271         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1272         non-optimized context.
1273         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1274         isn't inlined, and use OdrDerived in an optimized context.
1275         * testsuite/odr_header1.h: Defines OdrDerived, where
1276         optimization will change the
1277         first-instruction-in-the-destructor's file and line number.
1278         * testsuite/odr_header2.h: Defines OdrBase.
1279
1280 2011-03-09  Ian Lance Taylor  <iant@google.com>
1281
1282         * fileread.cc (File_read::clear_views): Don't delete the whole
1283         file view.
1284
1285 2011-03-08  Ian Lance Taylor  <iant@google.com>
1286
1287         PR gold/12525
1288         * fileread.cc: #include <climits>.
1289         (GOLD_IOV_MAX): Define.
1290         (File_read::read_multiple): Limit number of entries by iov_max.
1291         * fileread.h (class File_read): Always set max_readv_entries to
1292         128.
1293
1294 2011-03-07  Ian Lance Taylor  <iant@google.com>
1295
1296         PR gold/12525
1297         * options.h (class General_options): Add -dy and -dn.
1298
1299 2011-03-02  Cary Coutant  <ccoutant@google.com>
1300
1301         * testsuite/script_test_9.t: Add TLS segment.
1302
1303 2011-03-02  Simon Baldwin  <simonb@google.com>
1304
1305         * configure.ac: Add check for gnu_indirect_function support in
1306         the toolchain building binutils.
1307         * configure: Rebuild.
1308
1309 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1310
1311         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1312         plugin only symbols.
1313         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1314         in plugin files as not needed in the symbol table.
1315
1316 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1317
1318         * output.cc (Output_section::add_input_section): Delay fill
1319         generation for section ordering.
1320
1321 2011-02-09  Ian Lance Taylor  <iant@google.com>
1322
1323         PR gold/12316
1324         * object.h (class Sized_relobj): Remove clear_local_symbols.
1325         * reloc.cc (Sized_relobj::do_relocate): Don't call
1326         clear_local_symbols.
1327
1328 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1329
1330         * plugin.cc (is_visible_from_outside): Return true for symbols
1331         in the -u option.
1332
1333 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1334
1335         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1336         filename.
1337
1338 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1339
1340         * icf.h (is_section_foldable_candidate): Change type of parameter
1341         to std::string.
1342         * icf.cc (Icf::find_identical_sections): Change type of local variable
1343         section_name to be std::string.
1344         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1345
1346 2011-01-25  Ian Lance Taylor  <iant@google.com>
1347
1348         * script.cc (script_add_extern): Rewrite to use
1349         add_symbol_reference.
1350
1351 2011-01-25  Doug Kwan  <dougkwan@google.com>
1352
1353         * icf.cc (get_section_contents): Always lock section's object.
1354
1355 2011-01-24  Ian Lance Taylor  <iant@google.com>
1356
1357         * options.h (class General_options): Accept
1358         --no-detect-odr-violations.
1359
1360 2011-01-24  Ian Lance Taylor  <iant@google.com>
1361
1362         * version.cc (version_string): Bump to 1.11.
1363
1364 2011-01-24  Ian Lance Taylor  <iant@google.com>
1365
1366         * plugin.cc (class Plugin_rescan): Define new class.
1367         (Plugin_manager::claim_file): Set any_claimed_.
1368         (Plugin_manager::save_archive): New function.
1369         (Plugin_manager::save_input_group): New function.
1370         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1371         necessary.
1372         (Plugin_manager::new_undefined_symbol): New function.
1373         (Plugin_manager::rescan): New function.
1374         (Plugin_manager::rescannable_defines): New function.
1375         (Plugin_manager::add_input_file): Set any_added_.
1376         * plugin.h (class Plugin_manager): define new fields rescannable_,
1377         undefined_symbols_, any_claimed_, and any_added_.  Declare
1378         Plugin_rescan as friend.  Declare new functions.
1379         (Plugin_manager::Rescannable): Define type.
1380         (Plugin_manager::Rescannable_list): Define type.
1381         (Plugin_manager::Undefined_symbol_list): Define type.
1382         (Plugin_manager::Plugin_manager): Initialize new fields.
1383         * archive.cc (Archive::defines_symbol): New function.
1384         (Add_archive_symbols::run): Pass archive to plugins if any.
1385         * archive.h (class Archive): Declare defines_symbol.
1386         * readsyms.cc (Input_group::~Input_group): New function.
1387         (Finish_group::run): Pass input_group to plugins if any.
1388         * readsyms.h (class Input_group): Declare destructor.
1389         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1390         any.
1391
1392 2011-01-10  Ian Lance Taylor  <iant@google.com>
1393
1394         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1395         section as relro.
1396         (Layout::set_segment_offsets): Reset increase_relro before calling
1397         set_section_addresses a second time.
1398
1399 2011-01-04  Cary Coutant  <ccoutant@google.com>
1400
1401         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1402         sections before NOBITS sections.
1403
1404 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1405
1406         * version.cc (print_version): Update copyright to 2011.
1407
1408 2010-12-23  Cary Coutant  <ccoutant@google.com>
1409
1410         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1411         of OS to this->add.  Add OD parameter to second form of the function.
1412
1413 2010-12-20  Ian Lance Taylor  <iant@google.com>
1414
1415         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1416         second of two consecutive entries with same offset.
1417
1418 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1419
1420         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1421         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1422         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1423         to avoid unneeded links against $(LDADD).
1424         * testsuite/Makefile.in: Regenerate.
1425
1426 2010-12-15  Ian Lance Taylor  <iant@google.com>
1427
1428         PR gold/12324
1429         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1430         for R_X86_64_32 and R_X86_64_PC32.
1431         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1432         ver_matching_def_pic.o.
1433         (ver_matching_def_pic.o): New target.
1434
1435 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1436
1437         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1438         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1439         Move definition before File_read::View member definitions.
1440         (File_read::View::~View): Initialize and hold lock before
1441         updating current_mapped_bytes.
1442
1443 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1444
1445         * dwarf_reader.cc: Remove outdated comment.
1446         * gold-threads.cc: Fix typo in error message.
1447         * archive.cc: Fix typos in comments.
1448         * archive.h: Likewise.
1449         * arm-reloc-property.cc: Likewise.
1450         * arm-reloc-property.h: Likewise.
1451         * arm-reloc.def: Likewise.
1452         * arm.cc: Likewise.
1453         * attributes.h: Likewise.
1454         * cref.cc: Likewise.
1455         * ehframe.cc: Likewise.
1456         * fileread.h: Likewise.
1457         * gold.h: Likewise.
1458         * i386.cc: Likewise.
1459         * icf.cc: Likewise.
1460         * incremental.h: Likewise.
1461         * int_encoding.cc: Likewise.
1462         * layout.h: Likewise.
1463         * main.cc: Likewise.
1464         * merge.h: Likewise.
1465         * object.cc: Likewise.
1466         * object.h: Likewise.
1467         * options.cc: Likewise.
1468         * readsyms.cc: Likewise.
1469         * reduced_debug_output.cc: Likewise.
1470         * reloc.cc: Likewise.
1471         * script-sections.cc: Likewise.
1472         * sparc.cc: Likewise.
1473         * symtab.h: Likewise.
1474         * target-reloc.h: Likewise.
1475         * target.cc: Likewise.
1476         * target.h: Likewise.
1477         * timer.cc: Likewise.
1478         * timer.h: Likewise.
1479         * x86_64.cc: Likewise.
1480
1481 2010-12-09  Cary Coutant  <ccoutant@google.com>
1482
1483         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1484         stack.
1485         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1486         parameter; change all callers.
1487         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1488         * options.h (warn_execstack): New option.
1489
1490 2010-12-07  Doug Kwan  <dougkwan@google.com>
1491
1492         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1493         like function call relocations.
1494
1495 2010-12-07  Ian Lance Taylor  <iant@google.com>
1496
1497         * archive.cc (Archive::get_elf_object_for_member): Permit
1498         punconfigured to be NULL.
1499         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1500         (Archive::include_member): Pass NULL to get_elf_object_for_member
1501         if we searched for the archive and this is the first included
1502         object.
1503
1504 2010-12-01  Ian Lance Taylor  <iant@google.com>
1505
1506         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1507         track_relocs_type_ field.
1508         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1509         Set track_relocs_type_.
1510         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1511         contents when using RELA relocs.
1512         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1513         reloc_map_.
1514         * reloc.cc (Track_relocs::next_addend): New function.
1515         * reloc.h (class Track_relocs): Declare next_addend.
1516
1517 2010-12-01  Ian Lance Taylor  <iant@google.com>
1518
1519         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1520         virtual destructor.
1521
1522 2010-12-01  Ian Lance Taylor  <iant@google.com>
1523
1524         * README: Update compilers known to work and fail.
1525
1526 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1527
1528         * configure.in: For --enable-gold, handle value `default' instead of
1529         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1530         not the default.
1531         * configure: Regenerate.
1532
1533 2010-11-18  Doug Kwan  <dougkwan@google.com>
1534
1535         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1536         and right_alignment to be zero.  Store result alignment only if it is
1537         greater than existing alignment.
1538
1539 2010-11-16  Cary Coutant  <ccoutant@google.com>
1540
1541         PR gold/12220
1542         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1543         Check for ".zdebug_line".
1544
1545 2010-11-16  Doug Kwan  <dougkwan@google.com>
1546             Cary Coutant  <ccoutant@google.com>
1547
1548         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1549         by reference; adjust all callers.
1550         * output.cc (Output_segment::set_section_addresses): Adjust references
1551         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1552         list is empty.
1553         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1554         end at page boundary.
1555
1556 2010-11-16  Cary Coutant  <ccoutant@google.com>
1557
1558         PR gold/12220
1559         * layout.cc (Layout::choose_output_section): Transform names of
1560         compressed sections even when using a script with a SECTIONS clause.
1561         (Layout::output_section_name): Remove code to transform
1562         compressed debug section names.
1563         * output.cc (Output_section::add_input_section): Use uncompressed
1564         section size when tracking input sections.
1565
1566 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1567
1568         * symtab.h (Symbol::NON_PIC_REF): Remove.
1569         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1570         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1571         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1572         (Symbol::use_plt_offset): Take a flags argument and pass it
1573         directly to needs_dynamic_reloc.  Restrict check for undefined
1574         weak symbols to function calls.
1575         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1576         (Target_arm::Scan::global): Use it.
1577         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1578         (Target_arm::Relocate::relocate): Likewise.
1579         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1580         parameter with an r_type parameter.  Use get_reference_flags
1581         to get the flags.
1582         (Target_arm::Relocate::relocate): Update accordingly.
1583         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1584         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1585         (Target_i386::Scan::global): Likewise.
1586         (Target_i386::Relocate::relocate): Likewise.
1587         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1588         parameter with an r_type parameter.  Use get_reference_flags
1589         to get the flags.
1590         (Target_i386::Relocate::relocate): Update accordingly.
1591         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1592         (Target_powerpc::Scan::global): Use it.
1593         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1594         (Target_powerpc::Relocate::relocate): Likewise.
1595         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1596         (Target_sparc::Scan::global): Use it.
1597         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1598         (Target_sparc::Relocate::relocate): Likewise.
1599         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1600         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1601         (Target_x86_64::Scan::global): Likewise.
1602         (Target_x86_64::Relocate::relocate): Likewise.
1603
1604 2010-11-08  Doug Kwan  <dougkwan@google.com>
1605             Cary Coutant  <ccoutant@google.com>
1606
1607         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1608         (Arm_exidx_merge_section::section_contents_): New data member.
1609         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1610         (Arm_input_section::~Arm_input_section): De-allocate memory.
1611         (Arm_input_section::original_contents_): New data member.       
1612         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1613         in parameters instead of calling Object::section_contents without
1614         locking.
1615         (Arm_output_section::group_section): New parameter TASK.  Pass it
1616         to callees that need locking objects.
1617         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1618         to lock EXIDX input sections.  Fix a formatting issue.  Call
1619         Arm_exidx_merged_section::build_contents to create merged section
1620         contents.
1621         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1622         to lock object of stub table owner.
1623         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1624         TEXT_SIZE to initialize data member TEXT_SIZE_.
1625         (Arm_exidx_input_section::addralign): Fix typo in comment.
1626         (Arm_exidx_input_section::text_size): New method.
1627         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1628         that require locking objects.  Lock objects before scanning for stubs
1629         and updating local symbols.
1630         (Arm_input_section<big_endian>::init): Copy contents of original
1631         input section.
1632         (Arm_input_section<big_endian>::do_write): Use saved contents of
1633         original input section instead of calling Object::section_contents
1634         without locking.
1635         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1636         size without calling Object::section_size().
1637         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1638         for size.  Allocate a buffer for merged EXIDX entries.
1639         (Arm_exidx_merged_section::build_contents): New method.
1640         (Arm_exidx_merged_section::do_write): Move merge section contents
1641         building code to Arm_exidx_merged_section::build_contetns.  Write
1642         out contetns in buffer instead of building it on the fly.
1643         (Arm_relobj::make_exidx_input_section): Also pass text section size
1644         to Arm_exidx_input_section constructor.
1645         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1646         (Arm_dynobj::do_read_symbols): Fix memory leak.
1647         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1648         * target.h: (class Task): Add forward declaration.
1649         (Target::relax): Add new parameter TASK and pass it to
1650         Target::do_relax().
1651         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1652
1653 2010-11-05  Cary Coutant  <ccoutant@google.com>
1654
1655         PR gold/10708
1656         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1657         object when reading from the file.
1658         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1659         second layout pass.
1660         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1661         when reading section contents.
1662         (get_section_contents): Likewise.
1663         (icf::find_identical_sections): Likewise.
1664         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1665         object when reading from the file.
1666         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1667         the object when doing deferred section layout.
1668
1669 2010-11-03  Nick Clifton  <nickc@redhat.com>
1670
1671         PR gold/12001
1672         * script.h (class Symbol_assignment: name): New member.  Returns
1673         the name of the symbol.
1674         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1675         Returns true if the given symbol name is on the list of
1676         assignments wating to be processed.
1677         * archive.cc (should_incldue_member): If the symbol is undefined,
1678         check to see if it is on the list of symbols pending assignment.
1679
1680 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1681
1682         * script-sections.cc (Script_sections::find_memory_region): Check
1683         for a NULL output section pointer.
1684
1685 2010-10-29  Doug Kwan  <dougkwan@google.com>
1686
1687         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1688         Output_section::add_relaxed_input_section.
1689         * output.cc (Output_section::add_relaxed_input_section): Add new
1690         arguments LAYOUT and NAME.  Set section order index.
1691         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1692         Copy section order index.
1693         * output.h (Output_section::add_relaxed_input_section): Add new
1694         arguments LAYOUT and NAME.
1695
1696 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1697
1698         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1699         NATIVE_OR_CROSS_LINKER.
1700         * testsuite/Makefile.in: Regenerate.
1701
1702 2010-10-20  Doug Kwan  <dougkwan@google.com>
1703
1704         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1705         without SHF_LINK_ORDER flags.
1706         * layout.cc (Layout::choose_output_section): Do not filter
1707         SHF_LINK_ORDER flag in a relocatable link.
1708
1709 2010-10-17  Cary Coutant  <ccoutant@google.com>
1710
1711         * output.h (Output_segment::set_section_addresses): Change function
1712         signature.  Update all callers.
1713         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1714         sections.
1715         (Output_segment::set_section_addresses): Align after last TLS
1716         section.  Add padding before last relro section instead of after.
1717
1718 2010-10-17  Doug Kwan  <dougkwan@google.com>
1719
1720         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1721         GOT output section to be writable.
1722
1723 2010-10-14  Cary Coutant  <ccoutant@google.com>
1724
1725         * debug.h (DEBUG_INCREMENTAL): New flag.
1726         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1727         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1728         mode.
1729         * incremental.cc (report_command_line): Ignore all forms of
1730         --incremental.
1731         * layout.cc (Layout::Layout): Check parameters for incremental link
1732         mode.
1733         * options.cc (General_options::parse_incremental): New function.
1734         (General_options::parse_no_incremental): New function.
1735         (General_options::parse_incremental_full): New function.
1736         (General_options::parse_incremental_update): New function.
1737         (General_options::incremental_mode_): New data member.
1738         (General_options::finalize): Check incremental_mode_.
1739         * options.h (General_options): Update help text for --incremental.
1740         Add --no-incremental, --incremental-full, --incremental-update.
1741         (General_options::Incremental_mode): New enum type.
1742         (General_options::incremental_mode): New function.
1743         (General_options::incremental_mode_): New data member.
1744         * parameters.cc (Parameters::incremental_mode_): New data member.
1745         (Parameters::set_options): Set incremental_mode_.
1746         (Parameters::set_incremental_full): New function.
1747         (Parameters::incremental): New function.
1748         (Parameters::incremental_update): New function.
1749         (set_parameters_incremental_full): New function.
1750         * parameters.h (Parameters::set_incremental_full): New function.
1751         (Parameters::incremental): New function.
1752         (Parameters::incremental_update): New function.
1753         (Parameters::incremental_mode_): New data member.
1754         (set_parameters_incremental_full): New function.
1755         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1756         incremental link mode.
1757         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1758         (Sized_relobj::do_relocate_sections): Likewise.
1759         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1760         option.
1761         * testsuite/Makefile.in: Regenerate.
1762         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1763
1764 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1765
1766         * script-sections.h (class Script_sections): Make
1767         Sections_elements typedef public.
1768         * script-sections.cc (class Sort_output_sections): Add elements_
1769         field.  Add constructor which sets it; change all callers.
1770         (Sort_output_sections::is_before): New function.
1771         (Sort_output_sections::operator()): Call is_before.
1772         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1773         conditional.
1774         * testsuite/script_test_10.sh: New test. Test script section
1775         order.
1776         * testsuite/script_test_10.t: Likewise.
1777         * testsuite/script_test_10.s: Likewise.
1778         * testsuite/Makefile.am: Wrap the cross linker tests and the
1779         common tests into NATIVE_OR_CROSS_LINKER.
1780         (check_SCRIPTS): Add script_test_10.sh.
1781         (check_DATA): Add script_test_10.stdout.
1782         (script_test_10.o, script_test_10): New targets.
1783         (script_test_10.stdout): New target.
1784         * configure, testsuite/Makefile.in: Regenerate.
1785
1786 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1787
1788         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1789         error for the deprecated relocations.
1790         (Target_arm::Scan::global): Likewise.
1791         (Target_arm::Relocate::relocate): Likewise.
1792
1793 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1794
1795         * fileread.cc (Input_file::find_file): Initialize *found_name
1796         and *namep when using the fallback search for case 4.
1797
1798 2010-10-11  Cary Coutant  <ccoutant@google.com>
1799
1800         * options.h (class General_options): Redefine -z lazy as an alias for
1801         the negation of -z now.
1802
1803 2010-10-11  Ian Lance Taylor  <iant@google.com>
1804
1805         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1806         binding.
1807
1808 2010-10-06  Nick Clifton  <nickc@redhat.com>
1809
1810         * script-sections.cc(class Memory_region): Remove
1811         current_lma_offset_ field.  Rename current_vma_offset_ to
1812         current_offset_.  Add last_section_ field.
1813         (Memory_region::get_current_vma_address): Rename to
1814         get_current_address.
1815         (Memory_region::get_current_lma_address): Delete.
1816         (Memory_region::increment_vma_offset): Rename to
1817         increment_offset.
1818         (Memory_region::increment_lma_offset): Delete.
1819         (Memory_region::attributes_compatible): New method.  Returns
1820         true if the provided section is compatible with the region.
1821         (Memory_region::get_last_section): New method.  Returns the last
1822         section to use the region.
1823         (Memory_region::set_last_section): New method.  Stores the last
1824         section to use the region.
1825         (Script_sections::block_in_region): New method.  Returns true if
1826         a block of memory is contained within a region.
1827         (Script_sections::find_memory_region): New method.  Locates a
1828         memory region to be used to set a VMA or LMA address.
1829         (Output_section_definition::set_section_addresses): Add code to
1830         check for addresses set by memory regions.
1831         (Output_segment::set_section_addresses): Remove memory region
1832         walking code.
1833         (Script_sections::create_segment): Add a warning if a header
1834         segment is created outside of any region.
1835         * script-sections.h (class Script_sections): Add prototypes for
1836         find_memory_region and block_in_region methods.
1837         * testsuite/memory_test.s: Use .long instead of .word.
1838         * testsuite/memory_test.t: Add some more output sections.
1839         * testsuite/memory_test.sh: Update expected output.
1840
1841 2010-10-02  Doug Kwan  <dougkwan@google.com>
1842
1843         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1844         defintion to symtab.h
1845         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1846         declaration to defintion.
1847
1848 2010-10-01  Nick Clifton  <nickc@redhat.com>
1849
1850         * expression.cc (eval): Replace dummy argument with NULL.
1851         (eval_maybe_dot): Check for a NULL result section pointer.
1852         (Symbol_expression::value): Likewise.
1853         (Dot_expression::value): Likewise.
1854         (BINARY_EXPRESSION): Likewise.
1855         (Max_expression::value): Likewise.
1856         (Min_expression::value): Likewise.
1857         (Absolute_expression::value): Likewise.
1858         (Addr_expression::value_from_output_section): Likewise.
1859         (Loaddddr_expression::value_from_output_section): Likewise.
1860         (Segment_start_expression::value): Likewise.
1861         * script-sections.cc
1862         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1863         argument with NULL.
1864         (Sections_elememt_dot_assignment::set_section_addresses):
1865         Likewise.
1866         (Output_data_expression::do_write_to_buffer): Likewise.
1867         (Output_section_definition::finalize_symbols): Likewise.
1868         (Output_section_definition::set_section_addresses): Likewise.
1869
1870 2010-09-30  Doug Kwan  <dougkwan@google.com>
1871
1872         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1873
1874 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1875
1876         * target.h (Target::can_icf_inline_merge_sections): New virtual
1877         function.
1878         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1879         virtual function.
1880         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1881         virtual function.
1882         * icf.cc (get_section_contents): Inline merge sections only when
1883         target allows it.
1884
1885 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1886
1887         * configure: Regenerate.
1888
1889 2010-09-17  Ian Lance Taylor  <iant@google.com>
1890
1891         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1892         * testsuite/Makefile.am (memory_test.o): New target.
1893         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1894         memory_test.t.
1895         * testsuite/Makefile.in: Rebuild.
1896
1897 2010-09-17  Doug Kwan  <dougkwan@google.com>
1898
1899         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1900         defintion if relocation uses GOT entries of the symbol.
1901         * testsuite/icf_safe_test.sh: Fix test.
1902         * testsuite/icf_safe_so_test.sh: Fix test.
1903
1904 2010-09-16  Cary Coutant  <ccoutant@google.com>
1905
1906         * script_sections.cc (class Memory_region): Remove "NULL" from
1907         vector initializations.
1908
1909 2010-09-15  Cary Coutant  <ccoutant@google.com>
1910
1911         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1912         Resolve forwarding symbols.
1913
1914 2010-09-15  Doug Kwan  <dougkwan@google.com>
1915
1916         * gold/testsuite/script_test_3.t: Add ARM special sections.
1917         * gold/testsuite/script_test_4.t: Same.
1918         * gold/testsuite/script_test_5.t: Same.
1919         * gold/testsuite/script_test_6.t: Same.
1920         * gold/testsuite/script_test_7.t: Same.
1921         * gold/testsuite/script_test_7.t: Same.
1922         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1923
1924 2010-09-14  Cary Coutant  <ccoutant@google.com>
1925
1926         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1927         (Target_x86_64::Relocate::relocate_tls): Replace check for
1928         saw_tls_block_reloc_ with test for executable section.
1929
1930 2010-09-12  Cary Coutant  <ccoutant@google.com>
1931
1932         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1933         position-independent executables to shared libraries need dynamic
1934         relocations.
1935         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1936         position-independent executables.
1937         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1938         * testsuite/Makefile.in: Regenerate.
1939
1940 2010-09-10  Nick Clifton  <nickc@redhat.com>
1941
1942         PR gold/11997
1943         * testsuite/memory_test.t: Discard any sections that are not
1944         needed.
1945
1946 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1947
1948         PR gold/11996
1949         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1950         "This::" to work around a bug in gcc 4.2.
1951
1952         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1953
1954 2010-09-09  Rafael Espindola  <espindola@google.com>
1955
1956         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1957         sections with different PF_X flags in the same segment.
1958         (Layout::find_first_load_seg): Search all segments to find the first
1959         one.
1960         * options.h (rosegment): New.
1961
1962 2010-09-08  Rafael Espindola  <espindola@google.com>
1963
1964         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1965
1966 2010-09-08  Doug Kwan  <dougkwan@google.com>
1967
1968         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1969         (Arm_relobj::do_relocate_sections): Add new parameter for output
1970         file to match the parent.
1971         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1972         of local symbols instead of input values.  Update code to track
1973         changes in gold::relocate_section.
1974         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1975         (Sized_relobj::compute_final_local_value_internal): New methods.
1976         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1977         body into private version of Sized_relobj::compute_final_local_value.
1978         Call the inline method.
1979         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1980         merged symbol value if there is one.
1981         (Symbol_value::has_output_value): New method defintiion.
1982         (Sized_relobj::Compute_final_local_value_status): New enum type.
1983         (Sized_relobj::compute_final_local_value): New methods.
1984         (Sized_relobj::compute_final_local_value_internal): New methods.
1985         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1986         and arm_cortex_a8.sh.
1987         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1988         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1989         New tests.
1990         * Makefile.in: Regenerate.
1991         * testsuite/arm_bl_out_of_range.s: Update test.
1992         * testsuite/thumb_bl_out_of_range.s: Ditto.
1993         * testsuite/thumb_blx_out_of_range.s: Ditto.
1994         * testsuite/arm_branch_out_of_range.sh: New file.
1995         * testsuite/arm_cortex_a8.sh: Ditto.
1996         * testsuite/arm_cortex_a8_b.s: Ditto.
1997         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1998         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1999         * testsuite/arm_cortex_a8_bl.s: Ditto.
2000         * testsuite/arm_cortex_a8_blx.s: Ditto.
2001         * testsuite/arm_cortex_a8_local.s: Ditto.
2002         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2003         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2004
2005 2010-09-08  Rafael Espindola  <espindola@google.com>
2006
2007         * Makefile.am (memory_test.stdout): Run readelf with -W.
2008         * Makefile.in: Regenerate.
2009         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2010         64 bit output.
2011
2012 2010-09-08  Rafael Espindola  <espindola@google.com>
2013
2014         * script-sections.cc (Script_sections::add_memory_region): Convert
2015         field precision to int.
2016         * script.cc (script_set_section_region, script_set_section_region):
2017         Convert field precision to int.
2018
2019 2010-09-08  Rafael Espindola  <espindola@google.com>
2020
2021         * arm.cc (do_finalize_sections): Create the __exidx_start and
2022         __exdix_end symbols even when the section is missing.
2023
2024 2010-09-08  Nick Clifton  <nickc@redhat.com>
2025
2026         * README: Remove claim that MEMORY is not supported.
2027         * expression.cc (script_exp_function_origin)
2028         (script_exp_function_length): Move from here to ...
2029         * script.cc: ... here.
2030         (script_set_section_region, script_add_memory)
2031         (script_parse_memory_attr, script_include_directive): New
2032         functions.
2033         * script-sections.cc
2034         (class Memory_region): New class.
2035         (class Output_section_definition): Add set_memory_region,
2036         set_section_vma, set_section_lma and get_section_name methods.
2037         (class Script_Sections): Add add_memory_region,
2038         find_memory_region, find_memory_region_origin,
2039         find_memory_region_length and set_memory_region methods.
2040         Have set_section_addresses method walk the list of set memory
2041         regions.
2042         Extend the print methos to display memory regions.
2043         * script-sections.h: Add prototypes for new methods.
2044         Add enum for MEMORY region attributes.
2045         * yyscript.y: Add support for parsing MEMORY regions.
2046         * script-c.h: Add prototypes for new functions.
2047         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2048         * testsuite/Makefile.in: Regenerate.
2049         * testsuite/memory_test.sh: New script.
2050         * testsuite/memory_test.s: New assembler source file.
2051         * testsuite/memory_test.t: New linker script.
2052
2053 2010-08-27  Doug Kwan  <dougkwan@google.com>
2054
2055         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2056         reference override an existing dynamic weak reference.
2057         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2058         * testsuite/Makefile.in: Regenerate.
2059         * testsuite/dyn_weak_ref.sh: New file.
2060         * testsuite/dyn_weak_ref_1.c: Ditto.
2061         * testsuite/dyn_weak_ref_2.c: Ditto.
2062
2063 2010-08-27  Ian Lance Taylor  <iant@google.com>
2064
2065         * incremental.h (class Incremental_input_entry): Add virtual
2066         destructor.
2067
2068 2010-08-27  Ian Lance Taylor  <iant@google.com>
2069
2070         * testsuite/start_lib_test_3.c: Mark t3 as used.
2071
2072 2010-08-27  Nick Clifton  <nickc@redhat.com>
2073
2074         * options.cc (version_script): Fix small typo in previous
2075         whitespace tidyup.
2076
2077 2010-08-25  Nick Clifton  <nickc@redhat.com>
2078
2079         * archive.cc: Formatting fixes: Remove whitespace between
2080         typename and following asterisk.  Remove whitespace between
2081         function name and opening parenthesis.
2082         * archive.h: Likewise.
2083         * arm.cc: Likewise.
2084         * attributes.cc: Likewise.
2085         * attributes.h: Likewise.
2086         * common.cc: Likewise.
2087         * copy-relocs.cc: Likewise.
2088         * dirsearch.h: Likewise.
2089         * dynobj.cc: Likewise.
2090         * ehframe.cc: Likewise.
2091         * ehframe.h: Likewise.
2092         * expression.cc: Likewise.
2093         * fileread.cc: Likewise.
2094         * fileread.h: Likewise.
2095         * gc.h: Likewise.
2096         * gold-threads.cc: Likewise.
2097         * gold.cc: Likewise.
2098         * i386.cc: Likewise.
2099         * icf.h: Likewise.
2100         * incremental-dump.cc: Likewise.
2101         * incremental.cc: Likewise.
2102         * layout.cc: Likewise.
2103         * layout.h: Likewise.
2104         * main.cc: Likewise.
2105         * merge.cc: Likewise.
2106         * merge.h: Likewise.
2107         * object.cc: Likewise.
2108         * object.h: Likewise.
2109         * options.cc: Likewise.
2110         * options.h: Likewise.
2111         * output.cc: Likewise.
2112         * output.h: Likewise.
2113         * plugin.cc: Likewise.
2114         * plugin.h: Likewise.
2115         * powerpc.cc: Likewise.
2116         * reloc.cc: Likewise.
2117         * script-c.h: Likewise.
2118         * script-sections.cc: Likewise.
2119         * script.cc: Likewise.
2120         * stringpool.cc: Likewise.
2121         * symtab.cc: Likewise.
2122         * symtab.h: Likewise.
2123         * target.cc: Likewise.
2124         * timer.cc: Likewise.
2125         * timer.h: Likewise.
2126         * version.cc: Likewise.
2127         * x86_64.cc: Likewise.
2128
2129 2010-08-24  Nick Clifton  <nickc@redhat.com>
2130
2131         PR 11899
2132         * layout.cc (segment_precedes): Sort segments by their physical
2133         addresses, if they have been set.
2134
2135 2010-08-23  Cary Coutant  <ccoutant@google.com>
2136
2137         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2138         symbols data.
2139         (Lib_group::include_member): Unlock object after deleting its
2140         symbols data.
2141         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2142         the bug fixed here.
2143
2144 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2145             Cary Coutant  <ccoutant@google.com>
2146
2147         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2148         constructor, and set_blocker.
2149         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2150         readsyms_blocker_.
2151         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2152         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2153         * testsuite/Makefile.am (start_lib_test): New test case.
2154         * testsuite/Makefile.in: Regenerate.
2155         * testsuite/start_lib_test_main.c: New file.
2156         * testsuite/start_lib_test_1.c: New file.
2157         * testsuite/start_lib_test_2.c: New file.
2158         * testsuite/start_lib_test_3.c: New file.
2159
2160 2010-08-19  Ian Lance Taylor  <iant@google.com>
2161
2162         * Makefile.in: Rebuild with automake 1.11.1.
2163         * aclocal.m4: Likewise.
2164         * testsuite/Makefile.in: Likewise.
2165
2166 2010-08-19  Ian Lance Taylor  <iant@google.com>
2167
2168         PR 10893
2169         * i386.cc (class Output_data_plt_i386): Update declarations.
2170         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2171         local_ifuncs_ fields.
2172         (Target_i386::do_plt_section_for_global): New function.
2173         (Target_i386::do_plt_section_for_local): New function.
2174         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2175         parameter; change all callers.  Initialize global_ifuncs_ and
2176         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2177         __rel_iplt_end.
2178         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2179         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2180         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2181         symbols.
2182         (Target_i386::make_plt_section): New function, broken out of
2183         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2184         (Target_i386::make_plt_entry): Call make_plt_section.
2185         (Target_i386::make_local_ifunc_plt_entry): New function.
2186         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2187         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2188         R_386_IRELATIVE to switch.
2189         (Target_i386::Scan::global): Likewise.
2190         (Target_i386::Relocate::relocate): Likewise.
2191         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2192         switch.
2193         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2194         (Target_x86_64::do_plt_section_for_global): New function.
2195         (Target_x86_64::do_plt_section_for_local): New function.
2196         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2197         parameter; change all callers.  If doing a static link define
2198         __rela_iplt_start and __rela_iplt_end.
2199         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2200         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2201         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2202         to point to .plt.
2203         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2204         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2205         switch.
2206         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2207         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2208         R_X86_64_IRELATIVE to switch.
2209         (Target_x86_64::Scan::global): Likewise.
2210         (Target_x86_64::Relocate::relocate): Likewise.
2211         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2212         switch.
2213         * target.h (class Target): Add plt_section_for_global and
2214         plt_section_for_local functions.  Add do_plt_section_for_global
2215         and do_plt_section_for_local virtual functions.
2216         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2217         clarifying comments.
2218         (Symbol::use_plt_offset): Handle IFUNC symbol.
2219         * object.cc (Sized_relobj::Sized_relobj): Initialize
2220         local_plt_offsets_.
2221         (Sized_relobj::local_has_plt_offset): New function.
2222         (Sized_relobj::local_plt_offset): New function.
2223         (Sized_relobj::set_local_plt_offset): New function.
2224         (Sized_relobj::do_count): Handle IFUNC symbol.
2225         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2226         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2227         is_ifunc_symbol functions.
2228         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2229         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2230         local_plt_offsets_ field.
2231         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2232         * output.h (class Output_section_data): Add non-const
2233         output_section function.
2234         (class Output_data_got): Update declarations.
2235         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2236         Add use_plt_offset parameter to global and local constructors.
2237         Change all callers.  Change local_sym_index_ field to 31 bits.
2238         Change GSYM_CODE and CONSTANT_CODE accordingly.
2239         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2240         doing a static link don't set sh_link field.
2241         (Output_data_got::Got_entry::write): Use PLT offset if
2242         appropriate.
2243         (Output_data_got::add_global_plt): New function.
2244         (Output_data_got::add_local_plt): New function.
2245         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2246         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2247         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2248         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2249         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2250         IFUNC conditional.
2251         * testsuite/ifunc-sel.h: New file.
2252         * testsuite/ifuncmain1.c: New file.
2253         * testsuite/ifuncmain1vis.c: New file.
2254         * testsuite/ifuncmod1.c: New file.
2255         * testsuite/ifuncdep2.c: New file.
2256         * testsuite/ifuncmain2.c: New file.
2257         * testsuite/ifuncmain3.c: New file.
2258         * testsuite/ifuncmod3.c: New file.
2259         * testsuite/ifuncmain4.c: New file.
2260         * testsuite/ifuncmain5.c: New file.
2261         * testsuite/ifuncmod5.c: New file.
2262         * testsuite/ifuncmain6pie.c: New file.
2263         * testsuite/ifuncmod6.c: New file.
2264         * testsuite/ifuncmain7.c: New file.
2265         * configure, testsuite/Makefile.in: Rebuild.
2266
2267 2010-08-18  Ian Lance Taylor  <iant@google.com>
2268
2269         * incremental.cc
2270         (Output_section_incremental_inputs::write_input_files): Add cast
2271         to avoid signed/unsigned comparison warning.
2272         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2273
2274 2010-08-12  Cary Coutant  <ccoutant@google.com>
2275
2276         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2277
2278 2010-08-13  Ian Lance Taylor  <iant@google.com>
2279
2280         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2281
2282 2010-08-12  Cary Coutant  <ccoutant@google.com>
2283             Doug Kwan  <dougkwan@google.com>
2284
2285         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2286         defintion overrides non-weak undef, remember that the original undef
2287         is not weak.
2288         * symtab.cc (Symbol_table::sized_write_global): For undef without
2289         an original weak binding, set binding to global in output.
2290         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2291         * testsuite/Makefile.in: Regenerate.
2292         * testsuite/strong_ref_weak_def.sh: New file.
2293         * testsuite/strong_ref_weak_def_1.c: Ditto.
2294         * testsuite/strong_ref_weak_def_2.c: Ditto.
2295
2296 2010-08-12  Cary Coutant  <ccoutant@google.com>
2297
2298         * testsuite/incremental_test.sh: Rewrite.
2299         * testsuite/incremental_test_1.c: Rewrite.
2300         * testsuite/incremental_test_2.c: Rewrite.
2301
2302 2010-08-12  Cary Coutant  <ccoutant@google.com>
2303
2304         * arm.cc (Target_arm::got_size): Add const.
2305         (Target_arm::got_entry_count): New function.
2306         (Target_arm::plt_entry_count): New function.
2307         (Target_arm::first_plt_entry_offset): New function.
2308         (Target_arm::plt_entry_size): New function.
2309         (Output_data_plt_arm::entry_count): New function.
2310         (Output_data_plt_arm::first_plt_entry_offset): New function.
2311         (Output_data_plt_arm::get_plt_entry_size): New function.
2312         * i386.cc (Target_i386::got_size): Add const.
2313         (Target_i386::got_entry_count): New function.
2314         (Target_i386::plt_entry_count): New function.
2315         (Target_i386::first_plt_entry_offset): New function.
2316         (Target_i386::plt_entry_size): New function.
2317         (Output_data_plt_i386::entry_count): New function.
2318         (Output_data_plt_i386::first_plt_entry_offset): New function.
2319         (Output_data_plt_i386::get_plt_entry_size): New function.
2320         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2321         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2322         * incremental.cc: Include target.h.
2323         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2324         parameter.  Adjust all callers.  Find incremental_got_plt section.
2325         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2326         section.
2327         (Output_section_incremental_inputs::set_final_data_size): Calculate
2328         size of incremental_got_plt section.
2329         (Output_section_incremental_inputs::do_write): Write the
2330         incremental_got_plt section.
2331         (Got_plt_view_info): New struct.
2332         (Local_got_offset_visitor): New class.
2333         (Global_got_offset_visitor): New class.
2334         (Global_symbol_visitor_got_plt): New class.
2335         (Output_section_incremental_inputs::write_got_plt): New function.
2336         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2337         Add parameter.  Adjust all callers.
2338         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2339         (Incremental_inputs::got_plt_section): New function.
2340         (Incremental_inputs::got_plt_section_): New data member.
2341         (Incremental_got_plt_reader): New class.
2342         * layout.cc (Layout::create_incremental_info_sections): Add the
2343         incremental_got_plt section.
2344         * object.h (Got_offset_list::get_list): New function.
2345         (Got offset_list::for_all_got_offsets): New function.
2346         (Sized_relobj::local_got_offset_list): New function.
2347         * powerpc.cc (Target_powerpc::got_size): Add const.
2348         (Target_powerpc::got_entry_count): New function.
2349         (Target_powerpc::plt_entry_count): New function.
2350         (Target_powerpc::first_plt_entry_offset): New function.
2351         (Target_powerpc::plt_entry_size): New function.
2352         (Output_data_plt_powerpc::entry_count): New function.
2353         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2354         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2355         * sparc.cc (Target_sparc::got_size): Add const.
2356         (Target_sparc::got_entry_count): New function.
2357         (Target_sparc::plt_entry_count): New function.
2358         (Target_sparc::first_plt_entry_offset): New function.
2359         (Target_sparc::plt_entry_size): New function.
2360         (Output_data_plt_sparc::entry_count): New function.
2361         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2362         (Output_data_plt_sparc::get_plt_entry_size): New function.
2363         * symtab.h (Symbol::got_offset_list): New function.
2364         (Symbol_table::for_all_symbols): New function.
2365         * target.h (Sized_target::got_entry_count): New function.
2366         (Sized_target::plt_entry_count): New function.
2367         (Sized_target::plt_entry_size): New function.
2368         * x86_64.cc (Target_x86_64::got_size): Add const.
2369         (Target_x86_64::got_entry_count): New function.
2370         (Target_x86_64::plt_entry_count): New function.
2371         (Target_x86_64::first_plt_entry_offset): New function.
2372         (Target_x86_64::plt_entry_size): New function.
2373         (Output_data_plt_x86_64::entry_count): New function.
2374         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2375         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2376
2377 2010-08-12  Cary Coutant  <ccoutant@google.com>
2378
2379         * archive.cc: Include incremental.h.
2380         (Archive::Archive): Initialize incremental_info_.
2381         (Archive::include_member): Record archive members in incremental info.
2382         (Add_archive_symbols::run): Record begin and end of an archive in
2383         incremental info.
2384         (Lib_group::include_member): Record objects in incremental info.
2385         * archive.h (Incremental_archive_entry): Forward declaration.
2386         (Archive::set_incremental_info): New member function.
2387         (Archive::incremental_info): New member function.
2388         (Archive::Unused_symbol_iterator): New class.
2389         (Archive::unused_symbols_begin): New member function.
2390         (Archive::unused_symbols_end): New member function.
2391         (Archive::incremental_info_): New data member.
2392         * incremental-dump.cc (find_input_containing_global): New function.
2393         (dump_incremental_inputs): Dump new incremental info sections.
2394         * incremental.cc: Include symtab.h.
2395         (Output_section_incremental_inputs): New class.
2396         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2397         new incremental info sections.
2398         (Sized_incremental_binary::do_check_inputs): Likewise.
2399         (Incremental_inputs::report_archive): Remove.
2400         (Incremental_inputs::report_archive_begin): New function.
2401         (Incremental_inputs::report_archive_end): New function.
2402         (Incremental_inputs::report_object): New function.
2403         (Incremental_inputs::finalize_inputs): Remove.
2404         (Incremental_inputs::report_input_section): New function.
2405         (Incremental_inputs::report_script): Rewrite.
2406         (Incremental_inputs::finalize): Do nothing but finalize string table.
2407         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2408         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2409         (Incremental_inputs::create_data_sections): New function.
2410         (Incremental_inputs::relocs_entsize): New function.
2411         (Output_section_incremental_inputs::set_final_data_size): New function.
2412         (Output_section_incremental_inputs::do_write): New function.
2413         (Output_section_incremental_inputs::write_header): New function.
2414         (Output_section_incremental_inputs::write_input_files): New function.
2415         (Output_section_incremental_inputs::write_info_blocks): New function.
2416         (Output_section_incremental_inputs::write_symtab): New function.
2417         * incremental.h (Incremental_script_entry): Forward declaration.
2418         (Incremental_object_entry): Forward declaration.
2419         (Incremental_archive_entry): Forward declaration.
2420         (Incremental_inputs): Forward declaration.
2421         (Incremental_inputs_header_data): Remove.
2422         (Incremental_inputs_header): Remove.
2423         (Incremental_inputs_header_write): Remove.
2424         (Incremental_inputs_entry_data): Remove.
2425         (Incremental_inputs_entry): Remove.
2426         (Incremental_inputs_entry_write): Remove.
2427         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2428         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2429         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2430         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2431         Likewise.
2432         (Incremental_input_entry): New class.
2433         (Incremental_script_entry): New class.
2434         (Incremental_object_entry): New class.
2435         (Incremental_archive_entry): New class.
2436         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2437         (Incremental_inputs::report_inputs): Remove.
2438         (Incremental_inputs::report_archive): Remove.
2439         (Incremental_inputs::report_archive_begin): New function.
2440         (Incremental_inputs::report_archive_end): New function.
2441         (Incremental_inputs::report_object): Change prototype.
2442         (Incremental_inputs::report_input_section): New function.
2443         (Incremental_inputs::report_script): Change prototype.
2444         (Incremental_inputs::get_reloc_count): New function.
2445         (Incremental_inputs::set_reloc_count): New function.
2446         (Incremental_inputs::create_data_sections): New function.
2447         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2448         (Incremental_inputs::inputs_section): New function.
2449         (Incremental_inputs::symtab_section): New function.
2450         (Incremental_inputs::relocs_section): New function.
2451         (Incremental_inputs::get_stringpool): Add const.
2452         (Incremental_inputs::command_line): Add const.
2453         (Incremental_inputs::inputs): Remove.
2454         (Incremental_inputs::command_line_key): New function.
2455         (Incremental_inputs::input_file_count): New function.
2456         (Incremental_inputs::input_files): New function.
2457         (Incremental_inputs::relocs_entsize): New function.
2458         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2459         (Incremental_inputs::finalize_inputs): Remove.
2460         (Incremental_inputs::Input_info): Remove.
2461         (Incremental_inputs::lock_): Remove.
2462         (Incremental_inputs::inputs_): Change type.
2463         (Incremental_inputs::inputs_map_): Remove.
2464         (Incremental_inputs::current_object_entry_): New data member.
2465         (Incremental_inputs::inputs_section_): New data member.
2466         (Incremental_inputs::symtab_section_): New data member.
2467         (Incremental_inputs::relocs_section_): New data member.
2468         (Incremental_inputs::reloc_count_): New data member.
2469         (Incremental_inputs_reader): New class.
2470         (Incremental_symtab_reader): New class.
2471         (Incremental_relocs_reader): New class.
2472         * layout.cc (Layout::finalize): Move finalization of incremental info
2473         and creation of incremental info sections to follow finalization of
2474         symbol table.  Set offsets for postprocessing sections.
2475         (Layout::create_incremental_info_sections): Call
2476         Incremental_inputs::create_data_sections.  Add incremental symtab
2477         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2478         sections to layout after input sections.
2479         * layout.h (struct Timespec): Forward declaration.
2480         (Layout::incremental_inputs): Add const.
2481         (Layout::create_incremental_info_sections): Add parameter.
2482         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2483         * object.cc: Include incremental.h.
2484         (Relobj::finalize_incremental_relocs): New function.
2485         (Sized_relobj::do_layout): Record input sections in incremental info.
2486         * object.h (Object::output_section): New function.
2487         (Object::output_section_offset): Moved from Relobj.
2488         (Object::get_incremental_reloc_base): New function.
2489         (Object::get_incremental_reloc_count): New function.
2490         (Object::do_output_section): New function.
2491         (Object::do_output_section_offset): Moved from Relobj.
2492         (Object::do_get_incremental_reloc_base): New function.
2493         (Object::do_get_incremental_reloc_count): New function.
2494         (Object::Object): Initialize new data members.
2495         (Relobj::output_section): Renamed do_output_section and moved to
2496         protected.
2497         (Relobj::output_section_offset): Moved to Object.
2498         (Relobj::do_get_incremental_reloc_base): New function.
2499         (Relobj::do_get_incremental_reloc_count): New function.
2500         (Relobj::allocate_incremental_reloc_counts): New function.
2501         (Relobj::count_incremental_reloc): New function.
2502         (Relobj::finalize_incremental_relocs): New function.
2503         (Relobj::next_incremental_reloc_index): New function.
2504         (Relobj::reloc_counts_): New data member.
2505         (Relobj::reloc_bases_): New data member.
2506         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2507         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2508         (Sized_relobj::incremental_relocs_scan): New function.
2509         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2510         (Sized_relobj::incremental_relocs_write): New function.
2511         (Sized_relobj::incremental_relocs_write_reltype): New function.
2512         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2513         incremental link.
2514         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2515         archives and object files elsewhere.
2516         (Add_symbols::run): Report object files here.
2517         (Finish_group::run): Report end of archive at end of group.
2518         * reloc.cc: Include layout.h, incremental.h.
2519         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2520         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2521         (Sized_relobj::incremental_relocs_scan): New function.
2522         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2523         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2524         (Sized_relobj::incremental_relocs_write): New function.
2525         (Sized_relobj::incremental_relocs_write_reltype): New function.
2526         * script.cc (read_input_script): Rewrite test for incremental link.
2527         Change call to Incremental_inputs::report_script.
2528         * symtab.h (Symbol_table::first_global_index): New function.
2529         (Symbol_table::output_count): New function.
2530
2531 2010-08-12  Doug Kwan  <dougkwan@google.com>
2532
2533         * arm.cc (Target_arm::merge_object_attributes): Check command line
2534         options --no-wchar-size-warning and --no-enum-size-warning.
2535         * options.h (General_options): Add ld-compatible options
2536         --no-enum-size-warning and --no-wchar-size-warning.
2537
2538 2010-08-04  Ian Lance Taylor  <iant@google.com>
2539
2540         * x86_64.cc (Target_x86_64::Scan::local): Use
2541         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2542         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2543         (Target_x86_64::Scan::global): Likewise.
2544         (Target_x86_64::Relocate::relocate): Likewise.
2545         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2546         Likewise.
2547
2548 2010-08-03  Cary Coutant  <ccoutant@google.com>
2549
2550         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2551         to reserve space in merged_strings vector. Keep total input size
2552         for stats.
2553         (Output_merge_string::do_print_merge_stats): Print total input size.
2554         * merge.h (Output_merge_string): Add input_size_ field.
2555         * stringpool.cc (Stringpool_template::string_length): Move
2556         implementations out of Stringpool_template class and place in
2557         stringpool.h.
2558         * stringpool.h (string_length): Move out of Stringpool_template.
2559
2560 2010-08-03  Ian Lance Taylor  <iant@google.com>
2561
2562         PR 11712
2563         * layout.cc (relaxation_loop_body): If address of load segment is
2564         set, adjust address to include headers if possible.
2565
2566 2010-08-03  Ian Lance Taylor  <iant@google.com>
2567
2568         * version.cc (version_string): Bump to 1.10.
2569
2570 2010-08-03  Ian Lance Taylor  <iant@google.com>
2571
2572         PR 11805
2573         * layout.h (enum Output_section_order): Define.
2574         (class Layout): Update declarations.
2575         * layout.cc (Layout::get_output_section): Add order parameter.
2576         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2577         is_first_non_relro parameters.  Change all callers.
2578         (Layout::choose_output_section): Likewise.
2579         (Layout::add_output_section_data): Likewise.
2580         (Layout::make_output_section): Likewise.  Set order.
2581         (Layout::default_section_order): New function.
2582         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2583         * output.cc (Output_section::Output_section): Initialize order_.
2584         Don't initialize deleted fields.
2585         (Output_segment::Output_segment): Don't initialize deleted
2586         fields.
2587         (Output_segment::add_output_section_to_load): New function
2588         replacing add_output_section.  Change all callers to call this or
2589         add_output_section_to_nonload.
2590         (Output_segment::add_output_section_to_nonload): New function.
2591         (Output_segment::remove_output_section): Rewrite.
2592         (Output_segment::add_initial_output_data): Likewise.
2593         (Output_segment::has_any_data_sections): Likewise.
2594         (Output_segment::is_first_section_relro): Likewise.
2595         (Output_segment::maximum_alignment): Likewise.
2596         (Output_segment::has_dynamic_reloc): New function replacing
2597         dynamic_reloc_count.  Change all callers.
2598         (Output_segment::has_dynamic_reloc_list): New function replacing
2599         dynamic_reloc_count_list.  Change all callers.
2600         (Output_segment::set_section_addresses): Rewrite.
2601         (Output_segment::set_offset): Rewrite.
2602         (Output_segment::find_first_and_last_list): Remove.
2603         (Output_segment::set_tls_offsets): Rewrite.
2604         (Output_segment::first_section_load_address): Likewise.
2605         (Output_segment::output_section_count): Likewise.
2606         (Output_segment::section_with_lowest_load_address): Likewise.
2607         (Output_segment::write_section_headers): Likewise.
2608         (Output_segment::print_sections_to_map): Likewise.
2609         * output.h (class Output_data): Remove dynamic_reloc_count_
2610         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2611         (Output_data::add_dynamic_reloc): Rewrite.
2612         (Output_data::has_dynamic_reloc): New function.
2613         (Output_data::dynamic_reloc_count): Remove.
2614         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2615         is_last_relro_, is_first_non_relro_, is_interp_,
2616         is_dynamic_linker_section_ fields.  Add order and set_order
2617         functions.  Remove is_relro_local, set_is_relro_local,
2618         is_last_relro, set_is_last_relro, is_first_non_relro,
2619         set_is_first_non_relro functions, is_interp, set_is_interp,
2620         is_dynamic_linker_section, and set_is_dynamic_linker_section
2621         functions.
2622         (class Output_segment): Change Output_data_list from std::list to
2623         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2624         output_bss_ fields.  Update declarations.
2625
2626 2010-08-02  Ian Lance Taylor  <iant@google.com>
2627
2628         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2629         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2630         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2631
2632 2010-08-02  Ian Lance Taylor  <iant@google.com>
2633
2634         PR 11855
2635         * script.cc (Script_options::Script_options): Initialize
2636         symbol_definitions_ and symbol_references_.
2637         (Script_options::add_symbol_assignment): Update
2638         symbol_definitions_ and symbol_references_.
2639         (Script_options::add_symbol_reference): New function.
2640         (script_symbol): New function.
2641         * script.h (class Script_options): Add symbol_definitions_ and
2642         symbol_references_ fields.
2643         (Script_options::referenced_const_iterator): New type.
2644         (Script_options::referenced_begin): New function.
2645         (Script_options::referenced_end): New function.
2646         (Script_options::is_referenced): New function.
2647         (Script_options::any_unreferenced): New function.
2648         * script-c.h (script_symbol): Declare.
2649         * yyscript.y (exp): Call script_symbol.
2650         * symtab.cc: Include "script.h".
2651         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2652         Change all callers.  Check symbols referenced by scripts.
2653         (Symbol_table::add_undefined_symbols_from_command_line): Add
2654         layout parameter.  Change all callers.
2655         (Symbol_table::do_add_undefined_symbols_from_command_line):
2656         Likewise.  Break out loop body.  Check symbols referenced by
2657         scripts.
2658         (Symbol_table::add_undefined_symbol_from_command_line): New
2659         function broken out of
2660         do_add_undefined_symbols_from_command_line.
2661         * symtab.h (class Symbol_table): Update declarations.
2662         * archive.cc: Include "layout.h".
2663         (Archive::should_include_member): Add layout parameter.  Change
2664         all callers.  Check for symbol mentioned in expression.
2665         * archive.h (class Archive): Update declaration.
2666         * object.cc (Sized_relobj::do_should_include_member): Add layout
2667         parameter.
2668         * object.h (Object::should_include_member): Add layout parameter.
2669         Change all callers.
2670         (Object::do_should_include_member): Add layout parameter.
2671         (class Sized_relobj): Update declaration.
2672         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2673         parameter.
2674         * dynobj.h (class Sized_dynobj): Update declaration.
2675         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2676         layout parameter.
2677         * plugin.h (class Sized_pluginobj): Update declaration.
2678
2679 2010-08-02  Ian Lance Taylor  <iant@google.com>
2680
2681         PR 11866
2682         * output.cc (Output_segment::set_offset): Search for the first and
2683         last sections rather than assuming that the list is in order.
2684         (Output_segment::find_first_and_last_list): New function.
2685         * output.h (class Output_segment): Update declarations.
2686         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2687         (relro_strip_test_SOURCES): New variable.
2688         (relro_strip_test_DEPENDENCIES): New variable.
2689         (relro_strip_test_LDFLAGS): New variable.
2690         (relro_strip_test_LDADD): New variable.
2691         (relro_strip_test.so): New target.
2692
2693 2010-08-02  Ian Lance Taylor  <iant@google.com>
2694
2695         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2696         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2697         (Target_i386::got_tlsdesc_section): New function.
2698         (Target_i386::got_section): Create space for GOT entries for
2699         TLSDESC relocations.
2700         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2701         R_386_TLS_GOTDESC.
2702         (Target_i386::Scan::global): Likewise.
2703         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2704         using TLSDESC GOT.
2705         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2706         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2707         (Target_x86_64::got_tlsdesc_section): New function.
2708         (Target_x86_64::got_section): Create space for GOT entries for
2709         TLSDESC relocations.
2710         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2711         R_386_TLS_GOTDESC.
2712         (Target_x86_64::Scan::global): Likewise.
2713         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2714         using TLSDESC GOT.
2715
2716 2010-08-02  Ian Lance Taylor  <iant@google.com>
2717
2718         * testsuite/final_layout.sh: Use dc to convert from hex to
2719         decimal.
2720
2721 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2722
2723         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2724         paramter to the call to gold::gc_process_relocs.
2725         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2726         paramter to the call to gold::gc_process_relocs.
2727         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2728         parameter to the call to gold::gc_process_relocs.
2729         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2730         template parameter to the call to gold::gc_process_relocs.
2731         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2732         paramter to the call to gold::gc_process_relocs.
2733         * gc.h (get_embedded_addend_size): New function.
2734         (gc_process_relocs): Save the size of the reloc for use by ICF.
2735         * icf.cc (get_section_contents): Get the addend from the text section
2736         for SHT_REL relocation sections.
2737         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2738         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2739         * int_encoding.h (read_from_pointer): New overloaded function.
2740         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2741         * testsuite/icf_sht_rel_addend_test.sh: New file.
2742         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2743         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2744
2745 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2746
2747         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2748         * Makefile.in: Regenerate.
2749         * testsuite/Makefile.in: Regenerate.
2750
2751 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2752
2753         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2754         * gold/testsuite/debug_msg.cc: Likewise.
2755         * gold/testsuite/odr_violation1.cc
2756         * gold/testsuite/odr_violation2.cc
2757
2758 2010-07-21  Cary Coutant  <ccoutant@google.com>
2759
2760         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2761         string, and length fields.
2762         (Output_merge_string::Merged_strings_list): New type.
2763         (Output_merge_string::Merged_strings_lists): New typedef.
2764         (Output_merge_string): Replace merged_strings_ with
2765         merged_strings_lists_.
2766         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2767         Merged_strings_list per input object and section.  Don't store pointer
2768         to the string.  Don't store length with each merged string entry.
2769         (Output_merge_string::finalize_merged_data): Loop over list of merged
2770         strings lists.  Recompute length of each merged string.
2771
2772 2010-07-15  Cary Coutant  <ccoutant@google.com>
2773
2774         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2775         here.
2776
2777 2010-07-14  Ian Lance Taylor  <iant@google.com>
2778
2779         * descriptors.cc (Descriptors::open): Report correct name in error
2780         message.
2781
2782 2010-07-13  Doug Kwan  <dougkwan@google.com>
2783
2784         * arm.cc (Arm_input_section::Arm_input_section): For a
2785         SHT_ARM_EXIDX section, always keeps the input sections.
2786         (Arm_input_section::set_exidx_section_link): New method.
2787         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2788         has_errors_ to false.
2789         (Arm_exidx_input_section::has_errors,
2790         Arm_exidx_input_section::set_has_errors): New methods.
2791         (Arm_exidx_input_section::has_errors_): New data member.
2792         (Arm_relobj::get_exidx_shndx_list): New method.
2793         (Arm_output_section::append_text_sections_to_list): Do not skip
2794         section without SHF_EXECINSTR.
2795         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2796         errors.
2797         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2798         section header.  Make error messages more verbose.  Check for
2799         a non-executable section linked to an EXIDX section.
2800         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2801         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2802         check that there is no deferred EXIDX section if we exit early.
2803         Instead of not making an EXIDX section in case of an error, make one
2804         and set the has_errors flag of it.
2805         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2806         in a relocatable link.
2807         (Target_arm::do_relax): Look for the EXIDX output section instead of
2808         assuming that it is called .ARM.exidx.
2809         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2810         section list.  Do not check for SHF_EXECINSTR section flags but
2811         skip any input section with errors.
2812         * output.cc (Output_section::Output_section): Initialize
2813         always_keeps_input_sections_ to false.
2814         (Output_section::add_input_section): Check for
2815         always_keeps_input_sections_.
2816         *  output.h (Output_section::always_keeps_input_sections,
2817         Output_section::set_always_keeps_input_sections): New methods.
2818         (Output_section::always_keeps_input_sections): New data member.
2819
2820 2010-07-13  Rafael Espindola  <espindola@google.com>
2821
2822         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2823         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2824
2825 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2826             Ian Lance Taylor  <iant@google.com>
2827
2828         * output.h (Output_section_lookup_maps::add_merge_section):
2829         Correct check of whether value was inserted.
2830         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2831         (Output_section_lookup_maps::add_relaxed_input_section):
2832         Likewise.
2833         * arm.cc (Target_arm::got_section): Remove used local os.
2834         * i386.cc (Target_i386::got_section): Likewise.
2835         * x86_64.cc (Target_x86_64::got_section): Likewise.
2836         * sparc.cc (Target_sparc::got_section): Likewise.
2837         (Target_sparc::relocate): Remove unused local have_got_offset.
2838         * powerpc.cc (Target_powerpc::relocate): Likewise.
2839
2840 2010-07-13  Ian Lance Taylor  <iant@google.com>
2841
2842         * compressed_output.cc (zlib_decompress): Fix signature in
2843         !HAVE_ZLIB_H case.
2844
2845         * archive.cc (Archive::include_member): Unlock an external member
2846         of a thin archive.  Don't bother to delete an object we know is
2847         NULL.
2848
2849 2010-07-12  Cary Coutant  <ccoutant@google.com>
2850
2851         * compressed_output.cc (zlib_decompress): New function.
2852         (get_uncompressed_size): New function.
2853         (decompress_input_section): New function.
2854         * compressed_output.h (get_uncompressed_size): New function.
2855         (decompress_input_section): New function.
2856         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2857         Handle compressed debug sections.
2858         * layout.cc (is_compressed_debug_section): New function.
2859         (Layout::output_section_name): Map compressed section names to
2860         canonical names.
2861         * layout.h (is_compressed_debug_section): New function.
2862         (is_debug_info_section): Recognize compressed debug sections.
2863         * merge.cc: Include compressed_output.h.
2864         (Output_merge_data::do_add_input_section): Handle compressed
2865         debug sections.
2866         (Output_merge_string::do_add_input_section): Handle compressed
2867         debug sections.
2868         * object.cc: Include compressed_output.h.
2869         (Sized_relobj::Sized_relobj): Initialize new data members.
2870         (build_compressed_section_map): New function.
2871         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2872         * object.h (Object::section_is_compressed): New method.
2873         (Object::do_section_is_compressed): New method.
2874         (Sized_relobj::Compressed_section_map): New type.
2875         (Sized_relobj::do_section_is_compressed): New method.
2876         (Sized_relobj::compressed_sections_): New data member.
2877         * output.cc (Output_section::add_input_section): Handle compressed
2878         debug sections.
2879         * reloc.cc: Include compressed_output.h.
2880         (Sized_relobj::write_sections): Handle compressed debug sections.
2881
2882 2010-07-08  Cary Coutant  <ccoutant@google.com>
2883
2884         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2885         weak when resolving to a dynamic def.
2886         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2887         for weak undef/dynamic def cases. Adjust callers.
2888         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2889         undef_binding_weak_.
2890         (Symbol_table::sized_write_globals): Adjust symbol binding.
2891         (Symbol_table::sized_write_symbol): Add binding parameter.
2892         * symtab.h (Symbol::set_undef_binding): New method.
2893         (Symbol::is_undef_binding_weak): New method.
2894         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2895         (Symbol_table::should_override): Add new parameter.
2896         (Symbol_table::sized_write_symbol): Add new parameter.
2897
2898         * testsuite/weak_undef_file1.cc: Add new test case.
2899         * testsuite/weak_undef_file2.cc: Fix header comment.
2900         * testsuite/weak_undef_test.cc: Add new test case.
2901
2902 2010-06-29  Doug Kwan  <dougkwan@google.com>
2903
2904         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2905         Initialize USE_SYMBOL_.
2906         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2907         definition.
2908         (Arm_reloc_property::uses_symbol_): New data member declaration.
2909         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2910         uses symbol value and symbol is undefined but not weakly undefined.
2911
2912 2010-06-28  Rafael Espindola  <espindola@google.com>
2913
2914         * plugin.cc (Plugin::load): Use dlerror.
2915
2916 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2917
2918         * symtab.cc (detect_odr_violations): When reporting an ODR
2919         violation, report an object where the symbol is defined.
2920
2921 2010-06-25  Doug Kwan  <dougkwan@google.com>
2922
2923         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2924         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2925         definition.
2926         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2927         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2928         target hook to detect function points.
2929         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2930         * icf.h (Icf::check_section_for_function_pointers): Change type of
2931         parameter SECTION_NAME to const reference to std::string.  Use
2932         target hook to determine if section may have unsafe pointers.
2933         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2934         method definition.
2935
2936 2010-06-21  Rafael Espindola  <espindola@google.com>
2937
2938         * fileread.cc (Input_file::find_fie): New
2939         (Input_file::open): Use Input_file::find_fie.
2940         * fileread.h (Input_file::find_fie): New
2941         * plugin.cc (set_extra_library_path): New.
2942         (Plugin::load): Add set_extra_library_path to the transfer vector.
2943         (Plugin_manager::set_extra_library_path): New.
2944         (Plugin_manager::add_input_file): Use the extra search path if set.
2945         (set_extra_library_path(): New.
2946         * plugin.h (Plugin_manager): Add set_extra_library_path and
2947         extra_search_path_.
2948
2949 2010-06-19  Cary Coutant  <ccoutant@google.com>
2950
2951         * layout.cc (gdb_sections): Add .debug_types.
2952         (lines_only_debug_sections): Likewise.
2953
2954 2010-06-18  Rafael Espindola  <espindola@google.com>
2955
2956         * plugin.cc (add_input_file,add_input_library)
2957         (Plugin_manager::add_input_file): Make filename arguments const.
2958         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2959         const.
2960
2961 2010-06-16  Doug Kwan  <dougkwan@google.com>
2962
2963         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2964         .ARM.attributes section if we have not merged any input
2965         attributes sections.
2966
2967 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2968
2969         * arm.cc: Allow combining objects with no EABI version
2970         information.
2971
2972 2010-06-15  Rafael Espindola  <espindola@google.com>
2973
2974         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2975
2976 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2977
2978         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2979         (struct iovec): Correct !HAVE_READV definition.
2980
2981 2010-06-10  Cary Coutant  <ccoutant@google.com>
2982
2983         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2984         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2985         reloc sections.
2986         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2987
2988         PR 11683
2989         * symtab.h (Symbol::is_placeholder): New member function.
2990         * target-reloc.h (relocate_section): Check for placeholder symbols.
2991
2992         * testsuite/Makefile.am (plugin_test_8): New test.
2993         (plugin_test_9): New test.
2994         * testsuite/Makefile.in: Regenerate.
2995
2996 2010-06-09  Nick Clifton  <nickc@redhat.com>
2997
2998         * yyscript.y (input_list_element): Allow strings prefixed with
2999         the '-' character.  Treat these as libraries.
3000         * script.cc (script_add_library): New function.  Adds a library
3001         specified by "-l<name>" found in an input script.
3002         * script-c.h: Add prototype for script_add_library.
3003
3004 2010-06-07  Doug Kwan  <dougkwan@google.com>
3005
3006         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3007         Restrict stub-group size to be within long conditional branch
3008         range when working around cortex-A8 erratum.
3009
3010 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3011
3012         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3013         #ifdef typo.
3014
3015 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3016
3017         PR gold/11658
3018         * output.cc
3019         (Output_section::Input_section_sort_entry::compare_section_ordering):
3020         Change to return non-zero correctly.
3021         (Output_section::Input_section_sort_section_order_index_compare
3022         ::operator()): Change to fix ambiguity in comparisons.
3023
3024 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3025
3026         * gold.h (is_wildcard_string): New function.
3027         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3028         (Layout::layout_eh_frame): Ditto.
3029         (Layout::find_section_order_index): New method.
3030         (Layout::read_layout_from_file): New method.
3031         * layout.h (Layout::find_section_order_index): New method.
3032         (Layout::read_layout_from_file): New method.
3033         (Layout::input_section_position_): New private member.
3034         (Layout::input_section_glob_): New private member.
3035         * main.cc (main): Call read_layout_from_file here.
3036         * options.h (--section-ordering-file): New option.
3037         * output.cc (Output_section::input_section_order_specified_): New
3038         member.
3039         (Output_section::Output_section): Initialize new member.
3040         (Output_section::add_input_section): Add new parameter.
3041         Keep input sections when --section-ordering-file is used.
3042         (Output_section::set_final_data_size): Sort input sections when
3043         section ordering file is specified.
3044         (Output_section::Input_section_sort_entry): Add new parameter.
3045         Check sorting type.
3046         (Output_section::Input_section_sort_entry::compare_section_ordering):
3047         New method.
3048         (Output_section::Input_section_sort_compare::operator()): Change to
3049         consider section_order_index.
3050         (Output_section::Input_section_sort_init_fini_compare::operator()):
3051         Change to consider section_order_index.
3052         (Output_section::Input_section_sort_section_order_index_compare
3053         ::operator()): New method.
3054         (Output_section::sort_attached_input_sections): Change to sort
3055         according to section order when specified.
3056         (Output_section::add_input_section<32, true>): Add new parameter.
3057         (Output_section::add_input_section<64, true>): Add new parameter.
3058         (Output_section::add_input_section<32, false>): Add new parameter.
3059         (Output_section::add_input_section<64, false>): Add new parameter.
3060         * output.h (Output_section::add_input_section): Add new parameter.
3061         (Output_section::input_section_order_specified): New
3062         method.
3063         (Output_section::set_input_section_order_specified): New method.
3064         (Input_section::Input_section): Initialize section_order_index_.
3065         (Input_section::section_order_index): New method.
3066         (Input_section::set_section_order_index): New method.
3067         (Input_section::section_order_index_): New member.
3068         (Input_section::Input_section_sort_section_order_index_compare): New
3069         struct.
3070         (Output_section::input_section_order_specified_): New member.
3071         * script-sections.cc (is_wildcard_string): Delete and move modified
3072         method to gold.h.
3073         (Output_section_element_input::Output_section_element_input): Modify
3074         call to is_wildcard_string.
3075         (Output_section_element_input::Input_section_pattern
3076         ::Input_section_pattern): Ditto.
3077         (Output_section_element_input::Output_section_element_input): Ditto.
3078         * testsuite/Makefile.am (final_layout): New test case.
3079         * testsuite/Makefile.in: Regenerate.
3080         * testsuite/final_layout.cc: New file.
3081         * testsuite/final_layout.sh: New file.
3082
3083 2010-06-01  Rafael Espindola  <espindola@google.com>
3084
3085         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3086
3087 2010-06-01  Rafael Espindola  <espindola@google.com>
3088
3089         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3090         visibility of symbols.
3091
3092 2010-05-27  Doug Kwan  <dougkwan@google.com>
3093
3094         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3095         from start of output section instead of address for a local symbol
3096         in a merged or relaxed section when doing a relocatable link.
3097
3098 2010-05-26  Rafael Espindola  <espindola@google.com>
3099
3100        PR 11604
3101         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3102         adding sections the garbage collector removed.
3103         * gold/testsuite/Makefile.am: Add test.
3104         * gold/testsuite/Makefile.in: Regenerate.
3105         * gold/testsuite/plugin_test_7.sh: New.
3106         * gold/testsuite/plugin_test_7_1.c: New.
3107         * gold/testsuite/plugin_test_7_2.c: New.
3108
3109 2010-05-26  Rafael Espindola  <espindola@google.com>
3110
3111         * script-sections.cc (Output_section_definition::set_section_addresses):
3112         Check for --section-start.
3113
3114 2010-05-26  Doug Kwan  <dougkwan@google.com>
3115
3116         * arm.cc (Arm_scan_relocatable_relocs): New class.
3117         (Target_arm::relocate_special_relocatable): New method.
3118         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3119         (Arm_relocate_functions::thumb_branch_common): Same.
3120         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3121         instead of Default_scan_relocatable_relocs.
3122         * target-reloc.h (relocate_for_relocatable): Let target handle
3123         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3124         * target.h (Sized_target::relocate_special_relocatable): New method.
3125
3126 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3127
3128         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3129
3130 2010-05-23  Doug Kwan  <dougkwan@google.com>
3131
3132         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3133         instead of a cast.
3134         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3135         with a direct branch, not a conditional branch, to a stub.
3136         * merge.cc (Output_merge_base::record_input_section): New method
3137         defintion.
3138         (Output_merge_data::do_add_input_section): Record input section if
3139         keeps-input-sections flag is set.
3140         (Output_merge_string::do_add_input_section): Ditto.
3141         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3142         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3143         INPUT_SECTIONS_.
3144         (Output_merge_base::keeps_input_sections,
3145         Output_merge_base::set_keeps_input_sections,
3146         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3147         method definitions.
3148         (Output_merge_base::Input_sections): New type declaration.
3149         (Output_merge_base::input_sections_begin,
3150         Output_merge_base::input_sections_end,
3151         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3152         (Output_merge_base::bool keeps_input_sections_,
3153         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3154         Output_merge_base::input_sections_): New data members.
3155         (Output_merge_data::do_set_keeps_input_sections): New method
3156         defintion.
3157         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3158         * output.cc (Output_section::Input_section::relobj): Move method
3159         defintion from class declaration to here and handle merge sections.
3160         (Output_section::Input_section::shndx): Ditto.
3161         (Output_section::Output_section): Remove initializations of removed
3162         data members and initialize new data member LOOKUP_MAPS_.
3163         (Output_section::add_input_section): Set keeps-input-sections flag
3164         for a newly created merge output section as appropriate.  Adjust code
3165         to use Output_section_lookup_maps class.
3166         (Output_section::add_relaxed_input_section): Adjst code for lookup
3167         maps code refactoring.
3168         (Output_section::add_merge_input_section): Add a new parameter
3169         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3170         class.  If adding input section to a newly created merge output
3171         section fails, remove the new merge section.
3172         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3173         Adjust code for use of the Output_section_lookup_maps class.
3174         (Output_section::find_merge_section): Ditto.
3175         (Output_section::build_lookup_maps): New method defintion.
3176         (Output_section::find_relaxed_input_section): Adjust code to use
3177         Output_section_lookup_maps class.
3178         (Output_section::get_input_sections): Export merge sections.  Adjust
3179         code to use Output_section_lookup_maps class.
3180         (Output_section:::add_script_input_section): Adjust code to use
3181         Output_section_lookup_maps class.  Update lookup maps for merge
3182         sections also.
3183         (Output_section::discard_states): Use Output_section_lookup_maps.
3184         (Output_section::restore_states): Same.
3185         * output.h (Merge_section_properties): Move class defintion out of
3186         Output_section.
3187         (Output_section_lookup_maps): New class.
3188         (Output_section::Input_section::is_merge_section): New method
3189         defintion.
3190         (Output_section::Input_section::relobj): Move defintion out of class
3191         defintion.  Declare method only.
3192         (Output_section::Input_section::shndx): Ditto.
3193         (Output_section::Input_section::output_merge_base): New method defintion.
3194         (Output_section::Input_section::u2_.pomb): New union field.
3195         (Output_section::Merge_section_by_properties_map,
3196         Output_section::Output_section_data_by_input_section_map,
3197         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3198         Remove types.
3199         (Output_section::add_merge_input_section): Add new parameter
3200         KEEPS_INPUT_SECTIONS.
3201         (Output_section::build_lookup_maps): New method declaration.
3202         (Output_section::merge_section_map_,
3203         Output_section::merge_section_by_properties_map_,
3204         Output_section::relaxed_input_section_map_,
3205         Output_section::is_relaxed_input_section_map_valid_): Remove data
3206         members.
3207         (Output_section::lookup_maps_): New data member.
3208
3209 2010-05-21  Doug Kwan  <dougkwan@google.com>
3210
3211         PR gold/11619
3212         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3213         avoid a compilation error.
3214
3215 2010-05-19  Rafael Espindola  <espindola@google.com>
3216
3217         * script-sections.cc (Output_section_definition::allocate_to_segment):
3218         Update the phdrs_list even when the output section is NULL.
3219         * testsuite/Makefile.am: Add test.
3220         * testsuite/Makefile.in: Regenerate.
3221         * testsuite/script_test_9.cc: New.
3222         * testsuite/script_test_9.sh: New.
3223         * testsuite/script_test_9.t: New.
3224
3225 2010-05-19  Doug Kwan  <dougkwan@google.com>
3226
3227         * arm.cc (Arm_input_section::original_size): New method.
3228         (Arm_input_section::do_addralign): Add a cast.
3229         (Arm_input_section::do_output_offset): Remove static cast.
3230         (Arm_input_section::original_addralign,
3231          Arm_input_section::original_size_): Change type to uint32_t.
3232         (Arm_input_section::init): Add safe casts for section alignment
3233         and size.
3234         (Arm_input_section::set_final_data_size): Do not set address and
3235         offset of stub table.
3236         (Arm_output_section::fix_exidx_coverage): Change use of of
3237         Output_section::Simple_input_section to that of
3238         Output_section::Input_section.
3239         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3240         except for the first pass.
3241         * output.cc (Output_section::get_input_sections): Change type of
3242         input_sections to std::list<Input_section>.
3243         (Output_section::add_script_input_section): Rename from
3244         Output_section::add_simple_input_section.  Change type of SIS
3245         parameter from Simple_input_section to Input_section.
3246         * output.h (Output_section::Simple_input_section): Remove class.
3247         (Output_section::Input_section): Change class visibility to public.
3248         (Output_section::Input_section::addralign): Use stored alignments
3249         for special input sections if set.
3250         (Output_section::Input_section::set_addralign): New method.
3251         (Output_section::get_input_sections): Change parameter type from
3252         list of Simple_input_section to list of Input_section.
3253         (Output_section::add_script_input_section): Rename from
3254         Output_section::add_simple_input_section. Change first parameter's
3255         type from Simple_input_section to Input_section and remove the
3256         second and third parameters.
3257         * script-sections.cc (Input_section::Input_section_list): Change
3258         type to list of Output_section::Input_section/
3259         (Input_section_info::Input_section_info): Change parameter type of
3260         INPUT_SECTION to Output_section::Input_section.
3261         (Input_section_info::input_section): Change return type.
3262         (Input_section_info::input_section_): Change type to
3263         Output_section::Input_section.
3264         (Output_section_element_input::set_section_addresses): Adjust code
3265         to use Output_section::Input_section instead of
3266         Output_section::Simple_input_section.  Adjust code for renaming
3267         of Output_section::add_simple_input_section.
3268         (Orphan_output_section::set_section_addresses): Ditto.
3269
3270 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3271
3272         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3273         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3274
3275 2010-05-18  Rafael Espindola  <espindola@google.com>
3276
3277         * options.cc (General_options::finalize): Handle -nostdlib.
3278         * options.h (nostdlib): New option.
3279         * script.cc (script_add_search_dir): Handle -nostdlib.
3280
3281 2010-05-12  Doug Kwan  <dougkwan@google.com>
3282
3283         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3284         attributes section only if there no attributes section after merging.
3285         (Target_arm::merge_object_attributes): Move value of
3286         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3287         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3288         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3289         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3290         and arm_attr_merge_7.stdout.
3291         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3292         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3293         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3294         arm_attr_merge_7b.o): New rules.
3295         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3296         arm_attr_merge_7
3297         * testsuite/Makefile.in: Regenerate.
3298         * testsuite/arm_attr_merge.sh: New file.
3299         * testsuite/arm_attr_merge_[67][ab].s: Same.
3300
3301 2010-05-05  Nick Clifton  <nickc@redhat.com>
3302
3303         * po/es.po: Updated Spanish translation.
3304
3305 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3306
3307         * Makefile.am (install-exec-local): Properly install gold as
3308         default cross linker.
3309         * Makefile.in: Regenerated.
3310
3311 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3312             Nick Clifton  <nickc@redhat.com>
3313
3314         * configure.ac (install_as_default): Define and set to false
3315         unless --enable-gold or --enable-gold=both/gold has been
3316         specified.
3317         * configure: Regenerate.
3318
3319         * Makefile.am (install-exec-local): Install the executable as
3320         'ld.gold'.  If install_as_default is true then also install it as
3321         'ld'.
3322         * Makefile.in: Regenerated.
3323
3324 2010-04-24  Ian Lance Taylor  <iant@google.com>
3325
3326         * layout.cc (Layout::layout_reloc): In relocatable link don't
3327         combine reloc sections for grouped sections.
3328
3329 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3330
3331         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3332         sections that are not ordinary to icf.
3333         * icf.cc (get_section_contents): Handle relocation pointing to section
3334         with no object or shndx information.
3335         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3336         * testsuite/Makefile.in: Regenerate.
3337         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3338         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3339
3340 2010-04-22  Ian Lance Taylor  <iant@google.com>
3341
3342         * expression.cc (Expression::Expression_eval_info): Add
3343         result_alignment_pointer field.
3344         (Expression::eval_with_dot): Add result_alignment_pointer
3345         parameter.  Change all callers.
3346         (Expression::eval_maybe_dot): Likewise.
3347         (class Binary_expression): Add alignment_pointer parameter to
3348         left_value and right_value.  Change all callers.
3349         (BINARY_EXPRESSION): Set result alignment.
3350         (class Trinary_expression): Add alignment_pointer parameter to
3351         arg2_value and arg3_value.  Change all callers.
3352         (Trinary_cond::value): Set result alignment.
3353         (Max_expression::value, Min_expression::value): Likewise.
3354         (Align_expression::value): Likewise.
3355         * script-sections.cc (class Sections_element): Add dot_alignment
3356         parameter to set_section_addresses virtual function.  Update
3357         instantiations.
3358         (class Output_section_element): Likewise.
3359         (Script_sections::create_segments): Add dot_alignment parameter.
3360         Change all callers.
3361         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3362         (Script_sections::set_phdrs_clause_addresses): Likewise.
3363         * script-sections.h: Update declarations.
3364         * script.h: Update declarations.
3365         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3366         min_p_align.
3367         * testsuite/script_test_3.t: Set large alignment.
3368         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3369         segment has expected alignment.
3370
3371 2010-04-22  Nick Clifton  <nickc@redhat.com>
3372
3373         * po/gold.pot: Updated by the Translation project.
3374         * po/vi.po: Updated Vietnamese translation.
3375
3376 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3377
3378         * testsuite/Makefile.am (check_PROGRAMS): Add
3379         icf_virtual_function_folding_test.
3380         * testsuite/Makefile.in: Regenerated.
3381
3382 2010-04-15  Andrew Haley  <aph@redhat.com>
3383
3384         * options.h (merge_exidx_entries): New option.
3385         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3386         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3387         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3388         (Target_arm::merge_exidx_entries): New function.
3389         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3390         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3391         to Arm_exidx_fixup constructor.
3392         Add new arg, merge_exidx_entries.
3393         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3394         Arm_output_section::fix_exidx_coverage.
3395
3396 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3397
3398         * icf.cc (get_section_contents): Check for preemptible functions.
3399         Ignore addend when appropriate.
3400         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3401         section folded.
3402         (add_from_relobj): Check for section folded.
3403         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3404         * symtab.h (should_add_dynsym_entry): Add new parameter.
3405         * target-reloc.h (scan_relocs): Check for section folded.
3406         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3407         Check reloc types for function pointers in shared objects.
3408         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3409         case.
3410         (icf_preemptible_functions_test): New test case.
3411         (icf_string_merge_test): New test case.
3412         * testsuite.Makefile.in: Regenerate.
3413         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3414         bar_glob.  Refactor code.
3415         * testsuite/icf_preemptible_functions_test.cc: New file.
3416         * testsuite/icf_preemptible_functions_test.sh: New file.
3417         * testsuite/icf_string_merge_test.cc: New file.
3418         * testsuite/icf_string_merge_test.sh: New file.
3419         * testsuite/icf_virtual_function_folding_test.cc: New file.
3420         * testsuite/icf_virtual_function_folding_test.sh: New file.
3421
3422 2010-04-14  Doug Kwan  <dougkwan@google.com>
3423
3424         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3425         for local symbol recounting if we remove a section due to ICF.
3426         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3427         there are no regular objects in input.
3428
3429 2010-04-13  Doug Kwan  <dougkwan@google.com>
3430
3431         * arm.cc (Arm_input_section::set_final_data_size): Compute
3432         accurate final data size instead of using current data size.
3433
3434 2010-04-09  Doug Kwan  <dougkwan@google.com>
3435
3436         * layout.cc (Layout::choose_output_section): Handle script section
3437         types.
3438         (Layout::make_output_section_for_script): Add section type parameter.
3439         Handle script section types.
3440         * layout.h (Layout::make_output_section_for_script): Add section
3441         type parameter.
3442         * output.cc (Output_section::Output_section): Initialize data member
3443         is_noload_.
3444         (Output_section::do_reset_address_and_file_offset): Do not set address
3445         to 0 if section is a NOLOAD section.
3446         * output.h (Output_section::is_noload): New method.
3447         (Output_section::set_is_noload): Ditto.
3448         (Output_section::is_noload_): New data member.
3449         * script-c.h (Script_section_type): New enum type.
3450         (struct Parser_output_section_header): Add new file section_type.
3451         * script-sections.cc (Sections_element::output_section_name): Add
3452         parameter for returning script section type.
3453         (Output_section_definition::output_section_name): Ditto.
3454         (Output_section_definition::section_type)P; New method.
3455         (Output_section_definiton::script_section_type_name): Ditto.
3456         (Output_section_definition::script_section_type_): New data member.
3457         (Output_section_definition::Output_section_definition): Initialize
3458         data member Output_section_definition::script_section_type_.
3459         (Output_section_definition::create_sections): Pass script section type
3460         to Layout::make_output_section_for_script.
3461         (Output_section_definition::output_section_name): Return script
3462         section type to caller.
3463         (Output_section_definition::set_section_address): Do not advance
3464         dot value and load address if section type is NOLOAD.  Set address
3465         of NOLOAD sections regardless of section flags.
3466         (Output_section_definition::print): Print section type if it is
3467         not SCRIPT_SECTION_TYPE_NONE.
3468         (Output_section_definition::section_type): New method.
3469         (Output_section_definition::script_section_type_name): Ditto.
3470         (Script_sections::output_section_name): Add new parameter
3471         PSECTION_TYPE for returning script section type.  Pass it to
3472         section elements.  Handle discard sections.
3473         (Sort_output_sections::operator()): Handle NOLOAD sections.
3474         * script-sections.h (Script_sections::Section_type): New enum type.
3475         (Script_sections::output_section_name): Add a new parameter for
3476         returning script section type.
3477         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3478         INFO and NOLOAD.
3479         * yyscript.y (union): Add new field SECTION_TYPE.
3480         (COPY, DSECT, INFO, NOLOAD): New tokens.
3481         (opt_address_and_section_type): Change type to output_section_header.
3482         (section_type): New non-terminal
3483         (section_header): Handle section type.
3484         (opt_address_and_section_type): Return section type value.
3485
3486 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3487
3488         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3489         * testsuite/plugin_common_test_2.c (foo): Likewise.
3490
3491 2010-04-08  Doug Kwan  <dougkwan@google.com>
3492
3493         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3494         Output_merge_data.
3495         * output.cc (Output_section::add_merge_input_section): Simplify
3496         code and return status of Output_merge_base::add_input_section.
3497         Update merge section map only if Output_merge_base::add_input_section
3498         returns true.
3499
3500 2010-04-07  Doug Kwan  <dougkwan@google.com>
3501
3502         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3503         if section is marked as containing instructions but has no mapping
3504         symbols.
3505         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3506         correct section index.
3507         (Arm_relobj::find_linked_text_section): Ditto.
3508
3509 2010-04-07  Cary Coutant  <ccoutant@google.com>
3510
3511         * archive.cc (include_member): Destroy Read_symbols_data object before
3512         releasing file.
3513         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3514         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3515         (Read_symbols_data::~Read_symbols_data) New destructor.
3516         (Section_relocs::Section_relocs) New constructor.
3517         (Section_relocs::~Section_relocs) New destructor.
3518         (Read_relocs_data::Read_relocs_data) New constructor.
3519         (Read_relocs_data::~Read_relocs_data) New destructor.
3520         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3521         pointers to NULL after deleting.
3522
3523 2010-04-07  Doug Kwan  <dougkwan@google.com>
3524
3525         * arm.cc: Replace "endianity" with "endianness" in comments.
3526         (Arm_exidx_cantunwind): Ditto.
3527         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3528         (Arm_relobj::merge_flags_and_attributes): New method.
3529         (Arm_relobj::merge_flags_and_attributes_): New data member.
3530         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3531         (Arm_relobj::scan_sections_for_stubs): Ditto.
3532         (Arm_relobj::do_read_symbols): Check to see if we really want to
3533         merge processor-specific flags and attributes.  Exit early if
3534         an object is empty except for section names and the undefined symbol.
3535         (Target_arm::do_finalize_sections): Move check for ELF format to
3536         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3537         attributes from a regular object only when we have determined that
3538         it is aapropriate.  Do not create an .ARM.attributes section in
3539         output if there is no regular input object.
3540         (Target_arm::merge_processor_specific_flags): Check
3541         --warn-mismatch before printing any error.
3542         (Target_arm::merge_object_attributes): Ditto.
3543         * gold.cc (queue_middle_tasks): Handle the case in which there is
3544         no regular object in input.
3545         * options.cc (General_options::parse_EB): New method.
3546         (General_options::parse_EL): Same.
3547         (General_options::General_options): Initialize endianness_.
3548         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3549         New options.
3550         (General_options::Endianness): New enum.
3551         (General_options::endianness): New method.
3552         (General_options::endianness_): New data member.
3553         * parameters.cc (Parameters::set_options): Check target endianness.
3554         (Parameters::set_target_once): Ditto.
3555         (Parameters::check_target_endianness): New method.
3556         (parameters_force_valid_target): If either -EL or -EB is specified,
3557         use it to define endianness of default target.
3558         * parameters.h (Parameters::check_target_endianness): New method
3559         declaration.
3560         * target.h (class Target): Change "endianity" to "endianness"
3561         in comments.
3562
3563 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3564
3565         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3566         * configure: Regenerate.
3567         * Makefile.in: Regenerate.
3568         * testsuite/Makefile.in: Regenerate.
3569
3570 2010-04-06  Cary Coutant  <ccoutant@google.com>
3571
3572         gcc PR lto/42757
3573         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3574         prevailing definitions of common symbols.
3575         * testsuite/plugin_test_6.sh: New test case.
3576         * testsuite/plugin_common_test_1.c: New test case.
3577         * testsuite/plugin_common_test_2.c: New test case.
3578         * testsuite/Makefile.am (plugin_test_6): New test case.
3579         * testsuite/Makefile.in: Regenerate.
3580
3581 2010-04-06  Nick Clifton  <nickc@redhat.com>
3582
3583         * po/vi.po: New Vietnamese translation.
3584
3585 2010-03-30  Doug Kwan  <dougkwan@google.com>
3586
3587         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3588
3589 2010-03-25  Doug Kwan  <dougkwan@google.com>
3590
3591         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3592         to avoid a conversion warning on a 32-bit host.
3593
3594 2010-03-24  Ian Lance Taylor  <iant@google.com>
3595
3596         * testsuite/script_test_3.t: Add a TLS segment.
3597         * testsuite/Makefile.am (check_PROGRAMS): Add
3598         tls_phdrs_script_test.
3599         (tls_phdrs_script_test_SOURCES): Define.
3600         (tls_phdrs_script_test_DEPENDENCIES): Define.
3601         (tls_phdrs_script_test_LDFLAGS): Define.
3602         (tls_phdrs_script_test_LDADD): Define.
3603         * testsuite/Makefile.in: Rebuild.
3604
3605 2010-03-23  Cary Coutant  <ccoutant@google.com>
3606
3607         * fileread.cc (find_or_make_view): Fix comment.
3608
3609 2010-03-23  Ian Lance Taylor  <iant@google.com>
3610
3611         * script-sections.cc (class Orphan_section_placement): Define
3612         PLACE_TLS and PLACE_TLS_BSS.
3613         (Orphan_section_placement::Orphan_section_placement): Initialize
3614         new places.
3615         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3616         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3617         (tls_script_test_SOURCES): Define.
3618         (tls_script_test_DEPENDENCIES): Define.
3619         (tls_script_test_LDFLAGS): Define.
3620         (tls_script_test_LDADD): Define.
3621         * testsuite/Makefile.in: Rebuild.
3622
3623 2010-03-22  Doug Kwan  <dougkwan@google.com>
3624
3625         * arm.cc (Arm_relocate_functions::abs8,
3626         Arm_relocate_functions::abs16): Use correct check for overflow
3627         specified in the ARM ELF specs.
3628         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3629         target of a BLX instruction specially.
3630         (Reloc_stub::stub_type_for_reloc): Ditto.
3631         (Relocate::relocate): Use symbolic names instead of numeric relocation
3632         codes to report error.
3633         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3634         workaround.
3635         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3636         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3637         thumb2_blx_out_of_range.stdout
3638         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3639         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3640         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3641         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3642         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3643         thumb2_blx_in_range, thumb2_blx_in_range.o,
3644         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3645         thumb2_blx_out_of_range.o): New rules.
3646         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3647         thumb2_blx_in_range and thumb2_blx_out_of_range.
3648         * testsuite/Makefile.in: Regenerate.
3649         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3650         * testsuite/thumb_blx_in_range.s: New file.
3651         * testsuite/thumb_blx_out_of_range.s: New file.
3652
3653 2010-03-22  Rafael Espindola  <espindola@google.com>
3654
3655         * archive.cc (Should_include): Move to archive.h.
3656         (should_include_member): Make it a member of Archive.
3657         (Lib_group): New.
3658         (Add_lib_group_symbols): New.
3659         * archive.h: Include options.h.
3660         (Archive_member): Moved from Archive.
3661         (Should_include): Moved from archive.cc.
3662         (Lib_group): New.
3663         (Add_lib_group_symbols): New.
3664         * dynobj.cc (do_should_include_member): New.
3665         * dynobj.h (do_should_include_member): New.
3666         * gold.cc (queue_initial_tasks): Update call to queue.
3667         * main.cc (main): Print lib group stats.
3668         * object.cc (do_should_include_member): New.
3669         * object.h: Include archive.h.
3670         (Object::should_include_member): New.
3671         (Object::do_should_include_member): New.
3672         (Sized_relobj::do_should_include_member): New.
3673         * options.cc (General_options::parse_start_lib): New.
3674         (General_options::parse_end_lib): New.
3675         (Input_arguments::add_file): Handle lib groups.
3676         (Input_arguments::start_group): Check we are not in a lib.
3677         (Input_arguments::start_lib): New.
3678         (Input_arguments::end_lib): New.
3679         * options.h (General_options): Add start_lib and end_lib.
3680         (Input_argument::lib_): New.
3681         (Input_argument::lib): New.
3682         (Input_argument::is_lib): New.
3683         (Input_file_lib): New.
3684         (Input_arguments::in_lib_): New.
3685         (Input_arguments::in_lib): New.
3686         (Input_arguments::start_lib): New.
3687         (Input_arguments::end_lib_): New.
3688         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3689         in unused members as preempted.
3690         (Sized_pluginobj::do_should_include_member): New.
3691         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3692         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3693         return the blocker.
3694         (Read_symbols::do_whole_lib_group): New.
3695         (Read_symbols::do_lib_group): New.
3696         (Read_symbols::do_read_symbols): Handle lib groups.
3697         (Read_symbols::get_name): Handle lib groups.
3698         * readsyms.h (Read_symbols): Add an archive member pointer.
3699         (Read_symbols::do_whole_lib_group): New.
3700         (Read_symbols::do_lib_group): New.
3701         (Read_symbols::member_): New.
3702         * script.cc (read_input_script): Update call to queue_soon.
3703
3704 2010-03-19  Doug Kwan  <dougkwan@google.com>
3705
3706         * arm.cc (Stub_table::Stub_table): Initialize new data members
3707         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3708         (Stub_table::add_reloc_stub): Assign stub offset and update
3709         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3710         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3711         New data members.
3712         (Stub_table::update_data_size_and_addralign): Use
3713         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3714         instead of going over all reloc stubs.
3715         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3716         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3717         Stringpool_template::offset_ to size of Stringpool_char.
3718         (Stringpool_template::new_key_offset): Remove code to initialize
3719         Stringpool_template::offset_.
3720         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3721         Stringpool_template::offset_ to zero.
3722
3723 2010-03-15  Doug Kwan  <dougkwan@google.com>
3724
3725         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3726         offset_.
3727         (Stringpool_template::new_key_offset): New method.
3728         (Stringpool_template::add_string): Assign offsets when adding new
3729         strings.
3730         (Stringpool_template::set_string_offsets): Do not set string offsets
3731         when not optimizing.
3732         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3733         member size_.
3734         (Chunked_vector::clear): Clear size_.
3735         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3736         (Chunked_vector::size): Return size_.
3737         (Chunked_vector::push_back): Use size_ to find insert position.
3738         (Chunked_vector::size_): New data member.
3739         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3740         (Stringpool_template::new_key_offset): New method declaration.
3741         (Stringpool_template::offset_): New data member.
3742
3743 2010-03-15   Rafael Espindola  <espindola@google.com>
3744
3745         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3746         Add_symbols' constructor.
3747         * readsyms.h (Add_symbols): Remove the input_group member.
3748
3749 2010-03-10  Ian Lance Taylor  <iant@google.com>
3750
3751         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3752         target to ask whether a reference to a symbol requires a stack
3753         split.
3754         * target.h (Target::is_call_to_non_split): New function.
3755         (Target::do_is_call_to_non_split): Declare virtual function.
3756         * target.cc: Include "symtab.h".
3757         (Target::do_is_call_to_non_split): New function.
3758         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3759
3760 2010-03-10  Cary Coutant  <ccoutant@google.com>
3761
3762         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3763         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3764         (File_read::open[2]): Add whole_file_view_ to list of views.
3765         (File_read::make_view): Remove test of whole_file_view_.
3766         (File_read::find_or_make_view): Create whole_file_view_ if
3767         necessary.
3768         (File_read::clear_views): Replace bool parameter with enum;
3769         adjust all callers.  Don't delete views with permanent data;
3770         do delete cached views and views from archives if
3771         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3772         if clearing the corresponding view.
3773         * fileread.h (File_read::Clear_views_mode): New enum.
3774         (File_read::View::is_permanent_view): New method.
3775         (File_read::clear_views): Replace bool parameter
3776         with enum; adjust all callers.
3777         * options.h (General_options): Change keep_files_mapped option;
3778         add map_whole_files.
3779         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3780         releasing the file.
3781         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3782         the file.
3783
3784 2010-03-10  David S. Miller  <davem@davemloft.net>
3785
3786         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3787
3788 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3789
3790         * icf.cc (get_section_contents): Add '@' marker after processing the
3791         merge reloc.
3792
3793 2010-03-08  Doug Kwan  <dougkwan@google.com>
3794
3795         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3796         due to a conversion warning.
3797         (Arm_relobj::update_output_local_symbol_count): Check for local
3798         symbol with unset output index.
3799
3800 2010-03-05  Ian Lance Taylor  <iant@google.com>
3801
3802         * options.h (class General_options): Add --spare-dynamic-tags.
3803         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3804         --spare-dynamic-tags.
3805
3806 2010-03-05  Ian Lance Taylor  <iant@google.com>
3807
3808         * incremental.cc: Include "libiberty.h".
3809
3810 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3811
3812         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3813         function, is_info_ member.
3814         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3815         (Versions::Versions): Update caller.
3816         (Versions::define_base_version): Likewise.
3817         (Versions::add_def): Likewise.
3818
3819 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3820
3821         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3822         (Scan::possible_function_pointer_reloc): New function.
3823         (Scan::local_reloc_may_be_function_pointer): Change to call
3824         possible_function_pointer_reloc.
3825         (Scan::global_reloc_may_be_function_pointer): Ditto.
3826         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3827         relocations in ".data.rel.ro._ZTV" section.
3828         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3829         * testsuite/icf_safe_so_test.cc: Ditto.
3830         * testsuite/icf_safe_test.cc: Ditto.
3831         * testsuite/icf_safe_test.sh: Ditto.
3832
3833 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3834             Ian Lance Taylor  <iant@google.com>
3835
3836         * target-reloc.h (relocate_section): Check the symbol table index
3837         for -1U before setting the local symbol index.
3838         (scan_relocatable_relocs): If copying the relocation, record that
3839         the local symbol is required.
3840         * object.h (Symbol_value::is_output_symtab_index_set): New
3841         function.
3842         (Symbol_value::may_be_discarded_from_output_symtab): New
3843         function.
3844         (Symbol_value::has_output_symtab_entry): New function.
3845         (Symbol_value::needs_output_symtab_entry): Remove.
3846         (Symbol_value::output_symtab_index): Make sure the symbol index is
3847         set.
3848         (Symbol_value::set_output_symtab_index): Make sure the symbol
3849         index is not set.  Make sure the new index is valid.
3850         (Symbol_value::set_must_have_output_symtab_entry): New function.
3851         (Symbol_value::has_output_dynsym_entry): New function.
3852         (Symbol_value::set_output_dynsym_index): Make sure the new index
3853         is valid.
3854         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3855         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3856         local symbol if permitted.
3857         (Sized_relobj::do_finalize_local_symbols): Call
3858         is_output_symtab_index_set rather than needs_output_symtab_entry.
3859         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3860         rather than needs_output_symtab_entry.  Call
3861         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3862         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3863         is_output_symtab_index_set rather than needs_output_symtab_entry.
3864         * testsuite/discard_locals_relocatable_test.c: New file.
3865         * testsuite/discard_locals_test.sh: Test -r.
3866         * testsuite/Makefile.am (check_DATA): Add
3867         discard_locals_relocatable_test1.syms,
3868         discard_local_relocatable_test2.syms.
3869         (MOSTLYCLEANFILES): Likewise.  Also add
3870         discard_locals_relocatable_test1.lout and
3871         discard_locals_relocatable_test2.out.
3872         (discard_locals_relocatable_test1.syms): New target.
3873         (discard_locals_relocatable_test.o): New target.
3874         (discard_locals_relocatable_test1.out): New target.
3875         (discard_locals_relocatable_test2.syms): New target.
3876         (discard_locals_relocatable_test2.out): New target.
3877         (various): Add missing ../ld-new dependencies.
3878         * testsuite/Makefile.in: Rebuild.
3879
3880 2010-03-03  Nick Clifton  <nickc@redhat.com>
3881
3882         * po/fi.po: New Finnish translation.
3883
3884 2010-03-01  Doug Kwan  <dougkwan@google.com>
3885
3886         * layout.cc (Layout::Layout): Force section types of .init_array*,
3887         .preinit_array* and .fini_array* sections.
3888         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3889         Fix check of return value of std::string::find.().
3890         (Output_section::Input_section_sort_compare::operator()): Remove
3891         comment about .init_array.
3892         (Output_section::Input_section_sort_init_fini_compare::operator()):
3893         New method.
3894         (Output_section::sort_attached_input_sections): Handle .init_array
3895         and .fini_array specially.
3896         * output.h (Output_section::Inut_section_sort_compare): Update
3897         comment.
3898         (Output_section::Input_section_sort_init_fini_compare): New struct.
3899
3900 2010-02-26  Doug Kwan  <dougkwan@google.com>
3901
3902         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3903         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3904         * testsuite/debug_msg.sh: Avoid matching source line number for
3905         use of global variable undef_int.
3906
3907 2010-02-26  Doug Kwan  <dougkwan@google.com>
3908
3909         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3910         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3911         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3912         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3913         * options.cc (General_options::General_options): Initialize member
3914         fix_v4bx_.
3915         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3916         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3917         and rm_no_fix_v4bx.stdout
3918         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3919         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3920         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3921         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3922         and arm_no_fix_v4bx.
3923         * Makefile.in: Regenerate.
3924         * testsuite/arm_fix_v4bx.s: New file.
3925         * testsuite/arm_fix_v4bx.sh: Ditto.
3926
3927 2010-02-24  Doug Kwan  <dougkwan@google.com>
3928
3929         * arm.cc (Target_arm::got_section): Make the .got section the first
3930         non RELRO section in the data segment.
3931         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3932         suffixes of section names.
3933
3934 2010-02-24  Doug Kwan  <dougkwan@google.com>
3935
3936         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3937         flags and attributes merging if an input file is a binary file.
3938         * fileread.cc (Input_file::open): Record format of original file.
3939         * fileread.h (Input_file::Format): New enum type.
3940         (Input_file::Input_file): Initialize data member format_.
3941         (Input_file::format): New method definition.
3942         (Input_file::format_):: New data member.
3943
3944 2010-02-24  Doug Kwan  <dougkwan@google.com>
3945
3946         * arm.cc (Arm_output_data_got): New class.
3947         (ARM_TCB_SIZE): New constant
3948         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3949         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3950         If user uses a script with a SECTIONS clause, issue only a warning
3951         for a misplaced EXIDX input section.  Otherwise, issue an error.
3952         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3953         garbage collection.
3954         (Target_arm::got_mode_index_entry): Handle static linking.
3955         (Target_arm::Scan::local): Ditto.
3956         (Target_arm::Scan::global): Ditto.
3957         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3958         all incorrectly implemented relocations.
3959         (Target_arm::fix_exidx_coverage): Pass layout to
3960         Arm_output_section::fix_exidx_coverage.
3961         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3962         from ".ARM.exidx." and ".ARM.extab.".
3963
3964 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3965
3966         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3967         section if it does not already exist.
3968         * attributes.cc (Attributes_section_data::Attributes_section_data):
3969         Don't crash if size is zero.
3970
3971 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3972             Ian Lance Taylor  <iant@google.com>
3973
3974         * gold.cc (queue_middle_tasks): If no input files were opened,
3975         exit.
3976         * workqueue.h (Task_function::Task_function): Assert that there is
3977         a blocker.
3978
3979 2010-02-22  Doug Kwan  <dougkwan@google.com>
3980
3981         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3982         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3983         types to avoid warnings due to different uint64_t implementations
3984         on different hosts.
3985
3986 2010-02-21  Doug Kwan  <dougkwan@google.com>
3987
3988         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3989         handling of the maximum backward branch offset.
3990         (Arm_relocate_functions::thumb_branch_common): Ditto.
3991         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3992         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3993         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3994         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3995         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3996         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3997         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3998         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3999         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4000         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4001         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4002         thumb2_bl_out_of_range.o): New rules.
4003         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4004         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4005         thumb2_bl_out_of_range
4006         * testsuite/Makefile.in: Regenerate.
4007         * testsuite/arm_bl_in_range.s: New file.
4008         * testsuite/arm_bl_out_of_range.s: Ditto.
4009         * testsuite/arm_branch_in_range.sh: Ditto.
4010         * testsuite/arm_branch_range.t: Ditto.
4011         * testsuite/thumb2_branch_range.t: Ditto.
4012         * testsuite/thumb_bl_in_range.s: Ditto.
4013         * testsuite/thumb_bl_out_of_range.s: Ditto.
4014         * testsuite/thumb_branch_range.t: Ditto.
4015
4016 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4017
4018         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4019         Add reloc offset information.
4020         * icf.cc (get_section_contents): Change iterators to point to the new
4021         vectors. Add reloc offset information to the contents.
4022         * icf.h (Icf::Sections_reachable_info): New typedef.
4023         (Icf::Sections_reachable_list): New typedef.
4024         (Icf::Offset_info): New typedef.
4025         (Icf::Reloc_info): New struct typedef.
4026         (Icf::Reloc_info_list): New typedef.
4027         (Icf::symbol_reloc_list): Delete method.
4028         (Icf::addend_reloc_list): Delete method.
4029         (Icf::section_reloc_list): Delete method.
4030         (Icf::reloc_info_list): New method.
4031         (Icf::reloc_info_list_): New member.
4032
4033 2010-02-19  Doug Kwan  <dougkwan@google.com>
4034
4035         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4036         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4037         * arm.cc (Arm_relocation_functions): New forward declaration.
4038         (Target_arm::Target_arm): Initialize new data members
4039         got_mod_index_offset_ and tls_base_symbol_defined_.
4040         (Target_arm::Relocate::relocate_tls): New method.
4041         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4042          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4043         New methods.
4044         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4045         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4046         (Target_arm::got_mod_index_offset_,
4047         Target_arm::tls_base_symbol_defined_): New data members.
4048         (Target_arm::Scan::local, Target::Scan::global,
4049         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4050         relocations.
4051
4052 2010-02-18  Doug Kwan  <dougkwan@google.com>
4053
4054         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4055         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4056         text section as a parameter becuase some broken tools may not set
4057         the link in section header.
4058         (Target_arm::has_got_section): New method.
4059         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4060         without any mapping symbol as data only.  Remove warning.
4061         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4062         link in its section header, try to discover the link by inspecting the
4063         REL31 relocation at the beginning of the section.
4064         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4065         in error message.
4066         (Target_arm::Scan::global): Treat any reference to the symbol
4067         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4068
4069 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4070
4071         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4072         (Scan::global_reloc_may_be_function_pointer): New function.
4073         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4074         (Scan::global_reloc_may_be_function_pointer): New function.
4075         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4076         (Scan::global_reloc_may_be_function_pointer): New function.
4077         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4078         (Scan::global_reloc_may_be_function_pointer): New function.
4079         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4080         (Scan::global_reloc_may_be_function_pointer): New function.
4081         (Scan::possible_function_pointer_reloc): New function.
4082         (Target_x86_64::can_check_for_function_pointers): New function.
4083         * gc.h (gc_process_relocs): Scan relocation types to determine if
4084         function pointers were taken for targets that support it.
4085         * icf.cc (Icf::find_identical_sections): Include functions for
4086         folding in safe ICF whose pointer is not taken.
4087         * icf.h (Secn_fptr_taken_set): New typedef.
4088         (fptr_section_id_): New member.
4089         (section_has_function_pointers): New function.
4090         (set_section_has_function_pointers): New function.
4091         (check_section_for_function_pointers): New function.
4092         * options.h: Fix comment for safe ICF option.
4093         * target.h (can_check_for_function_pointers): New function.
4094         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4095         Modify icf_safe_test for X86-64.
4096         * testsuite/Makefile.in: Regenerate.
4097         * testsuite/icf_safe_so_test.cc: New file.
4098         * testsuite/icf_safe_so_test.sh: New file.
4099         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4100         (main): Change to take pointer to function kept_func_3.
4101         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4102         folding is done correctly for X86-64.
4103
4104 2010-02-12  David S. Miller  <davem@davemloft.net>
4105
4106         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4107         is_symbolless parameter.
4108         (Output_reloc<SHT_REL>::is_symbolless): New.
4109         (Output_reloc<SHT_REL>::is_symbolless_): New.
4110         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4111         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4112         (Output_reloc<SHT_RELA>::is_symbolless): New.
4113         (Output_data_reloc::add_global): Handle is_symbolless.
4114         (Output_data_reloc::add_global_relative): Likewise.
4115         (Output_data_reloc::add_local): Likewise.
4116         (Output_data_reloc::add_local_relative): Likewise.
4117         (Output_data_reloc::add_symbolless_global_addend): New.
4118         (Output_data_reloc::add_symbolless_local_addend): New.
4119         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4120         is_symbolless.
4121         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4122         instead of ->is_relative_
4123         (Output_reloc::write): Likewise.
4124         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4125         (Output_reloc::write_rel): Simplify.
4126
4127         * sparc.cc (Target_sparc::Scan::local): Use
4128         ->add_symbolless_local_addend as needed.
4129         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4130         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4131         based upon relocation offset.
4132
4133 2010-02-11  Doug Kwan  <dougkwan@google.com>
4134
4135         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4136         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4137         beginning of function.
4138         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4139         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4140         parameter is_32bit in calls to should_apply_static_reloc.
4141         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4142         (check_DATA): Add arm_abs_global.stdout.
4143         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4144         arm_abs_global.stdout): New rules.
4145         (MOSTLLYCLEANFILES): Add arm_abs_global
4146         * Makefile.in: Regenerate.
4147         * testsuite/arm_abs_global.s: New file.
4148         * testsuite/arm_abs_global.sh: Ditto.
4149         * testsuite/arm_abs_lib.s: Ditto.
4150
4151 2010-02-11  Ian Lance Taylor  <iant@google.com>
4152
4153         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4154         Read_relocs task.
4155         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4156         Allocate_commons_task first.
4157         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4158         task, rather than symtab_lock_.
4159         (Gc_process_relocs::~Gc_process_relocs): New function.
4160         (Gc_process_relocs::is_runnable): Check this_blocker_.
4161         (Gc_process_relocs::locks): Use next_blocker_ rather than
4162         blocker_.
4163         (Scan_relocs::~Scan_relocs): New function.
4164         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4165         symtab_lock_.
4166         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4167         next_blocker_.
4168         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4169         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4170         constructor accordingly.
4171         (class Gc_process_relocs): Likewise.
4172         (class Scan_relocs): Likewise.
4173         * common.h (class Allocate_commons_task): Remove symtab_lock_
4174         field, and corresponding constructor parameter.
4175         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4176         symtab_lock_.
4177         (Allocate_commons_task::locks): Likewise.
4178
4179 2010-02-11  Ian Lance Taylor  <iant@google.com>
4180
4181         * gold-threads.h (class Once): Define.
4182         (class Initialize_lock): Rewrite as child of Once.
4183         * gold-threads.cc (class Once_initialize): Define.
4184         (once_pointer_control): New static variable.
4185         (once_pointer, once_arg): New static variables.
4186         (c_run_once): New static function.
4187         (Once::Once, Once::run_once, Once::internal_run): New functions.
4188         (class Initialize_lock_once): Remove.
4189         (initialize_lock_control): Remove.
4190         (initialize_lock_pointer): Remove.
4191         (initialize_lock_once): Remove.
4192         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4193         (Initialize_lock::initialize): Rewrite.
4194         (Initialize_lock::do_run_once): New function.
4195         * archive.cc (Archive::interpret_header): Only clear name if it is
4196         not already empty.
4197         * fileread.cc: Include "gold-threads.h"
4198         (file_counts_lock): New static variable.
4199         (file_counts_initialize_lock): Likewise.
4200         (File_read::release): Only increment counts when using --stats.
4201         Use a lock around the increment.
4202         * parameters.cc (class Set_parameters_target_once): Define.
4203         (set_parameters_target_once): New static variable.
4204         (Parameters::Parameters): Move here from parameters.h.
4205         (Parameters::set_target): Rewrite.
4206         (Parameters::set_target_once): New function.
4207         (Parameters::clear_target): Move here and rewrite.
4208         * parameters.h (class Parameters): Update declarations.  Add
4209         set_parameters_target_once_ field.
4210         (Parameters::Parameters): Move to parameters.cc.
4211         (Parameters::clear_target): Likewise.
4212         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4213         task.
4214         (Start_group::~Start_group): New function.
4215         (Start_group::is_runnable): New function.
4216         (Start_group::locks, Start_group::run): New functions.
4217         (Finish_group::run): Change saw_undefined to size_t.
4218         * readsyms.h (class Start_group): Define.
4219         (class Finish_group): Change saw_undefined_ field to size_t.
4220         (Finish_group::Finish_group): Remove saw_undefined and
4221         this_blocker parameters.  Change all callers.
4222         (Finish_group::set_saw_undefined): New function.
4223         (Finish_group::set_blocker): New function.
4224         * symtab.h (class Symbol_table): Change saw_undefined to return
4225         size_t.  Change saw_undefined_ field to size_t.
4226         * target-select.cc (Set_target_once::do_run_once): New function.
4227         (Target_selector::Target_selector): Initialize set_target_once_
4228         field.  Don't initialize lock_ and initialize_lock_ fields.
4229         (Target_selector::instantiate_target): Rewrite.
4230         (Target_selector::set_target): New function.
4231         * target-select.h (class Set_target_once): Define.
4232         (class Target_selector): Update declarations.  Make
4233         Set_target_once a friend.  Remove lock_ and initialize_lock_
4234         fields.  Add set_target_once_ field.
4235
4236 2010-02-10  Ian Lance Taylor  <iant@google.com>
4237
4238         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4239         queueing any tasks.
4240         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4241         (queue_middle_tasks): Add all blockers before queueing any tasks.
4242         (queue_final_tasks): Likewise.
4243         * token.h (Task_token::add_blockers): New function.
4244         * object.h (Input_objects::number_of_relobjs): New function.
4245
4246 2010-02-10  Ian Lance Taylor  <iant@google.com>
4247
4248         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4249         shared, not if not position independent.
4250         * x86_64.cc (Relocate::relocate_tls): Likewise.
4251         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4252         (tls_pie_pic_test): New target.
4253         * testsuite/Makefile.in: Rebuild.
4254
4255         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4256         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4257         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4258         * testsuite/Makefile.in: Rebuild.
4259
4260 2010-02-09  David S. Miller  <davem@davemloft.net>
4261
4262         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4263         R_SPARC_RELATIVE using ->add_local_relative().
4264         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4265
4266         * output.h (Output_data_dynamic::add_section_size): New method
4267         that takes two Output_data objects.
4268         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4269         entry param.  Handle it in initializers.
4270         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4271         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4272         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4273         arg.
4274         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4275         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4276         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4277         for dynrel_includes_plt.
4278         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4279         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4280         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4281         before .rela.plt
4282         (Target_sparc::do_finalize_sections): Update to pass true for
4283         dynrel_includes_plt.
4284         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4285         output before .rela.plt
4286         (Target_powerpc::do_finalize_sections): Update to pass true for
4287         dynrel_includes_plt when 32-bit.
4288
4289 2010-02-08  Doug Kwan  <dougkwan@google.com>
4290
4291         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4292         method.
4293         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4294         Arm_relobj::scan_section_for_cortex_a8_stubs,
4295         Arm_relobj::do_relocation_section): Instead of calling
4296         Output_section::output_address, use faster
4297         Arm_relobj::simple_input_section_output_address.
4298
4299 2010-02-08  David S. Miller  <davem@davemloft.net>
4300
4301         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4302         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4303         relocation helper function.
4304
4305         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4306         just like R_SPARC_GOT{10,13,22}.
4307         (Target_sparc::Scan::local): Likewise.
4308         (Target_sparc::Relocate:relocate): Likewise.
4309
4310 2010-02-06  Ian Lance Taylor  <iant@google.com>
4311
4312         * configure.ac: Rewrite targetobjs duplicate removal code to use
4313         only shell constructs.
4314         * configure: Rebuild.
4315
4316 2010-02-05  Doug Kwan  <dougkwan@google.com>
4317
4318         PR 11247
4319         * arm.cc (Arm_relobj::section_is_scannable): New method.
4320         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4321         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4322
4323 2010-02-04  Doug Kwan  <dougkwan@google.com>
4324
4325         PR 11247
4326         * arm-reloc-property.cc (cstdio): Include.
4327         * configure.ac (targetobjs): Remove duplicates.
4328         * configure: Regenerate.
4329         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4330         big and little endian version for a given address size.
4331
4332 2010-02-03  Doug Kwan  <dougkwan@google.com>
4333
4334         * arm-reloc-property.cc
4335         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4336         definition.
4337         * arm-reloc-property.h
4338         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4339         New method definition.
4340         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4341         declaration.
4342         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4343         overflow to N.
4344         (GOT_PREL): Change implemented to Y.
4345         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4346         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4347         (Arm_relocate_functions::movw_abs_nc): Remove method.
4348         (Arm_relocate_functions::movt_abs): Ditto.
4349         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4350         (Arm_relocate_functions::thm_movt_abs): Ditto.
4351         (Arm_relocate_functions::movw_rel_nc): Ditto.
4352         (Arm_relocate_functions::movw_rel): Ditto.
4353         (Arm_relocate_functions::movt_rel): Ditto.
4354         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4355         (Arm_relocate_functions:thm_movw_rel): Ditto.
4356         (Arm_relocate_functions:thm_movt_rel): Ditto.
4357         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4358         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4359         New method definitions.
4360         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4361         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4362         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4363         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4364         (Target_arm::Relocate::relocate): Check for non-static or
4365         unimplemented relocation code and exit early.  Change calls to
4366         Target_arm::reloc_uses_thumb_bit and
4367         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4368         instead.  Refactor code to handle similar relocations to increase
4369         code sharing.  Remove check for unsupported relocation code in switch
4370         statement.
4371         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4372         relocation property table to find out size.  Change error message to
4373         print out the name of a relocation code instead of the numeric value.
4374         (Target_arm::scan_reloc_for_stub): Use relocation property table
4375         instead of calling Target_arm::reloc_uses_thumb_bit().
4376
4377 2010-02-02  Doug Kwan  <dougkwan@google.com>
4378
4379         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4380         types of relaxed input section.
4381
4382 2010-02-02  Doug Kwan  <dougkwan@google.com>
4383
4384         * Makefile.am (HFILES): Add arm-reloc-property.h.
4385         (DEFFILES): New.
4386         (TARGETSOURCES): Add arm-reloc-property.cc
4387         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4388         (libgold_a_SOURCES): $(DEFFILES)
4389         * Makefile.in: Regenerate.
4390         * arm-reloc-property.cc: New file.
4391         * arm-reloc-property.h: New file.
4392         * arm-reloc.def: New file.
4393         * arm.cc: Update comments.
4394         (arm-reloc-property.h): New included header.
4395         (arm_reloc_property_table): New global variable.
4396         (Target_arm::do_select_as_default_target): New method definition.
4397         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4398         arm-reloc-property to targ_extra_obj.
4399         * parameters.cc (set_parameters_target): Call
4400         Target::select_as_default_target().
4401         * target.h (Target::select_as_default_target): New method definition.
4402         (Target::do_select_as_default_target): Same.
4403
4404 2010-02-01  Doug Kwan  <dougkwan@google.com>
4405
4406         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4407         first_output_text_section_.
4408         (Arm_exidx_fixup::first_output_text_section): New method definition.
4409         (Arm_exidx_fixup::first_output_text_section_): New data member.
4410         (Arm_exidx_fixup::process_exidx_section): Record the first text
4411         output section seen.
4412         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4413         and entsize in output section header.
4414
4415 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4416
4417         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4418         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4419         (Arm_relocate_functions::thm_alu11): New Method.
4420         (Arm_relocate_functions::thm_pc8): New Method.
4421         (Arm_relocate_functions::thm_pc12): New Method.
4422         (Target_arm::Scan::local): Handle the relocations.
4423         (Target_arm::Scan::global): Likewise.
4424         (Target_arm::Relocate::relocate): Likewise.
4425         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4426
4427 2010-01-29  Doug Kwan  <dougkwan@google.com>
4428
4429         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4430         of relocation types as ld.
4431
4432 2010-01-29  Doug Kwan  <dougkwan@google.com>
4433
4434         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4435         to public.
4436         (Arm_relocate_functions::thumb_branch_common): Ditto.
4437         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4438         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4439         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4440         Arm_relocate_functions::jump24): Remove.
4441         (Target_arm::Relocate::relocate): Adjust code to call
4442         Arm_relocation_functions::arm_branch_common and
4443         Arm_relocation_functions::thumb_branch_common instead of their removed
4444         wrappers.  Merge switch-cases together to reduce source code size.
4445
4446 2010-01-29  Doug Kwan  <dougkwan@google.com>
4447
4448         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4449         output_local_symbol_count_needs_update_.
4450         (Arm_relobj::output_local_symbol_count_needs_update,
4451          Arm_relobj::set_output_local_symbol_count_needs_update,
4452          Arm_relobj::update_output_local_symbol_count): New methods.
4453         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4454         member.
4455         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4456         of pointed function as in a R_ARM_PREL31 relocation.
4457         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4458         for output local symbol count updating.
4459         (Target_arm::do_relax): Update output local symbol counts in objects
4460         if necessary.
4461         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4462
4463 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4464
4465         * arm.cc: Added support for the ARM relocations:
4466         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4467         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4468         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4469         movw_prel_nc).
4470         (Arm_relocate_functions::movw_rel): New method.
4471         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4472         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4473         thm_movw_prel_nc).
4474         (Arm_relocate_functions::thm_movw_rel): New method.
4475         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4476         thm_movt_prel).
4477         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4478         relocations.
4479         (Target_arm::Scan::global): Likewise.
4480         (Target_arm::Relocate::relocate): Likewise.
4481         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4482         Likewise.
4483
4484 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4485
4486         * arm.cc: Added support for ARM group relocations.
4487         (Target_arm::reloc_needs_sym_origin): New method.
4488         (Arm_relocate_functions::calc_grp_kn): New method.
4489         (Arm_relocate_functions::calc_grp_residual): New method.
4490         (Arm_relocate_functions::calc_grp_gn): New method.
4491         (Arm_relocate_functions::arm_grp_alu): New Method.
4492         (Arm_relocate_functions::arm_grp_ldr): New Method.
4493         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4494         (Arm_relocate_functions::arm_grp_ldc): New Method.
4495         (Target_arm::Scan::local): Handle the ARM group relocations.
4496         (Target_arm::Scan::global): Likewise.
4497         (Target_arm::Relocate::relocate): Likewise.
4498         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4499         Likewise.
4500
4501 2010-01-26  Doug Kwan  <dougkwan@google.com>
4502
4503         * arm.cc (set): Include.
4504         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4505         pointer type.
4506         (Arm_output_section::Text_section_list): New type.
4507         (Arm_output_section::append_text_sections_to_list): New method.
4508         (Arm_output_section::fix_exidx_coverage): Ditto.
4509         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4510         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4511         Relobj::set_section_offset() instead of
4512         Sized_relobj::invalidate_section_offset().
4513         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4514         parameter for section headers. Ignore relocation sections for
4515         unallocated sections and EXIDX sections.
4516         (Target_arm::fix_exidx_coverage): New method.
4517         (Target_arm::output_section_address_less_than): New type.
4518         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4519         linked text section instead of the EXIDX section.
4520         (Arm_output_section::create_stub_group): Add an assertion to check
4521         that this is not an EXIDX output section.
4522         (Arm_output_section::append_text_sections_to_list): New method.
4523         (Arm_output_section::fix_exidx_coverage): Ditto.
4524         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4525         Arm_relobj::section_needs_reloc_stub_scanning.
4526         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4527         first pass.
4528         (Target_arm::fix_exidx_coverage): New method.
4529         * object.h (Relobj::set_output_section): New method.
4530         (Sized_relobj::invalidate_section_offset): Remove method.
4531         (Sized_relobj::do_invalidate_section_offset): Remove method.
4532         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4533
4534 2010-01-25  Doug Kwan  <dougkwan@google.com>
4535
4536         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4537         Fix warning due to signed and unsigned comparison on a 32-bit host.
4538
4539 2010-01-22  Doug Kwan  <dougkwan@google.com>
4540
4541         * arm.cc (Target_arm::do_relax): Record an output section for section
4542         offset adjustment it contains any stub table that has changed.
4543         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4544         offsets in an output section if necessary.
4545         * output.cc (Output_section::Output_section): Initialize
4546         section_offsets_need_adjustments_.
4547         (Output_section::add_input_section_for_script): Renamed to
4548         Output_section::add_simple_input_section.
4549         (Output_section::save_states): Add a comment.
4550         (Output_section::discard_states): New method defintion.
4551         (Output_section::adjust_section_offsets): Same.
4552         * output.h (Output_section::add_input_section_for_script): Renamed to
4553         Output_section::add_simple_input_section.
4554         (Output_section::discard_states): New method declaration.
4555         (Output_section::adjust_section_offsets): Same.
4556         (Output_section::section_offsets_need_adjustment,
4557         Output_section::set_section_offsets_need_adjustment): New method
4558         definitions.
4559         (Output_section::section_offsets_need_adjustment_): New data member.
4560         * script-sections.cc
4561         (Output_section_element_input::set_section_address): Adjust code for
4562         renaming of Output_section::add_input_section_for_script.
4563         (Orphan_output_section::set_section_address): Same.
4564
4565 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4566
4567         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4568         Fix_v4bx enum values .
4569         * gold/options.h (General_options): New option definitions.
4570         (General_options::fix_v4bx): New method.
4571         (General_options::Fix_v4bx): New enum.
4572         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4573         (General_options::parse_fix_v4bx_interworking): New method.
4574
4575 2010-01-22  Doug Kwan  <dougkwan@google.com>
4576
4577         * arm.cc (Arm_exidx_fixup): New class.
4578
4579 2010-01-21  Doug Kwan  <dougkwan@google.com>
4580
4581         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4582         classes.
4583         (Arm_exidx_section_offset_map): New type.
4584
4585 2010-01-21  Doug Kwan  <dougkwan@google.com>
4586
4587         * arm.cc (Arm_exidx_input_section): New class.
4588         (Arm_relobj::exidx_input_section_by_link,
4589         Arm_relobj::exidx_input_section_by_shndx,
4590         Arm_relobj::make_exidx_input_section): New methods.
4591         (read_arm_attributes_section): Remove.
4592         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4593         information about them.
4594         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4595         to here.
4596
4597 2010-01-20  Doug Kwan  <dougkwan@google.com>
4598
4599         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4600         Input_section_specifier to Section_id.
4601         (Target_arm::new_arm_input_section: Adjust code for change of key
4602         type.
4603         (Target_arm::find_arm_input_section): Ditto.
4604         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4605         (Section_id): Remove.
4606         (Garbage_collection::Section_id_hash): Remove.
4607         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4608         (Section_id): Remove.
4609         (Icf::Section_id_hash): Remove.
4610         * object.h (Section_id, Const_section_id, Section_id_hash,
4611         Const_section_id_hash): New type definitions.
4612         * output.cc (Output_section::add_relaxed_input_section): Change to
4613         use Const_section_id instead of Input_section_specifier as key type.
4614         (Output_section::add_merge_input_section): Ditto.
4615         (Output_section::build_relaxation_map): Change to use Section_id
4616         instead of Input_section_specifier as key type.
4617         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4618         Ditto.
4619         (Output_section::convert_input_sections_to_relaxed_sections): Change
4620         to use Const_section_id instead of Input_section_specifier as key type.
4621         (Output_section::find_merge_section): Ditto.
4622         (Output_section::find_relaxed_input_section): Ditto.
4623         * output.h (Input_section_specifier): Remove class.
4624         (Output_section::Output_section_data_by_input_section_map): Change
4625         key type to Const_section_id.
4626         (Output_section::Output_relaxed_input_section_by_input_section_map):
4627         Ditto.
4628         (Output_section::Relaxation_map): Change key type to Section_id.
4629
4630 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4631
4632         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4633         (class Arm_v4bx_stub): New class.
4634         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4635         (Stub_factory::make_arm_v4bx_stub): New method.
4636         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4637         (Stub_table::empty): Handle v4bx stubs.
4638         (Stub_table::add_arm_v4bx_stub): New method.
4639         (Stub_table::find_arm_v4bx_stub): New method.
4640         (Arm_relocate_functions::v4bx): New method.
4641         (Target_arm::fix_v4bx): New method.
4642         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4643         (Stub_table::relocate_stubs): Likewise.
4644         (Stub_table::do_write): Likewise.
4645         (Stub_table::update_data_size_and_addralign): Likewise.
4646         (Stub_table::finalize_stubs):  Likewise.
4647         (Target_arm::Scan::local): Likewise.
4648         (Target_arm::Scan::global): Likewise.
4649         (Target_arm::do_finalize_sections): Likewise.
4650         (Target_arm::Relocate::relocate): Likewise.
4651         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4652         Likewise.
4653         (Target_arm::scan_reloc_for_stub): Likewise.
4654         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4655
4656 2010-01-19  Ian Lance Taylor  <iant@google.com>
4657
4658         * output.cc (Output_section_headers::do_sized_write): Write large
4659         segment count to sh_info field.
4660         (Output_file_header::do_sized_write): For large segment count,
4661         write PN_XNUM to e_phnum field.
4662
4663 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4664
4665         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4666         (Arm_relocate_functions::thm_jump8): New function.
4667         (Arm_relocate_functions::thm_jump11): New function.
4668         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4669         R_ARM_THM_JUMP11.
4670         (Target_arm::Scan::global): Likewise.
4671         (Target_arm::Relocate::relocate): Likewise.
4672         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4673         Likewise.
4674
4675 2010-01-14  Doug Kwan  <dougkwan@google.com>
4676
4677         * arm.cc (map, utility): Include headers.
4678         (Target_arm::apply_cortex_a8_workaround): New method.
4679         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4680         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4681         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4682         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4683         the --[no-]fix-cortex-a8 command line options.
4684         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4685         (Target_arm::relocate_stub): Use addend in instruction template.
4686         * options.h (DEFINE_bool): Set the user-set flag.
4687         (General_options): Add --[no-]-fix-cortex options.
4688         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4689         : Update fast look-up map after conversion.
4690
4691 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4692
4693         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4694         in the first pass of do_layout.
4695
4696 2010-01-13  Doug Kwan  <dougkwan@google.com>
4697
4698         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4699         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4700         apparent compiler problem of not folding static constant integral
4701         data members of elfcpp::Elf_sizes<32>.
4702
4703 2010-01-13  Doug Kwan  <dougkwan@google.com>
4704
4705         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4706         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4707         Arm_relobj::scan_section_for_cortex_a8_erratum,
4708         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4709         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4710         sections to scan for relocation stubs into a new method
4711         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4712         relocation and Cortex-A8 stub scanning.
4713         (Target_arm::do_relax): Force stubs to be after stubbed sections
4714         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4715         the beginning of a new relaxation pass.  Update a comment.
4716         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4717
4718 2010-01-12  Ian Lance Taylor  <iant@google.com>
4719
4720         * target-reloc.h (visibility_error): New inline function.
4721         (relocate_section): Call visibility_error.
4722         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4723         (MOSTLYCLEANFILES): Likewise.
4724         (protected_4_pic.o, protected_3.err): New targets.
4725         * testsuite/protected_4.cc: New file.
4726
4727 2010-01-12  Doug Kwan  <dougkwan@google.com>
4728
4729         * arm.cc (Cortex_a8_reloc): New class.
4730         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4731         and cortex_a8_relocs_info_.
4732         (Target_arm::fix_cortex_a8): New method definition.
4733         (Target_arm::Cortex_a8_relocs_info): New type.
4734         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4735         New data member declarations.
4736         (Target_arm::scan_reloc_for_stub): Record information about
4737         relocations for THUMB branches that might be exempted from the
4738         Cortex-A8 workaround.
4739         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4740         at the beginning of a relaxation pass.
4741
4742 2010-01-12  Doug Kwan  <dougkwan@google.com>
4743
4744         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4745         (Arm_relobj::Mapping_symbol_position,
4746          Arm_reloj::Mapping_symbol_position_less,
4747          Arm_relobj::Mapping_symbols_info): New types.
4748         (Target_arm::is_mapping_symbol_name): New method definition.
4749         (Arm_relobj::do_count_local_symbols): Save information about mapping
4750         symbols.
4751
4752 2010-01-11  Doug Kwan  <dougkwan@google.com>
4753
4754         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4755         Arm_relocate_functions::thumb32_branch_upper,
4756         Arm_relocate_functions::thumb32_branch_lower,
4757         Arm_relocate_functions::thumb32_cond_branch_offset,
4758         Arm_relocate_functions::thumb32_cond_branch_upper,
4759         Arm_relocate_functions::thumb32_cond_branch_lower,
4760         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4761         branch offset encoding.
4762         (Arm_relocate_functions::thumb_branch_common): Use new branch
4763         offset encoding methods to avoid code duplication.
4764         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4765         (Stub_addend_reader::operator()): Use new branch encoding method
4766         to avoid code duplication.
4767
4768 2010-01-11  Doug Kwan  <dougkwan@google.com>
4769
4770         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4771         (Target_arm::do_finalize_sections): Define special EXIDX section
4772         symbols only if referenced.
4773         * gc.h (Garbage_collection::add_reference): New method.
4774         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4775         code duplication.
4776
4777 2010-01-11  Ian Lance Taylor  <iant@google.com>
4778
4779         * script.cc (Version_script_info::build_expression_list_lookup):
4780         Change complaing about duplicate wildcard match from error to
4781         warning.
4782
4783         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4784         of 2009-12-30.
4785         (Version_script_info::Version_script_info): Initialize globs_,
4786         default_version_, default_is_global_, and exact_.  Don't
4787         initialize globals_ or locals_.
4788         (Version_script_info::build_lookup_tables): Build local symbols
4789         first.
4790         (Version_script_info::unquote): New function.
4791         (Version_script_info::add_exact_match): New function.
4792         (Version_script_info::build_expression_list_lookup): Remove lookup
4793         parameter.  Add is_global parameter.  Change all callers.  Handle
4794         wildcard pattern specially.  Unquote pattern.  Call
4795         add_exact_match.
4796         (Version_script_info::get_name_to_match): New function.
4797         (Version_script_info::get_symbol_version): New function.
4798         (Version_script_info::get_symbol_version_helper): Remove.
4799         (Version_script_info::check_unmatched_names): Call unquote.
4800         * script.h (class Version_script_info): Change get_symbol_version
4801         to be non-inline and add is_global parameter; change all callers.
4802         Rewrite symbol_is_local.  Update declarations.  Define struct
4803         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4804         Remove globals_ and locals_ members.  Add exact_, globs_,
4805         default_version_, is_global_.
4806         (Version_script_info::Glob): Remove pattern, add expression and
4807         is_global.  Update constructor.  Change all callers.
4808         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4809         default version.
4810         (Versions::symbol_section_contents): If a symbol is undefined, or
4811         defined in a dynamic object, set the version index to
4812         VER_NDX_LOCAL.
4813         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4814         symbol_is_local.
4815         (Symbol_table::add_from_pluginobj): Likewise.
4816         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4817
4818 2010-01-11  Doug Kwan  <dougkwan@google.com>
4819
4820         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4821         (incremental_dump_LDADD): Add linking option for libintl.
4822         * Makefile.in: Regenerate.
4823
4824 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4825
4826         PR gold/11144
4827         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4828         instead of -Ds.
4829         * testsuite/Makefile.in: Regenerated.
4830
4831 2010-01-10  Doug Kwan  <dougkwan@google.com>
4832
4833         * options.h (DEFINE_var): Use parentheses around argument varname__
4834         in macro body to avoid any unintended subsequent substitutions.
4835
4836 2010-01-10  Ian Lance Taylor  <iant@google.com>
4837
4838         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4839         candidates before doing symbol resolution.
4840
4841         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4842         ODR candidates if only one is weak.
4843
4844 2010-01-08  Ian Lance Taylor  <iant@google.com>
4845
4846         * script.cc (Version_script_info::build_expression_list_lookup):
4847         Don't warn about ambiguous version, just record the ambiguity.
4848         (Version_script_info::get_symbol_version_helper): Give error if
4849         version is ambiguous.
4850
4851 2010-01-08  Doug Kwan  <dougkwan@google.com>
4852
4853         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4854           prev_data_size_ and prev_addralign_.  Remove initializer for
4855           deleted data member has_been_changed_.
4856           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4857           to determine if the table is empty.
4858           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4859           Remove.
4860           (Stub_table::add_reloc_stub): Define method in class definition
4861           instead of just declaring it there.
4862           (Stub_table::add_cortex_a8_stub): New method definition.
4863           (Stub_table::update_data_size_and_addralign): Ditto.
4864           (Stub_table::finalize_stubs): Ditto.
4865           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4866           (Stub_table::do_addralign_): Return address alignment in the
4867           (Stub_table::do_reset_address_and_file_offset): Define method in
4868           class definition instead of declaring it there.  Set current data
4869           size to be the data size of the previous pass.
4870           (Stub_table::set_final_data_size): Use current data size as the
4871           final data size.
4872           (Stub_table::relocate_stub): Change parameter type of stub from
4873           Reloc_stub pointer to Stub pointer.
4874           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4875           (Stub_table::Cortex_a8_stub_list): New typedef.
4876           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4877            Stub_table::prev_addralign_): New data member.
4878           (Arm_relobj::Arm_relobj): Initialize data member
4879           section_has_cortex_a8_workaround_.
4880           (Arm_relobj::section_has_cortex_a8_workaround,
4881            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4882            definitions.
4883           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4884           declarations.
4885           (Target_arm::relocate_stub): Change parameter type of stub from
4886           Reloc_stub pointer to Stub pointer.
4887           (Insn_template::size, Insn_template::alignment): Handle
4888           THUMB16_SPECIAL_TYPE.
4889           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4890            Stub_table::update_data_size_and_addralign,
4891            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4892           definitions.
4893           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4894           (Stub_table::do_write): Ditto.
4895           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4896
4897 2010-01-08  Ian Lance Taylor  <iant@google.com>
4898
4899         PR 11108
4900         * symtab.h (class Symbol): Remove fields is_target_special_ and
4901         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4902         (Symbol::is_defined_in_discarded_section): New function.
4903         (Symbol::set_is_defined_in_discarded_section): New function.
4904         (Symbol::has_plt_offset): Rewrite.
4905         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4906         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4907         Don't initialize is_target_special_ or has_plt_offset_.
4908         Initialize is_defined_in_discarded_section_.
4909         (Symbol_table::add_from_relobj): If appropriate, set
4910         is_defined_in_discarded_section.
4911         * resolve.cc (Symbol::override_base_with_special): Don't test
4912         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4913         * target-reloc.h (relocate_section): Do special handling for
4914         symbols defined in discarded sections for global symbols as well
4915         as local symbols.
4916
4917 2010-01-08  Ian Lance Taylor  <iant@google.com>
4918
4919         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4920         the SHT_SYMTAB case.
4921
4922 2010-01-08  Ian Lance Taylor  <iant@google.com>
4923
4924         * object.cc (Sized_relobj::do_layout): Don't get confused if
4925         layout_eh_frame returns NULL.
4926
4927 2010-01-08  Ian Lance Taylor  <iant@google.com>
4928
4929         PR 11084
4930         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4931         dynamic symbol table, use the normal symbol table.
4932         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4933         symbol table.
4934
4935 2010-01-08  Ian Lance Taylor  <iant@google.com>
4936
4937         PR 11072
4938         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4939         sections.
4940
4941 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4942
4943         * version.cc (print_version): Change to "Copyright 2010".
4944
4945 2010-01-08  Ian Lance Taylor  <iant@google.com>
4946
4947         PR 10287
4948         PR 11063
4949         * i386.cc (class Target_i386): Change return type of plt_section
4950         to be non-const.
4951         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4952         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4953         tls_desc_rel_ field.
4954         (Output_data_plt_i386::rel_tls_desc): New function.
4955         (Target_i386::rel_tls_desc_section): New function.
4956         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4957         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4958         R_386_TLS_DESC reloc in rel_tls_desc_section.
4959         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4960         Define struct Tlsdesc_info.
4961         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4962         (Target_x86_64::do_reloc_symbol_index): New function.
4963         (Target_x86_64::add_tlsdesc_info): New function.
4964         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4965         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4966         tlsdesc_rel_ field.
4967         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4968         all callers.
4969         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4970         (Target_x86_64::rela_tlsdesc_section): New function.
4971         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4972         handling.
4973         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4974         (Target_x86_64::do_reloc_addend): New function.
4975         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4976         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4977         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4978         (Output_reloc::type): New function.
4979         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4980         (Output_reloc::is_target_specific): New function.
4981         (Output_reloc::target_arg): New function.
4982         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4983         absolute relocs and target specific relocs.
4984         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4985         add_target_specific.
4986         (class Output_data_reloc) [SHT_RELA]: Likewise.
4987         * output.cc (Output_reloc::Output_reloc): Add four new versions
4988         for absolute relocs and target specific relocs.
4989         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4990         (Output_reloc::get_symbol_index): Likewise.
4991         (Output_reloc::local_section_offset): Check that local_sym_index_
4992         is not TARGET_CODE or 0.
4993         (Output_reloc::symbol_value): Likewise.
4994         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4995         reloc.
4996         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4997         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4998         functions.
4999         * layout.cc (add_target_dynamic_tags): Use output section for
5000         DT_PLTRELSZ and DT_JMPREL.
5001
5002 2010-01-07  Ian Lance Taylor  <iant@google.com>
5003
5004         PR 11061
5005         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5006         function.
5007         (class Output_data_reloc_generic): Define.
5008         (class Output_data_reloc_base): Change base class to
5009         Output_data_reloc_generic.  Change add() method to call
5010         bump_relative_reloc_count for a relative reloc.  Remove
5011         sort_relocs_ field.
5012         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5013         to sort_relocs().
5014         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5015         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5016         appropriate.
5017         * layout.h (class Layout): Update declaration.
5018
5019 2010-01-07  Ian Lance Taylor  <iant@google.com>
5020
5021         * output.h (class Output_data): Add const version of
5022         output_section and do_output_section.
5023         (class Output_section_data): Add const version of
5024         do_output_section.
5025         (class Output_section): Likewise.
5026         * layout.cc (Layout::add_target_dynamic_tags): New function.
5027         * layout.h (class Layout): Update declarations.
5028         * arm.cc (Target_arm::do_finalize_sections): Use
5029         add_target_dynamic_tags.
5030         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5031         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5032         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5033         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5034
5035 2010-01-07  Ian Lance Taylor  <iant@google.com>
5036
5037         PR 11042
5038         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5039         object as needed.
5040
5041 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5042             Ian Lance Taylor  <iant@google.com>
5043
5044         PR 11019
5045         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5046         Xindex::read_symtab_xindex.
5047
5048 2010-01-07  Doug Kwan  <dougkwan@google.com>
5049
5050         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5051         (Insn_template::thumb16_bcond_insn): New method declaration.
5052         (Insn_template): Fix spelling.
5053         (Stub::thumb16_special): New method declaration.
5054         (Stub::do_write): Define virtual method which was previously pure
5055         virtual.
5056         (Stub::do_thumb16_special): New method declaration.
5057         (Stub::do_fixed_endian_write): New template member.
5058         (Reloc_stub::do_write): Remove.
5059         (Reloc_stub::do_fixed_endian_write): Remove.
5060         (Cortex_a8_stub): New class definition.
5061         (Stub_factory::make_cortex_a8_stub): New method definition.
5062         (Stub_factory::Stub_factory): Add missing static storage class
5063         qualifier for elf32_arm_stub_a8_veneer_blx.
5064
5065 2010-01-07  Ian Lance Taylor  <iant@google.com>
5066
5067         PR 10980
5068         * options.h (class General_options): Add --warn-unresolved-symbols
5069         and --error-unresolved-symbols.
5070         * errors.cc (Errors::undefined_symbol): Implement
5071         --warn-unresolved-symbols.
5072
5073         * options.h (class General_options): Add -z text and -z textoff.
5074         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5075
5076 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5077
5078         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5079         (Garbage_collection::cident_sections): New function.
5080         (Garbage_collection::add_cident_section): New function.
5081         (Garbage_collection::cident_sections_): New member.
5082         (gc_process_relocs): Add references to sections whose names are C
5083         identifiers.
5084         * gold.h (cident_section_start_prefix): New constant.
5085         (cident_section_stop_prefix): New constant.
5086         (is_cident): New function.
5087         * layout.cc (Layout::define_section_symbols): Replace string constants
5088         with the newly defined constants.
5089         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5090         C identifiers.
5091         * testsuite/Makefile.am: Add gc_orphan_section_test.
5092         * testsuite/Makefile.in: Regenerate.
5093         * testsuite/gc_orphan_section_test.cc: New file.
5094         * testsuite/gc_orphan_section_test.sh: New file.
5095
5096 2010-01-06  Ian Lance Taylor  <iant@google.com>
5097
5098         PR 10980
5099         * options.h (class General_options): Add --warn-shared-textrel.
5100         * layout.cc (Layout::finish_dynamic_section): Implement
5101         --warn-shared-textrel.
5102
5103         PR 10980
5104         * options.h (class General_options): Add --warn-multiple-gp.
5105
5106 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5107
5108         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5109         $(THREADSLIB) and $(LIBDL).
5110         * Makefile.in: Rebuild.
5111
5112 2010-01-06  Ian Lance Taylor  <iant@google.com>
5113
5114         PR 10980
5115         * options.cc (General_options::parse_section_start): New function.
5116         (General_options::section_start): New function.
5117         (General_options::General_options): Initialize all members.
5118         * options.h: Include <map>
5119         (class General_options): Add --section-start.  Add section_starts_
5120         member.
5121         * layout.cc (Layout::attach_allocated_section_to_segment): If
5122         --section-start was used, set the address of the segment.  Remove
5123         local sort_sections.
5124         (Layout::relaxation_loop_body): If the address of the load segment
5125         has been set by --section-start, don't use it.
5126         * output.h (Output_segment::update_flags_for_output_section): New
5127         function.
5128         * output.cc (Output_segment::add_output_section): Call
5129         update_flags_for_output_section.
5130
5131 2010-01-05  Ian Lance Taylor  <iant@google.com>
5132
5133         PR 10980
5134         * options.h (class General_options): Add --undefined-version.
5135         * script.cc (struct Version_expression): Add was_matched_by_symbol
5136         field.
5137         (Version_script_info::matched_symbol): New function.
5138         (Version_script_info::get_symbol_version_helper): Call
5139         matched_symbol.
5140         (Version_script_info::check_unmatched_names): New function.
5141         * script.h (class Version_script_info): Update declarations.
5142         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5143
5144         * options.h (class General_options): Use DEFINE_bool_alias for
5145         allow_multiple_definition.
5146         * resolve.cc (Symbol_table::should_override): Don't test
5147         allow_multiple_definition.
5148
5149         PR 10980
5150         * options.h (class General_options): Add --cref.
5151         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5152         until after printing cref table.
5153         * cref.cc: Include "symtab.h".
5154         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5155         (Cref_table_compare::operator()): New function.
5156         (Cref_inputs::gather_cref): New function.
5157         (filecol): New static const.
5158         (Cref_inputs::print_cref): New function.
5159         (Cref::print_cref): New function.
5160         * cref.h: Include <cstdio>.
5161         (class Cref): Update declarations.
5162         * mapfile.h (Mapfile::file): New function.
5163         * object.h (class Object): Define Symbols.  Declare virtual
5164         do_get_global_symbols.
5165         (Object::get_global_symbols): New function.
5166         * object.cc (Input_objects::add_object): Pass object to cref_ if
5167         --cref.
5168         (Input_objects::archive_start): Likewise.
5169         (Input_objects::archive_stop): Likewise.
5170         (Input_objects::print_cref): New function.
5171         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5172         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5173         --cref.
5174         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5175         function.
5176         * plugin.h (class Sized_pluginobj): Update declarations.
5177
5178 2010-01-05  Ian Lance Taylor  <iant@google.com>
5179
5180         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5181         to is_default_version.  Rename insdef to insdefault.
5182         (Symbol_table::add_from_relobj): Rename def to is_default_version
5183         and local to is_forced_local.
5184         (Symbol_table::add_from_pluginobj): Likewise.
5185         (Symbol_table::add_from_dynobj): Likewise.
5186         (Symbol_table::define_special_symbol): Rename insdef to
5187         insdefault.
5188
5189 2010-01-04  Ian Lance Taylor  <iant@google.com>
5190
5191         PR 10980
5192         * options.h (class General_options): Add
5193         --allow-multiple-definition and -z muldefs.
5194         * resolve.cc (Symbol_table::should_override): Don't warn about a
5195         multiple symbol definition if --allow-multiple-definition or -z
5196         muldefs.
5197
5198         PR 10980
5199         * options.h (class General_options): Add --add-needed and
5200         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5201         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5202         error if --copy-dt-needed-entries aka --add-needed is used and
5203         would cause a change in behaviour.
5204
5205         PR 10980
5206         * options.h (class General_options): Add -G as a short version of
5207         --shared.  Add no-op options -assert, -g, and -i.
5208
5209 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5210
5211         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5212         check for .text or .gnu.linkonce.t sections.
5213         * icf.cc (Icf::find_identical_sections): Ditto.
5214         Change the detection for mangled function name within the section
5215         name.
5216         * icf.h (is_section_foldable_candidate): New function.
5217
5218 2009-12-30  Ian Lance Taylor  <iant@google.com>
5219
5220         PR 10980
5221         * options.h (class General_options): Permit two dashes with
5222         --retain-symbols-file.
5223
5224 2009-12-30  Ian Lance Taylor  <iant@google.com>
5225
5226         PR 10979
5227         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5228         don't put the file header and segment headers in the text
5229         segment.
5230
5231         PR 10979
5232         * common.cc (Sort_commons::operator()): Stabilize sort when both
5233         entries are NULL.
5234         (Symbol_table::do_allocate_commons_list): When allocating common
5235         symbols, skip a symbol which is no longer common.
5236         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5237         an object before checking its type.
5238         * testsuite/common_test_2.c: New file.
5239         * testsuite/common_test_3.c: New file.
5240         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5241         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5242         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5243         (common_test_2_pic.o, common_test_2.so): New targets.
5244         (common_test_3_pic.o, common_test_3.so): New targets.
5245         * testsuite/Makefile.in: Rebuild.
5246
5247         PR 10979
5248         * script.cc (read_input_script): If we see a new SECTIONS clause,
5249         and we have added an input section, give an error.
5250         * layout.h (class Layout): Add have_added_input_section function.
5251         Add have_added_input_section_ field.
5252         * layout.cc (Layout::Layout): Initialize
5253         have_added_input_section_.
5254         (Layout::layout): Set have_added_input_section_.
5255         (Layout::layout_eh_frame): Likewise.
5256
5257 2009-12-30  Ian Lance Taylor  <iant@google.com>
5258
5259         PR 10931
5260         * options.h (class General_options): Add --sort-common option.
5261         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5262         * common.cc (Sort_common): Add sort_order parameter to
5263         constructor.  Add sort_order_ field.
5264         (Sort_commons::operator): Check sort_order_.
5265         (Symbol_table::allocate_commons): Determine the sort order.
5266         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5267         Change all callers.
5268         (Symbol_table::do_allocate_commons_list): Likewise.
5269
5270 2009-12-30  Ian Lance Taylor  <iant@google.com>
5271
5272         PR 10916
5273         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5274         symbols from this object, don't change the visibility of an
5275         undefined symbol.
5276         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5277
5278 2009-12-30  Ian Lance Taylor  <iant@google.com>
5279
5280         PR 10861
5281         * script.h (class Version_script_info): Define Language enum.
5282         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5283         new fields globals_, locals_, and is_finalized_.
5284         * script.cc: Various formatting fixes.
5285         (class Parser_closure): Change language_stack_ from a vector of
5286         std::string to one of Version_script_info::Language.  Adjust all
5287         uses accordingly.
5288         (class Lazy_demangler): Remove.
5289         (struct Version_expression): Change language from std::string to
5290         Version_script_info::Language.
5291         (Version_script_info::Version_script_info): New function.
5292         (Version_script_info::~Version_script_info): Don't call clear.
5293         (Version_script_info::finalize): New function.
5294         (Version_script_info::build_lookup_tables): New function.
5295         (Version_script_info::build_expression_list_lookup): New
5296         function.
5297         (Version_script_info::get_symbol_version_helper): Rewrite to use
5298         lookup tables.
5299         (Version_script_info::print_expression_list): Adjust to use
5300         Version_script_info::Language.
5301         (script_push_lex_into_version_mode): Check that the version script
5302         has not been finalized.
5303         (version_script_push_lang): Change language string to
5304         Version_script_info::Language.
5305         * options.cc (Command_line::version_script): New function.
5306         * options.h (class General_options): Add finalize_dynamic_list
5307         function.  Change version_script from declaration to definition.
5308         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5309         * testsuite/version_script.map: Remove duplicate def of foo.
5310         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5311         version_script.map.
5312         * testsuite/Makefile.in: Rebuild.
5313
5314 2009-12-30  Ian Lance Taylor  <iant@google.com>
5315
5316         PR 10843
5317         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5318         if the input symbol index is 0, make the output symbol index 0.
5319
5320 2009-12-30  Ian Lance Taylor  <iant@google.com>
5321
5322         PR 10670
5323         * options.h (class General_options): Add -x/--discard-all.
5324         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5325         --discard-all.  If the local symbol needs a dynamic entry, check
5326         that before handling --discard-locals.
5327
5328 2009-12-30  Ian Lance Taylor  <iant@google.com>
5329
5330         PR 10450
5331         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5332         flags to PF_R.
5333         (Output_segment::add_output_section): Don't change the flags if
5334         the type is PT_TLS.
5335
5336         PR 10450
5337         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5338         GNU hash table if they need a dynamic value.  Otherwise, don't add
5339         them if they are defined in a dynamic object or are forced local.
5340
5341 2009-12-29  Ian Lance Taylor  <iant@google.com>
5342
5343         PR 10450
5344         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5345         .gnu.hash table for a 32-bit target.
5346
5347         PR 10450
5348         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5349         regular and a dynamic object only needs a dynamic symbol table
5350         entry if it is externally visible.
5351
5352         PR 10450
5353         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5354         constructor.  Add global_offset_table_ field.
5355         (Target_i386::got_section): Set global_offset_table_.
5356         (Target_i386::do_finalize_sections): Set global_offset_table_
5357         size.
5358         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5359         in constructor.  Add global_offset_table_ field.
5360         (Target_x86_64::got_section): Set global_offset_table_.
5361         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5362         size.
5363
5364         * layout.cc (Layout::Layout): Initialize increase_relro_.
5365         (Layout::get_output_section): Add is_relro, is_last_relro, and
5366         is_first_non_relro parameters.  Change all callers.
5367         (Layout::choose_output_section): Likewise.
5368         (Layout::add_output_section_data): Likewise.
5369         (Layout::make_output_section): Likewise.
5370         (Layout::set_segment_offsets): Clear increase_relro when using a
5371         linker script.
5372         * layout.h (class Layout): Add increase_relro method.  Add
5373         increase_relro_ field.  Update declarations.
5374         * output.cc (Output_section::Output_section): Initialize
5375         is_last_relro_ and is_first_non_relro_.
5376         (Output_segment::add_output_section): Group relro sections is
5377         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5378         (Output_segment::maximum_alignment): Remove relro handling.
5379         (Output_segment::set_section_addresses): Add increase_relro
5380         parameter.  Change all callers.  Add initial alignment to align
5381         relro sections on separate page.  Remove old relro handling.
5382         (Output_segment::set_section_list_addresses): Remove in_relro
5383         parameter.  Change all callers.
5384         (Output_segment::set_offset): Add increase parameter.  Change all
5385         callers.  Remove old relro handling.
5386         * output.h (class Output_section): Add new methods: is_last_relro,
5387         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5388         Add is_last_relro_ and is_first_non_relro_ fields.
5389         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5390         Create separate .got.plt section.  Call increase_relro.
5391         * x86_64.cc (Target_x86_64::got_section): Likewise.
5392         * testsuite/relro_script_test.t: Add .got.plt.
5393
5394         PR 10450
5395         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5396         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5397         (Layout::finalize): Call set_dynamic_symbol_size.
5398         (Layout::set_dynamic_symbol_size): New function.
5399         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5400         set_dynamic_symbol_size.
5401
5402         PR 10450
5403         * output.h (class Output_section): Add is_entsize_zero_ field.
5404         * output.cc (Output_section::Output_section): Initialize
5405         is_entsize_zero_.
5406         (Output_section::set_entsize): If two different entsizes are
5407         requested, force it to zero.
5408         (Output_section::add_input_section): Set flags for .debug_str
5409         before updating section flags.  Set entsize.
5410         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5411         and SHF_STRING if all input sections have those flags.
5412
5413 2009-12-29   Rafael Espindola  <espindola@google.com>
5414
5415         * main.cc (main): Fix the sys time reporting.
5416         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5417         reporting.
5418
5419 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5420
5421         * options.cc (General_options::parse_version): Allow -v to exit
5422         without an error if there is nothing to link.
5423
5424 2009-12-29  Ian Lance Taylor  <iant@google.com>
5425
5426         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5427         using a version of gcc before 4.1.
5428         * configure: Rebuild.
5429
5430 2009-12-28  Chris Demetriou  <cgd@google.com>
5431
5432         * attributes.cc (Output_attributes_section_data::do_write): Use
5433         std::vector::front rather than std::vector::data.
5434
5435 2009-12-28  Ian Lance Taylor  <iant@google.com>
5436
5437         * symtab.h (class Symbol_table): Add enum Defined.
5438         * resolve.cc (Symbol_table::should_override): Add defined
5439         parameter.  Change all callers.  Test whether object is NULL
5440         before calling a method on it.
5441         (Symbol_table::report_resolve_problem): Add defined parameter.
5442         Change all callers.
5443         (Symbol_table::should_override_with_special): Likewise.
5444         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5445         parameter.  Change all callers.
5446         (Symbol_table::do_define_in_output_data): Likewise.
5447         (Symbol_table::define_in_output_segment): Likewise.
5448         (Symbol_table::do_define_in_output_segment): Likewise.
5449         (Symbol_table::define_as_constant): Likewise.
5450         (Symbol_table::do_define_as_constant): Likewise.
5451         * script.h (class Symbol_assignment): Add is_defsym parameter to
5452         constructor; change all callers.
5453         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5454         parameter.  Change all callers.  Add is_defsym_ field.
5455         (class Parser_closure): Add parsing_defsym parameter to
5456         constructor; change all callers.  Add parsing_defsym accessor
5457         function.  Add parsing_defsym_ field.
5458
5459 2009-12-28  Ian Lance Taylor  <iant@google.com>
5460
5461         * gold.cc (queue_middle_tasks): Fix formatting.
5462         * object.cc (Relobj::is_section_name_included): Likewise.
5463
5464 2009-12-23  Ian Lance Taylor  <iant@google.com>
5465
5466         * i386.cc (Target_i386::do_calls_non_split): Recognize
5467         -fsplit-stack prologue for a function with a static chain.
5468         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5469         -fsplit-stack prologue when using %r11.
5470
5471 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5472
5473         * options.cc (General_options::parse_version): Make -v continue and do
5474         the link like GNU ld does.
5475
5476 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5477
5478         * Makefile.am (CCFILES): Add timer.cc.
5479         (HFILES): Add timer.h.
5480         * configure.ac: Check for sysconf and times.
5481         * main.cc: include timer.h.
5482         (main): Use Timer instead of get_run_time.
5483         * timer.cc: New.
5484         * timer.h: New.
5485         * workqueue.cc: include timer.h.
5486         (Workqueue::find_and_run_task):
5487         Report user, sys and wall time.
5488         * Makefile.in: Regenerate.
5489         * config.in: Regenerate.
5490         * configure: Regenerate.
5491
5492 2009-12-16  Doug Kwan  <dougkwan@google.com>
5493
5494         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5495         sections.
5496         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5497         relaxed input sections.
5498         * output.cc (Output_section::find_relaxed_input_section): Change
5499         return type to Output_relaxed_input_section pointer.  Adjust code
5500         for new type of relaxed_input_section_map_.
5501         * output.h (Output_section::find_relaxed_input_section): Change
5502         return type to Output_relaxed_input_section pointer.
5503         (Output_section::Output_relaxed_input_section_by_input_section_map):
5504         New type.
5505         (Output_section::relaxed_input_section_map_): Change type to
5506         Output_section::Output_relaxed_input_section_by_input_section_map.
5507         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5508         input section.
5509
5510 2009-12-15  Ian Lance Taylor  <iant@google.com>
5511
5512         * layout.cc (Layout::create_shstrtab): Only write out after input
5513         sections if we are compressing debug sections.
5514
5515 2009-12-15  Ian Lance Taylor  <iant@google.com>
5516
5517         * archive.cc (Archive::add_symbols): Only look up a symbol without
5518         a version if there is, in fact, a version.
5519
5520 2009-12-14  Ian Lance Taylor  <iant@google.com>
5521
5522         Revert -Wshadow changes, all changes from:
5523         2009-12-11  Doug Kwan  <dougkwan@google.com>
5524         2009-12-11  Nick Clifton  <nickc@redhat.com>
5525         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5526
5527 2009-12-11  Doug Kwan  <dougkwan@google.com>
5528
5529         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5530         due to -Wshadow.
5531         * attributes.cc (Object_attribute::size): Ditto.
5532         (Attributes_section_data::size): Ditto.
5533         (Attributes_section_data::Attributes_section_data): Ditto.
5534         (Output_attributes_section_data::do_write): Ditto.
5535         * attributes.h (Object_attribute::set_type): Ditto.
5536         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5537
5538 2009-12-11  Nick Clifton  <nickc@redhat.com>
5539
5540         * archive.cc: Fix shadowed variable warnings.
5541         * arm.cc: Likewise.
5542         * compressed_output.cc: Likewise.
5543         * compressed_output.h: Likewise.
5544         * configure: Likewise.
5545         * dwarf_reader.cc: Likewise.
5546         * dynobj.cc: Likewise.
5547         * dynobj.h: Likewise.
5548         * ehframe.cc: Likewise.
5549         * ehframe.h: Likewise.
5550         * errors.cc: Likewise.
5551         * expression.cc: Likewise.
5552         * fileread.cc: Likewise.
5553         * fileread.h: Likewise.
5554         * freebsd.h: Likewise.
5555         * i386.cc: Likewise.
5556         * icf.cc: Likewise.
5557         * incremental.h: Likewise.
5558         * layout.cc: Likewise.
5559         * layout.h: Likewise.
5560         * mapfile.cc: Likewise.
5561         * merge.cc: Likewise.
5562         * merge.h: Likewise.
5563         * object.cc: Likewise.
5564         * object.h: Likewise.
5565         * options.h: Likewise.
5566         * output.cc: Likewise.
5567         * output.h: Likewise.
5568         * parameters.cc: Likewise.
5569         * plugin.cc: Likewise.
5570         * powerpc.cc: Likewise.
5571         * reduced_debug_output.cc: Likewise.
5572         * reduced_debug_output.h: Likewise.
5573         * reloc.cc: Likewise.
5574         * reloc.h: Likewise.
5575         * resolve.cc: Likewise.
5576         * script-sections.cc: Likewise.
5577         * script.cc: Likewise.
5578         * script.h: Likewise.
5579         * sparc.cc: Likewise.
5580         * symtab.cc: Likewise.
5581         * symtab.h: Likewise.
5582         * target-select.cc: Likewise.
5583         * target-select.h: Likewise.
5584         * token.h: Likewise.
5585         * workqueue.cc: Likewise.
5586         * workqueue.h: Likewise.
5587         * x86_64.cc: Likewise.
5588
5589 2009-12-10  Doug Kwan  <dougkwan@google.com>
5590
5591         * arm.cc (attributes.h): New include.
5592         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5593         (Arm_relobj::~Arm_relobj): Delete object pointed by
5594         attributes_section_data_.
5595         (Arm_relobj::attributes_section_data): New method definition.
5596         (Arm_relobj::attributes_section_data_): New data member declaration.
5597         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5598         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5599         attributes_section_data_.
5600         (Arm_dynobj::attributes_section_data): New method definition.
5601         (Arm_dynobj::attributes_section_data_): New data member declaration.
5602         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5603         initialization value of may_use_blx_ to false.
5604         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5605         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5606         object attributes to compute results instead of hard-coding.
5607         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5608         Target_arm::get_secondary_compatible_arch,
5609         Target_arm::set_secondary_compatible_arch
5610         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5611         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5612         New method declarations.
5613         (Target_arm::get_aeabi_object_attribute): New method definition.
5614         (Target_arm::attributes_section_data_): New data member declaration.
5615         (read_arm_attributes_section): New template definition.
5616         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5617         (Arm_dynobj::do_read_symbols): Ditto.
5618         (Target_arm::do_finalize_sections): Merge attributes sections from
5619         input.  Check for BLX use after attributes section merging.
5620         Fix __exidx_start and __exidx_end visibility.  Create an
5621         .ARM.attributes section if necessary.
5622         (Target_arm::get_secondary_compatible_arch,
5623         Target_arm::set_secondary_compatible_arch,
5624         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5625         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5626         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5627         New method definitions.
5628
5629 2009-12-09  Ian Lance Taylor  <iant@google.com>
5630
5631         * plugin.cc (Plugin::load): Don't cast from void* to a function
5632         pointer.
5633
5634 2009-12-09  Ian Lance Taylor  <iant@google.com>
5635
5636         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5637         information fields.
5638
5639 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5640
5641         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5642         Replace two_file_shared_1.so with two_file_shared_2.so.
5643         * testsuite/Makefile.in: Regenerated.
5644
5645 2009-12-08  Doug Kwan  <dougkwan@google.com>
5646
5647         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5648         (HFILES): Add attributes.h and int_encoding.h.
5649         * Makefile.in: Regenerate.
5650         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5651         function definitions to int_encoding.cc
5652         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5653         prototypes to int_encoding.h
5654         * reduced_debug_output.cc (int_encoding.h): New include.
5655         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5656         function definitions to int_encoding.cc
5657         (insert_into_vector, read_from_pointer): Move template definitions to
5658         int_encoding.h
5659         * attributes.cc: New file.
5660         * attributes.h: New file.
5661         * int_encoding.cc: New file.
5662         * int_encoding.h: New file.
5663
5664 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5665
5666         PR gold/11055
5667         * incremental-dump.cc (dump_incremental_inputs): New.
5668         (main): Use dump_incremental_inputs.
5669
5670 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5671
5672         PR gold/10893
5673         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5674         checking elfcpp::STT_FUNC.
5675         (Target_i386::Relocate::relocate): Likewise.
5676         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5677
5678         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5679         symbols from shared libraries into normal FUNC symbols.
5680
5681         * symtab.h (Symbol): Add is_func and use it.
5682
5683 2009-12-05  Doug Kwan  <dougkwan@google.com>
5684
5685         * arm.cc (Target_arm::arm_info): Initialize new fields
5686         attributes_section and attributes_vendor.
5687         * i386.cc (Target_i386::i386_info): Same.
5688         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5689         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5690         fields attributes_section and attributes_vendor.
5691         * sparc.cc (Target_sparc::sparc_info): Same.
5692         * target.h (Target::attributes_section, Target::attributes_vendor,
5693         Target::is_attributes_section, Target::attribute_arg_type,
5694         Target::attributes_order): New method definitions.
5695         (Target::Target_info::attributes_section,
5696         Target::Target_info::attributes_vendor): New fields.
5697         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5698         virtual method definitions.
5699         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5700         attributes_section and attributes_vendor.
5701         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5702
5703 2009-12-05  Doug Kwan  <dougkwan@google.com>
5704
5705         * arm.cc: Update comments about interworking and stub generation.
5706         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5707         considered as non-PIC.
5708         (Arm_relocate_functions::base_abs): Fix formatting.
5709         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5710         of function to use GOT entry address instead of offset.
5711         (Target_arm::Scan::global): Issue an error if a symbol would need a
5712         PLT does not get one because it is untyped.  Remove code to create
5713         dynamic symbols for relative branches.
5714         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5715         takes unsigned integer instead of boolean.
5716
5717 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5718
5719         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5720         (two_file_test_LDADD): Likewise.
5721         (common_test_1_LDADD): Likewise.
5722         (exception_test_LDADD) Likewise.
5723         (weak_test_LDADD): Likewise.
5724         (many_sections_test_LDADD): Likewise.
5725         (initpri1_LDADD): Likewise.
5726         (script_test_1_LDADD): Likewise.
5727         (script_test_2_LDADD): Likewise.
5728         (justsyms_LDADD): Likewise.
5729         (binary_test_LDADD): Likewise.
5730         (large_LDADD): Likewise.
5731         * testsuite/Makefile.in: Regenerated.
5732
5733 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5734
5735         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5736         (Symbol_table::override_with_special): Likewise.
5737         (Symbol_table::add_from_object): Likewise.
5738
5739 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5740
5741         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5742         Don't set the data_offset twice.
5743
5744 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5745
5746         * testsuite/Makefile.in: Regenerate.
5747
5748 2009-12-03  Doug Kwan  <dougkwan@google.com>
5749
5750         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5751         (Target_arm::do_finalize_sections): Add parameter for symbol table
5752         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5753         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5754         parameter for symbol table pointer.
5755         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5756         an additional parameter for a pointer to symbol table.
5757         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5758         parameter for a symbol table pointer.
5759         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5760         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5761         Ditto.
5762         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5763         parameter for a symbol table pointer.
5764
5765 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5766
5767         * incremental.cc (Incremental_inputs_header)
5768         (Incremental_inputs_header_write, Incremental_inputs_entry)
5769         (Incremental_inputs_entry_write): Move ...
5770         * incremental.h (Incremental_inputs_header)
5771         (Incremental_inputs_header_write, Incremental_inputs_entry)
5772         (Incremental_inputs_entry_write): here.
5773
5774 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5775
5776         * incremental.cc (make_sized_incremental_binary): Set the target.
5777         Error if it is incompatible.
5778         * output.h (Output_file): Add filename method.
5779
5780 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5781
5782         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5783         from the get_* methods.
5784
5785 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5786
5787         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5788         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5789         Write 0 for the data_offset of scripts.
5790
5791 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5792
5793         * testsuite/Makefile.am: Add the incremental_test.sh test.
5794         * testsuite/incremental_test.sh: New.
5795         * testsuite/incremental_test_1.c: New.
5796         * testsuite/incremental_test_2.c: New.
5797
5798 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5799
5800        * incremental-dump.cc (main): Fix typos.
5801
5802 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5803
5804         PR gold/11025
5805         * incremental-dump.cc (main): Use llu to print 64 bit values.
5806
5807 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5808             H.J. Lu  <hongjiu.lu@intel.com>
5809
5810         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5811         $(LIBDL).
5812         (incremental_dump_LDADD): Likewise.
5813         * Makefile.in: Regenerated.
5814
5815 2009-11-25  Doug Kwan  <dougkwan@google.com>
5816
5817         Revert:
5818
5819         2009-11-25  Doug Kwan  <dougkwan@google.com>
5820
5821                 * arm.cc (Target_arm::Target_arm): Move method definition
5822                 outside of class definition.  Add code to handle
5823                 --target1-rel, --target1-abs and --target2= options.
5824                 (Target_arm::get_reloc_reloc_type): Change method to be
5825                 non-static and const.
5826                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5827                 New data member declaration.
5828                 (Target_arm::Scan::local, Target_arm::Scan::global,
5829                 Target_arm::Relocate::relocate,
5830                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5831                 Adjust call to Target_arm::get_real_reloc_type.
5832                 (Target_arm::get_real_reloc_type): Use command line options
5833                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5834                 * options.h (--target1-rel, --target1-abs, --target2): New
5835                 ARM-only options.
5836
5837 2009-11-25  Doug Kwan  <dougkwan@google.com>
5838
5839         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5840         class definition.  Add code to handle --target1-rel, --target1-abs
5841         and --target2= options.
5842         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5843         and const.
5844         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5845         member declaration.
5846         (Target_arm::Scan::local, Target_arm::Scan::global,
5847         Target_arm::Relocate::relocate,
5848         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5849         call to Target_arm::get_real_reloc_type.
5850         (Target_arm::get_real_reloc_type): Use command line options to
5851         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5852         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5853         options.
5854
5855 2009-11-25  Doug Kwan  <dougkwan@google.com>
5856
5857         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5858         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5859         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5860         formatting.
5861         (Arm_relocate_functions::thm_call): Replace body with a call to
5862         Arm_relocate_functions::thumb_branch_common.
5863         (Arm_relocate_functions::thm_jump24,
5864         Arm_relocate_functions::thm_xpc22): New method definitions.
5865         (Arm_relocate_functions::thumb_branch_common): New method definition.
5866         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5867         operator.
5868         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5869         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5870
5871 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5872
5873         * Makefile.am: Build incremental-dump
5874         * Makefile.in: Regenerate.
5875         * incremental-dump.cc: New.
5876         * incremental.cc (Incremental_inputs_header_data,
5877         Incremental_inputs_entry_data): Move to incremental.h
5878         * incremental.h: (Incremental_inputs_header_data,
5879         Incremental_inputs_entry_data): Move from incremental.cc
5880
5881 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5882
5883         * incremental.cc (Incremental_inputs_header,
5884         Incremental_inputs_header_write, Incremental_inputs_entry,
5885         Incremental_inputs_entry_write): Add a typedef with the data type.
5886
5887 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5888
5889         * incremental.cc (Incremental_inputs_header,
5890         Incremental_inputs_header_write, Incremental_inputs_entry,
5891         Incremental_inputs_entry_write): Update comment about which
5892         type has the filed descriptions.
5893
5894 2009-11-15  Doug Kwan  <dougkwan@google.com>
5895
5896         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5897         (Arm_relocate_functions::arm_branch_common): Change method defintion
5898         in class definition to a method declaration and update list of formal
5899         parameters.
5900         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5901         Arm_relocation_functions::jump24): Adjust call to
5902         Arm_relocate_functions::arm_branch_common.  Update list of formal
5903         parameters.
5904         (Arm_relocate_functions::xpc25): New method definition.
5905         (Arm_relocate_functions::arm_branch_common): Move method defintion
5906         out from class definition.  Use stubs for mode-switching and extending
5907         branch ranges.
5908         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5909         specially.  Change code to enable use of stubs in ARM branches.
5910
5911 2009-11-10  Doug Kwan  <dougkwan@google.com>
5912
5913         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5914         in method declaration.
5915         (Target_arm::relocate_stub): New method declaration.
5916         (Target_arm::default_target): Change to return a pointer instead of
5917         a const reference.
5918         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5919         Target_arm::default_target.
5920         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5921         method definition.
5922         (Target_arm::relocate_section): Adjust view.
5923         (Target_arm::relocate_stub): New method definition.
5924
5925 2009-11-10  Doug Kwan  <dougkwan@google.com>
5926
5927         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5928         a format warning.
5929         * incremental.cc (open_incremental_binary): Initialized local
5930         variables to avoid warnings.
5931         * object.cc (make_elf_object): Ditto.
5932         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5933         a format warning.
5934
5935 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5936
5937         PR gold/10930
5938         * testsuite/plugin_test.c: Include "config.h".
5939
5940 2009-11-09  Doug Kwan  <dougkwan@google.com>
5941
5942         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5943         (arm_symbol_value): Remove.
5944         (Arm_relocate_functions::arm_branch_common,
5945         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5946         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5947         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5948         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5949         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5950         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5951         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5952         Arm_relocate_functions::thm_mobw_abs_nc,
5953         Arm_relocate_functions::thm_mov_abs,
5954         Arm_relocate_functions::movw_prel_nc,
5955         Arm_relocate_functions::thm_movt_abs,
5956         Arm_relocate_functions::movt_prel,
5957         Arm_relocate_functions::thm_movw_prel_nc,
5958         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5959         (Target_arm::Relocate::relocate): Only decompose address into two
5960         parts if relocation type uses the thumb-bit and pass the actual
5961         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5962         calls to methods in Arm_relocate_functions for this change.
5963
5964 2009-11-08  Ian Lance Taylor  <iant@google.com>
5965
5966         PR 10925
5967         * reloc.cc: Instantiate
5968         Sized_relobj::initialize_input_to_output_maps and
5969         Sized_relobj:free_input_to_output_maps.
5970
5971 2009-11-06  Ian Lance Taylor  <iant@google.com>
5972
5973         PR 10876
5974         * defstd.cc (in_segment): Set only_if_ref true for "end".
5975
5976 2009-11-06  Doug Kwan  <dougkwan@google.com>
5977
5978         * arm.cc (class Reloc_stub): Correct a comment.
5979         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5980         (Target_arm::scan_section_for_stubs): New method declaration.
5981         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5982         Change methods from private to protected.
5983         (Target_arm::do_may_relax): New method definition.
5984         (Target_arm::do_relax, Target_arm::group_sections,
5985         Target_arm::scan_reloc_for_stub,
5986         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5987         (Target_arm::arm_input_section_map_): New data member declaration.
5988         (Target_arm::scan_reloc_for_stub,
5989         Target_arm::scan_reloc_section_for_stubs,
5990         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5991         Target_arm::do_relax): New method definitions.
5992
5993 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5994
5995         * configure.ac: Check for (struct stat)::st_mtim
5996         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5997         * config.in: Regenerate.
5998         * configure: Regenerate.
5999
6000 2009-11-05  Ian Lance Taylor  <iant@google.com>
6001
6002         PR 10910
6003         * output.cc (Output_segment::add_output_section): Add missing
6004         return statement.
6005
6006 2009-11-04  Ian Lance Taylor  <iant@google.com>
6007
6008         PR 10880
6009         * object.h (class Object): Add is_needed and set_is_needed
6010         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6011         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6012         defined in a dynamic object and referenced by a regular object,
6013         set is_needed for the dynamic object.
6014         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6015         if the file is marked with as_needed and it is not needed.
6016
6017 2009-11-04  Ian Lance Taylor  <iant@google.com>
6018
6019         PR 10887
6020         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6021         tags if data is discarded by linker script.
6022         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6023         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6024         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6025         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6026
6027 2009-11-04  Ian Lance Taylor  <iant@google.com>
6028
6029         * layout.cc (Layout::get_output_section): Add is_interp and
6030         is_dynamic_linker_section parameters.  Change all callers.
6031         (Layout::choose_output_section): Likewise.
6032         (Layout::make_output_section): Likewise.
6033         (Layout::add_output_section_data): Add is_dynamic_linker_section
6034         parameter.  Change all callers.
6035         * layout.h (class Layout): Update declarations.
6036         * output.h (class Output_section): Add is_interp, set_is_interp,
6037         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6038         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6039         generate_code_fills_at_write_ to a bitfield.
6040         * output.cc (Output_section::Output_sections): Initialize new
6041         fields.
6042         (Output_segment::add_output_section): Add do_sort parameter.
6043         Change all callers.
6044
6045 2009-11-03  Ian Lance Taylor  <iant@google.com>
6046
6047         PR 10860
6048         * options.h (class General_options): Add --warn-common.
6049         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6050         merging two common symbols.
6051         (Symbol_table::should_override): Handle --warn-common when merging
6052         a common symbol with a defined symbol.  Use report_resolve_problem
6053         for multiple definitions.
6054         (Symbol_table::report_resolve_problem): New function.
6055         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6056
6057 2009-11-03  Doug Kwan  <dougkwan@google.com>
6058
6059         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6060         stub_factory_.
6061         (Target_arm::stub_factory): New method definition.
6062         (Target_arm::new_arm_input_section,
6063         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6064         Target_arm::reloc_uses_thumb_bit): New method declarations.
6065         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6066         New type definitions.
6067         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6068         member declarations.
6069         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6070         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6071         New method definitions.
6072
6073 2009-11-03  Ian Lance Taylor  <iant@google.com>
6074
6075         * options.h (class General_options): Add --warn_constructors.
6076
6077 2009-11-03  Ian Lance Taylor  <iant@google.com>
6078
6079         PR 10893
6080         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6081         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6082
6083 2009-11-03  Ian Lance Taylor  <iant@google.com>
6084
6085         PR 10895
6086         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6087         --msgid-bugs-address.
6088         (install-pdf): New target.
6089         (install-data_yes): Look up one directory to find mkinstalldirs.
6090
6091 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6092
6093         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6094         tree.
6095
6096 2009-10-30  Doug Kwan  <dougkwan@google.com>
6097
6098         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6099
6100 2009-10-30  Doug Kwan  <dougkwan@google.com>
6101
6102         * arm.cc (Stub_addend_reader): New struct template definition
6103         and partial specializations.
6104         (Stub_addend_reader::operator()): New method definition for a
6105         partially specialized template.
6106
6107 2009-10-30  Doug Kwan  <dougkwan@google.com>
6108
6109         * arm.cc (Arm_relobj::processor_specific_flags): New method
6110         definition.
6111         (Arm_relobj::do_read_symbols): New method declaration.
6112         (Arm_relobj::processor_specific_flags_): New data member declaration.
6113         (Arm_dynobj): New class definition.
6114         (Target_arm::do_finalize_sections): Add input_objects parameter.
6115         (Target_arm::do_adjust_elf_header): New method declaration.
6116         (Target_arm::are_eabi_versions_compatible,
6117         (Target_arm::merge_processor_specific_flags): New method declaration.
6118         (Target_arm::do_make_elf_object): New overloaded method definitions
6119         and declaration.
6120         (Arm_relobj::do_read_symbols): New method definition.
6121         (Arm_dynobj::do_read_symbols): Ditto.
6122         (Target_arm::do_finalize_sections): Add input_objects parameters.
6123         Merge processor-specific flags from all input objects.
6124         (Target_arm::are_eabi_versions_compatible,
6125         Target_arm::merge_processor_specific_flags,
6126         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6127         New method definitions.
6128         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6129         Input_objects pointer type parameter.
6130         * layout.cc (Layout::finalize): Pass input objects to target's.
6131         finalize_sections function.
6132         * output.cc (Output_file_header::do_sized_write): Set ELF file
6133         header's processor-specific flags.
6134         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6135         Input_objects pointer type parameter.
6136         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6137         * target.h (Input_objects): New forward class declaration.
6138         (Target::processor_specific_flags,
6139         Target::are_processor_specific_flags_sect): New method definitions.
6140         (Target::finalize_sections): Add input_objects parameter.
6141         (Target::Target): Initialize processor_specific_flags_ and
6142         are_processor_specific_flags_set_.
6143         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6144         parameter.
6145         (Target::set_processor_specific_flags): New method definition.
6146         (Target::processor_specific_flags_,
6147         Target::are_processor_specific_flags_set_): New data member
6148         declarations.
6149         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6150         Input_objects pointer type parameter.
6151
6152 2009-10-30  Doug Kwan  <dougkwan@google.com>
6153
6154         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6155
6156 2009-10-28  Ian Lance Taylor  <iant@google.com>
6157
6158         * object.h (class Relobj): Drop options parameter from
6159         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6160         do_scan_relocs, do_relocate.  Change all callers.
6161         (class Sized_relobj): Drop options parameters from
6162         do_gc_process_relocs, do_scan_relocs, do_relocate,
6163         do_relocate_sections, relocate_sections, emit_relocs_scan,
6164         emit_relocs_scan_reltype.  Change all callers.
6165         (struct Relocate_info): Remove options field and all references to
6166         it.
6167         * reloc.h (class Read_relocs): Remove options constructor
6168         parameter and options_ field.  Change all callers.
6169         (class Gc_process_relocs, class Scan_relocs): Likewise.
6170         (class Relocate_task): Likewise.
6171         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6172         all callers.
6173         (scan_relocatable_relocs): Likewise.
6174         * target.h (class Sized_target): Remove options parameter from
6175         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6176         all callers.
6177         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6178         callers.
6179         * arm.cc: Update functions to remove options parameters.
6180         * i386.cc: Likewise.
6181         * powerpc.cc: Likewise.
6182         * sparc.cc: Likewise.
6183         * x86_64.cc: Likewise.
6184         * testsuite/testfile.cc: Likewise.
6185
6186 2009-10-28  Doug Kwan  <dougkwan@google.com>
6187
6188         * arm.cc (Arm_relobj): New class definition.
6189         (Arm_relobj::scan_sections_for_stubs,
6190         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6191         New method definitions.
6192
6193 2009-10-28  Cary Coutant  <ccoutant@google.com>
6194
6195         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6196         (Plugin::cleanup_done_): New member.
6197         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6198         (Plugin_manager::cleanup_done_): Remove.
6199         (Plugin_manager::add_input_file): Edit error message.
6200         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6201         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6202
6203 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6204
6205         * fileread.cc: (File_read::View::~View): Use the new
6206         data_ownership_ filed.
6207         (File_read::~File_read): Dispose the new whole_file_view_.
6208         (File_read::open): Mmap the whole file if needed.
6209         (File_read::open): Use whole_file_view_ instead of contents_.
6210         (File_read::find_view): Use whole_file_view_ if applicable.
6211         (File_read::do_read): Use whole_file_view_ instead of contents_.
6212         (File_read::make_view): Use whole_file_view_ instead of contents_,
6213         update File_read::View::View call.
6214         (File_read::find_or_make_view): Update File_read::View::View
6215         call.
6216         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6217         remove contents_
6218         (File_read::View::Data_ownership): New enum.
6219         (File_read::View::View): Replace bool mapped_ with Data_ownership
6220         argument.
6221         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6222         (File_read::View::data_ownership_): New field.
6223         (File_read::contents_): Remove (replaced by whole_file_view_).
6224         (File_read::whole_file_view_): New field.
6225         * options.h (class General_options): Add --keep-files-mapped.
6226
6227 2009-10-27  Cary Coutant  <ccoutant@google.com>
6228
6229         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6230         * testsuite/Makefile.am (plugin_test_5): New test case.
6231         * testsuite/Makefile.in: Regenerate.
6232
6233 2009-10-25  Doug Kwan  <dougkwan@google.com>
6234
6235         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6236         from private to protected to allow access by child class.
6237         (Sized_relobj::do_relocate_sections): New method declaration.
6238         (Sized_relobj::relocate_sections): Virtualize.
6239         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6240         Sized_relobj::relocate_sections.  Instantiate template explicitly
6241         for different target sizes and endianity.
6242
6243 2009-10-24  Doug Kwan  <dougkwan@google.com>
6244
6245         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6246         (Arm_input_section::as_arm_input_section): New method.
6247         (Arm_output_section): New class definition.
6248         (Arm_output_section::create_stub_group,
6249         Arm_output_section::group_sections): New method definitions.
6250
6251 2009-10-22  Doug Kwan  <dougkwan@google.com>
6252
6253         * arm.cc (Arm_input_section): New class definition.
6254         (Arm_input_section::init, Arm_input_section:do_write,
6255         Arm_input_section::set_final_data_size,
6256         Arm_input_section::do_reset_address_and_file_offset): New method
6257         definitions.
6258
6259 2009-10-21  Doug Kwan  <dougkwan@google.com>
6260
6261         * arm.cc (Stub_table, Arm_input_section): New forward class
6262         declarations.
6263         (Stub_table): New class defintion.
6264         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6265         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6266         New method definition.
6267
6268 2009-10-21  Doug Kwan  <dougkwan@google.com>
6269
6270         * arm.cc: Update copyright comments.
6271         (Target_arm): New forward class template declaration.
6272         (Arm_address): New type.
6273         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6274         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6275         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6276         constants.
6277         (Insn_template): Same.
6278         (DEF_STUBS): New macro.
6279         (Stub_type): New enum type.
6280         (Stub_template): New class definition.
6281         (Stub): Same.
6282         (Reloc_stub): Same.
6283         (Stub_factory): Same.
6284         (Target_arm::Target_arm): Initialize may_use_blx_ and
6285         should_force_pic_veneer_.
6286         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6287         Target_arm::should_force_pic_veneer,
6288         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6289         Target_arm::using_thumb_only, Target_arm:;default_target): New
6290         method defintions.
6291         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6292         New data member declarations.
6293         (Insn_template::size, Insn_template::alignment): New method defintions.
6294         (Stub_template::Stub_template): New method definition.
6295         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6296         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6297         (Stub_factory::Stub_factory): New method definition.
6298         * gold.h (string_hash): New template.
6299         * output.h (Input_section_specifier::hash_value): Use
6300         gold::string_hash.
6301         (Input_section_specifier::string_hash): Remove.
6302         * stringpool.cc (Stringpool_template::string_hash): Use
6303         gold::string_hash.
6304
6305 2009-10-20  Doug Kwan  <dougkwan@google.com>
6306
6307         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6308         symbols of relaxed input sections.
6309         * output.h (Output_section::find_relaxed_input_section): Make
6310         method public.
6311
6312 2009-10-16  Doug Kwan  <dougkwan@google.com>
6313
6314         * dynobj.cc (Versions::Versions): Initialize version_script_.
6315         Only insert base version symbol definition for a shared object
6316         if version script defines any version versions.
6317         (Versions::define_base_version): New method definition.
6318         (Versions::add_def): Check that base version is not needed.
6319         (Versions::add_need): Define base version lazily.
6320         * dynobj.h (Versions::define_base_version): New method declaration.
6321         (Versions::needs_base_version_): New data member declaration.
6322         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6323         (check_DATA): Add no_version_test.stdout.
6324         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6325         New make rules.
6326         * testsuite/Makefile.in: Regenerate.
6327         * testsuite/no_version_test.c: New file.
6328         * testsuite/no_version_test.sh: Ditto.
6329
6330 2009-10-16  Doug Kwan  <dougkwan@google.com>
6331
6332         * expression.cc (class Segment_start_expression): New class definition.
6333         (Segment_start_expression::value): New method definition.
6334         (script_exp_function_segment_start): Return a new
6335         Segment_start_expression.
6336         * gold/script-c.h (script_saw_segment_start_expression): New function
6337         prototype.
6338         * script-sections.cc (Script_sections::Script_sections): Initialize
6339         SAW_SEGMENT_START_EXPRESSION_ to false.
6340         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6341         and -Tbbs options to specify section addresses if given in
6342         command line and no SEGMENT_START expression is seen in a script.
6343         * script-sections.h (Script_sections::saw_segment_start_expression,
6344         Script_sections::set_saw_segment_start_expression): New method
6345         definition.
6346         (Script_sections::saw_segment_start_expression_): New data member
6347         declaration.
6348         * script.cc (script_saw_segment_start_expression): New function.
6349         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6350         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6351         script_test_7.sh and script_test_8.sh.
6352         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6353         script_test_8.stdout.
6354         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6355         (script_test_6, script_test_6.stdout, script_test_7,
6356         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6357         * Makefile.in: Regenerate.
6358         * testsuite/script_test_6.sh: New file.
6359         * testsuite/script_test_6.t: Same.
6360         * testsuite/script_test_7.sh: Same.
6361         * testsuite/script_test_7.t: Same.
6362         * testsuite/script_test_8.sh: Same.
6363
6364 2009-10-16  Doug Kwan  <dougkwan@google.com>
6365
6366         * output.cc (Output_segment::set_section_list_address): Cast
6367         expressions to unsigned long long type to avoid format warnings.
6368
6369 2009-10-15  Ian Lance Taylor  <iant@google.com>
6370
6371         * script.cc (Script_options::add_symbol_assignment): Always add a
6372         dot assignment to script_sections_.
6373         * script-sections.cc (Script_sections::add_dot_assignment):
6374         Initialize if necessary.
6375
6376         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6377         program headers with no load segment if there is a linker script.
6378
6379         * layout.cc (Layout::set_segment_offsets): Align the file offset
6380         to the segment aligment for -N or -n with no load segment.
6381         * output.cc (Output_segment::add_output_section): Don't crash if
6382         the first section is a TLS section.
6383         (Output_segment::set_section_list_addresses): Print an error
6384         message if the address moves backward in a linker script.
6385         * script-sections.cc
6386         (Output_section_element_input::set_section_addresses): Don't
6387         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6388         (Orphan_output_section::set_section_addresses): Likewise.
6389
6390 2009-10-15  Doug Kwan  <dougkwan@google.com>
6391
6392         * layout.cc (Layout::finish_dynamic_section): Generate tags
6393         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6394         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6395         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6396
6397 2009-10-14  Ian Lance Taylor  <iant@google.com>
6398
6399         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6400         fields.
6401         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6402         data_shdr fields of relinfo.
6403         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6404         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6405         R_386_TLS_LDO_32, adjust based on section flags.
6406         (Target_i386::Relocate::fix_up_ldo): Remove.
6407
6408 2009-10-13  Ian Lance Taylor  <iant@google.com>
6409
6410         Add support for -pie.
6411         * options.h (class General_options): Add -pie and
6412         --pic-executable.
6413         (General_options::output_is_position_independent): Test -pie.
6414         (General_options::output_is_executable): Return true if not shared
6415         and not relocatable.
6416         (General_options::output_is_pie): Remove.
6417         * options.cc (General_options::finalize): Reject incompatible uses
6418         of -pie.
6419         * gold.cc (queue_middle_tasks): A -pie link is not static.
6420         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6421         * symtab.cc (Symbol::final_value_is_known): Return false if
6422         output_is_position_independent.
6423         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6424         output_is_position_independent.
6425         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6426         output_is_position_independent.
6427         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6428         output_is_position_independent.
6429         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6430         two_file_pie_test.
6431         (basic_pie_test.o, basic_pie_test): New targets.
6432         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6433         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6434         (two_file_pie_test): New target.
6435         * testsuite/Makefile.in: Rebuild.
6436         * README: Remove note saying that -pie is not supported.
6437
6438 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6439
6440         * options.h (class General_options): Add -init and -fini.
6441         * layout.cc (Layout::finish_dynamic_section): Emit
6442         given init and fini functions.
6443
6444 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6445
6446         * gc.h (gc_process_relocs): Check if icf is enabled using new
6447         function.
6448         * gold.cc (queue_initial_tasks): Likewise.
6449         (queue_middle_tasks): Likewise.
6450         * object.cc (do_layout): Likewise.
6451         * symtab.cc (is_section_folded): Likewise.
6452         * main.cc (main): Likewise.
6453         * reloc.cc (Read_relocs::run): Likewise.
6454         (Sized_relobj::do_scan_relocs): Likewise.
6455         * icf.cc (is_function_ctor_or_dtor): New function.
6456         (Icf::find_identical_sections): Check if function is ctor or dtor when
6457         safe icf is chosen.
6458         * options.h (General_options::icf): Change option to be an enum.
6459         (Icf_status): New enum.
6460         (icf_enabled): New method.
6461         (icf_safe_folding): New method.
6462         (set_icf_status): New method.
6463         (icf_status_): New variable.
6464         * (options.cc) (General_options::finalize): Set icf_status_.
6465         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6466         icf_test and icf_keep_unique_test to use the --icf enum flag.
6467         * testsuite/icf_safe_test.sh: New file.
6468         * testsuite/icf_safe_test.cc: New file.
6469
6470 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6471
6472         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6473         includes to gc.h and icf.h.
6474         * arm.cc: Include gc.h.
6475         * gold.cc: Likewise.
6476         * i386.cc: Likewise.
6477         * powerpc.cc: Likewise.
6478         * sparc.cc: Likewise.
6479         * x86_64.cc: Likewise.
6480         * gc.h: Include icf.h.
6481
6482 2009-10-11  Ian Lance Taylor  <iant@google.com>
6483
6484         * plugin.cc: Include "gold.h" before other header files.
6485
6486 2009-10-10  Chris Demetriou  <cgd@google.com>
6487
6488         * options.h (Input_file_argument::Input_file_type): New enum.
6489         (Input_file_argument::is_lib_): Replace with...
6490         (Input_file_argument::type_): New member.
6491         (Input_file_argument::Input_file_argument): Take Input_file_type
6492         'type' rather than boolean 'is_lib' as second argument.
6493         (Input_file_argument::is_lib): Use type_.
6494         (Input_file_argument::is_searched_file): New function.
6495         (Input_file_argument::may_need_search): Handle is_searched_file.
6496         * options.cc (General_options::parse_library): Support -l:filename.
6497         (General_options::parse_just_symbols): Update for Input_file_argument
6498         changes.
6499         (Command_line::process): Likewise.
6500         * archive.cc (Archive::get_file_and_offset): Likewise.
6501         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6502         * script.cc (read_script_file, script_add_file): Likewise.
6503         * fileread.cc (Input_file::Input_file): Likewise.
6504         (Input_file::will_search_for): Handle is_searched_file.
6505         (Input_file::open): Likewise.
6506         * readsyms.cc (Read_symbols::get_name): Likewise.
6507         * testsuite/Makefile.am (searched_file_test): New test.
6508         * testsuite/Makefile.in: Regenerate.
6509         * testsuite/searched_file_test.cc: New file.
6510         * testsuite/searched_file_test_lib.cc: New file.
6511
6512 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6513             Ian Lance Taylor  <iant@google.com>
6514
6515         * descriptor.cc: Include <cstdio> and "binary-io.h".
6516         (Descriptors::open): Open the files in binary mode always.
6517         * script.cc (Lex::get_token): Treat \r as whitespace.
6518
6519 2009-10-09  Ian Lance Taylor  <iant@google.com>
6520
6521         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6522
6523 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6524             Ian Lance Taylor  <iant@google.com>
6525
6526         * configure.ac: Check for readv function also.
6527         * fileread.cc (readv): Define if not HAVE_READV.
6528         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6529         does not exist.
6530         * config.in: Regenerate.
6531         * configure: Regenerate.
6532
6533 2009-10-09  Doug Kwan  <dougkwan@google.com>
6534
6535         * layout.cc (Layout::make_output_section): Call target hook to make
6536         ordinary output section.
6537         (Layout::finalize): Adjust parameter list of call the
6538         Target::may_relax().
6539         * layout.h (class Layout::section_list): New method.
6540         * merge.h (Output_merge_base::entsize): Change visibility to public.
6541         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6542         New methods.
6543         (Output_merge_string::do_is_string): New method.
6544         * object.cc (Sized_relobj::do_setup): renamed from
6545         Sized_relobj::set_up.
6546         * object.h (Sized_relobj::adjust_shndx,
6547         Sized_relobj::initializ_input_to_output_maps,
6548         Sized_relobj::free_input_to_output_maps): Change visibilities to
6549         protected.
6550         (Sized_relobj::setup): Virtualize.
6551         (Sized_relobj::do_setup): New method declaration.
6552         (Sized_relobj::invalidate_section_offset,
6553         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6554         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6555         * options.cc (parse_int): New function.
6556         * options.h (parse_int): New declaration.
6557         (DEFINE_int): New macro.
6558         (stub_group_size): New option.
6559         * output.cc (Output_section::Output_section): Initialize memebers
6560         merge_section_map_, merge_section_by_properties_map_,
6561         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6562         (Output_section::add_input_section): Handled deferred code-fill
6563         generation and remove an old comment.
6564         (Output_section::add_relaxed_input_section): New method definition.
6565         (Output_section::add_merge_input_section): Use merge section by
6566         properties map to speed to search.  Update merge section maps
6567         as appropriate.
6568         (Output_section::build_relaxation_map): New method definition.
6569         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6570         Same.
6571         (Output_section::relax_input_section): Renamed to
6572         Output_section::convert_input_sections_to_relaxed_sections and change
6573         interface to take a vector of pointers to relaxed sections.
6574         (Output_section::find_merge_section,
6575         Output_section::find_relaxed_input_section): New method definitions.
6576         (Output_section::is_input_address_mapped,
6577         Output_section::output_offset, Output_section::output_address):
6578         Use output section data maps to speed up searching.
6579         (Output_section::find_starting_output_address): Add comments.
6580         (Output_section::do_write,
6581         Output_section::write_to_postprocessing_buffer): Do code-fill
6582         generation as appropriate.
6583         (Output_section::get_input_sections): Invalidate relaxed input section
6584         map.
6585         (Output_section::restore_states): Adjust type of checkpoint .
6586         Invalidate relaxed input section map.
6587         * output.h (Output_merge_base): New class declaration.
6588         (Input_section_specifier): New class defintion.
6589         (class Output_relaxed_input_section) Change base class to
6590         Output_section_data_build.
6591         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6592         base class initializer.
6593         (Output_section::add_relaxed_input_section): New method declaration.
6594         (Output_section::Input_section): Change visibility to protected.
6595         (Output_section::Input_section::relobj,
6596         Output_section::Input_section::shndx): Handle relaxed input sections.
6597         Output_section::input_sections) Change visibility to protected.  Also
6598         define overload to return a non-const pointer.
6599         (Output_section::Merge_section_properties): New class defintion.
6600         (Output_section::Merge_section_by_properties_map,
6601         Output_section::Output_section_data_by_input_section_map,
6602         Output_section::Relaxation_map): New types.
6603         (Output_section::relax_input_section): Rename method to
6604         Output_section::convert_input_sections_to_relaxed_sections and change
6605         interface to take a vector of relaxed section pointers.
6606         (Output_section::find_merge_section,
6607         Output_section::find_relaxed_input_section,
6608         Output_section::build_relaxation_map,
6609         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6610         New method declarations.
6611         (Output_section::merge_section_map_
6612         Output_section::merge_section_by_properties_map_,
6613         Output_section::relaxed_input_section_map_,
6614         Output_section::is_relaxed_input_section_map_valid_,
6615         Output_section::generate_code_fills_at_write_): New data members.
6616         * script-sections.cc
6617         (Output_section_element_input::set_section_addresses): Call
6618         current_data_size and addralign methods of relaxed input sections.
6619         (Orphan_output_section::set_section_addresses): Call current_data_size
6620         and addralign methods of relaxed input sections.
6621         * symtab.cc (Symbol_table::compute_final_value): Extract template
6622         from the body of Symbol_table::sized_finalize_symbol.
6623         (Symbol_table::sized_finalized_symbol): Call
6624         Symbol_table::compute_final_value.
6625         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6626         (Symbol_table::compute_final_value): New templated method declaration.
6627         * target.cc (Target::do_make_output_section): New method defintion.
6628         * target.h (Target::make_output_section): New method declaration.
6629         (Target::relax): Add more parameters for input objects, symbol table
6630         and layout.  Adjust call to do_relax.
6631         (Target::do_make_output_section): New method declaration.
6632         (Target::do_relax): Add parameters for input objects, symbol table
6633         and layout.
6634
6635 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6636
6637         * pread.c: Include stdio.h.
6638
6639 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6640
6641         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6642         defined.
6643
6644 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6645
6646         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6647         Change read_shndx type to unsigned int.
6648         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6649         int.
6650         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6651         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6652         Change read_shndx type to unsigned int.
6653         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6654         int.
6655         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6656         * layout.cc (Layout::create_symtab_sections): Cast the result of
6657         local_symcount * symsize to off_t in the gold_assert.
6658
6659 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6660
6661         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6662         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6663         R_ARM_BASE_ABS.
6664         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6665         (Arm_relocate_functions::thm_abs5): New function.
6666         (Arm_relocate_functions::abs12): New function.
6667         (Arm_relocate_functions::abs16): New function.
6668         (Arm_relocate_functions::base_abs): New function.
6669         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6670         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6671         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6672         R_ARM_BASE_ABS.
6673         (Scan::global): Likewise.
6674         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6675         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6676         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6677         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6678         R_ARM_BASE_ABS.
6679
6680 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6681
6682         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6683         (Arm_relocate_functions::movt_prel): New function.
6684         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6685         (Arm_relocate_functions::thm_movt_prel): New function.
6686         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6687         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6688         (Scan::global, Relocate::relocate): Likewise.
6689         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6690
6691 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6692
6693         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6694         Incremental_checker.
6695         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6696         unsigned int.
6697         (class Incremental_inputs_header): New class.
6698         (Incremental_inputs_header_writer): Edit comment.
6699         (Incremental_inputs_entry): New class.
6700         (Incremental_inputs_entry_writer): Edit comment.
6701         (Sized_incremental_binary::do_find_incremental_inputs_section):
6702         Add *strtab_shndx parameter, fill it.
6703         (Sized_incremental_binary::do_check_inputs): New method.
6704         (Incremental_checker::can_incrementally_link_output_file): Use
6705         Sized_incremental_binary::check_inputs.
6706         (Incremental_inputs::report_command_line): Save command line in
6707         command_line_.
6708         * incremental.h:
6709         (Incremental_binary::find_incremental_inputs_section): New
6710         method.
6711         (Incremental_binary::do_find_incremental_inputs_section): Add
6712         strtab_shndx parameter.
6713         (Incremental_binary::do_check_inputs): New pure virtual method.
6714         (Sized_incremental_binary::do_check_inputs): Declare.
6715         (Incremental_checker::Incremental_checker): Add incremental_inputs
6716         parameter, use it to initialize incremental_inputs_.
6717         (Incremental_checker::incremental_inputs_): New field.
6718         (Incremental_checker::command_line): New method.
6719         (Incremental_checker::inputs): New method.
6720         (Incremental_checker::command_line_): New field.
6721
6722 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6723
6724         * incremental.cc: Include <cstdarg> and "target-select.h".
6725         (vexplain_no_incremental): New function.
6726         (explain_no_incremental): New function.
6727         (Incremental_binary::error): New method.
6728         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6729         method.
6730         (make_sized_incremental_binary): New function.
6731         (open_incremental_binary): New function.
6732         (can_incrementally_link_file): Add checks if output is ELF and has
6733         inputs section.
6734         * incremental.h: Include "elfcpp_file.h" and "output.h".
6735         (Incremental_binary): New class.
6736         (Sized_incremental_binary): New class.
6737         (open_incremental_binary): Declare.
6738         * object.cc (is_elf_object): Use
6739         elfcpp::Elf_recognizer::is_elf_file.
6740         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6741         * output.h (Output_file::filesize): New method.
6742
6743 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6744
6745         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6746         New function.
6747         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6748         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6749         function.
6750         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6751         function.
6752         (Arm_relocate_functions::movw_abs_nc): New function.
6753         (Arm_relocate_functions::movt_abs): New function.
6754         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6755         (Arm_relocate_functions::thm_movt_abs): New function.
6756         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6757         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6758         (Scan::global): Likewise.
6759         (Relocate::relocate): Likewise.
6760         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6761
6762 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6763
6764         * arm.cc (Arm_relocate_functions::got_prel) New function.
6765         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6766         (Relocate::relocate): Likewise.
6767         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6768
6769 2009-10-06  Ian Lance Taylor  <iant@google.com>
6770
6771         * options.h (class General_options): Define
6772         split_stack_adjust_size parameter.
6773         * object.h (class Object): Add uses_split_stack_ and
6774         has_no_split_stack_ fields.  Add uses_split_stack and
6775         has_no_split_stack accessor functions.  Declare
6776         handle_split_stack_section.
6777         (class Reloc_symbol_changes): Define.
6778         (class Sized_relobj): Define Function_offsets.  Declare
6779         split_stack_adjust, split_stack_adjust_reltype, and
6780         find_functions.
6781         * object.cc (Object::handle_split_stack_section): New function.
6782         (Sized_relobj::do_layout): Call handle_split_stack_section.
6783         * dynobj.cc (Sized_dynobj::do_layout): Call
6784         handle_split_stack_section.
6785         * reloc.cc (Sized_relobj::relocate_sections): Call
6786         split_stack_adjust for executable sections in split_stack
6787         objects.  Pass reloc_map to relocate_section.
6788         (Sized_relobj::split_stack_adjust): New function.
6789         (Sized_relobj::split_stack_adjust_reltype): New function.
6790         (Sized_relobj::find_functions): New function.
6791         * target-reloc.h: Include "object.h".
6792         (relocate_section): Add reloc_symbol_changes parameter.  Change
6793         all callers.
6794         * target.h (class Target): Add calls_non_split method.  Declare
6795         do_calls_non_split virtual method.  Declare match_view and
6796         set_view_to_nop.
6797         * target.cc: Include "elfcpp.h".
6798         (Target::do_calls_non_split): New function.
6799         (Target::match_view): New function.
6800         (Target::set_view_to_nop): New function.
6801         * gold.cc (queue_middle_tasks): Give an error if mixing
6802         split-stack and non-split-stack objects with -r.
6803         * i386.cc (Target_i386::relocate_section): Add
6804         reloc_symbol_changes parameter.
6805         (Target_i386::do_calls_non_split): New function.
6806         * x86_64.cc (Target_x86_64::relocate_section): Add
6807         reloc_symbol_changes parameter.
6808         (Target_x86_64::do_calls_non_split): New function.
6809         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6810         parameter.
6811         * powerpc.cc (Target_powerpc::relocate_section): Add
6812         reloc_symbol_changes parameter.
6813         * sparc.cc (Target_sparc::relocate_section): Add
6814         reloc_symbol_changes parameter.
6815         * configure.ac: Call AM_CONDITIONAL for the default target.
6816         * configure: Rebuild.
6817         * testsuite/Makefile.am (TEST_AS): New variable.
6818         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6819         (check_DATA): Add split_i386 and split_x86_64 files.
6820         (SPLIT_DEFSYMS): Define.
6821         (split_i386_[1234n].o): New targets.
6822         (split_i386_[124]): New targets.
6823         (split_i386_[1234r].stdout): New targets.
6824         (split_x86_64_[1234n].o): New targets.
6825         (split_x86_64_[124]): New targets.
6826         (split_x86_64_[1234r].stdout): New targets.
6827         (MOSTLYCLEANFILES): Add new executables.
6828         * testsuite/split_i386.sh: New file.
6829         * testsuite/split_x86_64.sh: New file.
6830         * testsuite/split_i386_1.s: New file.
6831         * testsuite/split_i386_2.s: New file.
6832         * testsuite/split_i386_3.s: New file.
6833         * testsuite/split_i386_4.s: New file.
6834         * testsuite/split_i386_n.s: New file.
6835         * testsuite/split_x86_64_1.s: New file.
6836         * testsuite/split_x86_64_2.s: New file.
6837         * testsuite/split_x86_64_3.s: New file.
6838         * testsuite/split_x86_64_4.s: New file.
6839         * testsuite/split_x86_64_n.s: New file.
6840         * testsuite/testfile.cc (Target_test): Update relocation_section
6841         function.
6842         * testsuite/Makefile.in: Rebuild.
6843
6844 2009-10-06  Ian Lance Taylor  <iant@google.com>
6845
6846         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6847         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6848         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6849         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6850         the address on ldo_addrs_.
6851         (Target_i386::Relocate::fix_up_ldo): New function.
6852
6853 2009-10-06   Rafael Espindola  <espindola@google.com>
6854
6855         * plugin.cc (add_input_library): New.
6856         (Plugin::load): Add add_input_library to tv.
6857         (Plugin_manager::add_input_file): Add the is_lib argument.
6858         (add_input_file): Update call to Plugin_manager::add_input_file.
6859         (add_input_library): New.
6860         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6861
6862 2009-09-30  Doug Kwan  <dougkwan@google.com>
6863
6864         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6865         symbol and call Symbol::may_need_copy_reloc to determine if
6866         a copy reloc is needed.
6867         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6868         nocopyreloc is given in command line.
6869         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6870         given in command line.
6871         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6872         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6873         of the removed Target_i386::may_need_copy_reloc.
6874         * options.h (copyreloc): New option with default value false.
6875         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6876         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6877         instead of the removed Target_powerpc::may_need_copy_reloc.
6878         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6879         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6880         instead of the removed Target_sparc::may_need_copy_reloc.
6881         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6882         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6883         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6884         instead of the removed Target_x86_64::may_need_copy_reloc.
6885
6886 2009-09-30  Ian Lance Taylor  <iant@google.com>
6887
6888         * object.h (class Object): Remove target_ field, and target,
6889         sized_target, and set_target methods.
6890         (Object::sized_target): Remove.
6891         (class Sized_relobj): Update declarations.  Remove sized_target.
6892         * object.cc (Sized_relobj::setup): Remove target parameter.
6893         Change all callers.
6894         (Input_objects::add_object): Don't do anything with the target.
6895         (make_elf_sized_object): Add punconfigured parameter.  Change all
6896         callers.  Set or test parameter target.
6897         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6898         Change all callers.
6899         * parameters.cc (Parameters::set_target): Change parameter type to
6900         be non-const.
6901         (Parameters::default_target): Remove.
6902         (set_parameters_target): Change parameter type to be non-const.
6903         (parameters_force_valid_target): New function.
6904         (parameters_clear_target): New function.
6905         * parameters.h (class Parameters): Update declarations.  Remove
6906         default_target method.  Add sized_target and clear_target
6907         methods.  Change target_ to be non-const.
6908         (set_parameters_target): Update declaration.
6909         (parameters_force_valid_target): Declare.
6910         (parameters_clear_target): Declare.
6911         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6912         as NULL if we aren't searching.
6913         (Add_symbols::run): Don't check for compatible target.
6914         * fileread.cc (Input_file::open_binary): Call
6915         parameters_force_valid_target.
6916         * gold.cc (queue_middle_tasks): Likewise.
6917         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6918         set_target on object.
6919         * dynobj.h (class Sized_dynobj): Update declarations.
6920         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6921         make_elf_object returns NULL.
6922         (Archive::include_member): Don't check whether object target is
6923         compatible.
6924         * output.cc (Output_section::add_input_section): Get target from
6925         parameters.
6926         (Output_section::relax_input_section): Likewise.
6927         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6928         parameters.
6929         (Sized_relobj::do_scan_relocs): Likewise.
6930         (Sized_relobj::relocate_sections): Likewise.
6931         * resolve.cc (Symbol_table::resolve): Likewise.
6932         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6933         parameter.  Change all callers.
6934         (Symbol_table::add_from_object): Get target from parameters.
6935         (Symbol_table::add_from_relobj): Don't check object target.
6936         (Symbol_table::add_from_dynobj): Likewise.
6937         (Symbol_table::define_special_symbol): Get target from
6938         parameters.
6939         * symtab.h (class Symbol_table): Update declaration.
6940         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6941         parameter.  Change all callers.  Clear parameter target.
6942         (Binary_test): Test target here.
6943         * testsuite/object_unittest.cc (gold_testsuite): Remove
6944         target_test_pointer parameter.  Change all callers.
6945         (Object_test): Test target here.
6946
6947 2009-09-26  Ian Lance Taylor  <iant@google.com>
6948
6949         * testsuite/initpri1.c: Don't try to use constructor priorities if
6950         compiling with gcc before 4.3.
6951
6952 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6953
6954         * testsuite/retain_symbols_file_test.sh (check_present): Change
6955         output file name to retain_symbols_file_test.stdout.
6956         (check_absent): Likewise.
6957
6958 2009-09-18  Craig Silverstein  <csilvers@google.com>
6959
6960         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6961         * options.cc: Include <cerrno> and <fstream>.
6962         (General_options::finalize): Parse -retain-symbols-file tag.
6963         * options.h: New flag.
6964         (General_options): New method should_retain_symbol, new
6965         variable symbols_to_retain.
6966         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6967         should_retain_symbol map.
6968         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6969         * testsuite/Makefile.in: Regenerate.
6970         * testsuite/retain_symbols_file_test.sh: New file.
6971
6972 2009-09-18  Nick Clifton  <nickc@redhat.com>
6973
6974         * po/es.po: Updated Spanish translation.
6975
6976 2009-09-17  Doug Kwan  <dougkwan@google.com>
6977
6978         * debug.h (DEBUG_RELAXATION): New constant.
6979         (DEBUG_ALL): Add DEBUG_RELAXATION.
6980         (debug_string_to_enum): Add relaxation debug option.
6981         * layout.cc
6982         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6983         Layout::Relaxation_debug_check::read_sections,
6984         Layout::Relaxation_debug_check::read_sections): New method definitions.
6985         (Layout::Layout): Initialize data members
6986         record_output_section_data_from_scrips_,
6987         script_output_section_data_list_ and relaxation_debug_check_.
6988         (Layout::save_segments, Layout::restore_segments,
6989         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6990         Layout::relaxation_loop_body): New method definitions.
6991         (Layout::finalize): Support relaxation.  Move section layout code to
6992         Layout::relaxation_loop_body.
6993         (Layout::set_asection_address_from_script): Move code for orphan
6994         section placement out.
6995         (Layout::place_orphan_sections_in_script): New method definition.
6996         * layout.h (Output_segment_headers, Output_file_header):
6997         New forward class declarations.
6998         (Layout::~Layout): Define.
6999         (Layout::new_output_section_data_from_script): New method definition.
7000         (Layout::place_orphan_sections_in_script): New method declaration.
7001         (Layout::Segment_states): New type declaration.
7002         (Layout::save_segments, Layout::restore_segments,
7003         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7004         Layout::relaxation_loop_body): New method declarations.
7005         (Layout::Output_section_data_list): New type declaration.
7006         (Layout::Relaxation_debug_check): New class definition.
7007         (Layout::record_output_section_data_from_script_,
7008         Layout::script_output_section_data_list_, Layout::segment_states_,
7009         Layout::relaxation_debug_check_): New data members.
7010         * output.cc: (Output_section_headers::do_size): New method definition.
7011         (Output_section_headers::Output_section_headers): Move size
7012         computation to Output_section_headers::do_size.
7013         (Output_segment_headers::do_size): New method definition.
7014         (Output_file_header::Output_file_header): Move size computation to
7015         Output_file_header::do_size and call it.
7016         (Output_file_header::do_size): New method definition.
7017         (Output_data_group::Output_data_group): Adjust call to
7018         Output_section_data.
7019         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7020         (Output_symtab_xindex::do_write): Add array bound check.
7021         (Output_section::Input_section::print_to_mapfile): Handle
7022         RELAXED_INPUT_SECTION_CODE.
7023         (Output_section::Output_section): Initialize data member checkpoint_.
7024         (Output_section::~Output_section): Delete checkpoint object pointed
7025         by checkpoint_.
7026         (Output_section::add_input_section): Always add an Input_section if
7027         relaxing.
7028         (Output_section::add_merge_input_section): Add assert.
7029         (Output_section::relax_input_section): New method definition.
7030         (Output_section::set_final_data_size): Set load address to zero for
7031         an unallocated section.
7032         (Output_section::do_address_and_file_offset_have_reset_values):
7033         New method definition.
7034         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7035         Handle relaxed input section.
7036         (Output_section::sort_attached_input_sections): Checkpoint input
7037         section list lazily.
7038         (Output_section::get_input_sections): Change type of input_sections to
7039         list of Simple_input_section pointers.  Checkpoint input section list
7040         lazily.  Also handle relaxed input sections.
7041         (Output_section::add_input_section_for_script): Take a reference to
7042         a Simple_input_section object instead of Relobj pointer and section
7043         index as parameter.  Handle relaxed input sections.
7044         (Output_section::save_states, Output_section::restore_states): New
7045         method definitions.
7046         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7047         (Output_data::is_data_size_fixed): New method definition.
7048         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7049         if it is fixed.
7050         (Output_data::address_and_file_offset_have_reset_values): New method
7051         definition.
7052         (Output_data::do_address_and_file_offset_have_reset_values): New method
7053         definition.
7054         (Output_data::set_data_size): Check that data size is not fixed.
7055         (Output_data::fix_data_size): New method definition.
7056         (Output_data::is_data_size_fixed_): New data member.
7057         (Output_section_headers::set_final_data_size): New method definition.
7058         (Output_section_headers::do_size): New method declaration.
7059         (Output_segment_headers::set_final_data_size): New method definition.
7060         (Output_segment_headers::do_size): New method declaration.
7061         (Output_file_header::set_final_data_size)::New method definition.
7062         (Output_file_header::do_size)::New method declaration.
7063         (Output_section_data::Output_section_data): Add new parameter
7064         is_data_size_fixed and use it to fix data size.
7065         (Output_data_const::Output_data_const): Adjust call to base class
7066         constructor and fix data size.
7067         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7068         base class constructor and fix data size.
7069         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7070         base class constructor and fix data size.
7071         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7072         class constructor and fix data size.
7073         (Output_data_group::set_final_data_size): New method definition.
7074         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7075         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7076         class constructor and fix data size.
7077         (Output_relaxed_input_section): New class definition.
7078         (Output_section::Simple_input_section): New class definition.
7079         (Output_section::get_input_sections): Adjust parameter list.
7080         (Output_section::add_input_section_for_script): Same.
7081         (Output_section::save_states, Output_section::restore_states,
7082         Output_section::do_address_and_file_offset_have_reset_values,
7083         (Output_section::Input_section::Input_section): Handle
7084         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7085         Output_relaxed_input_section.
7086         (Output_section::Input_section::is_input_section,
7087         Output_section::Input_section::set_output_section): Handle relaxed
7088         input section.
7089         (Output_section::Input_section::is_relaxed_input_section,
7090         Output_section::Input_section::output_section_data,
7091         Output_section::Input_section::relaxed_input_section): New method
7092         definitions.
7093         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7094         value.
7095         (Output_section::Input_section::u1_): Update comments.
7096         (Output_section::Input_section::u2_): Add new union member poris.
7097         (Output_section::Checkpoint_output_section): New classs definition.
7098         (Output_section::relax_input_section): New method declaration.
7099         (Output_section::checkpoint_): New data member.
7100         (Output_segment): Update comments.
7101         (Output_segment::Output_segment): Un-privatize copy constructor.
7102         (Output_segment::operator=): Un-privatize.
7103         * script-sections.cc (Output_section_element::Input_section_list):
7104         Change element type to Output_section::Simple_input_section.
7105         (Output_section_element_dot_assignment::set_section_addresses):
7106         Register output section data for relaxation clean up.
7107         (Output_data_exression::Output_data_expression): Adjust call to base
7108         constructor to fix data size.
7109         (Output_section_element_data::set_section_addresses): Register
7110         Output_data_expression object for relaxation clean up.
7111         (struct Input_section_info): Replace Relobj pointer and section index
7112         pair with Output_section::Simple_input_section and Convert struct to a
7113         class.
7114         (Input_section_sorter::operator()): Adjust access to
7115         Input_section_info data member to use accessors.
7116         (Output_section_element_input::set_section_addresses): Use layout
7117         parameter.  Adjust code to use Output_section::Simple_input_section
7118         and Input_secction_info classes.  Register filler for relaxation
7119         clean up.
7120         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7121         and section index pair with Output_section::Simple_input_section
7122         class.  Adjust code accordingly.
7123         (Phdrs_element::release_segment): New method definition.
7124         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7125         segment list.
7126         (Script_sections::release_segments): New method definition.
7127         * gold/script-sections.h (Script_sections::release_segments): New
7128         method declaration.
7129         * gold/target.h (Target::may_relax, Target::relax,
7130         Target::do_may_relax, Target::do_relax): New method definitions.
7131
7132 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7133
7134         * arm.cc (has_signed_unsigned_overflow): New function.
7135         (Arm_relocate_functions::abs8): New function.
7136         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7137         (Target_arm::Scan::global): Likewise.
7138         (Target_arm::relocate::relocate): Likewise.
7139         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7140         Likewise.
7141
7142 2009-09-16  Cary Coutant  <ccoutant@google.com>
7143
7144         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7145         * testsuite/Makefile.in: Regenerate.
7146
7147 2009-09-11  Nick Clifton  <nickc@redhat.com>
7148
7149         * po/gold.pot: Updated by the Translation project.
7150
7151 2009-09-08  Cary Coutant  <ccoutant@google.com>
7152
7153         * output.cc (Output_file::open): Add execute permission to empty file.
7154         * testsuite/Makefile.am (permission_test): New test.
7155         * testsuite/Makefile.in: Regenerate.
7156
7157 2009-09-02  Ian Lance Taylor  <iant@google.com>
7158
7159         * output.cc (Output_file::resize): Call map_no_anonymous rather
7160         than map.
7161
7162 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7163
7164         * gold.cc: Include "incremental.h".
7165         (queue_initial_tasks): Call Incremental_checker methods.
7166         * incremental.cc: Include "output.h".
7167         (Incremental_checker::can_incrementally_link_output_file): New
7168         method.
7169         * incremental.h (Incremental_checker): New class.
7170
7171         * output.cc (Output_file::open_for_modification): New method.
7172         (Output_file::map_anonymous): Changed return type to bool.  Record
7173         map in base_ field.
7174         (Output_file::map_no_anonymous): New method, broken out of map.
7175         (Output_file::map): Use map_no_anonymous and map_anonymous.
7176         * output.h (class Output_file): Update declarations.
7177
7178 2009-08-24  Cary Coutant  <ccoutant@google.com>
7179
7180         * options.h (Command_line::Pre_options): New class.
7181         (Command_line::pre_options): New member.
7182         * options.cc (gold::options::ready_to_register): New variable.
7183         (One_option::register_option): Do nothing if not registering options.
7184         Assert if same short option registered twice.
7185         (General_options::General_options): Turn off option registration when
7186         done constructing.
7187         (Command_line::Pre_options::Pre_options): New constructor.
7188
7189 2009-08-24  Cary Coutant  <ccoutant@google.com>
7190
7191         * options.h (General_options::no_keep_memory): Remove incorrect
7192         short option.
7193
7194 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7195
7196         * Makefile.am (am__skiplex, am__skipyacc): New.
7197         * Makefile.in: Regenerate.
7198
7199 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7200
7201         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7202         (INCLUDES): ... this.
7203         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7204         (AM_CPPFLAGS): Renamed from ...
7205         (INCLUDE): ... this.
7206         * Makefile.in, testsuite/Makefile.in: Regenerate.
7207
7208         * Makefile.in: Regenerate.
7209         * aclocal.m4: Likewise.
7210         * config.in: Likewise.
7211         * configure: Likewise.
7212         * testsuite/Makefile.in: Likewise.
7213
7214         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7215         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7216         * Makefile.in: Regenerate.
7217         * testsuite/Makefile.in: Regenerate.
7218
7219 2009-08-19  Cary Coutant  <ccoutant@google.com>
7220
7221         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7222         symbols in shared libraries overridden by hidden or internal symbols
7223         in the main program.
7224
7225 2009-08-19  Chris Demetriou  <cgd@google.com>
7226
7227         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7228         checking source file names in error messages.
7229
7230 2009-08-18  Doug Kwan  <dougkwan@google.com>
7231
7232         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7233         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7234         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7235         an elfcpp::Ehdr as parameter.
7236         * object.cc (Object::set_target): Remove the version that looks up
7237         a target and sets it.
7238         (Sized_relobj::setup): Take a Target object instead of
7239         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7240         (make_elf_sized_object): Find target and ask target to
7241         make an ELF object.
7242         * object.h: (Object::set_target): Remove the version that looks up
7243         a target and sets it.
7244         (Sized_relobj::setup): Take a Target object instead of
7245         an elfcpp:Ehdr as parameter.
7246         * target.cc: Include dynobj.h.
7247         (Target::do_make_elf_object_implementation): New.
7248         (Target::do_make_elf_object): New.
7249         * target.h (Target::make_elf_object): New template declaration.
7250         (Target::do_make_elf_object): New method declarations.
7251         (Target::do_make_elf_object_implementation): New template declaration.
7252
7253 2009-08-14  Ian Lance Taylor  <iant@google.com>
7254
7255         * gold.h (FUNCTION_NAME): Define.
7256         (gold_unreachable): Use FUNCTION_NAME.
7257
7258 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7259
7260         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7261         symbol in the --keep-unique list is not found.
7262
7263 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7264
7265         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7266         been maked as --keep-unique.
7267         (Icf::unfold_section): New function.
7268         * icf.h (Icf::unfold_section): New function.
7269         * options.h (General_options::keep_unique): New option.
7270         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7271         * testsuite/Makefile.in: Regenerate.
7272         * testsuite/icf_keep_unique_test.sh: New file.
7273         * testsuite/icf_keep_unique_test.cc: New file.
7274
7275 2009-08-12  Cary Coutant  <ccoutant@google.com>
7276
7277         PR 10471
7278         * resolve.cc (Symbol_table::resolve): Check for references from
7279         dynamic objects to hidden and internal symbols.
7280         * testsuite/Makefile.am (hidden_test.sh): New test.
7281         * testsuite/Makefile.in: Regenerate.
7282         * testsuite/hidden_test.sh: New script.
7283         * testsuite/hidden_test_1.c: New test source.
7284         * testsuite/hidden_test_main.c: New test source.
7285
7286 2009-08-11  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc: Update comments.
7289         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7290         segment to locate the .ARM.exidx section if present.
7291
7292 2009-08-09  Doug Kwan  <dougkwan@google.com>
7293
7294         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7295         patch.
7296
7297 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7298         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7299         compiler warnings.
7300
7301 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7302
7303         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7304         valid tls_segment only for non-debug-section relocations.
7305         * testsuite/Makefile.am: Add gc_tls_test.
7306         * testsuite/Makefile.in: Regenerate.
7307         * testsuite/gc_tls_test.cc: New file.
7308         * testsuite/gc_tls_test.sh: New file.
7309
7310 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7311
7312         * icf.cc: New file.
7313         * icf.h: New file.
7314         * Makefile.am (CCFILES): Add icf.cc.
7315         (HFILES): Add icf.h
7316         * Makefile.in: Regenerate.
7317         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7318         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7319         section, symbol and addend information for the relocs.
7320         * gold.cc (queue_middle_tasks): Call identical code folding.
7321         * gold.h: Add defines for multimap.
7322         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7323         to the call of finalize_local_symbols.
7324         * main.cc (main): Create object of class Icf.
7325         * object.cc (Sized_relobj::do_layout): Allow this function to be
7326         called twice during icf.
7327         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7328         to sections marked as identical by icf.
7329         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7330         when available.
7331         (Sized_relobj::do_section_entsize): New function.
7332         * object.h (Object::section_entsize): New function.
7333         (Object::do_section_entsize): New pure virtual function.
7334         (Relobj::finalize_local_symbols): Add new parameter.
7335         (Relobj::do_section_entsize): New function.
7336         * options.h (General_options::icf): New option.
7337         (General_options::icf_iterations): New option.
7338         (General_options::print_icf_sections): New option.
7339         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7340         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7341         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7342         icf.
7343         * symtab.cc (Symbol_table::is_section_folded): New function.
7344         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7345         to sections marked as identical by icf.
7346         * symtab.h (Symbol_table::set_icf): New function.
7347         (Symbol_table::icf): New function.
7348         (Symbol_table::is_section_folded): New function.
7349         (Symbol_table::icf_): New data member.
7350         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7351         * testsuite/Makefile.am: Add commands to build icf_test.
7352         * testsuite/Makefile.in: Regenerate.
7353         * testsuite/icf_test.sh: New file.
7354         * testsuite/icf_test.cc: New file.
7355
7356 2009-07-24  Chris Demetriou  <cgd@google.com>
7357
7358         * layout.cc (is_compressible_debug_section): Fix incorrect
7359         comment about compressed section names.
7360
7361 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7362
7363         PR 10419
7364         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7365
7366 2009-07-16  Ian Lance Taylor  <iant@google.com>
7367
7368         PR 10400
7369         * layout.h: #include <map>.
7370         (class Kept_section): Change from struct to class.  Add accessors
7371         and setters.  Add section size to Comdat_group mapping.  Change
7372         Comdat_group to std::map.  Add is_comdat_ field.  Add
7373         linkonce_size field in union.
7374         (class Layout): Update declaration of find_or_add_kept_section.
7375         Don't declare find_kept_object.
7376         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7377         parameter.  Add object, shndx, is_comdat, and is_group_name
7378         parameters.  Change all callers.  Adjust for new Kept_section.
7379         (Layout::find_kept_object): Remove.
7380         * object.cc (Sized_relobj::include_section_group): Update use of
7381         Kept_section.  Rename secnum to shndx.  Only record
7382         Kept_comdat_section if sections are the same size.
7383         (Sized_relobj::include_linkonce_section): Update use of
7384         Kept_section.  Only record Kept_comdat_section if sections are the
7385         same size.  Set size of linkonce section.
7386         (Sized_relobj::map_to_kept_section): Update call to
7387         get_kept_comdat_section.
7388         * object.h (class Sized_relobj): Rename fields in
7389         Kept_comdat_section to drop trailing underscores; change object
7390         field to Relobj*.  Change Kept_comdat_section_table to store
7391         struct rather than pointer.
7392         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7393         Add kept_object and kept_shndx parameters.  Change all callers.
7394         (Sized_relobj::get_kept_comdat_section): Change return type to
7395         bool.  Add kept_object and kept_shndx parameters.  Change all
7396         callers.
7397         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7398         Layout::find_or_add_kept_section.
7399
7400 2009-07-09  Ian Lance Taylor  <iant@google.com>
7401
7402         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7403         Reserve space in the hash table.
7404
7405 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7406
7407         * fileread.cc (File_read::get_mtime): New method.
7408         * fileread.h (Timespec): New structure.
7409         (File_read::get_mtime): New method.
7410         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7411         Renamed from timestamp_nsec.
7412         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7413         Elf_Xword.
7414         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7415         timestamp_nsec.
7416         (Incremental_inputs::report_archive): Save mtime; style fix.
7417         (Incremental_inputs::report_obejct): Save mtime; style fix.
7418         (Incremental_inputs::report_script): Save mtime; style fix.
7419         (Incremental_inputs::finalize_inputs): Style fix.
7420         (Incremental_inputs::finalize): Style fix.
7421         (Incremental_inputs::create_input_section_data): Store inputs
7422         mtime.
7423         * incremental.h (Incremental_inputs::report_script): Add mtime
7424         argument.
7425         (Incremental_inputs::Input_info::Input_info): Intialize only one
7426         union member.
7427         (Incremental_inputs::Input_info::archive): Move to nameless
7428         union.
7429         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7430         (Incremental_inputs::Input_info::script): Move to nameless union.
7431         (Incremental_inputs::mtime): New field.
7432         * script.cc (read_input_script): Pass file mtime to
7433         Incremental_input.
7434         * script.h (Script_info::inputs): Style fix.
7435
7436 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7437
7438         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7439         instead of 32.
7440
7441 2009-06-24  Ian Lance Taylor  <iant@google.com>
7442
7443         PR 10156
7444         * layout.cc (Layout::choose_output_section): If we find an
7445         existing section, update the flags.
7446         (Layout::create_notes): New function, broken out of
7447         Layout::finalize.
7448         (Layout::finalize): Don't create note sections.
7449         (Layout::create_note): Don't crash if linker script discards
7450         section.
7451         (Layout::create_gold_note): Likewise.
7452         (Layout::create_build_id): Likewise.  Don't set
7453         after_input_sections on the section.
7454         (Layout::create_executable_stack_info): Remove target parameter.
7455         Change caller.
7456         * layout.h (class Layout): Declare create_notes.  Update
7457         declaration of create_executable_stack_info.
7458         * gold.cc (queue_middle_tasks): Call create_notes.
7459         * output.cc (Output_section::update_flags_for_input_section): Move
7460         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7461         invalid.
7462         * output.h (Output_data::mark_address_invalid): New function.
7463         (class Output_section): Only declare, not define,
7464         update_flags_for_input_section.  Remove set_flags.
7465
7466 2009-06-24  Ian Lance Taylor  <iant@google.com>
7467
7468         * script-sections.cc (Output_section_definition::
7469         set_section_addresses): Rename shadowing local load_address to
7470         laddr.
7471
7472 2009-06-24  Ian Lance Taylor  <iant@google.com>
7473
7474         PR 10244
7475         * reloc.cc (relocate_sections): Skip empty relocation sections.
7476
7477 2009-06-23  Ian Lance Taylor  <iant@google.com>
7478
7479         PR 10156
7480         * layout.cc (Layout::create_note): Use choose_output_section
7481         rather than make_output_section.
7482
7483 2009-06-23  Ian Lance Taylor  <iant@google.com>
7484
7485         PR 10237
7486         * options.cc (General_options::parse_V): Set printed_version_.
7487         (General_options::General_options): Initialize printed_version_.
7488         * options.h (class General_options): Add printed_version_ field.
7489         * gold.cc (queue_initial_tasks): If there are no input files,
7490         don't give a fatal error if we printed the version information.
7491         (queue_middle_tasks): If using -r with a shared object, give a
7492         fatal error rather than an ordinary error.
7493
7494 2009-06-23  Ian Lance Taylor  <iant@google.com>
7495
7496         PR 10219
7497         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7498         (Layout::make_output_section): Set have_stabstr_section_ if we see
7499         a .stab*str section.
7500         (Layout::finalize): Call link_stabs_sections.
7501         (Layout::link_stabs_sections): New file.
7502         * layout.h (class Layout): Add have_stabstr_section_ field.
7503         Declare link_stabs_sections.
7504
7505 2009-06-23  Doug Kwan  <dougkwan@google.com>
7506
7507         * Makefile.am (libgold_a_LIBADD): New.
7508         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7509         * Makefile.in: Regenerate.
7510         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7511         * configure: Regenerate.
7512         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7513         * fileread.cc: Include sys/state.h
7514         * gold.h: Declare memmem and strndup if found missing.
7515         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7516
7517 2009-06-23  Ian Lance Taylor  <iant@google.com>
7518
7519         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7520         * configure: Rebuild.
7521
7522 2009-06-23  Ian Lance Taylor  <iant@google.com>
7523
7524         PR 10147
7525         * object.cc (Object::section_contents): Don't try to get a view if
7526         the section has length zero.
7527         (Object::handle_gnu_warning_section): If the section is empty, use
7528         the name of the section as the warning.
7529
7530 2009-06-23  Ian Lance Taylor  <iant@google.com>
7531
7532         PR 10133
7533         * stringpool.h (class Stringpool_template): Add optimize_ field.
7534         (Stringpool_template::set_optimize): New function.
7535         * stringpool.cc (Stringpool_template::Stringpool_template):
7536         Initialize optimize_ field.
7537         (Stringpool_template::set_string_offsets): Test local optimize
7538         fild rather than parameter.
7539         * layout.cc (Layout::Layout): Call set_optimize on the section
7540         name stringpool.
7541
7542 2009-06-22  Ian Lance Taylor  <iant@google.com>
7543
7544         PR 10030
7545         * yyscript.y: Parse TARGET.
7546         * script.cc (script_set_target): New function.
7547         * script-c.h (script_set_target): Declare.
7548         * options.cc (General_options::string_to_object_format): Rename
7549         from string_to_object_format in anonymous namespace.  Change
7550         callers.
7551         * options.h (class General_options): Declare
7552         string_to_object_format.
7553
7554 2009-06-22  Ian Lance Taylor  <iant@google.com>
7555
7556         * script-sections.cc (Script_sections::create_segments): Don't put
7557         program headers in a PT_LOAD segment if -n or -N.
7558
7559 2009-06-22  Ian Lance Taylor  <iant@google.com>
7560
7561         PR 10141
7562         * options.h (class General_options): Add -z lazy and -z now.  Sort
7563         -z options into alphabetical order.
7564         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7565
7566 2009-06-21  Ian Lance Taylor  <iant@google.com>
7567
7568         * layout.cc (Layout::make_output_section): Call
7569         Target::new_output_section.
7570         (Layout::attach_allocated_section_to_segment): Put large section
7571         sections in a separate load segment with the large segment flag
7572         set.
7573         (Layout::segment_precedes): Sort large data segments after other
7574         load segments.
7575         (align_file_offset): New static function.
7576         (Layout::set_segment_offsets): Use align_file_offset.
7577         * output.h (class Output_section): Add is_small_section_ and
7578         is_large_section_ fields.
7579         (Output_section::is_small_section): New function.
7580         (Output_section::set_is_small_section):  New function.
7581         (Output_section::is_large_section): New function.
7582         (Output_section::set_is_large_section): New function.
7583         (Output_section::is_large_data_section): New function.
7584         (class Output_segment): Add is_large_data_segment_ field.
7585         (Output_segment::is_large_data_segment): New function.
7586         (Output_segment::set_is_large_data_segment): New function.
7587         * output.cc (Output_section::Output_section): Initialize new
7588         fields.
7589         (Output_segment::Output_segment): Likewise.
7590         (Output_segment::add_output_section): Add assertion that large
7591         data sections always go in large data segments.  Force small data
7592         sections to the end of the list of data sections.  Force small BSS
7593         sections to the start of the list of BSS sections.  For large BSS
7594         sections to the end of the list of BSS sections.
7595         * symtab.h (class Symbol): Declare is_common_shndx.
7596         (Symbol::is_defined): Check Symbol::is_common_shndx.
7597         (Symbol::is_common): Likewise.
7598         (class Symbol_table): Define enum Commons_section_type.  Update
7599         declarations.  Add small_commons_ and large_commons_ fields.
7600         * symtab.cc (Symbol::is_common_shndx): New function.
7601         (Symbol_table::Symbol_table): Initialize new fields.
7602         (Symbol_table::add_from_object): Put small and large common
7603         symbols in the right list.
7604         (Symbol_table::sized_finalized_symbol): Check
7605         Symbol::is_common_shndx.
7606         (Symbol_table::sized_write_globals): Likewise.
7607         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7608         common symbol lists.  Don't call do_allocate_commons_list if the
7609         list is empty.
7610         (Symbol_table::do_allocate_commons_list): Remove is_tls
7611         parameter.  Add comons_section_type parameter.  Change all
7612         callers.  Handle small and large common symbols.
7613         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7614         Symbol::is_common_shndx.
7615         * resolve.cc (symbol_to_bits): Likewise.
7616         * target.h (Target::small_common_shndx): New function.
7617         (Target::small_common_section_flags): New function.
7618         (Target::large_common_shndx): New function.
7619         (Target::large_common_section_flags): New function.
7620         (Target::new_output_section): New function.
7621         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7622         small_common_section_flags, and large_common_section_flags
7623         fields.
7624         (Target::do_new_output_section): New virtual function.
7625         * arm.cc (Target_arm::arm_info): Initialize new fields.
7626         * i386.cc (Target_i386::i386_info): Likewise.
7627         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7628         Likewise.
7629         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7630         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7631         (Target_x86_64::do_new_output_section): New function.
7632         * configure.ac: Define conditional MCMODEL_MEDIUM.
7633         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7634         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7635         (large_LDFLAGS): Define.
7636         * testsuite/large.c: New file.
7637         * testsuite/testfile.cc (Target_test::test_target_info):
7638         Initialize new fields.
7639         * configure, testsuite/Makefile.in: Rebuild.
7640
7641 2009-06-05  Doug Kwan  <dougkwan@google.com>
7642
7643         * Makefile.am (CCFILES): Add target.cc.
7644         * Makefile.in: Regenerate.
7645         * i386.cc (class Target_i386): Define new virtual method to
7646         override do_is_local_label_name in parent.
7647         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7648         local symbols if --discard-locals or -X is given.
7649         * options.h (class General_options): Declare new options
7650         '--discard-locals' and '-X' for discarding locals.
7651         * target.h (class Target): Define new methods is_local_label_name.
7652         Declare new virtual method do_is_local_label_name.
7653         * target.cc: New file.
7654         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7655         (check_SCRIPTS): Add discard_locals_test.sh.
7656         (check_DATA): Add discard_local_tests.syms.
7657         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7658         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7659         * testsuite/Makefile.in: Regenerate.
7660         * testsuite/discard_locals_test.c: New file.
7661         * testsuite/discard_locals_test.sh: Same.
7662
7663 2009-06-05  Doug Kwan  <dougkwan@google.com>
7664
7665         * object.cc (Sized_relobj::Sized_relobj): Initialize
7666         discarded_eh_frame_shndx_ to -1U.
7667         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7668         section.
7669         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7670         a discarded .eh_frame section.
7671         (Sized_relobj::do_finalize_local_symbols): Ditto.
7672         * object.h (class Sized_relobj): Declare new member
7673         discarded_eh_frame_shndx_.
7674         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7675         (local_labels_test.o, local_labels_test): New rules.
7676         * testsuite/Makefile.in: Regenerate.
7677
7678 2009-06-04  Doug Kwan  <dougkwan@google.com>
7679
7680         * layout.cc (Layout::section_name_mapping): Add mapping for
7681         special ARM sections.
7682
7683 2009-06-03  Doug Kwan  <dougkwan@google.com>
7684
7685         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7686         (utils::has_overflow): Same.
7687
7688 2009-06-03  Ian Lance Taylor  <iant@google.com>
7689
7690         * layout.cc (Layout::section_name_mapping): New array, replacing
7691         Layout::linkonce_mapping.
7692         (Layout::section_name_mapping_count): New variable, replacing
7693         Layout::linkonce_mapping_count.
7694         (Layout::linkonce_output_name): Remove.
7695         (Layout::output_section_name): Rewrite.
7696         * layout.h (class Layout): Rename Linkonce_mapping to
7697         Section_name_mapping, linkonce_mapping to section_name_mapping,
7698         linkonce_mapping_count to section_name_mapping_count.  Don't
7699         declare linkonce_output_name.
7700
7701 2009-06-03  Doug Kwan  <dougkwan@google.com>
7702
7703         * gold/arm.cc (namespace utils): New.
7704         (Target_arm::reloc_is_non_pic): Define new method.
7705         (class Arm_relocate_functions): New.
7706         (Target_arm::Relocate::relocate): Handle relocation types used by
7707         Android.
7708
7709 2009-06-03  Ian Lance Taylor  <iant@google.com>
7710
7711         * arm.cc (Target_arm::scan::global): Use || instead of |.
7712
7713 2009-06-02  Doug Kwan  <dougkwan@google.com>
7714
7715         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7716         issued_non_pic_error_.
7717         (class Target_arm::Scan): Declare new method check_non_pic.
7718         Define new method symbol_needs_plt_entry.
7719         Declare new data member issued_non_pic_error_.
7720         (class Target_arm::Relocate): Declare new method
7721         should_apply_static_reloc.
7722         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7723         (Target_arm::Scan::check_non_pic): Define new method.
7724         (Target_arm::Scan::local): Handle a small subset of reloc types used
7725         by Android.
7726         (Target_arm::Scan::local): Same.
7727         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7728
7729 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7730
7731         * incremental.cc (Incremental_inputs::report_command_line): Filter
7732         out --incremental-* options.
7733
7734 2009-05-29  Doug Kwan  <dougkwan@google.com>
7735
7736         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7737         template class.
7738         (class Target_arm): Update comment.
7739         (Target_arm::Target_arm): Initialize new data members GOT_,
7740         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7741         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7742         and Target_arm::rel_dyn_section.
7743         Declare new_enum Target_arm::Got_type.
7744         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7745         and DYNBSS_.
7746         Update commments for member do_dynsym_value.
7747         (Target_arm::got_size, Target_arm::plt_section,
7748         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7749         new methods inside class defintion.
7750         (Target_arm::got_section): Define new method.
7751         (Target_arm::rel_dyn_section): Same.
7752         (Output_data_plt_arm): New template class.
7753         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7754         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7755         (Output_data_plt_arm::add_entry): Same.
7756         (Output_data_plt_arm::first_plt_entry): Define new
7757         static data member for PLT instruction template.
7758         (Output_data_plt_arm::plt_entry): Same.
7759         (Output_data_plt_arm::do_write): Define new method.
7760         (Target_arm::make_plt_entry): Same.
7761         (Target_arm::do_finalize_sections): Same.
7762         (Target_arm::do_dynsym_value): Same.
7763
7764 2009-05-28  Doug Kwan  <dougkwan@google.com>
7765
7766         * Makefile.am (TARGETSOURCES): Add arm.cc.
7767         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7768         * Makefile.in: Regenerate.
7769         * arm.cc: New file.
7770         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7771
7772 2009-05-26  Doug Kwan  <dougkwan@google.com>
7773
7774         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7775         (General_options::check_excluded_libs): Strip off directories in
7776         archive name before matching like GNU ld does.
7777         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7778         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7779         (exclude_libs_test_LDFLAGS): Add linker option
7780         -Wl,--exclude-libs,libexclude_libs_test_3
7781         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7782         an explicit archive without using -l.
7783         (alt/libexclude_libs_test_3.a): New make rule.
7784         * testsuite/Makefile.in: Regenerate.
7785         * testsuite/exclude_libs_test.c : Declare lib3_default().
7786         (main): Call it.
7787         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7788         * exclude_libs_test_3.c: New file.
7789
7790 2009-05-26  Nick Clifton  <nickc@redhat.com>
7791
7792         * po/id.po: New Indonesian translation.
7793         * po/gold.pot: Updated template file.
7794
7795 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7796
7797         * testsuite/Makefile.am: Add -ffunction-sections to compile
7798         gc_comdat_test files.  Add -Wl,--gc-sections to build
7799         gc_comdat_test.
7800         * testsuite/Makefile.in: Regenerate.
7801         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7802
7803 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7804
7805         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7806         kept comdat section was garbage collected.
7807         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7808         * testsuite/Makefile.in: Regenerate.
7809         * testsuite/gc_comdat_test.sh: New file.
7810         * testsuite/gc_comdat_test_1.cc: New file.
7811         * testsuite/gc_comdat_test_2.cc: New file.
7812
7813 2009-05-19  Doug Kwan  <dougkwan@google.com>
7814
7815         * archive.cc (Archive::Archive): Move constructor from archive.h
7816         to here.  Initialize no_export_.
7817         (Archive::get_elf_object_for_member): Set no_export flag of object.
7818         * archive.h (Archive::Archive): Move constructor body to
7819         archive.cc.
7820         (Archive::no_export): New method.
7821         (Archive::no_export_): New field.
7822         * object.h (Object::Object): Initialize no_export_ to false.
7823         (Object::no_export, Object::set_no_export): New methods.
7824         (Object::no_export_): New field.
7825         * options.cc (General_options::parse_exclude_libs): New method.
7826         (General_options::check_excluded_libs) Same.
7827         * options.h (exclude_libs): New option.
7828         (General_options::check_excluded_libs): New method declaration.
7829         (General_options::excluded_libs_): New field.
7830         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7831         default or protected visibility if an object has no-export flag set.
7832         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7833         (check_SCRIPTS): Add exclude_libs_test.sh.
7834         (check_DATA): Add exclude_libs_test.syms.
7835         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7836         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7837         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7838         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7839         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7840         libexclude_libs_test_2.a): New rules.
7841         * testsuite/Makefile.in: Regenerate.
7842         * testsuite/exclude_libs_test.c: New file.
7843         * testsuite/exclude_libs_test.sh: Ditto.
7844         * testsuite/exclude_libs_test_1.c: Ditto.
7845         * testsuite/exclude_libs_test_2.c: Ditto.
7846
7847 2009-05-15  Ian Lance Taylor  <iant@google.com>
7848
7849         * configure.ac: Check for declarations for cases where libiberty.h
7850         checks HAVE_DECL_xxx.
7851         * configure, config.in: Rebuild.
7852
7853 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7854
7855         * gold.h (Incremental_argument_list): Remove (invalid) forward
7856         declaration.
7857         * incremental.cc (Incremental_inputs::report_achive): New method.
7858         (Incremental_inputs::report_object): New method.
7859         (Incremental_inputs::report_script): New method.
7860         (Incremental_inputs::finalize_inputs): New method.
7861         (Incremental_inputs::finalize): Call finalize_inputs().
7862         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7863         Create inputs entries.
7864         * incremental.h (Incremental_input_type): New enum.
7865         (Incremental_inputs::Incremental_input): Initialize new fields.
7866         (Incremental_inputs::report_inputs): New method.
7867         (Incremental_inputs::report_achive): New method.
7868         (Incremental_inputs::report_object): New method.
7869         (Incremental_inputs::report_script): New method.
7870         (Incremental_inputs::finalize_inputs): New method.
7871         (Incremental_inputs::Input_info): New struct.
7872         (Incremental_inputs::Input_info_map): New typedef.
7873         (Incremental_inputs::lock_): New field.
7874         (Incremental_inputs::Inputs_): New field.
7875         (Incremental_inputs::Inputs_map): New field.
7876         * main.cc (main): Call Incremental_input::report_inputs.
7877         * options.h (Input_argument_list): Typedef moved from
7878         Input_arguments.
7879         (Input_file_group::Files): Remove, use ::Input_argument_list.
7880         (Input_file_group::Input_argument_list): Remove, use
7881         ::Input_argument_list.
7882         * plugin.cc (Plugin_manager::add_input_file): Add error in
7883         incremental build.
7884         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7885         functions.
7886         * script.cc (read_input_script): Call
7887         Incremental_input::report_script.
7888         * script.h (Script_info): New class.
7889
7890 2009-04-27  Ian Lance Taylor  <iant@google.com>
7891
7892         * x86_64.cc (do_adjust_output_section): Set entsize to
7893         plt_entry_size.
7894
7895 2009-04-23  Elliott Hughes  <enh@google.com>
7896
7897         * output.cc (Output_file::close): After short writes, continue
7898         writing from the correct offset in the buffer being written.
7899
7900 2009-04-23  Chris Demetriou  <cgd@google.com>
7901
7902         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7903         * configure: Regenerate.
7904         * config.in: Regenerate.
7905         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7906         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7907
7908 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7909
7910         * incremental.cc (Incremental_inputs_header_data): Renamed from
7911         Incremental_input_header_data.
7912         (Incremental_inputs_header_data::data_size): New field.
7913         (Incremental_inputs_header_data::put_input_file_count): Renamed
7914         from input_file_count.
7915         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7916         from command_line_offset.
7917         (Incremental_inputs_header_data::put_reserved): Renamed from
7918         put_reserved.
7919         (Incremental_inputs_entry_data): Renamed from
7920         Incremental_input_entry_data.
7921         (Incremental_inputs_entry_data::data_size): New field.
7922         (Incremental_inputs::report_command_line): New method.
7923         (Incremental_inputs::finalize): New method.
7924         (Incremental_inputs::create_incremental_inputs_data): New method.
7925         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7926         * incremental.h: New file.
7927         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7928        (Layout::finalize): Create incremental inputs section in
7929         incremental builds.
7930        (Layout::create_incremental_info_sections): New method.
7931         * layout.h (Layout::incremental_inputs): New method.
7932        (Layout::create_incremental_info_sections): New method.
7933        (Layout::incremental_inputs_): New field.
7934         * main.cc (main): Notify Incremental_input of the command line.
7935
7936 2009-04-01  Ian Lance Taylor  <iant@google.com>
7937             Mikolaj Zalewski  <mikolajz@google.com>
7938
7939         * gold.h (reserve_unordered_map): Define, three versions, one for
7940         each version of Unordered_map.
7941         * layout.cc (Layout::Layout): Remove options parameter.  Add
7942         number_of_input_files parameter.  Don't initialize options_.
7943         Initialize number_of_input_files_ and resized_signatures_.  Move
7944         sections_are_attached_.
7945         (Layout::layout_group): Reserve space for group_signatures_.
7946         (Layout::find_or_add_kept_section): Change name parameter to be a
7947         reference.  Resize signatures_ map when it gets large enough.
7948         (Layout::layout_eh_frame): Use parameters->options() instead of
7949         this->options_.
7950         (Layout::make_output_section): Likewise.
7951         (Layout::attach_allocated_section_to_segment): Likewise.
7952         (Layout::finalize, Layout::create_executable_stack): Likewise.
7953         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7954         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7955         * layout.h (class Layout): Update declarations.  Remove options_
7956         field.  Add number_of_input_files_ and resized_signatures_
7957         fields.  Move sections_are_attached_ field.
7958         * main.cc (main): Pass number of input files to Layout
7959         constructor.  Don't pass options.
7960
7961 2009-03-30  Ian Lance Taylor  <iant@google.com>
7962
7963         * ffsll.c (ffsll): Correct implementation.
7964
7965 2009-03-27  Ian Lance Taylor  <iant@google.com>
7966
7967         * ffsll.c: New file.
7968         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7969         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7970         * ftruncate.c (ftruncate): Declare before definition.
7971         * mremap.c (mremap): Likewise.
7972         * pread.c (pread): Likewise.
7973         * configure, Makefile.in, config.in: Rebuild.
7974
7975         * mremap.c: New file.
7976         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7977         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7978         (mremap): Declare if HAVE_MREMAP is not defined.
7979         * configure, Makefile.in, config.in: Rebuild.
7980
7981 2009-03-27  Cary Coutant  <ccoutant@google.com>
7982
7983         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7984         position independent.
7985         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7986         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7987
7988 2009-03-24  Cary Coutant  <ccoutant@google.com>
7989
7990         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7991         an executable.
7992         (needs_dynamic_reloc): Likewise.
7993
7994 2009-03-24  Ian Lance Taylor  <iant@google.com>
7995
7996         * yyscript.y (file_cmd): Recognize EXTERN.
7997         (extern_name_list, extern_name_list_body): New nonterminals.
7998         * script.cc (script_add_extern): Define.
7999         * script-c.h (script_add_extern): Declare.
8000
8001 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8002
8003         * object.cc (is_elf_object): Define.
8004         * object.h (is_elf_object): Declare.
8005         * archive.cc (Archive::get_elf_object_for_member): Call
8006         is_elf_object.
8007         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8008
8009 2009-03-24  Elliott Hughes  <enh@google.com>
8010
8011         * output.cc (Output_file::map_anonymous): Define.
8012         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8013         try an anonymous one.  Report the size if the mmap fails.
8014         * output.h (class Output_file): Declare map_anonymous.
8015
8016 2009-03-24  Ian Lance Taylor  <iant@google.com>
8017
8018         * target-select.cc (instantiate_target): Don't acquire the lock if
8019         the instantiated_target_ field has already been set.
8020
8021 2009-03-23  Ian Lance Taylor  <iant@google.com>
8022
8023         * gold-threads.h (class Initialize_lock): Define.
8024         * gold-threads.cc (class Initialize_lock_once): Define.
8025         (initialize_lock_control): New static variable.
8026         (initialize_lock_pointer): New static variable.
8027         (initialize_lock_once): New static function.
8028         (Initialize_lock::Initialize_lock): Define.
8029         (Initialize_lock::initialize): Define.
8030         * target-select.h: Include "gold-threads.h".
8031         (class Target_selector): Add lock_ and initialize_lock_ fields.
8032         Don't define instantiate_target, just declare it.
8033         * target-select.cc (Target_selector::Target_selector): Initialize
8034         new fields.
8035         (Target_selector::instantiate_target): Define.
8036         * descriptors.h: Include "gold-threads.h".
8037         (class Descriptors): Add initialize_lock_ field.
8038         * descriptors.cc (Descriptors::Descriptors): Initialize new
8039         field.
8040         (Descriptors::open): Use initialize_lock_ field
8041         * errors.h (class Errors): Add initialize_lock_ field.
8042         * errors.cc (Errors::Errors): Initialize new field.
8043         (Errors::initialize_lock): Use initialize_lock_ field.
8044         * powerpc.cc (class Target_selector_powerpc): Remove
8045         instantiated_target_ field.  In do_recognize call
8046         instantiate_target rather than do_instantiate_target.  In
8047         do_instantiate_target just allocate a new target.
8048         * sparc.cc (class Target_selector_sparc): Likewise.
8049
8050         * freebsd.h: New file.
8051         * i386.cc: Include "freebsd.h".
8052         (Target_i386): Derive from Target_freebsd rather than
8053         Sized_target.
8054         (Target_selector_i386): Derive from Target_selector_freebsd rather
8055         than Target_selector.
8056         * x86_64.cc: Include "freebsd.h".
8057         (Target_x86_64): Derive from Target_freebsd rather than
8058         Sized_target.
8059         (Target_selector_x86_64): Derive from Target_selector_freebsd
8060         rather than Target_selector.
8061         * target.h (class Target): Add adjust_elf_header and
8062         do_adjust_elf_header.
8063         * output.cc (Output_file_header:: do_sized_write): Call target
8064         adjust_elf_header routine.
8065         * configure.tgt: Set targ_osabi.
8066         * configure.ac: Define GOLD_DEFAULT_OSABI.
8067         * parameters.cc (Parameters::default_target): Pass
8068         GOLD_DEFAULT_OSABI to select_target.
8069         * target-select.h (class Target_selector): Make instantiate_target
8070         protected rather than private.
8071         * Makefile.am (HFILES): Add freebsd.h.
8072         * configure, Makefile.in, config.in: Rebuild.
8073
8074         * merge.cc (do_add_input_section): Correct pend value.  Change
8075         message about last entry not being null terminated from error to
8076         warning.
8077
8078 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8079
8080         * incremental.cc: New file.
8081         * Makefile.am (CCFILES): Add incremental.cc.
8082         * Makefile.in: Rebuild.
8083
8084 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8085
8086         * layout.cc (Layout::output_section_name): Preserve names
8087         of '.note.' sections.
8088
8089 2009-03-19  Ian Lance Taylor  <iant@google.com>
8090
8091         * descriptors.cc (Descriptors::open): Check that the options are
8092         valid before using them.
8093
8094 2009-03-18  Ian Lance Taylor  <iant@google.com>
8095
8096         * script-sections.h: Include <list>.
8097         (class Script_sections): Change Sections_elements from std::vector
8098         to std::list.  Typedef public Elements_iterator.  Add
8099         orphan_section_placement_, data_segment_align_start_, and
8100         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8101         field.
8102         * script-sections.cc (class Orphan_section_placement): New class.
8103         (class Sections_element): Add virtual functions is_relro and
8104         orphan_section_init.  Remove virtual function place_orphan_here.
8105         (class Output_section_definition): Add is_relro and
8106         orphan_section_init.  Remove place_orphan_here.
8107         (class Orphan_output_section): Likewise.
8108         (Script_sections::Script_sections): Update for field changes.
8109         (Script_sections::data_segment_align): Set saw_data_segment_align_
8110         and data_segment_align_start_, not data_segment_align_index.
8111         (Script_sections::data_segment_relro_end): Check
8112         saw_data_segment_align_.  Use data_segment_align_start_ rather
8113         than data_segment_align_index_.
8114         (Script_sections::place_orphan): Rewrite to use
8115         Orphan_section_placement.
8116
8117 2009-03-17  Ian Lance Taylor  <iant@google.com>
8118
8119         * archive.cc (Archive::add_symbols): Check for a version attached
8120         to the symbol name in the archive map.
8121         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8122         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8123         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8124         (ver_test_11.a): New target.
8125         * testsuite/Makefile.in: Rebuild.
8126
8127         * configure.ac: Check for chsize and posix_fallocate.  Replace
8128         ftruncate.
8129         * ftruncate.c: New file, from gnulib.
8130         * output.cc (posix_fallocate): Define dummy version if not
8131         HAVE_POSIX_FALLOCATE.
8132         (Output_file::map): Call posix_fallocate rather than lseek and
8133         write.
8134         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8135         * configure, Makefile.in, config.in: Rebuild.
8136
8137 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8138
8139         * layout.h (Layout::create_note): Add section_name parameter.
8140         * layout.cc (Layout::create_note): Likewise.
8141         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8142
8143 2009-03-17  Ian Lance Taylor  <iant@google.com>
8144
8145         * descriptors.cc: Include "options.h".
8146         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8147         (Descriptors::open): Always use O_CLOEXEC when opening a new
8148         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8149         then set FD_CLOEXEC.
8150
8151         * sparc.cc (class Target_sparc): Add has_got_section.
8152         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8153         make sure we have a GOT section.
8154
8155         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8156         (Target_sparc::Scan::local): Likewise.
8157         (Target_sparc::Scan::global): Likewise.
8158         (Target_sparc::Relocate::relocate): Likewise.
8159         (Target_sparc::Relocate::relocate_tls): Likewise.
8160
8161         * symtab.cc (Symbol_table::define_default_version): New function,
8162         broken out of add_from_object.
8163         (Symbol_table::add_from_object): Call define_default_version.
8164         (Symbol_table::define_special_symbol): Add resolve_oldsym
8165         parameter.  Change all callers.  If the version for a symbol comes
8166         from a version script, resolve it with the symbol with the same
8167         name with no version.  Also add the symbol without a version if
8168         appropriate.
8169         (do_define_in_output_data): If resolving with oldsym, don't delete
8170         sym.
8171         (do_define_in_output_segment): Likewise.
8172         (do_define_as_constant): Likewise.
8173         * symtab.h (class Symbol_table): Update declarations.
8174
8175 2009-03-13  Ian Lance Taylor  <iant@google.com>
8176
8177         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8178         (Read_symbols::requeue): New function.
8179         (Read_symbols::do_read_symbols): If make_elf_object fails because
8180         the target type is not configured, and the file was searched for,
8181         issue a warning and retry with the next directory.
8182         (Add_symbols::run): If the file has an incompatible format, and
8183         it was searched for, requeue the Read_symbols task.  On error,
8184         release the object.
8185         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8186         dirindex parameter to constructor.  Change all callers.  Declare
8187         incompatible_warning and requeue.
8188         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8189         input_argument_ and input_group_ fields.  Add them to
8190         constructor.  Change all callers.
8191         (class Read_script): Add dirindex_ field.  Add it to constructor.
8192         Change all callers.
8193         * archive.cc (Archive::setup): Remove input_objects parameter.
8194         Change all callers.
8195         (Archive::get_file_and_offset): Likewise.
8196         (Archive::read_all_symbols): Likewise.
8197         (Archive::read_symbols): Likewise.
8198         (Archive::get_elf_object_for_member): Remove input_objects
8199         parameter.  Add punconfigured parameter.  Change all callers.
8200         (Archive::add_symbols): Change return type to bool.  Check return
8201         value of include_member.
8202         (Archive::include_all_members): Likewise.
8203         (Archive::include_member): Change return type to bool.  Return
8204         false if first included object has incompatible target.  Set
8205         included_member_ field.
8206         (Add_archive_symbols::run): If add_symbols returns false, requeue
8207         Read_symbols task.
8208         * archive.h (class Archive): Add included_member_ field.
8209         Initialize it in constructor.  Add input_file and searched_for
8210         methods.  Update declarations.
8211         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8212         input_argument_ fields.  Add them to constructor.  Change all
8213         callers.
8214         * script.cc: Include "target-select.h".
8215         (class Parser_closure): Add skip_on_incompatible_target_ and
8216         found_incompatible_target_ fields.  Add
8217         skip_on_incompatible_target parameter to constructor.  Change all
8218         callers.  Add methods skip_on_incompatible_target,
8219         clear_skip_on_incompatible_target, found_incompatible_target, and
8220         set_found_incompatible_target.
8221         (read_input_script): Add dirindex parameter.  Change all callers.
8222         If parser finds an incompatible target, requeue Read_symbols
8223         task.
8224         (script_set_symbol): Clear skip_on_incompatible_target in
8225         closure.
8226         (script_add_assertion, script_parse_option): Likewise.
8227         (script_start_sections, script_add_phdr): Likewise.
8228         (script_check_output_format): New function.
8229         * script.h (read_input_script): Update declaration.
8230         * script-c.h (script_check_output_format): Declare.
8231         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8232         (ignore_cmd): Remove OUTPUT_FORMAT.
8233         * fileread.cc (Input_file::Input_file): Add explicit this.
8234         (Input_file::will_search_for): New function.
8235         (Input_file::open): Add pindex parameter.  Change all callers.
8236         * fileread.h (class Input_file): Add input_file_argument method.
8237         Declare will_search_for.  Update declarations.
8238         * object.cc (make_elf_object): Add punconfigured parameter.
8239         Change all callers.
8240         * object.h (class Object): Make input_file public.  Add
8241         searched_for method.
8242         (make_elf_object): Update declaration.
8243         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8244         restart search.
8245         * dirsearch.h (class Dirsearch): Update declaration.
8246         * options.h (class General_options): Add --warn-search-mismatch.
8247         * parameters.cc (Parameters::is_compatible_target): New function.
8248         * parameters.h (class Parameters): Declare is_compatible_target.
8249         * workqueue.cc (Workqueue::add_blocker): New function.
8250         * workqueue.h (class Workqueue): Declare add_blocker.
8251
8252         * fileread.cc (Input_file::open): Remove options parameter.
8253         Change all callers.
8254         (Input_file::open_binary): Likewise.
8255         * script.cc (read_input_script): Likewise.
8256         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8257         options parameter from constructor.  Change all callers.
8258         (class Read_script): Likewise.
8259         * fileread.h (class Input_file): Update declarations.
8260         * script.h (read_input_script): Update declaration.
8261
8262 2009-03-10  Nick Clifton  <nickc@redhat.com>
8263
8264         * po/es.po: New Spanish translation.
8265
8266 2009-03-06  Cary Coutant  <ccoutant@google.com>
8267
8268         * options.cc (parse_short_option): Keep dash_z from registering itself.
8269
8270 2009-03-03  Ian Lance Taylor  <iant@google.com>
8271
8272         PR 9918
8273         * target-reloc.h (relocate_section): Pass output_section to
8274         relocate.
8275         * i386.cc (Target_i386::should_apply_static_reloc): Add
8276         output_section parameter.  Change all callers.
8277         (Target_i386::Relocate::relocate): Add output_section parameter.
8278         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8279         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8280         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8281         * testsuite/two_file_shared.sh: New script.
8282         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8283         (check_DATA): Add two_file_shared.dbg.
8284         (two_file_shared.dbg): New target.
8285         * testsuite/Makefile.in: Rebuild.
8286
8287 2009-03-01  Ian Lance Taylor  <iant@google.com>
8288
8289         * configure.ac: Check for byteswap.h.
8290         * configure: Rebuild.
8291         * config.in: Rebuild.
8292
8293 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8294
8295         * layout.cc (Layout::find_or_add_kept_section): New function.
8296         (Layout::add_comdat): Removed.
8297         * layout.h (struct Kept_section): Move out of class Layout.
8298         Remove trailing underscores from field names.  Add group_sections
8299         field.  Rename group_ field to is_group.  Change all uses.
8300         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8301         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8302         comdat_groups_ field.
8303         (Sized_relobj::include_section_group): Use
8304         find_or_add_kept_section and Kept_section::group_sections.
8305         (Sized_relobj::include_linkonce_section): Likewise.
8306         * object.cc (class Sized_relobj): Don't define Comdat_group or
8307         Comdat_group_table.  Remove find_comdat_group and
8308         add_comdat_group.  Remove comdat_groups_ field.
8309         * plugin.cc (include_comdat_group): Use
8310         Layout::find_or_add_kept_section.
8311
8312 2009-02-28  Ian Lance Taylor  <iant@google.com>
8313
8314         * README: --gc-sections and map files are now supported.  Document
8315         some build requirements.
8316
8317         PR 6992
8318         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8319         relocatable link set the value of the section symbol to zero.
8320         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8321         relocatable link don't include the section address in the local
8322         symbol value.
8323
8324 2009-02-27  Ian Lance Taylor  <iant@google.com>
8325
8326         PR 6811
8327         * options.h (class Search_directory): Add is_system_directory.
8328         (class General_options): Declare is_in_system_directory.
8329         * options.cc (get_relative_sysroot): Make static.
8330         (get_default_sysroot): Make static.
8331         (General_optoins::is_in_system_directory): New function.
8332         * fileread.cc (Input_file::is_in_system_directory): New function.
8333         * fileread.h (class Input_file): Declare is_in_system_directory.
8334         * object.h (class Object): Add is_in_system_directory.
8335         (class Input_objects): Remove system_library_directory_ field.
8336         * object.cc (Input_objects::add_object): Don't set
8337         system_library_directory_.
8338         (input_objects::found_in_system_library_directory): Remove.
8339         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8340         parameter.  Change all callers.
8341         (Symbol_table::sized_write_globals): Likewise.
8342         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8343         Call Object::is_in_system_directory.
8344         * symtab.h (class Symbol_table): Update declarations.
8345
8346         PR 5990
8347         * descriptors.h (Open_descriptor): Add is_on_stack field.
8348         * descriptors.cc (Descriptors::open): If the descriptor is on the
8349         top of the stack, remove it.  Initialize is_on_stack field.
8350         (Descriptors::release): Only add pod to stack if it is not on the
8351         stack already.
8352         (Descriptors::close_some_descriptor): Clear stack_next and
8353         is_on_stack fields.
8354
8355         PR 7091
8356         * output.cc (Output_section::find_starting_output_address): Rename
8357         from starting_output_address; add PADDR parameter; change return
8358         type.
8359         * output.h (class Output_section): Declare
8360         find_starting_output_address instead of starting_output_address.
8361         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8362         section symbol for which we can't find a merge section.
8363
8364         PR 9836
8365         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8366         hidden or internal, force the symbol to be local.
8367         * resolve.cc (Symbol::override_visibility): Define.
8368         (Symbol::override_base): Use override_visibility.
8369         (Symbol_table::resolve): Likewise.
8370         (Symbol::override_base_with_special): Likewise.
8371         (Symbol_table::override_with_special): If the visibility is hidden
8372         or internal, force the symbol to be local.
8373         * symtab.h (class Symbol): Add set_visibility and
8374         override_visibility.
8375         * testsuite/ver_test_1.sh: New file.
8376         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8377         (check_DATA): Add ver_test_1.syms.
8378         (ver_test_1.syms): New target.
8379         * testsuite/Makefile.in: Rebuild.
8380
8381 2009-02-25  Cary Coutant  <ccoutant@google.com>
8382
8383         * layout.cc (Layout::choose_output_section): Don't rename sections
8384         when using a linker script that has a SECTIONS clause.
8385         * Makefile.in: Regenerate.
8386
8387         * testsuite/Makefile.am (script_test_5.sh): New test case.
8388         * testsuite/Makefile.in: Regenerate.
8389         * testsuite/script_test_5.cc: New file.
8390         * testsuite/script_test_5.sh: New file.
8391         * testsuite/script_test_5.t: New file.
8392
8393 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8394
8395         * archive.cc (Archive::include_member): Update calls to add_symbols.
8396         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8397         the Layout argument.
8398         * dynobj.h (do_add_symbols): Add the Layout argument.
8399         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8400         Layout argument.
8401         * object.h (Object::add_symbols): Add the Layout argument.
8402         (Object::do_add_symbols): Add the Layout argument.
8403         (Sized_relobj::do_add_symbols): Add the Layout argument.
8404         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8405         Unify the two versions.
8406         (Add_plugin_symbols): Remove.
8407         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8408         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8409         (Add_plugin_symbols): Remove.
8410         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8411         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8412         (Add_symbols::run): Make it work with Pulginobj.
8413
8414 2009-02-06  Ian Lance Taylor  <iant@google.com>
8415
8416         * object.cc (Sized_relobj::do_layout): Make info message start
8417         with lower case letter.
8418
8419 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8420
8421         * binary.cc: Fix file comment.
8422
8423         * options.h (enum Incremental_disposition): Define.
8424         (class General_options): Add new options: --incremental,
8425         --incremental_changed, --incremental_unchanged,
8426         --incremental_unknown.  Add incremental_disposition_ and
8427         implicit_incremental_ fields.
8428         (General_options::incremental_disposition): New function.
8429         (class Position_dependent_options): Add incremental_disposition
8430         option.
8431         (Position_dependent_options::copy_from_options): Set incremental
8432         dispositions.
8433         * options.cc (General_options::parse_incremental_changed): New
8434         function.
8435         (General_options::parse_incremental_unchanged): New function.
8436         (General_options::parse_incremental_unknown): New function.
8437         (General_options::General_options): Initialize new fields
8438         incremental_disposition_ and implicit_incremental_.
8439         (General_options::finalize): Check for uasge of --incremental-*
8440         without --incremental.
8441
8442 2009-02-06  Chris Demetriou  <cgd@google.com>
8443
8444         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8445         pointer and to report location as the file name associated with
8446         the symbol.
8447         (gold_undefined_symbol_at_location): New function to replace the
8448         old gold_undefined_symbol functionality.
8449         * target-reloc.h (relocate_section): Update to use
8450         gold_undefined_symbol_at_location.
8451         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8452         Call gold_undefined_symbol function rather than gold_error.
8453         * errors.h (Errors::undefined_symbol): Take location as a
8454         string, rather than calculating it from a relocation.
8455         * errors.cc (Errors::fatal): Print "fatal error:" before the
8456         formatted message.
8457         (Errors::error, Errors::error_at_location): Print "error: "
8458         before the formatted message.
8459         (Errors::undefined_symbol): Take location as a string, rather
8460         than calculating it from a relocation.
8461         (gold_undefined_symbol_at_location): New function akin to
8462         old gold_undefined_symbol, calculates location from relocation.
8463         (gold_undefined_symbol): Change to take only a Symbol pointer
8464         and to report location as the file name associated with the symbol.
8465         * testsuite/debug_msg.sh: Update for changed error messages.
8466         * testsuite/undef_symbol.sh: Likewise.
8467
8468 2009-02-04  Duncan Sands  <baldrick@free.fr>
8469
8470         PR 9812
8471         * reduced_debug_output.h
8472         (Output_reduced_debug_abbrev_section::failed): Use format for
8473         gold_warning.
8474         (Output_reduced_debug_info_section::faild): Likewise.
8475
8476 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8477
8478         * script.cc (Lazy_demangler): New class.
8479         (Version_script_info::get_symbol_version_helper): Demangle a
8480         symbol only once.
8481
8482 2009-01-29  Cary Coutant  <ccoutant@google.com>
8483
8484         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8485         to __tls_get_addr.
8486         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8487
8488 2009-01-28  Ian Lance Taylor  <iant@google.com>
8489
8490         * version.cc (version_string): Bump to 1.9.
8491
8492         * gold.h: Include <cstring> and <stdint.h>.
8493         * version.cc: Include <cstdio>.
8494         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8495         warning.
8496         * reduced_debug_output.cc (insert_into_vector): Rename from
8497         Insert_into_vector; change all callers.  Use Swap_unaligned to
8498         avoid aliasing issue; remove union since it is unnecessary.
8499
8500 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8501
8502         * Makefile.am (CCFILES): Add gc.cc.
8503         (HFILES): Add gc.h.
8504         * Makefile.in: Regenerate.
8505         * gold.cc (Gc_runner): New class.
8506         (queue_initial_tasks): Call garbage collection related tasks
8507         when corresponding options are invoked.
8508         (queue_middle_gc_tasks): New function.
8509         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8510         processed early before laying out sections during garbage collection.
8511         * gold.h (queue_middle_gc_tasks): New function.
8512         (is_prefix_of): Move from "layout.cc".
8513         * i386.cc (Target_i386::gc_process_relocs): New function.
8514         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8515         * main.cc (main): Create object of class "Garbage_collection".
8516         * object.cc (Relobj::copy_symbols_data): New function.
8517         (Relobj::is_section_name_included): New function.
8518         (Sized_relobj::do_layout): Allow this function to be called twice
8519         during garbage collection and defer layout of section during the
8520         first call.
8521         * object.h (Relobj::get_symbols_data): New function.
8522         (Relobj::is_section_name_included): New function.
8523         (Relobj::copy_symbols_data): New function.
8524         (Relobj::set_symbols_data): New function.
8525         (Relobj::get_relocs_data): New function.
8526         (Relobj::set_relocs_data): New function.
8527         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8528         (Relobj::gc_process_relocs): New function.
8529         (Relobj::do_gc_process_relocs): New pure virtual function.
8530         (Relobj::sd_): New data member.
8531         (Sized_relobj::is_output_section_offset_invalid): New function.
8532         (Sized_relobj::do_gc_process_relocs): New function.
8533         * options.h (General_options::gc_sections): Modify to not be a no-op.
8534         (General_options::print_gc_sections): New option.
8535         * plugin.cc (Plugin_finish::run): Remove function call to
8536         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8537         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8538         * reloc.cc (Read_relocs::run): Add task to process relocs and
8539         determine unreferenced sections when doing garbage collection.
8540         (Gc_process_relocs): New class.
8541         (Sized_relobj::do_gc_process_relocs): New function.
8542         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8543         sections that are garbage collected.
8544         * reloc.h (Gc_process_relocs): New class.
8545         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8546         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8547         symbols whose corresponding sections are garbage collected.
8548         (Symbol_table::Symbol_table): Add new parameter for the garbage
8549         collection object.
8550         (Symbol_table::gc_mark_undef_symbols): New function.
8551         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8552         (Symbol_table::gc_mark_dyn_syms): New function.
8553         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8554         as garbage.
8555         (Symbol_table::add_from_object): Likewise.
8556         (Symbol_table::add_from_relobj): When building shared objects, do not
8557         treat externally visible symbols as garbage.
8558         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8559         table information for static and relocatable links.
8560         * symtab.h (Symbol_table::set_gc): New function.
8561         (Symbol_table::gc): New function.
8562         (Symbol_table::gc_mark_undef_symbols): New function.
8563         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8564         (Symbol_table::gc_mark_dyn_syms): New function.
8565         (Symbol_table::gc_): New data member.
8566         * target.h (Sized_target::gc_process_relocs): New pure virtual
8567         function.
8568         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8569         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8570
8571 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8572
8573         * options.h (General_options::gc_sections): Define as a no-op for now.
8574         (General_options::no_keep_memory): Ditto.
8575         (General_options::Bshareable): Define.
8576         * options.cc (General_options::finalize): Honor -Bshareable.
8577
8578 2009-01-20  Andreas Schwab  <schwab@suse.de>
8579
8580         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8581         read the value in the contents, since we don't use it.  Use the
8582         template endianness when writing.
8583         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8584
8585 2009-01-19  Andreas Schwab  <schwab@suse.de>
8586
8587         * configure.tgt (powerpc64-*): Fix targ_obj.
8588
8589 2009-01-15  Ian Lance Taylor  <iant@google.com>
8590
8591         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8592         local symbols when stripping all symbols.
8593
8594 2009-01-14  Cary Coutant  <ccoutant@google.com>
8595
8596         * output.cc (Output_reloc): Add explicit instantiations.
8597
8598 2009-01-14  Cary Coutant  <ccoutant@google.com>
8599
8600         * archive.cc (Archive::get_elf_object_for_member): Remove call
8601         to File_read::claim_for_plugin.
8602         * descriptors.cc (Descriptors::open): Remove reference to
8603         is_claimed.
8604         (Descriptors::claim_for_plugin): Remove.
8605         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8606         (Descriptors::is_claimed): Remove.
8607         (claim_descriptor_for_plugin): Remove.
8608         * fileread.cc (File_read::claim_for_plugin): Remove.
8609         * fileread.h (File_read::claim_for_plugin): Remove.
8610         (File_read::descriptor): Reopen descriptor if necessary.
8611         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8612         (Plugin_manager::all_symbols_read): Add task parameter. Change
8613         all callers.
8614         (Plugin_manager::get_input_file): New function.
8615         (Plugin_manager::release_input_file): New function.
8616         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8617         corresponding data member.
8618         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8619         and pass to base constructor. Change all callers.
8620         (get_input_file, release_input_file): New functions.
8621         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8622         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8623         (Plugin_manager::all_symbols_read): Add task parameter.
8624         (Plugin_manager::get_input_file): New function.
8625         (Plugin_manager::release_input_file): New function.
8626         (Plugin_manager::task_): New data member.
8627         (Pluginobj::Pluginobj): Add filesize parameter.
8628         (Pluginobj::filename): New function.
8629         (Pluginobj::descriptor): New function.
8630         (Pluginobj::filesize): New function.
8631         (Pluginobj::filesize_): New data member.
8632         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8633         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8634         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8635
8636         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8637         with archive libraries.
8638         * testsuite/Makefile.in: Regenerate.
8639         * testsuite/plugin_test.c (struct sym_info): New type.
8640         (get_input_file, release_input_file): New static variables.
8641         (onload): Capture new transfer vector entries.
8642         (claim_file_hook): Stop reading at end of file according to filesize.
8643         Factor out parsing of readelf output into separate function.
8644         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8645         APIs and get the source file name from the symbol table.  Convert
8646         source file name to corresponding object file name.  Print info
8647         message when adding new input files.
8648         (parse_readelf_line): New function.
8649         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8650         * testsuite/plugin_test_2.sh: Likewise.
8651         * testsuite/plugin_test_3.sh: Likewise.
8652         * testsuite/plugin_test_4.sh: New test case.
8653
8654 2009-01-07  Ian Lance Taylor  <iant@google.com>
8655
8656         * version.cc (version_string): Bump to 1.8.
8657
8658 2008-12-23  Cary Coutant  <ccoutant@google.com>
8659
8660         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8661         * plugin.cc (Plugin_manager::finish): Rename as
8662         layout_deferred_objects.  Move cleanup to separate function.
8663         (Plugin_manager::cleanup): New function.
8664         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8665         separately.
8666         * plugin.h (Plugin_manager::finish): Rename as
8667         layout_deferred_objects.
8668         (Plugin_manager::cleanup): New function.
8669         (Plugin_manager::cleanup_done): New field.
8670
8671 2008-12-23  Cary Coutant  <ccoutant@google.com>
8672
8673         * plugin.cc (is_visible_from_outside): New function.
8674         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8675         so we don't return "IR only" status for exported symbols or -r links.
8676
8677         * testsuite/Makefile.am (plugin_test_3): New test case.
8678         * testsuite/Makefile.in: Regenerate.
8679         * testsuite/plugin_test_3.sh: New file.
8680
8681 2008-12-22  Cary Coutant  <ccoutant@google.com>
8682
8683         * object.cc (Sized_relobj::layout_section): New function.
8684         (Sized_relobj::do_layout): Defer layout of input sections until after
8685         plugin has provided replacement files.
8686         (Sized_relobj::do_layout_deferred_sections): New function.
8687         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8688         (Relobj::layout_deferred_sections): New function.
8689         (Relobj::do_layout_deferred_sections): New function.
8690         (Sized_relobj::do_layout_deferred_sections): New function.
8691         (Sized_relobj::layout_section): New function.
8692         (Sized_relobj::Deferred_layout): New structure.
8693         (Sized_relobj::deferred_layout_): New field.
8694         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8695         Change all callers.  Layout deferred sections.
8696         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8697         references.
8698         (Plugin_hook::run): Move code from do_plugin_hook inline.
8699         (Plugin_hook::do_plugin_hook): Remove.
8700         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8701         (Plugin_manager::finish): Renamed, was cleanup.
8702         (Plugin_manager::should_defer_layout): New function.
8703         (Plugin_manager::add_deferred_layout_object): New function.
8704         (Plugin_manager::Deferred_layout_list): New type.
8705         (Plugin_manager::deferred_layout_objects_): New field.
8706         (Plugin_hook::do_plugin_hook): Remove.
8707
8708 2008-12-17  Ian Lance Taylor  <iant@google.com>
8709
8710         * options.h (class General_options): Add --no case for
8711         --export-dynamic.
8712
8713 2008-12-16  Cary Coutant  <ccoutant@google.com>
8714
8715         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8716         vector.
8717         (Plugin_manager::claim_file): Create plugin object even if
8718         plugin did not call the add_symbols callback.
8719         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8720         asking for more symbols than were added.
8721         * testsuite/Makefile.am (plugin_test_1): Add test case with
8722         no global symbols.
8723         (empty.syms): New target.
8724         * testsuite/Makefile.in: Regenerate.
8725         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8726         message. Don't call add_symbols if no globals.
8727         (all_symbols_read_hook): Don't provide replacement for empty
8728         claimed file.
8729
8730 2008-12-12  Ian Lance Taylor  <iant@google.com>
8731
8732         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8733         r_type == 0 for a local symbol with r_sym == 0.
8734         (scan_relocatable_relocs): Pass r_sym to
8735         local_non_section_strategy.
8736         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8737         r_sym parameter.
8738
8739         * configure.ac: Update test for TLS descriptors: they are
8740         supported as of glibc 2.9.
8741         * configure: Rebuild.
8742
8743 2008-12-11  Ian Lance Taylor  <iant@google.com>
8744
8745         PR 7091
8746         * target-reloc.h (Default_scan_relocatable_relocs): For each
8747         function, map r_type == 0 to RELOC_DISCARD.
8748
8749 2008-12-10  Cary Coutant  <ccoutant@google.com>
8750
8751         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8752         object to override a kept COMDAT group from a plugin object.
8753
8754 2008-12-09  Ian Lance Taylor  <iant@google.com>
8755
8756         PR 7088
8757         * yyscript.y (file_cmd): Handle INPUT.
8758
8759         * testsuite/initpri1.c: Change all declarations to be full
8760         prototypes by adding void, to avoid compiler warnings.
8761
8762 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8763
8764         * options.cc (General_options::parse_plugin_opt): New.
8765         (General_options::add_plugin): The argument now is just the filename.
8766         (General_options::add_plugin_option): New.
8767         * options.h (plugin_opt): New.
8768         (add_plugin): Change argument name.
8769         (add_plugin_option): New.
8770         * plugin.cc (Plugin::load): Don't parse the plugin option.
8771         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8772         (Plugin::add_option): New.
8773         (Plugin::args_): Change type.
8774         (Plugin::filename_): New.
8775         (Plugin_manager::add_plugin_option): New.
8776         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8777         * testsuite/Makefile.in: Regenerate.
8778
8779 2008-12-05  Cary Coutant  <ccoutant@google.com>
8780
8781         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8782         Handle --strip-lto-sections option.
8783         * options.h (strip_lto_sections): New option.
8784
8785 2008-12-01  Cary Coutant  <ccoutant@google.com>
8786
8787         * plugin.cc (ld_plugin_message): Change format parameter to const.
8788         Fix mismatch between new[] and delete.
8789
8790 2008-11-14  Cary Coutant  <ccoutant@google.com>
8791
8792         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8793         instead of -1U.
8794
8795 2008-11-05  Craig Silverstein  <csilvers@google.com>
8796
8797         * options.cc (General_options::parse_dynamic_list): New function.
8798         * options.h (General_options): New flags dynamic_list,
8799         dynamic_list_data, dynamic_list_cpp_new, and
8800         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8801         (General_options::in_dynamic_list): New function.
8802         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8803         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8804         (Lex::can_continue_name): Likewise.
8805         (yylex): Likewise.
8806         (read_script_file): New parameter script_options.
8807         (read_dynamic_list): New function.
8808         (Script_options::define_dynamic_list): New function.
8809         (dynamic_list_keyword_parsecodes): New variable.
8810         (dynamic_list_keywords): New variable.
8811         * script.h (Script_options::define_dynamic_list): New function
8812         prototype.
8813         (read_dynamic_list): New function prototype.
8814         * symtab.cc (strprefix): New macro.
8815         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8816         dynamic_list_data, dynamic_list_cpp_new, and
8817         dynamic_list_cpp_typeinfo.
8818         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8819         (dynamic_list_expr): New rule.
8820         (dynamic_list_nodes): Likewise.
8821         (dynamic_list_node): Likewise.
8822         * testsuite/Makefile.am (dynamic_list): New test.
8823         * testsuite/Makefile.in: Regenerated.
8824         * testsuite/dynamic_list.t: New file.
8825         * testsuite/dynamic_list.sh: New file.
8826
8827 2008-11-05  Craig Silverstein  <csilvers@google.com>
8828
8829         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8830         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8831         (t11_last): Likewise.
8832         * testsuite/ver_test_6.c (main): Likewise.
8833
8834 2008-10-07  Cary Coutant  <ccoutant@google.com>
8835
8836         * options.c (General_options::finalize): Add check for -static and
8837         -shared.
8838         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8839         is not empty.
8840
8841 2008-10-02  Cary Coutant  <ccoutant@google.com>
8842
8843         * plugin.cc (make_sized_plugin_object): Fix conditional
8844         compilation to work when not all targets are enabled.
8845
8846 2008-09-29  Cary Coutant  <ccoutant@google.com>
8847
8848         * archive.cc (Archive::get_file_and_offset): Use filename instead
8849         of name to get library path.
8850         (Archive::include_member): Unlock external member of a thin archive.
8851
8852         * testsuite/Makefile.am (TEST_AR): New variable.
8853         (thin_archive_test_1): New test.
8854         (thin_archive_test_2): New test.
8855         * testsuite/Makefile.in: Regenerate.
8856         * testsuite/thin_archive_main.cc: New file.
8857         * testsuite/thin_archive_test_1.cc: New file.
8858         * testsuite/thin_archive_test_2.cc: New file.
8859         * testsuite/thin_archive_test_3.cc: New file.
8860         * testsuite/thin_archive_test_4.cc: New file.
8861
8862 2008-09-29  Cary Coutant  <ccoutant@google.com>
8863
8864         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8865         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8866         instead of -1U.
8867         (Sized_relobj::do_finalize_local_symbols): Likewise.
8868         (Sized_relobj::map_to_kept_section): Likewise.
8869         * object.h (Sized_relobj::invalid_address): New constant.
8870         (Sized_relobj::do_output_section_offset): Check for invalid_address
8871         and return -1ULL.
8872         * output.cc (Output_reloc::local_section_offset): Use constant
8873         invalid_address instead of -1U.
8874         (Output_reloc::get_address): Likewise.
8875         (Output_section::output_address): Change -1U to -1ULL.
8876         * output.h (Output_reloc::invalid_address): New constant.
8877         * reloc.cc (Sized_relobj::write_sections): Use constant
8878         invalid_address instead of -1U.
8879         (Sized_relobj::relocate_sections): Likewise.
8880         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8881         values for merge sections.
8882         * target-reloc.h (relocate_for_relocatable): Use constant
8883         invalid_address instead of -1U.
8884
8885 2008-09-19  Cary Coutant  <ccoutant@google.com>
8886
8887         Add plugin functionality for link-time optimization (LTO).
8888         * configure.ac (plugins): Add --enable-plugins option.
8889         * configure: Regenerate.
8890         * config.in: Regenerate.
8891         * Makefile.am (LIBDL): New variable.
8892         (CCFILES): Add plugin.cc.
8893         (HFILES): Add plugin.h.
8894         (ldadd_var): Add LIBDL.
8895         * Makefile.in: Regenerate.
8896
8897         * archive.cc: Include "plugin.h".
8898         (Archive::setup): Don't preread archive symbols when using a plugin.
8899         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8900         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8901         files.
8902         (Archive::include_member): Add symbols from plugin objects.
8903         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8904         * descriptors.cc (Descriptors::open): Check for file descriptors
8905         abandoned by plugins.
8906         (Descriptors::claim_for_plugin): New function.
8907         * descriptors.h (Descriptors::claim_for_plugin): New function.
8908         (Open_descriptor::is_claimed): New field.
8909         (claim_descriptor_for_plugin): New function.
8910         * fileread.cc (File_read::claim_for_plugin): New function.
8911         * fileread.h (File_read::claim_for_plugin): New function.
8912         (File_read::descriptor): New function.
8913         * gold.cc: Include "plugin.h".
8914         (queue_initial_tasks): Add task to call plugin hooks for generating
8915         new object files.
8916         * main.cc: Include "plugin.h".
8917         (main): Load plugin libraries.
8918         * object.h (Pluginobj): Declare.
8919         (Object::pluginobj): New function.
8920         (Object::do_pluginobj): New function.
8921         (Object::set_target): New function.
8922         * options.cc: Include "plugin.h".
8923         (General_options::parse_plugin): New function.
8924         (General_options::General_options): Initialize plugins_ field.
8925         (General_options::add_plugin): New function.
8926         * options.h (Plugin_manager): Declare.
8927         (General_options): Add --plugin option.
8928         (General_options::has_plugins): New function.
8929         (General_options::plugins): New function.
8930         (General_options::add_plugin): New function.
8931         (General_options::plugins_): New field.
8932         * plugin.cc: New file.
8933         * plugin.h: New file.
8934         * readsyms.cc: Include "plugin.h".
8935         (Read_symbols::do_read_symbols): Check for archive before checking
8936         for ELF file.  Call plugin hooks to claim files.
8937         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8938         from a real object file; force override when processing replacement
8939         files.
8940         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8941         (Symbol::init_base_object): Likewise.
8942         (Symbol::init_base_output_data): Likewise.
8943         (Symbol::init_base_output_segment): Likewise.
8944         (Symbol::init_base_constant): Likewise.
8945         (Symbol::init_base_undefined): Likewise.
8946         (Symbol::output_section): Assert that object is not a plugin.
8947         (Symbol_table::add_from_pluginobj): New function.
8948         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8949         undefined.
8950         (Symbol_table::sized_write_globals): Likewise.
8951         (Symbol_table::add_from_pluginobj): Instantiate template.
8952         * symtab.h (Sized_pluginobj): Declare.
8953         (Symbol::in_real_elf): New function.
8954         (Symbol::set_in_real_elf): New function.
8955         (Symbol::in_real_elf_): New field.
8956         (Symbol_table::add_from_pluginobj): New function.
8957
8958         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8959         (LIBDL): New variable.
8960         (LDADD): Add LIBDL.
8961         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8962         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8963         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8964         (MOSTLYCLEANFILES): Likewise.
8965         * testsuite/Makefile.in: Regenerate.
8966         * testsuite/plugin_test.c: New file.
8967         * testsuite/plugin_test_1.sh: New file.
8968         * testsuite/plugin_test_2.sh: New file.
8969
8970 2008-09-16  Ian Lance Taylor  <iant@google.com>
8971
8972         * target-reloc.h (relocate_section): Check whether a symbol is
8973         defined by the ABI before reporting an undefined symbol error.
8974         * target.h (Target::is_defined_by_abi): Make parameter const.
8975         (Target::do_is_defined_by_abi): Likewise.
8976         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8977         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8978         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8979         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8980         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8981         * testsuite/Makefile.in: Rebuild.
8982
8983         * fileread.cc (make_view): Add casts to avoid warning.
8984
8985 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8986
8987         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8988         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8989
8990 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8991
8992         * options.h (General_options::output_is_executable): New.
8993         (General_options::output_is_pie): New.
8994         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8995         for shared libraries.
8996         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8997
8998 2008-09-11  Chris Demetriou  <cgd@google.com>
8999
9000         * options.h (origin): New -z option.
9001         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9002         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9003         in DT_FLAGS_1.
9004
9005 2008-09-05  Cary Coutant  <ccoutant@google.com>
9006
9007         * fileread.cc (File_read::make_view): Add check for attempt to map
9008         beyond end of file.
9009
9010 2008-09-05  Cary Coutant  <ccoutant@google.com>
9011
9012         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9013         explicit instantiations.
9014
9015 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9016
9017         PR gold/6858
9018         * options.cc (General_options::finalize): Allow undefined symbols
9019         in shlibs if linking -shared.
9020
9021         PR gold/6859
9022         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9023         symbols as not needing a dynsym entry.
9024
9025 2008-08-20  Craig Silverstein  <csilvers@google.com>
9026
9027         * fileread.cc (File_read::open): Do not lock the file unless it
9028         was successfully opened.
9029
9030 2008-08-14  Cary Coutant  <ccoutant@google.com>
9031
9032         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9033         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9034         * testsuite/tls_test.cc (struct int128): 128-bit struct
9035         for testing TLS relocs with non-zero addend.
9036         (v12): New TLS variable.
9037         (t12): New test.
9038         (t_last): Add check for v12.
9039         * testsuite/tls_test.h (t12): New function.
9040         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9041
9042 2008-08-13  Ian Lance Taylor  <iant@google.com>
9043
9044         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9045         set tls_segment_ or relro_segment_.
9046         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9047         when appropriate.
9048         * output.h (Output_section::clear_is_relro): New function.
9049         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9050         sections specially even when output_data_ is empty.
9051         (Output_segment::maximum_alignment): When first section is relro,
9052         only force alignment for PT_LOAD segments.
9053         * script.cc (script_data_segment_align): New function.
9054         (script_data_segment_relro_end): New function.
9055         * script-c.h (script_data_segment_align): Declare.
9056         (script_data_segment_relro_end): Declare.
9057         * script-sections.h (class Script_sections): Declare
9058         data_segment_align and data_segment_relro_end.  Add fields
9059         segment_align_index_ and saw_relro_end_.
9060         * script-sections.cc (class Sections_element): Add set_is_relro
9061         virtual function.  Add new bool* parameter to place_orphan_here.
9062         Add get_output_section virtual function.
9063         (class Output_section_definition): Add set_is_relro.  Add new
9064         bool* parameter to place_orphan_here.  Add get_output_section.
9065         Add is_relro_ field.
9066         (Output_section_definition::Output_section_definition): Initialize
9067         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9068         and is_relro_ fields.
9069         (Output_section_definition::place_orphan_here): Add is_relro
9070         parameter.
9071         (Output_section_definition::set_section_addresses): Set relro for
9072         output section.
9073         (Output_section_definition::alternate_constraint): Likewise.
9074         (class Orphan_output_section): Add new bool* parameter to
9075         place_orphan_here.  Add get_output_section.
9076         (Orphan_output_section::place_orphan_here): Add is_relro
9077         parameter.
9078         (Script_sections::Script_sections): Initialize
9079         data_segment_align_index_ and saw_relro_end_.
9080         (Script_sections::data_segment_align): New function.
9081         (Script_sections::data_segment_relro_end): New function.
9082         (Script_sections::place_orphan): Set or clear is_relro.
9083         (Script_sections::set_section_addresses): Force alignment of first
9084         TLS section.
9085         * yyscript.y (exp): Call script_data_segment_align and
9086         script_data_segment_relro_end.
9087         * testsuite/relro_script_test.t: New file.
9088         * testsuite/relro_test.cc (using_script): Declare.
9089         (t1, t2): Test using_script.
9090         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9091         (relro_script_test_SOURCES): Define.
9092         (relro_script_test_DEPENDENCIES): Define.
9093         (relro_script_test_LDFLAGS): Define.
9094         (relro_script_test_LDADD): Define.
9095         (relro_script_test.so): New target.
9096         * testsuite/Makefile.in: Rebuild.
9097
9098 2008-08-06  Cary Coutant <ccoutant@google.com>
9099
9100         * archive.cc (Archive::total_archives, Archive::total_members)
9101         (Archive::total_members_loaded): New variables.
9102         (Archive::setup): Add parameter.  Add option to preread
9103         archive symbols.
9104         (Archive::read_armap): Add counter.
9105         (Archive::get_file_and_offset): New function.
9106         (Archive::get_elf_object_for_member): New function.
9107         (Archive::read_all_symbols): New function.
9108         (Archive::read_symbols): New function.
9109         (Archive::add_symbols): Add counters.
9110         (Archive::include_all_members): Use armap to find members if it's
9111         already built.
9112         (Archive::include_member): Skip reading symbols if already read.
9113         Factored code into Archive::get_file_and_offset and
9114         Archive::get_elf_object_for_member.  Changed call to
9115         Mapfile::report_include_archive_member.
9116         (Archive::print_stats): New function.
9117         * archive.h: Declare Object and Read_symbols_data classes.
9118         (Archive::Archive): Add initializers for new members.
9119         (Archive::setup): Add parameter.
9120         (Archive::print_stats): New function.
9121         (Archive::total_archives, Archive::total_members)
9122         (Archive::total_members_loaded): New variables.
9123         (Archive::get_file_and_offset): New function.
9124         (Archive::get_elf_object_for_member): New function.
9125         (Archive::read_all_symbols): New function.
9126         (Archive::read_symbols): New function.
9127         (Archive::Archive_member): New class.
9128         (Archive::members_): New member.
9129         (Archive::num_members_): New member.
9130         * main.cc: Include archive.h.
9131         (main): Call Archive::print_stats.
9132         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9133         archive parameter; member_name is now the fully-decorated name.
9134         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9135         * options.h: (General_options): Add --preread-archive-symbols option.
9136         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9137         Archive::setup.
9138
9139 2008-08-04  Ian Lance Taylor  <iant@google.com>
9140
9141         * symtab.h (Symbol::use_plt_offset): New function.
9142         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9143         * powerpc.cc (Relocate::relocate): Likewise.
9144         * sparc.cc (Relocate::relocate): Likewise.
9145         * x86_64.cc (Relocate::relocate): Likewise.
9146         * testsuite/weak_plt.sh: New test.
9147         * testsuite/weak_plt_main.cc: New test.
9148         * testsuite/weak_plt_shared.cc: New test.
9149         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9150         (check_PROGRAMS): Add weak_plt.
9151         (check_DATA): Add weak_plt_shared.so.
9152         (weak_plt_main_pic.o, weak_plt): New targets.
9153         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9154         * testsuite/Makefile.in: Rebuild.
9155
9156         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9157         gcctestdir/ld.
9158         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9159         * testsuite/Makefile.in: Rebuild.
9160
9161 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9162
9163         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9164         * Makefile.in: Regenerate.
9165         * po/POTFILES.in: Regenerate.
9166
9167 2008-07-29  Ian Lance Taylor  <iant@google.com>
9168
9169         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9170         symbols before other symbols.
9171         * testsuite/script_test_2.cc (test_addr): Declare.
9172         (test_addr_alias): Declare.
9173         (main): Check that test_addr and test_addr_alias have the right
9174         values.
9175         * testsuite/script_test_2.t: Define test_addr_alias and
9176         test_addr.
9177
9178 2008-07-24  Ian Lance Taylor  <iant@google.com>
9179
9180         PR 5990
9181         * descriptors.cc: New file.
9182         * descriptors.h: New file.
9183         * gold-threads.h (class Hold_optional_lock): New class.
9184         * fileread.cc: Include "descriptors.h".
9185         (File_read::~File_read): Release descriptor rather than closing
9186         it.
9187         (File_read::open) [file]: Call open_descriptor rather than open.
9188         Set is_descriptor_opened_.
9189         (File_read::open) [memory]: Assert that descriptor is not open.
9190         (File_read::reopen_descriptor): New function.
9191         (File_read::release): Release descriptor.
9192         (File_read::do_read): Make non-const.  Reopen descriptor.
9193         (File_read::read): Make non-const.
9194         (File_read::make_view): Reopen descriptor.
9195         (File_read::do_readv): Likewise.
9196         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9197         Update declarations.
9198         * layout.cc: Include "descriptors.h".
9199         (Layout::create_build_id): Use open_descriptor rather than open.
9200         * output.cc: Include "descriptors.h".
9201         (Output_file::open): Use open_descriptor rather than open.
9202         * archive.cc (Archive::const_iterator): Change Archive to be
9203         non-const.
9204         (Archive::begin, Archive::end): Make non-const.
9205         (Archive::count_members): Likewise.
9206         * archive.h (class Archive): Update declarations.
9207         * object.h (Object::read): Make non-const.
9208         * Makefile.am (CCFILES): Add descriptors.cc.
9209         (HFILES): Add descriptors.h.
9210         * Makefile.in: Rebuild.
9211
9212         PR 6716
9213         * gold.h: Always include <clocale>.  Add Solaris workarounds
9214         following code in binutils/sysdep.h.
9215
9216         PR 6048
9217         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9218         this->eh_frame_hdr_ is NULL before using it.
9219
9220         * dynobj.cc (Versions::Versions): Update comment.
9221
9222         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9223         the base version name.
9224
9225         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9226         array size plus one.
9227         (Stringpool_template::set_string_offsets): Subtract one from key
9228         before using it as an array index.
9229         (Stringpool_template::get_offset_with_length): Likewise.
9230         (Stringpool_template::write_to_buffer): Likewise.
9231         * stringpool.h (Stringpool_template::get_offset_from_key):
9232         Likewise.
9233
9234 2008-07-23  Ian Lance Taylor  <iant@google.com>
9235
9236         PR 6658
9237         * object.h (Merged_symbol_value::value): Do our best to handle a
9238         negative addend.
9239
9240         PR 6647
9241         * script.cc (Version_script_info::get_versions): Don't add empty
9242         version tag to return value.
9243         (Version_script_info::get_symbol_version_helper): Change return
9244         type to bool.  Add pversion parameter.  Change all callers.
9245         (script_register_vers_node): Don't require a non-NULL tag.
9246         * script.h (class Version_script_info): Update declarations.
9247         (Version_script_info::get_symbol_version): Change return type to
9248         bool.  Add version parameter.  Change all callers.
9249         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9250         handling.  Handle an empty version from a version script.
9251         (Symbol_table::define_special_symbol): Likewise.
9252         * testsuite/ver_test_10.script: New file.
9253         * testsuite/ver_test_10.sh: New file.
9254         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9255         (check_DATA): Add ver_test_10.syms.
9256         (ver_test_10.syms, ver_test_10.so): New target.
9257         * testsuite/Makefile.in: Rebuild.
9258
9259 2008-07-23  Simon Baldwin  <simonb@google.com>
9260
9261         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9262         to zero for undefined symbols from dynamic libraries.
9263
9264 2008-07-23  Ian Lance Taylor  <iant@google.com>
9265
9266         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9267         Change all callers.
9268         * symtab.h (class Symbol_table): Update declaration.
9269         * testsuite/ver_test_9.cc: New file.
9270         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9271         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9272         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9273         (ver_test_9.so, ver_test_9.o): New targets.
9274         * testsuite/Makefile.in: Rebuild.
9275
9276 2008-07-22  Ian Lance Taylor  <iant@google.com>
9277
9278         * options.h (class General_options): Define --check-sections.
9279         * layout.cc (Layout::set_segment_offsets): Handle
9280         --check-sections.
9281
9282         * options.h (class General_options): Define -n/--nmagic and
9283         -N/--omagic.
9284         * options.cc (General_options::finalize): For -n/--nmagic or
9285         -N/--omagic, set -static.
9286         * layout.cc (Layout::attach_allocated_section_to_segment): If
9287         -N/--omagic, don't put read-only and read-write sections in
9288         different segments.
9289         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9290         finding a read-only segment.
9291         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9292         don't set the minimum segment alignment to the common page size,
9293         and don't set the file offset to the address modulo the page size.
9294         * script-sections.cc (Script_sections::create_segments): If
9295         -n/--omagic, don't put read-only and read-write sections in
9296         different segments.
9297
9298         * cref.cc: New file.
9299         * cref.h: New file.
9300         * options.h (class General_options): Add --print-symbol-counts.
9301         * main.cc (main): Issue defined symbol report if requested.
9302         * archive.cc (Archive::interpret_header): Make into a const member
9303         function.
9304         (Archive::add_symbols): Call Input_objects::archive_start and
9305         archive_stop.
9306         (Archive::const_iterator): Define new class.
9307         (Archive::begin, Archive::end): New functions.
9308         (Archive::include_all_members): Rewrite to use iterator.
9309         (Archive::count_members): New function.
9310         * archive.h (class Archive): Update declarations.
9311         (Archive::filename): New function.
9312         * object.cc: Include "cref.h".
9313         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9314         (Sized_relobj::do_get_global_symbol_counts): New function.
9315         (Input_objects::add_object): Add object to cross-referencer.
9316         (Input_objects::archive_start): New function.
9317         (Input_objects::archive_stop): New function.
9318         (Input_objects::print_symbol_counts): New function.
9319         * object.h: Declare Cref and Archive.
9320         (Object::get_global_symbol_counts): New function.
9321         (Object::do_get_global_symbol_counts): New pure virtual function.
9322         (class Sized_relobj): Add defined_count_ field.  Update
9323         declarations.
9324         (class Input_objects): Add cref_ field.  Update constructor.
9325         Update declarations.
9326         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9327         defined_count_.
9328         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9329         symbol counts.
9330         (Sized_dynobj::do_get_global_symbol_counts): New function.
9331         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9332         defined_count_.  Update declarations.  Define Symbols typedef.
9333         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9334         parameter.  Change all callers.
9335         (Symbol_table::add_from_dynobj): Add sympointers and defined
9336         parameters.  Change all callers.
9337         * symtab.h (class Symbol_table): Update declarations.
9338         * Makefile.am (CCFILES): Add cref.cc.
9339         (HFILES): Add cref.h.
9340         * Makefile.in: Rebuild.
9341
9342 2008-07-22  Simon Baldwin  <simonb@google.com>
9343
9344         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9345         to zero when writing undefined symbols.
9346
9347 2008-07-22  Ian Lance Taylor  <iant@google.com>
9348
9349         * output.cc (Output_section::add_input_section): Don't try to
9350         merge empty merge sections.
9351
9352 2008-07-21  Craig Silverstein  <csilvers@google.com>
9353
9354         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9355         Include symbol version in error message.
9356
9357 2008-07-20  Chris Demetriou  <cgd@google.com>
9358
9359         * configure.ac (gold_cv_c_random_seed): New configured variable.
9360         (RANDOM_SEED_CFLAGS): New substituted variable.
9361         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9362         * configure: Rebuild.
9363         * Makefile.in: Likewise.
9364         * testsuite/Makefile.in: Likewise.
9365
9366 2008-07-18  Ian Lance Taylor  <iant@google.com>
9367
9368         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9369         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9370         * testsuite/ver_test_main.cc (main): Call t4.
9371         (t4, t4_2a): Define.
9372         * testsuite/ver_test_2.cc (t4_2): Define.
9373         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9374         * testsuite/ver_test_4.cc (t4_2a): Define.
9375         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9376         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9377
9378 2008-07-17  Ian Lance Taylor  <iant@google.com>
9379
9380         * dynobj.cc (Versions::add_def): If we give an error about a
9381         missing version, go ahead and create the version anyhow.
9382
9383 2008-07-10  Ian Lance Taylor  <iant@google.com>
9384
9385         Handle output sections with more than 0x7fffffff bytes.
9386         * object.h (class Relobj): Change map_to_output_ to
9387         output_sections_, and just keep a section pointer.  Change all
9388         uses.  Move comdat group support to Sized_relobj.
9389         (Relobj::is_section_specially_mapped): Remove.
9390         (Relobj::output_section): Remove poff parameter.  Change all
9391         callers.
9392         (Relobj::output_section_offset): New function.
9393         (Relobj::set_section_offset): Rewrite.
9394         (Relobj::map_to_output): Remove.
9395         (Relobj::output_sections): New function.
9396         (Relobj::do_output_section_offset): New pure virtual function.
9397         (Relobj::do_set_section_offset): Likewise.
9398         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9399         group support from Relobj.  Update declarations.
9400         (Sized_relobj::get_output_section_offset): New function.
9401         (Sized_relobj::do_output_section_offset): New function.
9402         (Sized_relobj::do_set_section_offset): New function.
9403         * object.cc (Relobj::output_section_address): Remove.
9404         (Sized_relobj::Sized_relobj): Initialize new fields.
9405         (Sized_relobj::include_section_group): Cast find_kept_object to
9406         Sized_relobj.
9407         (Sized_relobj::include_linkonce_section): Likewise.
9408         (Sized_relobj::do_layout): Use separate arrays for output section
9409         and output offset.
9410         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9411         output_sections.
9412         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9413         output_sections and section_offsets.
9414         (Sized_relobj::write_local_symbols): Likewise.
9415         (map_to_kept_section): Compute output address directly.
9416         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9417         output_sections and section_offsets.
9418         (Sized_relobj::write_sections): Likewise.
9419         (Sized_relobj::relocate_sections): Likewise.
9420         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9421         * output.h (class Output_reloc): Update declarations.  Change
9422         u2_.relobj to Sized_relobj*.
9423         (class Output_data_reloc): Change add functions to use
9424         Sized_relobj*.
9425         * output.cc (Output_reloc::Output_reloc): Change relobj to
9426         Sized_relobj*.
9427         (Output_reloc::local_section_offset): Change return type to
9428         Elf_Addr.  Use get_output_section_offset.
9429         (Output_reloc::get_address): Likewise.
9430         (Output_section::is_input_address_mapped): Don't call
9431         is_section_specially_mapped.
9432         (Output_section::output_offset): Likewise.
9433         (Output_section::output_address): Likewise.
9434         (Output_section::starting_output_address): Likewise.
9435         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9436         parameter to Sized_relobj*.
9437         (Copy_relocs::need_copy_reloc): Likewise.
9438         (Copy_relocs::save): Likewise.
9439         * copy-relocs.h (class Copy_relocs): Update declarations.
9440         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9441         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9442         * target-reloc.h (relocate_for_relocatable): Change
9443         offset_in_output_section type to Elf_Addr.  Change code that uses
9444         it as well.
9445         * layout.cc (Layout::layout): Always set *off.
9446         * mapfile.cc (Mapfile::print_input_section): Use
9447         output_section_offset.
9448         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9449         Sized_relobj*.
9450         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9451         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9452         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9453
9454 2008-07-03  Ian Lance Taylor  <iant@google.com>
9455
9456         * layout.cc (Layout::include_section): Do not discard unrecognized
9457         SHT_STRTAB sections.
9458
9459 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9460
9461         * script.cc (Lex::can_continue_name): Make '?' allowable in
9462         version-script names.
9463         * testsuite/version_script.map: Change glob pattern to use '?'
9464
9465 2008-06-30  Manish Singh  <yosh@gimp.org>
9466
9467         PR 6585
9468         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9469         Correct typo.
9470
9471 2008-06-30  Ian Lance Taylor  <iant@google.com>
9472
9473         PR 6660
9474         PR 6682
9475         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9476         versions]: Don't try to read the value in the contents, since we
9477         don't use it.  Use the template endianness when writing.
9478
9479 2008-06-25  Cary Coutant  <ccoutant@google.com>
9480
9481         * fileread.cc (File_read::make_view): Assert on zero-length view.
9482         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9483         symbol table when there are no symbols to read.
9484
9485 2008-06-23  Craig Silverstein  <csilvers@google.com>
9486
9487         * version.cc (version_string): Bump to 1.7
9488
9489 2008-06-18  Craig Silverstein  <csilvers@google.com>
9490
9491         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9492         constant 0xFFFF to type Valtype.
9493         (Powerpc_relocate_functions::rel16_ha): Likewise.
9494
9495 2008-06-17  Ian Lance Taylor  <iant@google.com>
9496
9497         * output.h (Output_section::Input_section): Initialize p2align_ to
9498         zero for Output_section_data constructors.
9499         (Output_section::Input_section::addralign): If not an input
9500         section, return the alignment of the Output_section_data.
9501         * testsuite/copy_test.cc: New file.
9502         * testsuite/copy_test_1.cc: New file.
9503         * testsuite/copy_test_2.cc: New file.
9504         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9505         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9506         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9507         (copy_test_1_pic.o, copy_test_1.so): New targets.
9508         (copy_test_2_pic.o, copy_test_2.so): New targets.
9509         * testsuite/Makefile.in: Rebuild.
9510
9511         * script-sections.cc (Script_sections::place_orphan): Initialize
9512         local variable exact.
9513
9514 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9515
9516         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9517
9518 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9519             David S. Miller  <davem@davemloft.net>
9520
9521         * powerpc.cc: New file.
9522         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9523         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9524         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9525         * Makefile.in: Rebuild.
9526
9527 2008-06-09  Ian Lance Taylor  <iant@google.com>
9528
9529         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9530         <exception>.
9531         (throwing, orig_terminate): New static variables.
9532         (terminate_handler): New static function.
9533         (t2): Set terminate handler.
9534
9535 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9536
9537         PR 6584
9538         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9539         alignment.
9540
9541 2008-05-30  Cary Coutant  <ccoutant@google.com>
9542
9543         * archive.cc (Archive::include_all_members) Correct to step
9544         over symbol table and extended name table in thin archives.
9545
9546 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9547
9548         PR 6407
9549         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9550         calculation.
9551
9552 2008-05-28  Caleb Howe  <cshowe@google.com>
9553
9554         * reduced_debug_output.cc: New file.
9555         * reduced_debug_output.h: New file.
9556         * options.h (class General_options): Add --strip-debug-non-line.
9557         * options.cc (General_options::finalize): Add strip_debug_non_line
9558         to the strip heirarchy.
9559         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9560         fields.
9561         * layout.cc: Include "reduced_debug_output.h".
9562         (Layout::Layout): Initialize new fields.
9563         (line_only_debug_sections): New static array.
9564         (is_lines_only_debug_sections): New static inline function.
9565         (Layout::include_section): Handle --strip-debug-non-line.
9566         (Layout::make_output_section): If --strip-debug-non-line, build
9567         new output sections for .debug_abbrev and .debug_info.
9568         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9569         gold.  Warn about possible overflow.
9570         (read_signed_LEB_128): Likewise.
9571         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9572         (read_signed_LEB_128): Declare.
9573         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9574         (HFILES): Add reduced_debug_output.h.
9575         * Makefile.in: Rebuild.
9576
9577 2008-05-21  Ian Lance Taylor  <iant@google.com>
9578
9579         * mapfile.cc: New file.
9580         * mapfile.h: New file.
9581         * options.h (class General_options): Add -M/--print-map and -Map.
9582         * options.cc (General_options::finalize): Make -M equivalent to
9583         -Map -.
9584         * main.cc: Include <cstdio> and "mapfile.h".
9585         (main): Open mapfile if requested.
9586         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9587         constructor.  Change caller.
9588         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9589         (queue_middle_tasks): Likewise.
9590         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9591         declarations.
9592         * archive.cc: Include "mapfile.h".
9593         (Archive::add_symbols): Add mapfile parameter.  Change all
9594         callers.  Pass mapfile, symbol, and reason to include_member.
9595         (Archive::include_all_members): Add mapfile parameter.  Change all
9596         callers.
9597         (Archive::include_member): Add mapfile, sym, and why parameters.
9598         Change all callers.  Report inclusion to map file.
9599         * archive.h: Include "fileread.h".
9600         (class Archive): Update declarations.
9601         (Archive::file): New const method.
9602         (class Add_archive_symbols): Add mapfile_ field.  Update
9603         constructor.  Change all callers.
9604         * readsyms.h (class Read_symbols): Likewise.
9605         (class Finish_group): Likewise.
9606         (class Read_script): Likewise.
9607         * common.cc: Include "mapfile.h".
9608         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9609         all callers.
9610         (Symbol_table::do_allocate_commons): Likewise.
9611         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9612         symbol allocation to mapfile.
9613         * common.h (class Allocate_commons_task): Add mapfile_ field.
9614         Update constructor.  Change all callers.
9615         * symtab.h (class Symbol_table): Update declarations.
9616         * layout.cc: Include "mapfile.h".
9617         (Layout_task_runner::run): Print information to mapfile.
9618         (Layout::create_gold_note): Change Output_data_fixed_space to
9619         Output_data_zero_fill.
9620         (Layout::create_build_id): Likewise.
9621         (Layout::print_to_mapfile): New function.
9622         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9623         constructor.  Change caller.
9624         (class Layout): Declare print_to_mapfile.
9625         * output.cc (Output_section::Input_section::print_to_mapfile): New
9626         function.
9627         (Output_section::add_input_section): If producing a map, always
9628         add to input_sections_ list.
9629         (Output_section::do_print_to_mapfile): New function.
9630         (Output_segment::print_sections_to_mapfile): New function.
9631         (Output_segment::print_section_list_to_mapfile): New function.
9632         * output.h: Include "mapfile.h".
9633         (Output_data::print_to_mapfile): New function.
9634         (Output_data::do_print_to_mapfile): New virtual function.
9635         (Output_segment_headers::do_print_to_mapfile): New function.
9636         (Output_file_header::do_print_to_mapfile): New function.
9637         (Output_data_const::do_print_to_mapfile): New function.
9638         (class Output_data_const_buffer): Add map_name_ field.  Update
9639         constructor.  Change all callers.  Add do_print_to_mapfile
9640         function.
9641         (class Output_data_fixed_space): Likewise.
9642         (class Output_data_space): Likewise.
9643         (class Output_data_zero_fill): New class.
9644         (Output_data_strtab::do_print_to_mapfile): New function.
9645         (Output_data_reloc_base::do_print_to_mapfile): New function.
9646         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9647         (Output_data_group::do_print_to_mapfile): New function.
9648         (Output_data_got::do_print_to_mapfile): New function.
9649         (Output_data_dynamic::do_print_to_mapfile): New function.
9650         (Output_symtab_xindex::do_print_to_mapfile): New function.
9651         (class Output_section): Declare do_print_to_mapflie.  Declare
9652         print_to_mapfile in Input_section.
9653         (class Output_segment): Declare new functions.
9654         * object.h (Sized_relobj::symbol_count): New function.
9655         * script-sections.cc
9656         (Output_section_element_dot_assignment::set_section_addresses):
9657         Change Output_data_fixed_space to Output_data_zero_fill.
9658         (Output_data_expression::do_print_to_mapfile): New function.
9659         * script.cc (read_input_script): Add mapfile parameter.  Change
9660         all callers.
9661         * script.h (read_input_script): Update declaration.
9662         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9663         (Eh_frame::do_print_to_mapfile): New function.
9664         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9665         (Output_merge_string::do_print_to_mapfile): New function.
9666         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9667         function.
9668         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9669         function.
9670         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9671         function.
9672         * Makefile.am (CCFILES): Add mapfile.cc.
9673         (HFILES): Add mapfile.h.
9674         * Makefile.in: Rebuild.
9675
9676 2008-05-19  Ian Lance Taylor  <iant@google.com>
9677
9678         * options.h (class General_options): Add -z relro.
9679         * layout.cc (Layout::Layout): Initialize relro_segment_.
9680         (Layout::add_output_section_data): Return the output section.
9681         (Layout::make_output_section): Rcognize relro sections and mark
9682         them appropriately.
9683         (Layout::attach_allocated_section_to_segment): Put relro sections
9684         in a PT_GNU_RELRO segment.
9685         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9686         section as relro.
9687         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9688         PT_TLS segments.
9689         (Layout::linkonce_mapping): Map d.rel.ro.local to
9690         .data.rel.ro.local.
9691         (Layout::output_section_name): Us .data.rel.ro.local for any
9692         section which begins with that.
9693         * layout.h (class Layout): Update add_output_section_data
9694         declaration.  Add relro_segment_ field.
9695         * output.cc (Output_section::Output_section): Initialize is_relro_
9696         and is_relro_local_ fields.
9697         (Output_segment::add_output_section): Group relro sections.
9698         (Output_segment::is_first_section_relro): New function.
9699         (Output_segment::maximum_alignment): If there is a relro section,
9700         align the segment to the common page size.
9701         (Output_segment::set_section_addresses): Track whether we are
9702         looking at relro sections.  If the last section is a relro
9703         section, align to the common page size.
9704         (Output_segment::set_section_list_addresses): Add in_relro
9705         parameter.  Change all callers.  Align to the page size when
9706         moving from relro to non-relro section.
9707         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9708         segment.
9709         * output.h (class Output_section): Add is_relro_ and
9710         is_relro_local_ fields.
9711         (Output_section::is_relro): New function.
9712         (Output_section::set_is_relro): New function.
9713         (Output_section::is_relro_local): New function.
9714         (Output_section::set_is_relro_local): New function.
9715         (class Output_segment): Update declarations.
9716         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9717         * sparc.cc (Target_sparc::got_section): Likewise.
9718         * x86_64.cc (Target_x86_64::got_section): Likewise.
9719         * testsuite/relro_test_main.cc: New file.
9720         * testsuite/relro_test.cc: New file.
9721         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9722         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9723         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9724         (relro_test.so, relro_test_pic.o): New targets.
9725         * testsuite/Makefile.in: Rebuild.
9726
9727 2008-05-16  Ian Lance Taylor  <iant@google.com>
9728
9729         * output.cc (Output_segment::add_output_section): Remove front
9730         parameter.
9731         * output.h (class Output_segment): Remove
9732         add_initial_output_section and overloaded add_output_section.
9733         Update declaration of remaining add_output_section.
9734         * layout.cc (Layout::create_interp): Call add_output_section
9735         rather than add_initial_output_section.
9736         (Layout::finish_dynamic_section): Likewise.
9737
9738         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9739         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9740         know the dynamic type.
9741         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9742         field.  Initialize it in constructor.
9743         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9744         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9745         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9746         reloc.
9747
9748         * output.cc (Output_reloc::get_address): Change return type to
9749         Elf_Addr.
9750         * output.h (class Output_reloc): Update get_address declaration.
9751         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9752         for section addresses.
9753
9754 2008-05-09  Ian Lance Taylor  <iant@google.com>
9755
9756         PR 6493
9757         * gold.cc (gold_nomem): Use return value of write.
9758
9759 2008-05-08  Ian Lance Taylor  <iant@google.com>
9760
9761         * symtab.c (Symbol::init_base_output_data): Add version
9762         parameter.  Change all callers.
9763         (Symbol::init_base_output_segment): Likewise.
9764         (Symbol::init_base_constant): Likewise.
9765         (Symbol::init_base_undefined): Likewise.
9766         (Sized_symbol::init_output_data): Likewise.
9767         (Sized_symbol::init_output_segment): Likewise.
9768         (Sized_symbol::init_constant): Likewise.
9769         (Sized_symbol::init_undefined): Likewise.
9770         (Symbol_table::do_define_in_output_data): If the new symbol has a
9771         version, mark it as the default.
9772         (Symbol_table::do_define_in_output_segment): Likewise.
9773         (Symbol_table::do_define_as_constant): Likewise.
9774         * symtab.h (class Symbol): Update declarations.
9775         (class Sized_symbol): Likewise.
9776         * resolve.cc (Symbol::override_version): New function.
9777         (Symbol::override_base): Call override_version.
9778         (Symbol::override_base_with_special): Likewise.
9779         * testsuite/ver_script_8.script: New file.
9780         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9781         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9782         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9783         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9784
9785 2008-05-06  Ian Lance Taylor  <iant@google.com>
9786
9787         PR 6049
9788         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9789         functions.
9790         (class General_options): Remove existing --undefined, and add
9791         --no-undefined instead.  Add new --undefined as synonym for -u.
9792         * archive.cc (Archive::add_symbols): Check whether symbol was
9793         named with -u.
9794         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9795         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9796         all uses.  Add IS_UNDEFINED.  Update declarations to split
9797         different versions of init_base.  Declare init_base_undefined.
9798         (Symbol::is_defined): Handle IS_UNDEFINED.
9799         (Symbol::is_undefined): Likewise.
9800         (Symbol::is_weak_undefined): Call is_undefined.
9801         (Symbol::is_absolute): Handle IS_CONSTANT.
9802         (class Sized_symbol): Update declarations to split different
9803         versions of init.  Declare init_undefined.
9804         (class Symbol_table): Declare new functions.
9805         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9806         Change all callers.
9807         (Symbol::init_base_output_data): Likewise.
9808         (Symbol::init_base_output_segment): Likewise.
9809         (Symbol::init_base_constant): Likewise.
9810         (Symbol::init_base_undefined): New function.
9811         (Sized_symbol::init_object): Rename from init.  Change all
9812         callers.
9813         (Sized_symbol::init_output_data): Likewise.
9814         (Sized_symbol::init_output_segment): Likewise.
9815         (Sized_symbol::init_constant): Likewise.
9816         (Sized_symbol::init_undefined): New function.
9817         (Symbol_table::add_undefined_symbols_from_command_line): New
9818         function.
9819         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9820         function.
9821         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9822         (Symbol::output_section): Likewise.
9823         (Symbol::set_output_section): Likewise.
9824         (Symbol_table::sized_finalize_symbol): Likewise.
9825         (Symbol_table::sized_write_globals): Likewise.
9826         * resolve.cc (Symbol_table::should_override): Likewise.
9827         (Symbol::override_base_with_special): Likewise.
9828
9829         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9830         symbol, change it to have default visibility.
9831         * testsuite/protected_1.cc: New file.
9832         * testsuite/protected_2.cc: New file.
9833         * testsuite/protected_3.cc: New file.
9834         * testsuite/protected_main_1.cc: New file.
9835         * testsuite/protected_main_2.cc: New file.
9836         * testsuite/protected_main_3.cc: New file.
9837         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9838         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9839         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9840         (protected_1.so): New target.
9841         (protected_1_pic.o, protected_2_pic.o): New targets.
9842         (protected_3_pic.o): New target.
9843         (check_PROGRAMS): Add protected_2.
9844         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9845         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9846         * testsuite/Makefile.in: Rebuild.
9847
9848         * options.h (DEFINE_var): Add set_user_set_##varname__.
9849         (DEFINE_bool_alias): New macro.
9850         (class General_options): Define -Bstatic using DEFINE_bool_alias
9851         rather than DEFINE_special.  Add --undefined as an alias for -z
9852         defs.
9853         * options.cc (General_options::parse_Bstatic): Remove.
9854
9855         * options.h (class General_options): Add --fatal-warnings.
9856         * main.cc (main): Implement --fatal-warnings.
9857         * errors.h (Errors::warning_count): New function.
9858
9859         * options.h (class General_options): Add -Bsymbolic-functions.
9860         * symtab.h (Symbol::is_preemptible): Check for
9861         -Bsymbolic-functions.
9862
9863 2008-05-05  Ian Lance Taylor  <iant@google.com>
9864
9865         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9866         as noVARNAME rather than no-VARNAME.
9867         (class General_options): Add option -z combreloc.
9868         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9869         get_address.
9870         (Output_reloc::sort_before) [SHT_REL]: New function.
9871         (Output_reloc::sort_before) [SHT_RELA]: New function.
9872         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9873         Sort_relocs_comparison.
9874         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9875         parameter.  Change all callers.
9876         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9877         sort_relocs parameter.  Change all callers.
9878         * output.cc (Output_reloc::get_address): New function, broken out
9879         of write_rel.
9880         (Output_reloc::write_rel): Call it.
9881         (Output_reloc::compare): New function.
9882         (Output_data_reloc_base::do_write): Optionally sort relocs.
9883
9884         * configure.ac: If targ_extra_obj is set, link it in.
9885         * configure.tgt: Initialize all variables.
9886         (x86_64*): Set targ_extra_obj and targ_extra_size.
9887         * configure: Rebuild.
9888
9889         * object.cc (Sized_relobj::include_section_group): Adjust section
9890         indexes read from group data.  Build vector to pass to
9891         layout_group.
9892         * layout.cc (Layout::layout_group): Add flags and shndxes
9893         parameters.  Remove contents parameter.  Change caller.  Update
9894         explicit instantiations.
9895         * layout.h (class Layout): Update layout_group declaration.
9896         * output.cc (Output_data_group::Output_data_group): Add flags and
9897         input_shndxes parameters.  Remove contents parameter.  Change
9898         caller.
9899         (Output_data_group::do_write): Change input_sections_ to
9900         input_shndxes_.
9901         * output.h (class Output_data_group): Update constructor
9902         declaration.  Rename input_sections_ to input_shndxes_.
9903         * testsuite/many_sections_test.cc: Add template.
9904
9905 2008-04-30  Cary Coutant  <ccoutant@google.com>
9906
9907         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9908
9909         * layout.cc (Layout::include_section): Refactored check for debug
9910         info section.
9911         (Layout::add_comdat): Add new parameters.  Change type
9912         of signature parameter.  Add object and shndx to signatures table.
9913         (Layout::find_kept_object): New function.
9914         * layout.h: Include <cstring>.
9915         (Layout::is_debug_info_section): New function.
9916         (Layout::add_comdat): Add new parameters.
9917         (Layout::find_kept_object): New function.
9918         (Layout::Kept_section): New struct.
9919         (Layout::Signatures): Change type of map range.
9920         * object.cc (Relobj::output_section_address): New function.
9921         (Sized_relobj::include_section_group): Add new parameters.  Change
9922         calls to Layout::add_comdat.  Change to build table of kept comdat
9923         groups and table mapping discarded sections to kept sections.
9924         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9925         (Sized_relobj::do_layout): Change calls to include_section_group and
9926         include_linkonce_section.
9927         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9928         value to zero when section is discarded.
9929         (Sized_relobj::map_to_kept_section): New function.
9930         * object.h (Relobj::output_section_address): New function.
9931         (Relobj::Comdat_group): New type.
9932         (Relobj::find_comdat_group): New function.
9933         (Relobj::Comdat_group_table): New type.
9934         (Relobj::Kept_comdat_section): New type.
9935         (Relobj::Kept_comdat_section_table): New type.
9936         (Relobj::add_comdat_group): New function.
9937         (Relobj::set_kept_comdat_section): New function.
9938         (Relobj::get_kept_comdat_section): New function.
9939         (Relobj::comdat_groups_): New field.
9940         (Relobj::kept_comdat_sections_): New field.
9941         (Symbol_value::input_value): Update comment.
9942         (Sized_relobj::map_to_kept_section) New function.
9943         (Sized_relobj::include_linkonce_section): Add new parameter.
9944         * target-reloc.h (Comdat_behavior): New type.
9945         (get_comdat_behavior): New function.
9946         (relocate_section): Add code to map a discarded section to the
9947         corresponding kept section when applying a relocation.
9948
9949 2008-04-30  Craig Silverstein  <csilvers@google.com>
9950
9951         * dwarf_reader.cc (next_generation_count): New static var.
9952         (Addr2line_cache_entry): New struct.
9953         (addr2line_cache): New static var.
9954         (Dwarf_line_info::one_addr2line): Added caching.
9955         (Dwarf_line_info::clear_addr2line_cache): New function.
9956         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9957         cache-size parameter.
9958         (Dwarf_line_info::one_addr2line_cache): New function.
9959         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9960         new cache-size argument to one_addr2line(), and clear cache.
9961
9962 2008-04-28  Cary Coutant  <ccoutant@google.com>
9963
9964         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9965         R_386_PC8 relocations.
9966
9967 2008-04-23  Ian Lance Taylor  <iant@google.com>
9968
9969         * object.cc (Sized_relobj::include_section_group): Check for
9970         invalid section group.
9971
9972         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9973         header size.
9974
9975         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9976         than read for file header.
9977         * archive.cc (Archive::include_member): Likewise.
9978
9979 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9980
9981         * aclocal.m4: Regenerate.
9982         * configure: Regenerate.
9983
9984 2008-04-19  Ian Lance Taylor  <iant@google.com>
9985
9986         * version.cc (version_string): Bump to 1.6.
9987
9988         * testsuite/Makefile.am (many_sections_r_test): New target.
9989         (many_sections_r_test_SOURCES): Remove.
9990         (many_sections_r_test_DEPENDENCIES): Remove.
9991         (many_sections_r_test_LDFLAGS): Remove.
9992         (many_sections_r_test_LDADD): Remove.
9993
9994         * object.cc (Sized_relobj::do_add_symbols): Always pass
9995         local_symbol_count_ to add_from_relobj.
9996
9997         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9998         every thousand variables.
9999         * testsuite/Makefile.in: Rebuild.
10000
10001         * object.cc (Xindex::initialize_symtab_xindex): New function.
10002         (Xindex::read_symtab_xindex): New function.
10003         (Xindex::sym_xindex_to_shndx): New function.
10004         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10005         available.
10006         (Sized_relobj::do_initialize_xindex): New function.
10007         (Sized_relobj::do_read_symbols): Adjust section links.
10008         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10009         parameter.  Change all callers.
10010         (Sized_relobj::include_section_group): Adjust section links and
10011         symbol section indexes.
10012         (Sized_relobj::do_layout): Adjust section links.
10013         (Sized_relobj::do_count_local_symbols): Adjust section links and
10014         symbol section indexes.
10015         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10016         ordinary and special symbols.
10017         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10018         dynsym_xindex parameters.  Change all callers.  Adjust section
10019         links.  Use SHN_XINDEX when needed.
10020         (Sized_relobj::get_symbol_location_info): Adjust section links.
10021         Don't get fooled by special symbols.
10022         * object.h (class Xindex): Define.
10023         (class Object): Add xindex_ parameter.  Declare virtual functoin
10024         do_initialize_xindex.
10025         (Object::adjust_sym_shndx): New function.
10026         (Object::set_xindex): New protected function.
10027         (class Symbol_value): Add is_ordinary_shndx_ field.
10028         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10029         (Symbol_value::value): Assert ordinary section.
10030         (Symbol_value::initialize_input_to_output_map): Likewise.
10031         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10032         Change all callers.
10033         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10034         all callers.
10035         (class Sized_relobj): Update declarations.
10036         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10037         parameter.  Change all callers.
10038         (Sized_relobj::adjust_shndx): New function.
10039         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10040         field.
10041         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10042         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10043         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10044         (Sized_dynobj::read_dynsym_section): Adjust section links.
10045         (Sized_dynobj::read_dynamic): Likewise.
10046         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10047         section links.
10048         (Sized_dynobj::do_initialize_xindex): New function.
10049         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10050         do_initialize_xindex.
10051         (Sized_dynobj::adjust_shndx): New function.
10052         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10053         dynsym_xindex_ fields.
10054         (Layout::finalize): Add a call to set_section_indexes before
10055         creating the symtab sections.
10056         (Layout::set_section_indexes): Don't do anything if the section
10057         already has a section index.
10058         (Layout::create_symtab_sections): Add shnum parameter.  Change
10059         caller.  Create .symtab_shndx section if needed.
10060         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10061         caller.
10062         (Layout::allocated_output_section_count): New function.
10063         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10064         needed.
10065         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10066         fields.  Update declarations.
10067         (Layout::symtab_xindex): New function.
10068         (Layout::dynsym_xindex): New function.
10069         (class Write_symbols_task): Add layout_ field.
10070         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10071         Change caller.
10072         * output.cc (Output_section_headers::Output_section_headers): Add
10073         shstrtab_section parameter.  Change all callers.
10074         (Output_section_headers::do_sized_write): Store overflow values
10075         for section count and section string table section index in
10076         section header zero.
10077         (Output_file_header::do_sized_write): Check for overflow of
10078         section count and section string table section index.
10079         (Output_symtab_xindex::do_write): New function.
10080         (Output_symtab_xindex::endian_do_write): New function.
10081         * output.h (class Output_section_headers): Add shstrtab_section_.
10082         Update declarations.
10083         (class Output_symtab_xindex): Define.
10084         (Output_section::has_out_shndx): New function.
10085         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10086         field.
10087         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10088         Change all callers.
10089         (Sized_symbol::init): Likewise.
10090         (Symbol::output_section): Check for ordinary symbol.
10091         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10092         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10093         callers.
10094         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10095         Change all callers.  Simplify handling of symbols from sections
10096         not included in the link.
10097         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10098         distinction.
10099         (Weak_alias_sorter::operator()): Assert that symbols are
10100         ordinary.
10101         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10102         distinction.
10103         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10104         parameters.  Change all callers.
10105         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10106         symbol distinction.  Use SHN_XINDEX when needed.
10107         (Symbol_table::write_section_symbol): Add symtab_xindex
10108         parameter.  Change all callers.
10109         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10110         SHN_XINDEX when needed.
10111         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10112         declarations.
10113         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10114         (Symbol::is_defined): Check is_ordinary.
10115         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10116         (Symbol::is_absolute, Symbol::is_common): Likewise.
10117         (class Sized_symbol): Update declarations.
10118         (class Symbol_table): Update declarations.
10119         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10120         parameters.  Change all callers.
10121         (Sized_symbol::override): Likewise.
10122         (Symbol_table::override): Likewise.
10123         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10124         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10125         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10126         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10127         to be in an ordinary section.
10128         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10129         object and is_ordinary parameters.  Change all callers.
10130         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10131         Change all callers.  Don't add undefined or non-ordinary symbols
10132         to reloc_map_.
10133         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10134         Change all callers.
10135         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10136         declarations.
10137         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10138         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10139         (Sized_relobj::relocate_sections): Likewise.
10140         * target-reloc.h (scan_relocs): Adjust section symbol index.
10141         (scan_relocatable_relocs): Likewise.
10142         * i386.cc (Scan::local): Check for ordinary symbols.
10143         * sparc.cc (Scan::local): Likewise.
10144         * x86_64.cc (Scan::local): Likewise.
10145         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10146         to symbol_section_and_value.
10147         * testsuite/many_sections_test.cc: New file.
10148         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10149         (check_PROGRAMS): Add many_sections_test.
10150         (many_sections_test_SOURCES): Define.
10151         (many_sections_test_DEPENDENCIES): Define.
10152         (many_sections_test_LDFLAGS): Define.
10153         (BUILT_SOURCES): Add many_sections_define.h.
10154         (many_sections_define.h): New target.
10155         (BUILT_SOURCES): Add many_sections_check.h.
10156         (many_sections_check.h): New target.
10157         (check_PROGRAMS): Add many_sections_r_test.
10158         (many_sections_r_test_SOURCES): Define.
10159         (many_sections_r_test_DEPENDENCIES): Define.
10160         (many_sections_r_test_LDFLAGS): Define.
10161         (many_sections_r_test_LDADD): Define.
10162         (many_sections_r_test.o): New target.
10163         * testsuite/Makefile.in: Rebuild.
10164
10165 2008-04-17  Cary Coutant  <ccoutant@google.com>
10166
10167         * errors.cc (Errors::info): New function.
10168         (gold_info): New function.
10169         * errors.h (Errors::info): New function.
10170         * gold.h (gold_info): New function.
10171         * object.cc (Input_objects::add_object): Print trace output.
10172         * options.cc (options::parse_set): New function.
10173         (General_options::parse_wrap): Deleted.
10174         (General_options::General_options): Deleted initializer.
10175         * options.h (options::String_set): New typedef.
10176         (options::parse_set): New function.
10177         (DEFINE_set): New macro.
10178         (General_options::wrap): Changed to use DEFINE_set. Changed
10179         callers of any_wrap_symbols and is_wrap_symbol.
10180         (General_options::trace, General_options::trace_symbol):
10181         New options.
10182         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10183         (General_options::wrap_symbols_): Deleted.
10184         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10185
10186 2008-04-17  David S. Miller  <davem@davemloft.net>
10187
10188         * options.cc (General_options::parse_V): New function.
10189         * options.h: Add entries for -V and -Qy.
10190
10191 2008-04-17  Ian Lance Taylor  <iant@google.com>
10192
10193         * common.cc (Symbol_table::allocate_commons): Remove options
10194         parameter.  Change caller.
10195         (Symbol_table::do_allocate_commons): Remove options parameter.
10196         Change caller.  Just call do_allocate_commons_list twice.
10197         (Symbol_table::do_allocate_commons_list): New function, broken out
10198         of do_allocate_commons.
10199         * common.h (class Allocate_commons_task): Remove options_ field.
10200         Update constructor.
10201         * symtab.cc (Symbol_table::Symbol_table): Initialize
10202         tls_commons_.
10203         (Symbol_table::add_from_object): Put TLS common symbols on
10204         tls_commons_ list.
10205         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10206         which are IN_OUTPUT_DATA.
10207         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10208         allocate_commons and do_allocate_commons declarations.  Declare
10209         do_allocate_commons_list.
10210         * gold.cc (queue_middle_tasks): Update creation of
10211         Allocate_commons_task to not pass options.
10212         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10213         (TLS_TEST_C_FLAGS): New variable.
10214         (tls_test_c_pic.o): New target.
10215         (tls_test_shared.so): Link in tls_test_c_pic.o.
10216         (tls_test_c_pic_ie.o): New target.
10217         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10218         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10219         (tls_test_c.o): New target.
10220         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10221         (tls_pic_test_LDADD): Likewise.
10222         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10223         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10224         (tls_test_c_gnu2.o): New target.
10225         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10226         tls_test_c_gnu2.o.
10227         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10228         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10229         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10230         * testsuite/tls_test.cc: Include "config.h".
10231         (t_last): Call t11_last.
10232         * testsuite/tls_test.h (t11, t11_last): Declare.
10233         * testsuite/tls_test_c.c: New file.
10234         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10235         * configure.ac: Check for OpenMP support.
10236         * configure, config.in, Makefile.in: Rebuild.
10237         * testsuite/Makefile.in: Rebuild.
10238
10239 2008-04-16  Cary Coutant  <ccoutant@google.com>
10240
10241         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10242         (Target_i386::tls_base_symbol_defined_): New field.
10243         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10244         (Target_i386::Scan::global): Likewise.
10245         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10246         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10247         (Target_x86_64::tls_base_symbol_defined_): New field.
10248         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10249         (Target_x86_64::Scan::global): Likewise.
10250
10251 2008-04-16  Cary Coutant  <ccoutant@google.com>
10252
10253         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10254         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10255         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10256         building shared libraries.
10257         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10258         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10259         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10260         * testsuite/Makefile.in: Rebuild.
10261         * testsuite/weak_undef.h: New file.
10262         * testsuite/weak_undef_file1.cc: Add extra test cases.
10263         * testsuite/weak_undef_file2.cc: Likewise.
10264         * testsuite/weak_undef_test.cc: Likewise.
10265
10266 2008-04-16  David S. Miller  <davem@davemloft.net>
10267
10268         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10269         Add issued_non_pic_error_ field.  Declare check_non_pic.
10270         (Target_sparc::Scan::check_non_pic): New function.
10271         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10272         (Target_sparc::Scan::global): Likewise.
10273
10274         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10275         * configure: Rebuild.
10276
10277         * options.h (DEFINE_enable): New macro.
10278         (new_dtags): New enable option.
10279         (initfirst, interpose, loadfltr, nodefaultlib,
10280         nodelete, nodlopen, nodump): New -z options.
10281         * layout.cc (Layout:finish_dynamic_section): If new
10282         dtags enabled, emit DT_RUNPATH.  Also, emit a
10283         DT_FLAGS_1 containing any specified -z flags.
10284
10285 2008-04-16  Ian Lance Taylor  <iant@google.com>
10286
10287         * copy-relocs.cc: New file.
10288         * copy-relocs.h: New file.
10289         * reloc.cc: Remove Copy_relocs code.
10290         * reloc.h: Likewise.
10291         * reloc-types.h (struct Reloc_types) [both versions]: Add
10292         get_reloc_addend_noerror.
10293         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10294         variants of add_global which take an addend which must be zero.
10295         * i386.cc: Include "copy-relocs.h".
10296         (class Target_i386): Change type of copy_relocs_ to variable,
10297         update initializer.
10298         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10299         Change all callers.
10300         (Target_i386::do_finalize_sections): Change handling of
10301         copy_relocs_.
10302         * sparc.cc: Include "copy-relocs.h".
10303         (class Target_sparc): Change type of copy_relocs_ to variable,
10304         update initializer.
10305         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10306         Change all callers.
10307         (Target_sparc::do_finalize_sections): Change handling of
10308         copy_relocs_.
10309         * x86_64.cc: Include "copy-relocs.h".
10310         (class Target_x86_64): Change type of copy_relocs_ to variable,
10311         update initializer.
10312         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10313         class.  Change all callers.
10314         (Target_x86_64::do_finalize_sections): Change handling of
10315         copy_relocs_.
10316         * Makefile.am (CCFILES): Add copy-relocs.cc.
10317         (HFILES): Add copy-relocs.h.
10318
10319         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10320
10321         * testsuite/script_test_4.sh: Permit leading zeroes.
10322
10323 2008-04-15  Ian Lance Taylor  <iant@google.com>
10324
10325         * script-sections.cc (Script_sections::create_segments): Use
10326         header_size_adjustment even when there is enough room for the
10327         headers.
10328         * testsuite/script_test_4.sh: New file.
10329         * testsuite/script_test_4.t: New file.
10330         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10331         (check_DATA): Add script_test_4.stdout.
10332         (MOSTLYCLEANFILES): Likewise.
10333         (script_test_4): New target.
10334         (script_test_4.stdout): New target.
10335         * testsuite/Makefile.in: Rebuild.
10336
10337         * sparc.cc: Add definitions for Output_data_plt_sparc class
10338         constants.
10339
10340 2008-04-14  David S. Miller  <davem@davemloft.net>
10341
10342         * sparc.cc: New file.
10343         * Makefile.am (TARGETSOURCES): Add sparc.cc
10344         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10345         * configure.tgt: Document targ_extra_size and
10346         targ_extra_big_endian.  Add entries for sparc-* and
10347         sparc64-*.
10348         * configure.ac: Handle targ_extra_size and
10349         targ_extra_big_endian.
10350         * Makefile.in: Rebuild.
10351         * configure: Likewise.
10352         * po/POTFILES.in: Likewise.
10353         * po/gold.pot: Likewise.
10354
10355 2008-04-14  Ian Lance Taylor  <iant@google.com>
10356
10357         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10358         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10359         in the name/type/flags to section mapping.  Don't call
10360         allocate_output_section.
10361         (Layout::choose_output_section): Change parameter from adjust_name
10362         to is_input_section.  Don't permit input sections after sections
10363         are attached to segments.  Don't call allocate_output_section.
10364         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10365         not write_enable_output_section.
10366         (Layout::make_output_section): Don't push to
10367         unattached_section_list_ nor call attach_to_segment.  Call
10368         attach_section_to_segment if sections are attached.
10369         (Layout::attach_sections_to_segments): New function.
10370         (Layout::attach_section_to_segment): New function.
10371         (Layout::attach_allocated_section_to_segment): Rename from
10372         attach_to_segment.  Remove flags parameter.
10373         (Layout::allocate_output_section): Remove function.
10374         (Layout::write_enable_output_section): Remove function.
10375         * layout.h (class Layout): Update for above changes.  Add new
10376         field sections_are_attached_.
10377         * output.h (Output_section::update_flags_for_input_section): New
10378         function.
10379         * output.cc (Output_section::add_input_section): Call
10380         update_flags_for_input_section.
10381         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10382
10383 2008-04-11  Cary Coutant  <ccoutant@google.com>
10384
10385         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10386         thought unnecessary.
10387         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10388
10389 2008-04-11  Ian Lance Taylor  <iant@google.com>
10390
10391         * output.h (class Output_section_data): Remove inline definition
10392         of set_addralign.
10393         * output.cc (Output_section_data::set_addralign): New function.
10394
10395 2008-04-11  Cary Coutant  <ccoutant@google.com>
10396
10397         Add support for TLS descriptors for i386 and x86_64.
10398         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10399         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10400         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10401         GOT_TYPE_TLS_DESC.
10402         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10403         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10404         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10405         relocations.
10406         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10407         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10408         Fix problem with initial-exec relocations.
10409         (Target_i386::Relocate::relocate_tls): Likewise.
10410         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10411         relaxation.
10412         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10413         support for section-plus-offset dynamic table entries.
10414         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10415         (Output_data_dynamic::Dynamic_entry): Add support for
10416         section-plus-offset dynamic table entries.
10417         (Output_data_dynamic::Classification): Likewise.
10418         (Output_data_dynamic::classification_): Renamed offset_.
10419         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10420         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10421         (Target_x86_64::make_plt_section): New function.
10422         (Target_x86_64::reserve_tlsdesc_entries): New function.
10423         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10424         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10425         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10426         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10427         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10428         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10429         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10430         add extra PLT entry for TLS descriptors.
10431         (Output_data_plt_x86_64::got_): New field.
10432         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10433         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10434         fields.
10435         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10436         descriptors.
10437         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10438         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10439         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10440         R_386_TLS_DESC_CALL relocations.
10441         (Target_x86_64::Scan::global): Likewise.
10442         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10443         for TLS descriptors.
10444         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10445         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10446         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10447         GD-to-IE relaxation.
10448         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10449         and TLS_DESCRIPTORS.
10450         * Makefile.in: Rebuild.
10451         * configure: Rebuild.
10452         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10453         (tls_test_shared2.so): New target.
10454         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10455         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10456         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10457         (tls_shared_gd_to_ie_test_LDADD): New variable.
10458         (tls_shared_gnu2_gd_to_ie_test): New target.
10459         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10460         New targets.
10461         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10462         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10463         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10464         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10465         (tls_shared_gnu2_test): New target.
10466         (tls_test_gnu2_shared.so): New target.
10467         (tls_shared_gnu2_test_SOURCES): New variable.
10468         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10469         (tls_shared_gnu2_test_LDFLAGS): New variable.
10470         (tls_shared_gnu2_test_LDADD): New variable.
10471         * testsuite/Makefile.in: Rebuild.
10472         * testsuite/Makefile.
10473
10474 2008-04-11  Ian Lance Taylor  <iant@google.com>
10475
10476         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10477         justsyms.t.
10478         * testsuite/Makefile.in: Rebuild.
10479
10480         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10481         long.
10482         * testsuite/script_test_2.cc (main): Adjust test.
10483
10484 2008-04-11  David S. Miller  <davem@davemloft.net>
10485             Ian Lance Taylor  <iant@google.com>
10486
10487         * options.h (General_options): Add entries for '-Y' and
10488         '-relax'.
10489         * options.cc (General_options:finalize): If -Y was used, add those
10490         entries to the library path instead of the default "/lib" and
10491         "/usr/lib".
10492
10493 2008-04-11  David S. Miller  <davem@davemloft.net>
10494
10495         * testsuite/justsyms.t: Start at 0x100.
10496         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10497         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10498         long.
10499         * testsuite/script_test_2.cc: Adjust string and section length
10500         checks.
10501
10502 2008-04-09  Ian Lance Taylor  <iant@google.com>
10503
10504         PR gold/5996
10505         * script-sections.cc (Sections_element::allocate_to_segment): Add
10506         orphan parameter.
10507         (Output_section_definition::allocate_to_segment): Likewise.
10508         (Orphan_output_section::allocate_to_segment): Likewise.
10509         (Script_sections::attach_sections_using_phdrs_clause): Don't
10510         propagate non-PT_LOAD segments to orphan sections.
10511         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10512         readelf rather than objdump.
10513         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10514         .interp section and PT_INTERP segment are the same size.
10515         * testsuite/Makefile.in: Rebuild.
10516
10517         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10518         aliases for symbols defined in the same object.
10519         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10520         (weak_alias_test_SOURCES): New variable.
10521         (weak_alias_test_DEPENDENCIES): New variable.
10522         (weak_alias_test_LDFLAGS): New variable.
10523         (weak_alias_test_LDADD): New variable.
10524         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10525         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10526         (weak_alias_test_3.o): New target.
10527         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10528         * testsuite/weak_alias_test_main.cc: New file.
10529         * testsuite/weak_alias_test_1.cc: New file.
10530         * testsuite/weak_alias_test_2.cc: New file.
10531         * testsuite/weak_alias_test_3.cc: New file.
10532
10533 2008-04-08  Ian Lance Taylor  <iant@google.com>
10534
10535         * options.h (class General_options): Add --noinhibit-exec option.
10536         * main.cc (main): Check --noinhibit-exec.
10537
10538         * options.h (class General_options): Define --wrap as a special
10539         option.  Add wrap_symbols_ field.
10540         (General_options::any_wrap_symbols): New function.
10541         (General_options::is_wrap_symbol): New function.
10542         * options.cc (General_options::parse_wrap): New function.
10543         (General_options::General_options): Initialize wrap_symbols_.
10544         * symtab.cc (Symbol_table::wrap_symbol): New function.
10545         (Symbol_table::add_from_object): Handle --wrap.
10546         * symtab.h (class Symbol_table): Declare wrap_symbol.
10547         * target.h (Target::wrap_char): New function.
10548         (Target::Target_info): Add wrap_char field.
10549         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10550         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10551         * testsuite/testfile.cc (Target_test::test_target_info):
10552         Likewise.
10553
10554         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10555         there is one.
10556
10557         * layout.h (class Layout): Add added_eh_frame_data_ field.
10558         * layout.cc (Layout::Layout): Initialize new field.
10559         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10560         output section until we find a section we merged successfully.
10561         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10562         that the size be non-zero.
10563
10564         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10565         qualifier.
10566
10567 2008-04-08  Craig Silverstein  <csilvers@google.com>
10568
10569         * configure.ac: Export new conditional variable HAVE_ZLIB.
10570         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10571         on HAVE_ZLIB.
10572         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10573         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10574
10575 2008-04-07  Ian Lance Taylor  <iant@google.com>
10576
10577         * version.cc (version_string): Set to "1.5".
10578
10579         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10580         Add issued_non_pic_error_ field.  Declare check_non_pic.
10581         (Target_x86_64::Scan::check_non_pic): New function.
10582         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10583         (Target_x86_64::Scan::global): Likewise.
10584
10585         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10586         addend parameter.  Change caller.  Handle merge sections.
10587         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10588         Address to Addend.  Don't add in the result of
10589         local_section_offset, pass down the addend and use the returned
10590         value.
10591         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10592         Update declarations of local_section_offset and symbol_value.
10593         * testsuite/two_file_test_1.cc (t18): New function.
10594         * testsuite/two_file_test_2.cc (f18): New function.
10595         * testsuite/two_file_test_main.cc (main): Call t18.
10596         * testsuite/two_file_test.h (t18, f18): Declare.
10597
10598         * configure.ac: Don't test for objdump, c++filt, or readelf.
10599         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10600         conditionals.
10601         (TEST_READELF): New variable.
10602         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10603         (check_PROGRAMS): Add two_file_strip_test.
10604         (two_file_strip_test): New target.
10605         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10606         (two_file_same_shared_strip_test_SOURCES): New variable.
10607         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10608         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10609         (two_file_same_shared_strip_test_LDADD): New variable.
10610         (two_file_shared_strip.so): New target.
10611         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10612         (ver_test_5.syms, ver_test_7.syms): Likewise.
10613         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10614         (strip_test_3.stdout): Use TEST_OBJDUMP.
10615         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10616
10617 2008-04-04  Cary Coutant  <ccoutant@google.com>
10618
10619         * symtab.h (Symbol::is_weak_undefined): New function.
10620         (Symbol::is_strong_undefined): New function.
10621         (Symbol::is_absolute): New function.
10622         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10623         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10624         absolute symbols.
10625         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10626         (weak_undef_test): New target.
10627         * testsuite/Makefile.in: Rebuild.
10628         * testsuite/weak_undef_file1.cc: New file.
10629         * testsuite/weak_undef_file2.cc: New file.
10630         * testsuite/weak_undef_test.cc: New file.
10631
10632 2008-04-03  Craig Silverstein  <csilvers@google.com>
10633
10634         * compressed_output.h (class Output_compressed_section): Use
10635         unsigned buffer.
10636         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10637         add zlib header.
10638         (zlib_compressed_suffix): Removed.
10639         (Output_compressed_section::set_final_data_size): Use unsigned
10640         buffers.
10641         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10642         Fix linker invocation.
10643         (flagstest_o_specialfile_and_compress_debug_sections):
10644         Likewise.
10645         * testsuite/Makefile.in: Regenerated.
10646
10647 2008-04-02  David S. Miller  <davem@davemloft.net>
10648
10649         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10650         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10651
10652 2008-04-02  Craig Silverstein  <csilvers@google.com>
10653
10654         * TODO: New file.
10655
10656 2008-04-02  Ian Lance Taylor  <iant@google.com>
10657
10658         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10659         parameters.  Update for new key type to views_.  Change all
10660         callers.
10661         (File_read::read): Adjust for byteshift in returned view.
10662         (File_read::add_view): New function, broken out of
10663         find_and_make_view.
10664         (File_read::make_view): New function, broken out of
10665         find_and_make_view.
10666         (File_read::find_or_make_view): Add offset and aligned
10667         parameters.  Rewrite accordingly.  Change all callers.
10668         (File_read::get_view): Add offset and aligned parameters.  Adjust
10669         for byteshift in return value.
10670         (File_read::get_lasting_view): Likewise.
10671         * fileread.h (class File_read): Update declarations.
10672         (class File_read::View): Add byteshift_ field.  Add byteshift to
10673         constructor.  Add byteshift method.
10674         * archive.h (Archive::clear_uncached_views): New function.
10675         (Archive::get_view): Add aligned parameter.  Change all callers.
10676         * object.h (Object::get_view): Add aligned parameter.  Change all
10677         callers.
10678         (Object::get_lasting_view): Likewise.
10679
10680         * fileread.cc (File_read::release): Don't call clear_views if
10681         there are multiple objects.
10682         * fileread.h (File_read::clear_uncached_views): New function.
10683         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10684         on the archive.
10685
10686 2008-03-31  Cary Coutant  <ccoutant@google.com>
10687
10688         Add thin archive support.
10689         * archive.cc (Archive::armagt): New const.
10690         (Archive::setup): Remove task parameter and calls to unlock.
10691         (Archive::unlock_nested_archives): New function.
10692         (Archive::read_header): Add nested_off parameter. Change
10693         all callers.
10694         (Archive::interpret_header): Likewise.
10695         (Archive::include_all_members): Change to handle thin
10696         archives.
10697         (Archive::include_member): Likewise.
10698         * archive.h (Archive::Archive): Add new parameters and
10699         initializers.
10700         (Archive::armagt): New const.
10701         (Archive::setup): Remove task parameter.
10702         (Archive::unlock_nested_archives): New function.
10703         (Archive::read_header): Add nested_off parameter.
10704         (Archive::interpret_header): Likewise.
10705         (Archive::Nested_archive_table): New typedef.
10706         (Archive::is_thin_archive_): New field.
10707         (Archive::nested_archives_): New field.
10708         (Archive::options_): New field.
10709         (Archive::dirpath_): New field.
10710         (Archive::task_): New field.
10711         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10712         for thin archives.  Pass additional parameters to
10713         Archive::Archive.  Unlock the archive file after calling
10714         Archive::setup.
10715
10716 2008-03-29  Ian Lance Taylor  <iant@google.com>
10717
10718         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10719         version symbol to be local.
10720         * testsuite/ver_test_4.sh: New file.
10721         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10722         (check_DATA): Add ver_test_4.syms.
10723         (ver_test_4.syms): New target.
10724         * testsuite/Makefile.in: Rebuild.
10725
10726         * output.cc
10727         (Output_section::Input_section_sort_entry::has_priority): New
10728         function.
10729         (Output_section::Input_section_sort_entry::match_file_name): New
10730         function.
10731         (Output_section::Input_section_sort_entry::match_section_name):
10732         Remove.
10733         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10734         Remove.
10735         (Output_section::Input_section_sort_entry::match_section_file):
10736         Remove.
10737         (Output_section::Input_section_sort_compare::operator()): Rewrite
10738         using new Input_section_sort_entry functions.  Sort crtbegin and
10739         crtend first.  Sort sections with no priority before sections with
10740         a priority.
10741         * testsuite/initpri1.c (d3): Check j != 4.
10742         (cd5): New constructor/destructor function.
10743         (main): Check j != 2.
10744
10745         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10746         new symbol when resolving, don't call set_is_default.
10747         * testsuite/ver_test_7.cc: New file.
10748         * testsuite/ver_test_7.sh: New file.
10749         * testsuite/Makefile.am (ver_test_7.so): New target.
10750         (ver_test_7.o): New target.
10751         (check_SCRIPTS): Add ver_test_7.sh.
10752         (check_DATA): Add ver_test_7.syms.
10753         (ver_test_7.syms): New target.
10754
10755 2008-03-28  Ian Lance Taylor  <iant@google.com>
10756
10757         * layout.cc (Layout::layout): If we see an input section with a
10758         name that needs sorting, set the must_sort flag for the output
10759         section.
10760         (Layout::make_output_section): If the name of the output section
10761         indicates that it might require sorting, set the may_sort flag.
10762         * output.h (Output_section::may_sort_attached_input_sections): New
10763         function.
10764         (Output_section::set_may_sort_attached_input_sections): New
10765         function.
10766         (Output_section::must_sort_attached_input_sections): New
10767         function.
10768         (Output_section::set_must_sort_attached_input_sections): New
10769         function.
10770         (class Output_section): Declare Input_section_sort_entry.  Define
10771         Input_section_sort_compare.  Declare
10772         sort_attached_input_sections.  Add new fields:
10773         may_sort_attached_input_sections_,
10774         must_sort_attached_input_sections_,
10775         attached_input_sections_are_sorted_.
10776         * output.cc (Output_section::Output_section): Initialize new
10777         fields.
10778         (Output_section::add_input_section): Add an entry to
10779         input_sections_ if may_sort or must_sort are true.
10780         (Output_section::set_final_data_size): Call
10781         sort_attached_input_sections if necessary.
10782         (Output_section::Input_section_sort_entry): Define new class.
10783         (Output_section::Input_section_sort_compare::operator()): New
10784         function.
10785         (Output_section::sort_attached_input_sections): New function.
10786         * configure.ac: Check whether the compiler supports constructor
10787         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10788         * testsuite/initpri1.c: New file.
10789         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10790         CONSTRUCTOR_PRIORITY.
10791         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10792         (initpri1_LDFLAGS): New variable.
10793         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10794
10795 2008-03-27  Ian Lance Taylor  <iant@google.com>
10796
10797         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10798         * testsuite/common_test_1.c: New file.
10799         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10800         (common_test_1_SOURCES): New variable.
10801         (common_test_1_DEPENDENCIES): New variable.
10802         (common_test_1_LDFLAGS): New variable.
10803
10804         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10805         and commons_ correctly when NAME/VERSION does not override
10806         NAME/NULL.
10807         * testsuite/ver_test_6.c: New file.
10808         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10809         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10810         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10811
10812 2008-03-26  Ian Lance Taylor  <iant@google.com>
10813
10814         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10815         of an undefined symbol from a version script.
10816         * testsuite/Makefile.am (ver_test_5.so): New target.
10817         (ver_test_5.o): New target.
10818         (check_SCRIPTS): Add ver_test_5.sh.
10819         (check_DATA): Add ver_test_5.syms.
10820         (ver_test_5.syms): New target.
10821         * testsuite/ver_test_5.cc: New file.
10822         * testsuite/ver_test_5.script: New file.
10823         * testsuite/ver_test_5.sh: New file.
10824         * Makefile.in, testsuite/Makefile.in: Rebuild.
10825
10826         PR gold/5986
10827         Fix problems building gold with gcc 4.3.0.
10828         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10829         (gold_error_at_location, gold_warning_at_location): Use it.
10830         * configure.ac: Check whether we can compile and use a template
10831         function with a printf attribute.
10832         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10833         when jumping over bytes.
10834         * object.cc: Instantiate Object::read_section_data.
10835         * debug.h: Include <cstring>
10836         * dwarf_reader.cc: Include <algorithm>
10837         * main.cc: Include <cstring>.
10838         * options.cc: Include <cstring>.
10839         * output.cc: Include <cstring>.
10840         * script.cc: Include <cstring>.
10841         * script.h: Include <string>.
10842         * symtab.cc: Include <cstring> and <algorithm>.
10843         * target-select.cc: Include <cstring>.
10844         * version.cc: Include <string>.
10845         * testsuite/testmain.cc: Include <cstdlib>.
10846         * configure, config.in: Rebuild.
10847
10848 2008-03-25  Ian Lance Taylor  <iant@google.com>
10849
10850         * options.cc: Include "../bfd/bfdver.h".
10851         (options::help): Print bug reporting address.
10852
10853         * version.cc (print_version): Adjust output for current value of
10854         BFD_VERSION_STRING.
10855
10856         * NEWS: New file.
10857
10858         * options.cc (options::help): Print list of supported targets.
10859         * target-select.h: Include <vector>.
10860         (class Target_selector): Make machine_, size_, and is_big_endian_
10861         fields const.  Add bfd_name_ and instantiated_target_ fields.
10862         (Target_selector::Target_selector): Add bfd_name parameter.
10863         (Target_selector::recognize): Make non-virtual, call
10864         do_recognize.
10865         (Target_selector::recognize_by_name): Make non-virtual, call
10866         do_recognize_by_name.
10867         (Target_selector::supported_names): New function.
10868         (Target_selector::bfd_name): New function.
10869         (Target_selector::do_instantiate_target): New pure virtual
10870         function.
10871         (Target_selector::do_recognize): New virtual function.
10872         (Target_selector::do_recognize_by_name): New virtual function.
10873         (Target_selector::instantiate_target): New private function.
10874         (supported_target_names): Declare.
10875         * target-select.cc (Target_selector::Target_selector): Update for
10876         new parameter and fields.
10877         (select_target_by_name): Check that the name matches before
10878         calling recognize_by_name.
10879         (supported_target_names): New function.
10880         * i386.cc (class Target_selector_i386): Update Target_selector
10881         constructor call.  Remove recognize and recognize_by_name.  Add
10882         do_instantiate_target.
10883         * x86_64.cc (class Target_selector_x86_64): Likewise.
10884         * testsuite/testfile.cc (class Target_selector_test): Update for
10885         changes to Target_selector.
10886
10887         * README: Rewrite, with some notes on unsupported features.
10888
10889 2008-03-24  Cary Coutant  <ccoutant@google.com>
10890
10891         * i386.cc (Target_i386::Got_type): New enum declaration.
10892         (Target_i386::Scan::local): Updated callers of Output_data_got
10893         member functions.
10894         (Target_i386::Scan::global): Likewise.
10895         (Target_i386::Relocate::relocate): Likewise.
10896         (Target_i386::Relocate::relocate_tls): Likewise.
10897         * object.h (Got_offset_list): New class.
10898         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10899         (Sized_relobj::local_got_offset): Likewise.
10900         (Sized_relobj::set_local_got_offset): Likewise.
10901         (Sized_relobj::local_has_tls_got_offset): Removed.
10902         (Sized_relobj::local_tls_got_offset): Removed.
10903         (Sized_relobj::set_local_tls_got_offset): Removed.
10904         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10905         * output.cc (Output_data_got::add_global): Added got_type parameter.
10906         (Output_data_got::add_global_with_rel): Likewise.
10907         (Output_data_got::add_global_with_rela): Likewise.
10908         (Output_data_got::add_global_pair_with_rel): New function.
10909         (Output_data_got::add_global_pair_with_rela): New function.
10910         (Output_data_got::add_local): Added got_type parameter.
10911         (Output_data_got::add_local_with_rel): Likewise.
10912         (Output_data_got::add_local_with_rela): Likewise.
10913         (Output_data_got::add_local_pair_with_rel): New function.
10914         (Output_data_got::add_local_pair_with_rela): New function.
10915         (Output_data_got::add_global_tls): Removed.
10916         (Output_data_got::add_global_tls_with_rel): Removed.
10917         (Output_data_got::add_global_tls_with_rela): Removed.
10918         (Output_data_got::add_local_tls): Removed.
10919         (Output_data_got::add_local_tls_with_rel): Removed.
10920         (Output_data_got::add_local_tls_with_rela): Removed.
10921         * output.h (Output_data_got::add_global): Added got_type parameter.
10922         (Output_data_got::add_global_with_rel): Likewise.
10923         (Output_data_got::add_global_with_rela): Likewise.
10924         (Output_data_got::add_global_pair_with_rel): New function.
10925         (Output_data_got::add_global_pair_with_rela): New function.
10926         (Output_data_got::add_local): Added got_type parameter.
10927         (Output_data_got::add_local_with_rel): Likewise.
10928         (Output_data_got::add_local_with_rela): Likewise.
10929         (Output_data_got::add_local_pair_with_rel): New function.
10930         (Output_data_got::add_local_pair_with_rela): New function.
10931         (Output_data_got::add_global_tls): Removed.
10932         (Output_data_got::add_global_tls_with_rel): Removed.
10933         (Output_data_got::add_global_tls_with_rela): Removed.
10934         (Output_data_got::add_local_tls): Removed.
10935         (Output_data_got::add_local_tls_with_rel): Removed.
10936         (Output_data_got::add_local_tls_with_rela): Removed.
10937         * resolve.cc (Symbol::override_base_with_special): Removed
10938         reference to has_got_offset_ field.
10939         * symtab.cc (Symbol::init_fields): Replaced initialization
10940         of got_offset_ with got_offsets_.  Removed initialization
10941         of has_got_offset_
10942         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10943         (Symbol::got_offset): Likewise.
10944         (Symbol::set_got_offset): Likewise.
10945         (Symbol::has_tls_got_offset): Removed.
10946         (Symbol::tls_got_offset): Removed.
10947         (Symbol::set_tls_got_offset): Removed.
10948         (Symbol::got_offset_): Removed.
10949         (Symbol::tls_mod_got_offset_): Removed.
10950         (Symbol::tls_pair_got_offset_): Removed.
10951         (Symbol::got_offsets_): New field.
10952         (Symbol::has_got_offset): Removed.
10953         (Symbol::has_tls_mod_got_offset): Removed.
10954         (Symbol::has_tls_pair_got_offset): Removed.
10955         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10956         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10957         member functions.
10958         (Target_x86_64::Scan::global): Likewise.
10959         (Target_x86_64::Relocate::relocate): Likewise.
10960         (Target_x86_64::Relocate::relocate_tls): Likewise.
10961
10962 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10963
10964         * yyscript.y: Fix spelling error in comment.
10965
10966 2008-03-24  Ian Lance Taylor  <iant@google.com>
10967
10968         * options.h (class General_options): Define build_id option.
10969         * layout.h (class Layout): Declare write_build_id, create_note,
10970         create_build_id.  Add build_id_note_ member.
10971         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10972         "libiberty.h", "md5.h", "sha1.h".
10973         (Layout::Layout): Initialize eh_frame_data_,
10974         eh_frame_hdr_section_, and build_id_note_.
10975         (Layout::finalize): Call create_build_id.
10976         (Layout::create_note): New function, broken out of
10977         Layout::create_gold_note.
10978         (Layout::create_gold_note): Call create_note.
10979         (Layout::create_build_id): New function.
10980         (Layout::write_build_id): New function.
10981         (Close_task_runner::run): Call write_build_id.
10982
10983         * x86_64.cc: Correct license to GPLv3.
10984
10985 2008-03-23  Ian Lance Taylor  <iant@google.com>
10986
10987         * options.cc: Include "demangle.h".
10988         (parse_optional_string): New function.
10989         (parse_long_option): Handle takes_optional_argument.
10990         (parse_short_option): Update dash_z initializer.  Handle
10991         takes_optional_argument.
10992         (General_options::General_options): Initialize do_demangle_.
10993         (General_options::finalize): Set do_demangle_.  Handle demangling
10994         style.
10995         * options.h (parse_optional_string): Declare.
10996         (struct One_option): Add optional_arg field.  Update constructor.
10997         Update call constructor calls.  Add takes_optional_argument
10998         function.
10999         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11000         (DEFINE_optional_string): Define.
11001         (General_options::demangle): Change from DEFINE_bool to
11002         DEFINE_optional_string.
11003         (General_options::no_demangle): New function.
11004         (General_options::do_demangle): New function.
11005         (General_options::set_do_demangle): New function.
11006         (General_options::execstack_status_): Move definition to end of
11007         class definition.
11008         (General_options::static_): Likewise.
11009         (General_options::do_demangle_): New field.
11010         * object.cc (big_endian>::get_symbol_location_info): Call
11011         Options::do_demangle, not Options::demangle.
11012         * symtab.cc (demangle): Likewise.
11013
11014 2008-03-22  Ian Lance Taylor  <iant@google.com>
11015
11016         * gold.h: Include <cstddef> and <sys/types.h>
11017         * options.h: Include <cstring>.
11018
11019 2008-03-21  Ian Lance Taylor  <iant@google.com>
11020
11021         * Added source code to GNU binutils.