* layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-06-18  Ian Lance Taylor  <iant@google.com>
2
3         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4         merely because a non-PT_LOAD segment has a dynamic reloc.
5
6 2011-06-18  Ian Lance Taylor  <iant@google.com>
7
8         * layout.cc (Layout::finish_dynamic_section): Don't create
9         DT_FLAGS entry if not needed.
10
11 2011-06-18  Ian Lance Taylor  <iant@google.com>
12
13         PR gold/12745
14         * layout.cc (Layout::layout_eh_frame): Correct handling of
15         writable .eh_frame section.
16
17 2011-06-17  Ian Lance Taylor  <iant@google.com>
18
19         PR gold/12893
20         * resolve.cc (Symbol_table::resolve): Don't give an error if a
21         symbol is redefined with the exact same object and value.
22
23 2011-06-17  Ian Lance Taylor  <iant@google.com>
24
25         PR gold/12880
26         * layout.h (class Layout): Add interp_segment_ field.
27         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
28         (Layout::attach_allocated_section_to_segment): If making shared
29         library, put .interp section in PT_INTERP segment.
30         (Layout::finalize): Also call create_interp if -dynamic-linker
31         option was used.
32         (Layout::create_interp): Assert that there is no PT_INTERP
33         segment.  If not using a SECTIONS clause, use make_output_section.
34         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
35         * script-sections.cc
36         (Script_sections::create_note_and_tls_segments): If making shared
37         library, put .interp section in PT_INTERP segment.
38
39 2011-06-17  Ian Lance Taylor  <iant@google.com>
40
41         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
42         when making a shared library.
43
44 2011-06-17  Ian Lance Taylor  <iant@google.com>
45
46         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
47         parameter.  Change all callers.  Don't issue warning about PC32
48         against locally defined symbol.
49
50 2011-06-16  Ian Lance Taylor  <iant@google.com>
51
52         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
53         occurs in same object.
54
55 2011-06-14  Alan Modra  <amodra@gmail.com>
56
57         * po/POTFILES.in: Regenerate.
58
59 2011-06-09  Ian Lance Taylor  <iant@google.com>
60
61         * script-sections.cc
62         (Orphan_output_section::set_section_addresses): For a relocatable
63         link set address to 0.
64
65 2011-06-09  Cary Coutant  <ccoutant@google.com>
66
67         PR gold/12804
68         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
69         used with --compress-debug-sections.
70         * gold/object.cc (Sized_relobj_file::do_layout): Report
71         uncompressed size of compressed input sections.
72
73 2011-06-08  Cary Coutant  <ccoutant@google.com>
74
75         PR gold/12804
76         * testsuite/two_file_test_2_v1.cc: Change initialization of
77         v2 to keep it in .data.
78
79 2011-06-07  Cary Coutant  <ccoutant@google.com>
80
81         * common.cc (Symbol_table::do_allocate_commons_list): Call
82         gold_fallback.
83         * errors.cc (Errors::fatal): Adjust call to gold_exit.
84         (Errors::fallback): New function.
85         (gold_fallback): New function.
86         * errors.h (Errors::fallback): New function.
87         * gold.cc (gold_exit): Change status parameter to enum; adjust
88         all callers.
89         (queue_initial_tasks): Call gold_fallback.
90         * gold.h: Include cstdlib.
91         (Exit_status): New enum type.
92         (gold_exit): Change status parameter to enum.
93         (gold_fallback): New function.
94         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
95         (Layout::create_symtab_sections): Likewise.
96         (Layout::create_shdrs): Likewise.
97         * main.cc (main): Adjust call to gold_exit.
98         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
99         (Output_data_got::add_got_entry_pair): Likewise.
100         (Output_section::add_input_section): Likewise.
101         (Output_section::add_output_section_data): Likewise.
102         (Output_segment::set_section_list_addresses): Likewise.
103         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
104
105 2011-06-07  Cary Coutant  <ccoutant@google.com>
106
107         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
108         for incremental links.
109         * output.cc (Output_segment::set_section_list_addresses): Remove
110         FIXME and test for TLS or BSS.
111
112 2011-06-07  Cary Coutant  <ccoutant@google.com>
113
114         * testsuite/Makefile.am: Add incremental_copy_test,
115         incremental_common_test_1.
116         * testsuite/Makefile.in: Regenerate.
117         * testsuite/common_test_1_v1.c: New source file.
118         * testsuite/common_test_1_v2.c: New source file.
119         * testsuite/copy_test_v1.cc: New source file.
120
121 2011-06-07  Cary Coutant  <ccoutant@google.com>
122
123         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
124         update, allocate common from bss section's free list.
125         * incremental-dump.cc (dump_incremental_inputs): Print flag for
126         linker-defined symbols.
127         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
128         Skip GOT and PLT entries that are no longer referenced.
129         (Output_section_incremental_inputs::write_info_blocks): Mark
130         linker-defined symbols.
131         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
132         * output.cc (Output_section::allocate): New function.
133         * output.h (Output_section::allocate): New function.
134         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
135         linker-defined symbols.
136         (Symbol::override_base_with_special): Copy is_predefined_ flag.
137         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
138         (Symbol::init_base_output_data): Likewise.
139         (Symbol::init_base_output_segment): Likewise.
140         (Symbol::init_base_constant): Likewise.
141         (Sized_symbol::init_output_data): Likewise.
142         (Sized_symbol::init_output_segment): Likewise.
143         (Sized_symbol::init_constant): Likewise.
144         (Symbol_table::do_define_in_output_data): Likewise.
145         (Symbol_table::do_define_in_output_segment): Likewise.
146         (Symbol_table::do_define_as_constant): Likewise.
147         * symtab.h (Symbol::is_predefined): New function.
148         (Symbol::init_base_output_data): Add is_predefined parameter.
149         (Symbol::init_base_output_segment): Likewise.
150         (Symbol::init_base_constant): Likewise.
151         (Symbol::is_predefined_): New data member.
152         (Sized_symbol::init_output_data): Add is_predefined parameter.
153         (Sized_symbol::init_output_segment): Likewise.
154         (Sized_symbol::init_constant): Likewise.
155         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
156
157 2011-06-07  Cary Coutant  <ccoutant@google.com>
158
159         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
160         instead of emit_copy_reloc.
161         (Copy_relocs::emit_copy_reloc): Refactor.
162         (Copy_relocs::make_copy_reloc): New function.
163         (Copy_relocs::add_copy_reloc): Remove.
164         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
165         section.
166         (Copy_relocs::make_copy_reloc): New function.
167         (Copy_relocs::add_copy_reloc): Remove.
168         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
169         unchanged input files.
170         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
171         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
172         Reserve BSS space for COPY relocations.
173         (Sized_incremental_binary::do_emit_copy_relocs): New function.
174         (Output_section_incremental_inputs::write_info_blocks): Record
175         whether a symbol is copied from a shared object.
176         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
177         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
178         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
179         (Incremental_input_entry_reader::get_output_symbol_index): Add
180         is_copy parameter.
181         (Incremental_binary::emit_copy_relocs): New function.
182         (Incremental_binary::do_emit_copy_relocs): New function.
183         (Sized_incremental_binary::Sized_incremental_binary): Initialize
184         new data member.
185         (Sized_incremental_binary::add_copy_reloc): New function.
186         (Sized_incremental_binary::do_emit_copy_relocs): New function.
187         (Sized_incremental_binary::Copy_reloc): New struct.
188         (Sized_incremental_binary::Copy_relocs): New typedef.
189         (Sized_incremental_binary::copy_relocs_): New data member.
190         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
191         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
192         * target.h (Sized_target::emit_copy_reloc): New function.
193         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
194
195 2011-06-02  Cary Coutant  <ccoutant@google.com>
196
197         PR gold/12163
198         * gold/archive.cc (Archive::Archive): Initialize new data member.
199         (Archive::include_all_members): Return if archive has already been
200         included.
201         * gold/archive.h (Archive::include_all_members_): New data member.
202
203 2011-06-02  Nick Clifton  <nickc@redhat.com>
204
205         * dynobj.h: Fix spelling mistake in comment.
206         * output.cc: Likewise.
207
208 2011-05-31  Doug Kwan  <dougkwan@google.com>
209             Asier Llano
210
211         PR gold/12826
212         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
213         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
214         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
215         redundant arm_exidx_test.so.
216         * testsuite/Makefile.in: Regenerate.
217         (check_SCRIPTS): Add pr12826.sh
218         (check_DATA): Add pr12826.stdout
219         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
220         * testsuite/pr12826.sh: New file.
221         * testsuite/pr12826_1.s: Ditto.
222         * testsuite/pr12826_1.s: Ditto.
223
224 2011-05-30  Ian Lance Taylor  <iant@google.com>
225
226         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
227         sections.
228
229 2011-05-29  Ian Lance Taylor  <iant@google.com>
230
231         PR gold/12804
232         * testsuite/Makefile.am: Use different file name for two_file_test
233         temporary file for each incremental test.
234         * testsuite/Makefile.in: Rebuild.
235
236 2011-05-29  Ian Lance Taylor  <iant@google.com>
237
238         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
239         binary input file is empty.
240
241 2011-05-27  Ian Lance Taylor  <iant@google.com>
242
243         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
244         (ver_test_9.so): Likewise.
245         * testsuite/Makefile.in: Rebuild.
246
247 2011-05-26 Cary Coutant  <ccoutant@google.com>
248
249         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
250         * incremental.cc (Incremental_inputs::report_input_section): Fix
251         comment, indentation.
252         (Incremental_inputs::report_comdat_group): New function.
253         (Output_section_incremental_inputs::set_final_data_size): Adjust size
254         of data for incremental input file entry.
255         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
256         group count, COMDAT group signatures.
257         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
258         an unchanged input file.
259         * incremental.h (Incremental_object_entry::Incremental_object_entry):
260         Initialize new data member.
261         (Incremental_object_entry::add_comdat_group): New function.
262         (Incremental_object_entry::get_comdat_group_count): New function.
263         (Incremental_object_entry::get_comdat_signature_key): New function.
264         (Incremental_object_entry::groups_): New data member.
265         (Incremental_inputs::report_comdat_group): New function.
266         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
267         data for incremental input file entry.
268         (Incremental_input_entry_reader::get_comdat_group_count): New function.
269         (Incremental_input_entry_reader::get_input_section): Adjust size of
270         data for incremental input file entry.
271         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
272         (Incremental_input_entry_reader::get_comdat_group_signature): New
273         function.
274         * object.cc (Sized_relobj::include_section_group): Report kept
275         COMDAT groups for incremental links.
276
277 2011-05-24  David Meyer  <pdox@google.com>
278
279         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
280         with name parameter.  Add found_name parameter.
281         * fileread.cc (Input_file::find_file): Adjust code accordingly.
282         * dirsearch.h (class Dirsearch): Update declaration.
283
284 2011-05-24  Ian Lance Taylor  <iant@google.com>
285
286         * archive.cc (Library_base::should_include_member): Pull in object
287         from archive if it defines the entry symbol.
288         * parameters.cc (Parameters::entry): New function.
289         * parameters.h (class Parameters): Declare entry.
290         * output.h (class Output_file_header): Remove entry_ field.
291         * output.cc (Output_file_header::Output_file_header): Remove entry
292         parameter.  Change all callers.
293         (Output_file_header::entry): Use parameters->entry.
294         * gold.cc (queue_middle_tasks): Likewise.
295         * plugin.cc (Plugin_hook::run): Likewise.
296
297 2011-05-24 Cary Coutant  <ccoutant@google.com>
298
299         * gold.cc (queue_initial_tasks): Pass incremental base filename
300         to Output_file::open_base_file; don't print error message.
301         * incremental-dump.cc (main): Adjust call to
302         Output_file::open_for_modification.
303         * incremental-dump.cc (main): Likewise.
304         * incremental.cc (Incremental_inputs::report_command_line):
305         Ignore --incremental-base option when comparing command lines.
306         Ignore parameter when given as separate argument.
307         * options.h (class General_options): Add --incremental-base.
308         * output.cc (Output_file::Output_file):
309         (Output_file::open_base_file): Add base_name and writable parameters;
310         read base file into new file; print error message here.
311         (Output_file::map_no_anonymous): Add writable parameter; adjust all
312         callers.
313         * output.h (Output_file::open_for_modification): Rename to...
314         (Output_file::open_base_file): ...this; add base_name and
315         writable parameters; adjust all callers.
316         (Output_file::map_no_anonymous): Add writable parameter; adjust all
317         callers.
318         * testsuite/Makefile.am (incremental_test_4): Test
319         --incremental-base.
320         * testsuite/Makefile.in: Regenerate.
321
322 2011-05-24 Cary Coutant  <ccoutant@google.com>
323
324         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
325         incremental_test_4.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/two_file_test_1_v1.cc: New test source file.
328         * testsuite/two_file_test_1b_v1.cc: New test source file.
329         * testsuite/two_file_test_2_v1.cc: New test source file.
330
331 2011-05-24 Cary Coutant  <ccoutant@google.com>
332
333         * dynobj.h (Dynobj::do_dynobj): New function.
334         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
335         flag and soname for shared objects.
336         * incremental.cc (Incremental_inputs::report_object): Make
337         either Incremental_object_entry or Incremental_dynobj_entry; add
338         soname to string table.
339         (Incremental_inputs::report_input_section): Add assertion.
340         (Output_section_incremental_inputs::set_final_data_size): Adjust
341         type of input file entry for shared libraries; adjust size of
342         shared library info entry.
343         (Output_section_incremental_inputs::write_input_files): Write
344         as_needed flag for shared libraries.
345         (Output_section_incremental_inputs::write_info_blocks): Adjust type
346         of input file entry for shared libraries; write soname.
347         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
348         soname from incremental info.
349         * incremental.h (enum Incremental_input_flags): Add
350         INCREMENTAL_INPUT_AS_NEEDED.
351         (Incremental_input_entry::Incremental_input_entry): Initialize new
352         data member.
353         (Incremental_input_entry::set_as_needed): New function.
354         (Incremental_input_entry::as_needed): New function.
355         (Incremental_input_entry::do_dynobj_entry): New function.
356         (Incremental_input_entry::as_needed_): New data member.
357         (Incremental_object_entry::Incremental_object_entry): Don't check
358         for shared library.
359         (Incremental_object_entry::do_type): Likewise.
360         (class Incremental_dynobj_entry): New class.
361         (Incremental_input_entry_reader::as_needed): New function.
362         (Incremental_input_entry_reader::get_soname): New function.
363         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
364         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
365         size of shared library info entry.
366         * layout.cc (Layout::finish_dynamic_section): Don't test for 
367         incremental link when adding DT_NEEDED entries.
368         * object.h (Object::Object): Initialize new data member.
369         (Object::dynobj): New function.
370         (Object::set_as_needed): New function.
371         (Object::as_needed): New function.
372         (Object::do_dynobj): New function.
373         (Object::as_needed_): New data member.
374
375 2011-05-24 Cary Coutant  <ccoutant@google.com>
376
377         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
378         info; adjust display of GOT entries.
379         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
380         vector of input objects; remove file_status_.
381         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
382         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
383         got_plt reader; call target hooks to reserve GOT entries.
384         (Output_section_incremental_inputs::set_final_data_size): Adjust size
385         of input file info header and GOT info entry.
386         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
387         relocation info.
388         (Got_plt_view_info::got_descriptor): Remove.
389         (Got_plt_view_info::sym_index): New data member.
390         (Got_plt_view_info::input_index): New data member.
391         (Local_got_offset_visitor::visit): Write input file index.
392         (Global_got_offset_visitor::visit): Write 0 for input file index.
393         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
394         with sym_index and input_index.
395         (Output_section_incremental_inputs::write_got_plt): Adjust size of
396         incremental info GOT entry; replace got_descriptor with input_index.
397         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
398         map from input file index to object.
399         (Sized_relobj_incr::do_layout): Replace direct data member reference
400         with accessor function.
401         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
402         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
403         Adjust size of input file info header.
404         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
405         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
406         (Incremental_input_entry_reader::get_input_section): Adjust size of
407         input file info header.
408         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
409         of incremental info GOT entry.
410         (Incremental_got_plt_reader::get_got_desc): Remove.
411         (Incremental_got_plt_reader::get_got_symndx): New function.
412         (Incremental_got_plt_reader::get_got_input_index): New function.
413         (Sized_incremental_binary::Sized_incremental_binary): Remove
414         file_status_; add input_objects_.
415         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
416         (Sized_incremental_binary::set_file_is_unchanged): Remove.
417         (Sized_incremental_binary::file_is_unchanged): Remove.
418         (Sized_incremental_binary::set_input_object): New function.
419         (Sized_incremental_binary::input_object): New function.
420         (Sized_incremental_binary::file_status_): Remove.
421         (Sized_incremental_binary::input_objects_): New data member.
422         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
423         references.
424         (Sized_relobj_incr::invalid_address): Move to base class.
425         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
426         class.
427         (Sized_relobj_incr::do_output_section_offset): Likewise.
428         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
429         (Sized_relobj_incr::section_offsets_): Likewise.
430         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
431         function.
432         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
433         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
434         with accessor function.
435         (Sized_relobj_file::do_layout): Likewise.
436         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
437         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
438         (Sized_relobj_file::compute_final_local_value): Replace refs to
439         section_offsets_ with accessor function.
440         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
441         * object.h (Relobj::Relobj): Initialize new data members.
442         (Relobj::add_dyn_reloc): New function.
443         (Relobj::first_dyn_reloc): New function.
444         (Relobj::dyn_reloc_count): New function.
445         (Relobj::first_dyn_reloc_): New data member.
446         (Relobj::dyn_reloc_count_): New data member.
447         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
448         references.
449         (Sized_relobj::Address): New typedef.
450         (Sized_relobj::invalid_address): Move here from child class.
451         (Sized_relobj::Sized_relobj): Initialize new data members.
452         (Sized_relobj::sized_relobj): New function.
453         (Sized_relobj::is_output_section_offset_invalid): Move here from
454         child class.
455         (Sized_relobj::get_output_section_offset): Likewise.
456         (Sized_relobj::local_has_got_offset): Likewise.
457         (Sized_relobj::local_got_offset): Likewise.
458         (Sized_relobj::set_local_got_offset): Likewise.
459         (Sized_relobj::do_for_all_local_got_entries): Likewise.
460         (Sized_relobj::clear_got_offsets): New function.
461         (Sized_relobj::section_offsets): Move here from child class.
462         (Sized_relobj::do_output_section_offset): Likewise.
463         (Sized_relobj::do_set_section_offset): Likewise.
464         (Sized_relobj::Local_got_offsets): Likewise.
465         (Sized_relobj::local_got_offsets_): Likewise.
466         (Sized_relobj::section_offsets_): Likewise.
467         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
468         references.
469         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
470         class.
471         (Sized_relobj_file::sized_relobj): New function
472         (Sized_relobj_file::local_has_got_offset): Move to base class.
473         (Sized_relobj_file::local_got_offset): Likewise.
474         (Sized_relobj_file::set_local_got_offset): Likewise.
475         (Sized_relobj_file::get_output_section_offset): Likewise.
476         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
477         (Sized_relobj_file::do_output_section_offset): Likewise.
478         (Sized_relobj_file::do_set_section_offset): Likewise.
479         (Sized_relobj_file::Local_got_offsets): Likewise.
480         (Sized_relobj_file::local_got_offsets_): Likewise.
481         (Sized_relobj_file::section_offsets_): Likewise.
482         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
483         (all constructors).
484         (set_needs_dynsym_index): Convert relobj to derived class pointer.
485         (Output_reloc::get_symbol_index): Likewise.
486         (Output_reloc::local_section_offset): Likewise.
487         (Output_reloc::get_address): Likewise.
488         (Output_reloc::symbol_value): Likewise.
489         (Output_data_got::reserve_slot): Move to class definition.
490         (Output_data_got::reserve_local): New function.
491         (Output_data_got::reserve_slot_for_global): Remove.
492         (Output_data_got::reserve_global): New function.
493         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
494         (all constructors, two instantiations).
495         (Output_reloc::get_relobj): New function (two instantiations).
496         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
497         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
498         (Output_data_reloc::add_global): Adjust type of relobj.
499         (Output_data_reloc::add_global_relative): Likewise.
500         (Output_data_reloc::add_symbolless_global_addend): Likewise.
501         (Output_data_reloc::add_local): Likewise.
502         (Output_data_reloc::add_local_relative): Likewise.
503         (Output_data_reloc::add_symbolless_local_addend): Likewise.
504         (Output_data_reloc::add_local_section): Likewise.
505         (Output_data_reloc::add_output_section): Likewise.
506         (Output_data_reloc::add_absolute): Likewise.
507         (Output_data_reloc::add_target_specific): Likewise.
508         (Output_data_got::reserve_slot): Move definition here.
509         (Output_data_got::reserve_local): New function.
510         (Output_data_got::reserve_global): New function.
511         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
512         section_offsets_ with accessor function.
513         (Sized_relobj_file::write_sections): Likewise.
514         (Sized_relobj_file::do_relocate_sections): Likewise.
515         * target.h (Sized_target::reserve_local_got_entry): New function.
516         (Sized_target::reserve_global_got_entry): New function.
517         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
518         (Target_x86_64::reserve_global_got_entry): New function.
519         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
520
521 2011-05-23 Cary Coutant  <ccoutant@google.com>
522
523         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
524         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
525         bit when checking got_type.
526         * incremental.cc (Sized_incremental_binary::setup_readers):
527         Store symbol table and string table locations; initialize bit vector
528         of file status flags.
529         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
530         unchanged files.
531         (Sized_incremental_binary::do_process_got_plt): New function.
532         (Sized_incremental_binary::get_symtab_view): Use stored locations.
533         (Output_section_incremental_inputs::set_final_data_size): Record
534         file index for each input file.
535         (Output_section_incremental_inputs::write_got_plt): Store file index
536         instead of input entry offset for each GOT entry.
537         * incremental.h
538         (Incremental_input_entry::Incremental_input_entry): Initialize new
539         data member.
540         (Incremental_input_entry::set_offset): Store file index.
541         (Incremental_input_entry::get_file_index): New function.
542         (Incremental_input_entry::file_index_): New data member.
543         (Incremental_binary::process_got_plt): New function.
544         (Incremental_binary::do_process_got_plt): New function.
545         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
546         data members.
547         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
548         (Sized_incremental_binary::set_file_is_unchanged): New function.
549         (Sized_incremental_binary::file_is_unchanged): New function.
550         (Sized_incremental_binary::do_process_got_plt): New function.
551         (Sized_incremental_binary::file_status_): New data member.
552         (Sized_incremental_binary::main_symtab_loc_): New data member.
553         (Sized_incremental_binary::main_strtab_loc_): New data member.
554         * output.cc (Output_data_got::Got_entry::write): Add case
555         RESERVED_CODE.
556         (Output_data_got::add_global): Call add_got_entry.
557         (Output_data_got::add_global_plt): Likewise.
558         (Output_data_got::add_global_with_rel): Likewise.
559         (Output_data_got::add_global_with_rela): Likewise.
560         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
561         (Output_data_got::add_global_pair_with_rela): Likewise.
562         (Output_data_got::add_local): Call add_got_entry.
563         (Output_data_got::add_local_plt): Likewise.
564         (Output_data_got::add_local_with_rel): Likewise.
565         (Output_data_got::add_local_with_rela): Likewise.
566         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
567         (Output_data_got::add_local_pair_with_rela): Likewise.
568         (Output_data_got::reserve_slot): New function.
569         (Output_data_got::reserve_slot_for_global): New function.
570         (Output_data_got::add_got_entry): New function.
571         (Output_data_got::add_got_entry_pair): New function.
572         (Output_section::add_output_section_data): Edit FIXME.
573         * output.h
574         (Output_section_data_build::Output_section_data_build): New
575         constructor with size parameter.
576         (Output_data_space::Output_data_space): Likewise.
577         (Output_data_got::Output_data_got): Initialize new data member; new
578         constructor with size parameter.
579         (Output_data_got::add_constant): Call add_got_entry.
580         (Output_data_got::reserve_slot): New function.
581         (Output_data_got::reserve_slot_for_global): New function.
582         (class Output_data_got::Got_entry): Add RESERVED_CODE.
583         (Output_data_got::add_got_entry): New function.
584         (Output_data_got::add_got_entry_pair): New function.
585         (Output_data_got::free_list_): New data member.
586         * target.h (Sized_target::init_got_plt_for_update): New function.
587         (Sized_target::register_global_plt_entry): New function.
588         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
589         Initialize new data member; call init; add constructor with PLT count.
590         (Output_data_plt_x86_64::init): New function.
591         (Output_data_plt_x86_64::add_relocation): New function.
592         (Output_data_plt_x86_64::reserve_slot): New function.
593         (Output_data_plt_x86_64::free_list_): New data member.
594         (Target_x86_64::init_got_plt_for_update): New function.
595         (Target_x86_64::register_global_plt_entry): New function.
596         (Output_data_plt_x86_64::add_entry): Allocate from free list for
597         incremental updates.
598         (Output_data_plt_x86_64::add_relocation): New function.
599         * testsuite/object_unittest.cc (Object_test): Set default options.
600
601 2011-05-16  Ian Lance Taylor  <iant@google.com>
602
603         * options.h (class General_options): Make -i a synonym for -r.
604
605 2011-05-16  Ian Lance Taylor  <iant@google.com>
606
607         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
608
609 2011-05-10 Cary Coutant  <ccoutant@google.com>
610
611         * object.cc (Sized_relobj::do_count_local_symbols): Check for
612         strip_all (-s).
613
614 2011-05-06  Ian Lance Taylor  <iant@google.com>
615
616         * layout.cc (Layout::layout): If the output section flags change,
617         update the ordering.
618
619 2011-04-25 Cary Coutant  <ccoutant@google.com>
620
621         * incremental-dump.cc (dump_incremental_inputs): Print local
622         symbol info for each input file.
623         * incremental.cc
624         (Output_section_incremental_inputs::set_final_data_size): Add local
625         symbol info to input file entries in incremental info.
626         (Output_section_incremental_inputs::write_info_blocks): Likewise.
627         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
628         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
629         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
630         implementation.
631         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
632         (Sized_incr_relobj::do_relocate): Write the local symbols.
633         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
634         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
635         Adjust size of input file header.
636         (Incremental_inputs_reader::get_local_symbol_offset): New function.
637         (Incremental_inputs_reader::get_local_symbol_count): New function.
638         (Incremental_inputs_reader::get_input_section): Adjust size of input
639         file header.
640         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
641         (Sized_incr_relobj::This): New typedef.
642         (Sized_incr_relobj::sym_size): New const data member.
643         (Sized_incr_relobj::Local_symbol): New struct.
644         (Sized_incr_relobj::do_output_local_symbol_count): New function.
645         (Sized_incr_relobj::do_local_symbol_offset): New function.
646         (Sized_incr_relobj::local_symbol_count_): New data member.
647         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
648         (Sized_incr_relobj::local_symbol_index_): New data member.
649         (Sized_incr_relobj::local_symbol_offset_): New data member.
650         (Sized_incr_relobj::local_dynsym_offset_): New data member.
651         (Sized_incr_relobj::local_symbols_): New data member.
652         * object.h (Relobj::output_local_symbol_count): New function.
653         (Relobj::local_symbol_offset): New function.
654         (Relobj::do_output_local_symbol_count): New function.
655         (Relobj::do_local_symbol_offset): New function.
656         (Sized_relobj::do_output_local_symbol_count): New function.
657         (Sized_relobj::do_local_symbol_offset): New function.
658
659 2011-04-22  Vladimir Simonov  <sv@sw.ru>
660
661         * descriptors.cc (set_close_on_exec): New function.
662         (Descriptors::open): Use set_close_on_exec.
663         * output.cc (S_ISLNK): Define if not defined.
664
665 2011-04-22 Cary Coutant  <ccoutant@google.com>
666
667         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
668         global symbol map.
669         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
670         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
671         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
672         relocations.
673         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
674         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
675         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
676         * incremental.h
677         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
678         function.
679         (Incremental_binary::apply_incremental_relocs): New function.
680         (Incremental_binary::do_apply_incremental_relocs): New function.
681         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
682         data member.
683         (Sized_incremental_binary::add_global_symbol): New function.
684         (Sized_incremental_binary::global_symbol): New function.
685         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
686         (Sized_incremental_binary::symbol_map_): New data member.
687         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
688         * target.h (Sized_target::apply_relocation): New function.
689         * target-reloc.h (apply_relocation): New function.
690         * x86_64.cc (Target_x86_64::apply_relocation): New function.
691
692 2011-04-22  Doug Kwan  <dougkwan@google.com>
693
694         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
695         flag of a SHT_ARM_EXIDX section.
696         * testsuite/Makefile.am (arm_exidx_test): New test rules.
697         * testsuite/Makefile.in: Regenerate.
698         * testsuite/arm_exidx_test.s: New file.
699         * testsuite/arm_exidx_test.sh: Same.
700
701 2011-04-20 Cary Coutant  <ccoutant@google.com>
702
703         PR gold/12689
704         * archive.h (Incremental_archive_entry::Archive_member):
705         Initialize arg_serial_ (second constructor).
706
707 2011-04-17  Ian Lance Taylor  <iant@google.com>
708
709         * object.cc (Relocate_info::location): Simplify location string.
710         * errors.cc (Errors::error_at_location): Don't print program
711         name.
712         (Errors::warning_at_location): Likewise.
713         (Errors::undefined_symbol): Likewise.
714         * testsuite/debug_msg.sh: Update accordingly.
715
716 2011-04-14 Cary Coutant  <ccoutant@google.com>
717
718         * gold/layout.cc (Layout::symtab_section_offset): New function.
719         * gold/layout.h (Layout::symtab_section_offset): New function.
720         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
721
722 2011-04-12  Ian Lance Taylor  <iant@google.com>
723
724         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
725         with MREMAP_MAYMOVE.
726         * output.h (class Output_file): Add map_is_allocated_ field.
727         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
728         not available, provide stubs.  If mremap is not available, #define
729         it to gold_mremap.
730         (MREMAP_MAYMOVE): Define if not defined.
731         (Output_file::Output_file): Initialize map_is_allocated_.
732         (Output_file::resize): Check map_is_allocated_.
733         (Output_file::map_anonymous): If mmap fails, use malloc.
734         (Output_file::unmap): Don't do anything for an anonymous map.
735         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
736         is not available, provide stubs.
737         (File_read::View::~View): Use free rather than delete[].
738         (File_read::make_view): Use malloc rather than new[].  If mmap
739         fails, use malloc.
740         (File_read::find_or_make_view): Use malloc rather than new[].
741         * gold.h: Remove HAVE_REMAP code.
742         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
743         exists.  Rename mremap to gold_mremap.  If mmap is not available
744         don't do anything.
745         * configure, config.in: Rebuild.
746
747 2011-04-11  Ian Lance Taylor  <iant@google.com>
748
749         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
750         initialize local variable v.
751
752 2011-04-11  Cary Coutant  <ccoutant@google.com>
753
754         * archive.cc (Archive::include_member): Adjust call to
755         report_object.
756         (Add_archive_symbols::run): Track argument serial numbers.
757         (Lib_group::include_member): Likewise.
758         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
759         * archive.h (Incremental_archive_entry::Archive_member):
760         Initialize arg_serial_.
761         (Archive_member::arg_serial_): New data member.
762         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
763         (Sized_dynobj::do_add_symbols): Track symbols when doing an
764         incremental link.
765         (Sized_dynobj::do_for_all_local_got_entries): New function.
766         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
767         function.
768         * fileread.cc (get_mtime): New function.
769         * fileread.h (get_mtime): New function.
770         * gold.cc (queue_initial_tasks): Check for incremental update.
771         (process_incremental_input): New function.
772         (queue_middle_tasks): Don't force valid target for incremental
773         update.
774         * incremental-dump.cc (find_input_containing_global): Adjust
775         size of symbol info entry.
776         (dump_incremental_inputs): Dump argument serial number and
777         in_system_directory flag; bias shndx by 1; print symbol names
778         when dumping per-file symbol lists; use new symbol info readers.
779         * incremental.cc
780         (Output_section_incremental_inputs:update_data_size): New function.
781         (Sized_incremental_binary::setup_readers): Setup input readers
782         for each input file; build maps for files added from libraries
783         and scripts.
784         (Sized_incremental_binary::check_input_args): New function.
785         (Sized_incremental_binary::do_check_inputs): Build map of argument
786         serial numbers to input arguments.
787         (Sized_incremental_binary::do_file_has_changed): Rename
788         do_file_is_unchanged to this; compare file modification times.
789         (Sized_incremental_binary::do_init_layout): New function.
790         (Sized_incremental_binary::do_reserve_layout): New function.
791         (Sized_incremental_binary::do_get_input_reader): Remove.
792         (Sized_incremental_binary::get_symtab_view): New function.
793         (Incremental_checker::can_incrementally_link_output_file): Remove.
794         (Incremental_inputs::report_command_line): Exclude --debug options.
795         (Incremental_inputs::report_archive_begin): Add parameter; track
796         argument serial numbers; don't put input file entry for archive
797         before archive members.
798         (Incremental_inputs::report_archive_end): Put input file entry
799         for archive after archive members.
800         (Incremental_inputs::report_object): Add parameter; track argument
801         serial numbers and in_system_directory flag.
802         (Incremental_inputs::report_script): Add parameter; track argument
803         serial numbers.
804         (Output_section_incremental_inputs::set_final_data_size): Adjust
805         size of symbol info entry; check for forwarding symbols.
806         (Output_section_incremental_inputs::write_input_files): Write
807         in_system_directory flag and argument serial number.
808         (Output_section_incremental_inputs::write_info_blocks): Map section
809         indices between incremental info and original input file; store
810         input section index for each symbol.
811         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
812         change operator() to visit().
813         (class Global_got_offset_visitor): Likewise.
814         (class Global_symbol_visitor_got_plt):
815         (Output_section_incremental_inputs::write_got_plt): Use new visitor
816         classes.
817         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
818         (Sized_incr_relobj::do_read_symbols): New function.
819         (Sized_incr_relobj::do_layout): New function.
820         (Sized_incr_relobj::do_layout_deferred_sections): New function.
821         (Sized_incr_relobj::do_add_symbols): New function.
822         (Sized_incr_relobj::do_should_include_member): New function.
823         (Sized_incr_relobj::do_for_all_global_symbols): New function.
824         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
825         (Sized_incr_relobj::do_section_size): New function.
826         (Sized_incr_relobj::do_section_name): New function.
827         (Sized_incr_relobj::do_section_contents): New function.
828         (Sized_incr_relobj::do_section_flags): New function.
829         (Sized_incr_relobj::do_section_entsize): New function.
830         (Sized_incr_relobj::do_section_address): New function.
831         (Sized_incr_relobj::do_section_type): New function.
832         (Sized_incr_relobj::do_section_link): New function.
833         (Sized_incr_relobj::do_section_info): New function.
834         (Sized_incr_relobj::do_section_addralign): New function.
835         (Sized_incr_relobj::do_initialize_xindex): New function.
836         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
837         (Sized_incr_relobj::do_read_relocs): New function.
838         (Sized_incr_relobj::do_gc_process_relocs): New function.
839         (Sized_incr_relobj::do_scan_relocs): New function.
840         (Sized_incr_relobj::do_count_local_symbols): New function.
841         (Sized_incr_relobj::do_finalize_local_symbols): New function.
842         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
843         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
844         (Sized_incr_relobj::do_relocate): New function.
845         (Sized_incr_relobj::do_set_section_offset): New function.
846         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
847         (Sized_incr_dynobj::do_read_symbols): New function.
848         (Sized_incr_dynobj::do_layout): New function.
849         (Sized_incr_dynobj::do_add_symbols): New function.
850         (Sized_incr_dynobj::do_should_include_member): New function.
851         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
852         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
853         (Sized_incr_dynobj::do_section_size): New function.
854         (Sized_incr_dynobj::do_section_name): New function.
855         (Sized_incr_dynobj::do_section_contents): New function.
856         (Sized_incr_dynobj::do_section_flags): New function.
857         (Sized_incr_dynobj::do_section_entsize): New function.
858         (Sized_incr_dynobj::do_section_address): New function.
859         (Sized_incr_dynobj::do_section_type): New function.
860         (Sized_incr_dynobj::do_section_link): New function.
861         (Sized_incr_dynobj::do_section_info): New function.
862         (Sized_incr_dynobj::do_section_addralign): New function.
863         (Sized_incr_dynobj::do_initialize_xindex): New function.
864         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
865         (make_sized_incremental_object): New function.
866         (Incremental_library::copy_unused_symbols): New function.
867         (Incremental_library::do_for_all_unused_symbols): New function.
868         * incremental.h (enum Incremental_input_flags): New type.
869         (class Incremental_checker): Remove.
870         (Incremental_input_entry::Incremental_input_entry): Add argument
871         serial number.
872         (Incremental_input_entry::arg_serial): New function.
873         (Incremental_input_entry::set_is_in_system_directory): New function.
874         (Incremental_input_entry::is_in_system_directory): New function.
875         (Incremental_input_entry::arg_serial_): New data member.
876         (Incremental_input_entry::is_in_system_directory_): New data member.
877         (class Script_info): Move here from script.h.
878         (Script_info::Script_info): Add filename parameter.
879         (Script_info::filename): New function.
880         (Script_info::filename_): New data member.
881         (Incremental_script_entry::Incremental_script_entry): Add argument
882         serial number.
883         (Incremental_object_entry::Incremental_object_entry): Likewise.
884         (Incremental_object_entry::add_input_section): Build list of input
885         sections with map to original shndx.
886         (Incremental_object_entry::get_input_section_index): New function.
887         (Incremental_object_entry::shndx_): New data member.
888         (Incremental_object_entry::name_key_): Rename; adjust all refs.
889         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
890         (Incremental_archive_entry::Incremental_archive_entry): Add argument
891         serial number.
892         (Incremental_inputs::report_archive_begin): Likewise.
893         (Incremental_inputs::report_object): Likewise.
894         (Incremental_inputs::report_script): Likewise.
895         (class Incremental_global_symbol_reader): New class.
896         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
897         and store flags and input file type.
898         (Incremental_input_entry_reader::arg_serial): New function.
899         (Incremental_input_entry_reader::type): Extract type from flags.
900         (Incremental_input_entry_reader::is_in_system_directory): New function.
901         (Incremental_input_entry_reader::get_input_section_count): Call
902         accessor function for type.
903         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
904         function for type; adjust size of global symbol entry.
905         (Incremental_input_entry_reader::get_global_symbol_count): Call
906         accessor function for type.
907         (Incremental_input_entry_reader::get_object_count): Likewise.
908         (Incremental_input_entry_reader::get_object_offset): Likewise.
909         (Incremental_input_entry_reader::get_member_count): Likewise.
910         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
911         (Incremental_input_entry_reader::get_member_offset): Likewise.
912         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
913         (Incremental_input_entry_reader::Global_symbol_info): Remove.
914         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
915         (Incremental_input_entry_reader::get_global_symbol_reader): New
916         function.
917         (Incremental_input_entry_reader::get_output_symbol_index): New
918         function.
919         (Incremental_input_entry_reader::type_): Remove.
920         (Incremental_input_entry_reader::flags_): New data member.
921         (Incremental_inputs_reader::input_file_offset): New function.
922         (Incremental_inputs_reader::input_file_index): New function.
923         (Incremental_inputs_reader::input_file): Call input_file_offset.
924         (Incremental_inputs_reader::input_file_at_offset): New function.
925         (Incremental_relocs_reader::get_r_type): Reformat.
926         (Incremental_relocs_reader::get_r_shndx): Reformat.
927         (Incremental_relocs_reader::get_r_offset): Reformat.
928         (Incremental_relocs_reader::data): New function.
929         (Incremental_binary::Incremental_binary): Initialize new data members.
930         (Incremental_binary::check_inputs): Add cmdline parameter.
931         (Incremental_binary::file_is_unchanged): Remove.
932         (Input_reader::arg_serial): New function.
933         (Input_reader::get_unused_symbol_count): New function.
934         (Input_reader::get_unused_symbol): New function.
935         (Input_reader::do_arg_serial): New function.
936         (Input_reader::do_get_unused_symbol_count): New function.
937         (Input_reader::do_get_unused_symbol): New function.
938         (Incremental_binary::input_file_count): New function.
939         (Incremental_binary::get_input_reader): Change signature to use
940         index instead of filename.
941         (Incremental_binary::file_has_changed): New function.
942         (Incremental_binary::get_input_argument): New function.
943         (Incremental_binary::get_library): New function.
944         (Incremental_binary::get_script_info): New function.
945         (Incremental_binary::init_layout): New function.
946         (Incremental_binary::reserve_layout): New function.
947         (Incremental_binary::output_file): New function.
948         (Incremental_binary::do_check_inputs): New function.
949         (Incremental_binary::do_file_is_unchanged): Remove.
950         (Incremental_binary::do_file_has_changed): New function.
951         (Incremental_binary::do_init_layout): New function.
952         (Incremental_binary::do_reserve_layout): New function.
953         (Incremental_binary::do_input_file_count): New function.
954         (Incremental_binary::do_get_input_reader): Change signature.
955         (Incremental_binary::input_args_map_): New data member.
956         (Incremental_binary::library_map_): New data member.
957         (Incremental_binary::script_map_): New data member.
958         (Sized_incremental_binary::Sized_incremental_binary): Initialize
959         new data members.
960         (Sized_incremental_binary::output_section): New function.
961         (Sized_incremental_binary::inputs_reader): Add const.
962         (Sized_incremental_binary::symtab_reader): Add const.
963         (Sized_incremental_binary::relocs_reader): Add const.
964         (Sized_incremental_binary::got_plt_reader): Add const.
965         (Sized_incremental_binary::get_symtab_view): New function.
966         (Sized_incremental_binary::Inputs_reader): New typedef.
967         (Sized_incremental_binary::Input_entry_reader): New typedef.
968         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
969         (Sized_incremental_binary::do_file_is_unchanged): Remove.
970         (Sized_incremental_binary::do_file_has_changed): New function.
971         (Sized_incremental_binary::do_init_layout): New function.
972         (Sized_incremental_binary::do_reserve_layout): New function.
973         (Sized_input_reader::Inputs_reader): Remove.
974         (Sized_input_reader::Input_entry_reader): Remove.
975         (Sized_input_reader::do_arg_serial): New function.
976         (Sized_input_reader::do_get_unused_symbol_count): New function.
977         (Sized_input_reader::do_get_unused_symbol): New function.
978         (Sized_incremental_binary::do_input_file_count): New function.
979         (Sized_incremental_binary::do_get_input_reader): Change signature;
980         use index instead of filename.
981         (Sized_incremental_binary::section_map_): New data member.
982         (Sized_incremental_binary::input_entry_readers_): New data member.
983         (class Sized_incr_relobj): New class.
984         (class Sized_incr_dynobj): New class.
985         (make_sized_incremental_object): New function.
986         (class Incremental_library): New class.
987         * layout.cc (Free_list::num_lists): New static data member.
988         (Free_list::num_nodes): New static data member.
989         (Free_list::num_removes): New static data member.
990         (Free_list::num_remove_visits): New static data member.
991         (Free_list::num_allocates): New static data member.
992         (Free_list::num_allocate_visits): New static data member.
993         (Free_list::init): New function.
994         (Free_list::remove): New function.
995         (Free_list::allocate): New function.
996         (Free_list::dump): New function.
997         (Free_list::print_stats): New function.
998         (Layout_task_runner::run): Resize output file for incremental updates.
999         (Layout::Layout): Initialize new data members.
1000         (Layout::set_incremental_base): New function.
1001         (Layout::init_fixed_output_section): New function.
1002         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1003         incremental updates.
1004         (Layout::create_gold_note): Do not create gold note section for
1005         incremental updates.
1006         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1007         for incremental updates.
1008         (Layout::set_section_offsets): For incremental updates, allocate space
1009         from free list.
1010         (Layout::create_symtab_sections): Layout with offsets relative to
1011         start of section; for incremental updates, allocate space from free
1012         list.
1013         (Layout::create_shdrs): For incremental updates, allocate space from
1014         free list.
1015         (Layout::finish_dynamic_section): For incremental updates, do not
1016         check --as-needed (fixed in subsequent patch).
1017         * layout.h (class Free_list): New class.
1018         (Layout::set_incremental_base): New function.
1019         (Layout::incremental_base): New function.
1020         (Layout::init_fixed_output_section): New function.
1021         (Layout::allocate): New function.
1022         (Layout::incremental_base_): New data member.
1023         (Layout::free_list_): New data member.
1024         * main.cc (main): Print Free_list statistics.
1025         * object.cc (Relobj::finalize_incremental_relocs): Add
1026         clear_counts parameter; clear counts only when clear_counts is set.
1027         (Sized_relobj::Sized_relobj): Initialize new base class.
1028         (Sized_relobj::do_layout): Don't report special sections.
1029         (Sized_relobj::do_for_all_local_got_entries): New function.
1030         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1031         symtab_off to all symbol table offsets.
1032         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1033         * object.h (class Got_offset_list): Move to top of file.
1034         (Object::Object): Allow case where input_file == NULL.
1035         (Object::~Object): Likewise.
1036         (Object::input_file): Assert that input_file != NULL.
1037         (Object::lock): Allow case where input_file == NULL.
1038         (Object::unlock): Likewise.
1039         (Object::is_locked): Likewise.
1040         (Object::token): Likewise.
1041         (Object::release): Likewise.
1042         (Object::is_incremental): New function.
1043         (Object::get_mtime): New function.
1044         (Object::for_all_local_got_entries): New function.
1045         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1046         (Object::set_is_in_system_directory): New function.
1047         (Object::is_in_system_directory): New function.
1048         (Object::do_is_incremental): New function.
1049         (Object::do_get_mtime): New function.
1050         (Object::do_for_all_local_got_entries): New function.
1051         (Object::is_in_system_directory_): New data member.
1052         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1053         (class Sized_relobj_base): New class.
1054         (class Sized_relobj): Derive from Sized_relobj_base.
1055         (class Sized_relobj::Symbols): Redeclare from base class.
1056         (class Sized_relobj::local_got_offset_list): Remove.
1057         (class Sized_relobj::Output_sections): Redeclare from base class.
1058         (class Sized_relobj::do_for_all_local_got_entries): New function.
1059         (class Sized_relobj::write_local_symbols): Add offset parameter.
1060         (class Sized_relobj::local_symbol_offset_): Update comment.
1061         (class Sized_relobj::local_dynsym_offset_): Update comment.
1062         * options.cc (Input_arguments::add_file): Remove const.
1063         * options.h (Input_file_argument::Input_file_argument):
1064         Initialize arg_serial_ (all constructors).
1065         (Input_file_argument::set_arg_serial): New function.
1066         (Input_file_argument::arg_serial): New function.
1067         (Input_file_argument::arg_serial_): New data member.
1068         (Input_arguments::Input_arguments): Initialize file_count_.
1069         (Input_arguments::add_file): Remove const.
1070         (Input_arguments::number_of_input_files): New function.
1071         (Input_arguments::file_count_): New data member.
1072         (Command_line::number_of_input_files): Call
1073         Input_arguments::number_of_input_files.
1074         * output.cc (Output_segment_headers::Output_segment_headers):
1075         Set current size.
1076         (Output_section::Input_section::current_data_size): New function.
1077         (Output_section::Output_section): Initialize new data members.
1078         (Output_section::add_input_section): Don't do merge sections for
1079         an incremental link; allocate space from free list for an
1080         incremental update.
1081         (Output_section::add_output_section_data): Allocate space from
1082         free list for an incremental update.
1083         (Output_section::update_data_size): New function.
1084         (Output_section::set_fixed_layout): New function.
1085         (Output_section::reserve): New function.
1086         (Output_segment::set_section_addresses): Remove const.
1087         (Output_segment::set_section_list_addresses): Remove const; allocate
1088         space from free list for an incremental update.
1089         (Output_segment::set_offset): Adjust size of RELRO segment for an
1090         incremental update.
1091         * output.h (Output_data::current_data_size): Move here from
1092         child classes.
1093         (Output_data::pre_finalize_data_size): New function.
1094         (Output_data::update_data_size): New function.
1095         (Output_section_headers::update_data_size): new function.
1096         (Output_section_data_build::current_data_size): Move to Output_data.
1097         (Output_data_strtab::update_data_size): New function.
1098         (Output_section::current_data_size): Move to Output_data.
1099         (Output_section::set_fixed_layout): New function.
1100         (Output_section::has_fixed_layout): New function.
1101         (Output_section::reserve): New function.
1102         (Output_section::update_data_size): New function.
1103         (Output_section::has_fixed_layout_): New data member.
1104         (Output_section::free_list_): New data member.
1105         (Output_segment::set_section_addresses): Remove const.
1106         (Output_segment::set_section_list_addresses): Remove const.
1107         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1108         New function.
1109         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1110         New function.
1111         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1112         parameter when calling Add_symbols constructor; store argument
1113         serial number for members of a lib group.
1114         (Add_symbols::locks): Allow case where token == NULL.
1115         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1116         (Read_member::~Read_member): New function.
1117         (Read_member::is_runnable): New function.
1118         (Read_member::locks): New function.
1119         (Read_member::run): New function.
1120         (Check_script::~Check_script): New function.
1121         (Check_script::is_runnable): New function.
1122         (Check_script::locks): New function.
1123         (Check_script::run): New function.
1124         (Check_library::~Check_library): New function.
1125         (Check_library::is_runnable): New function.
1126         (Check_library::locks): New function.
1127         (Check_library::run): New function.
1128         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1129         (Add_symbols::library_): New data member.
1130         (class Read_member): New class.
1131         (class Check_script): New class.
1132         (class Check_library): New class.
1133         * reloc.cc (Read_relocs::is_runnable): Allow case where
1134         token == NULL.
1135         (Read_relocs::locks): Likewise.
1136         (Scan_relocs::locks): Likewise.
1137         (Relocate_task::locks): Likewise.
1138         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1139         to clear counters.
1140         (Sized_relobj::incremental_relocs_scan): Fix comment.
1141         (Sized_relobj::do_relocate): Pass output file offset to
1142         write_local_symbols.
1143         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1144         from class declaration.
1145         * script.cc (read_input_script): Allocate Script_info; pass
1146         argument serial number to report_script.
1147         * script.h (class Script_info): Move to incremental.h.
1148         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1149         * symtab.h (Symbol_table::add_from_incrobj): New function.
1150         (Symbol_table::set_file_offset): New function.
1151
1152 2011-04-05  Cary Coutant  <ccoutant@google.com>
1153
1154         * incremental-dump.cc (dump_incremental_inputs): Change signature
1155         to take a Sized_incremental_binary; change caller.  Use readers
1156         in Sized_incremental_binary.
1157         * incremental.cc
1158         (Sized_incremental_binary::find_incremental_inputs_sections):
1159         Rename do_find_incremental_inputs_sections to this.
1160         (Sized_incremental_binary::setup_readers): New function.
1161         (Sized_incremental_binary::do_check_inputs): Check
1162         has_incremental_info_ flag; move setup code to setup_readers;
1163         use input readers.
1164         (Sized_incremental_binary::do_file_is_unchanged): New function.
1165         (Sized_incremental_binary::do_get_input_reader): New function.
1166         * incremental.h (class Incremental_binary): Move to end of file.
1167         (Incremental_binary::file_is_unchanged): New function.
1168         (Incremental_binary::do_file_is_unchanged): New function.
1169         (Incremental_binary::Input_reader): New class.
1170         (Incremental_binary::get_input_reader): New function.
1171         (class Sized_incremental_binary): Move to end of file.
1172         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1173         input section reader classes.
1174         (Sized_incremental_binary::has_incremental_info): New function.
1175         (Sized_incremental_binary::inputs_reader): New function.
1176         (Sized_incremental_binary::symtab_reader): New function.
1177         (Sized_incremental_binary::relocs_reader): New function.
1178         (Sized_incremental_binary::got_plt_reader): New function.
1179         (Sized_incremental_binary::do_file_is_unchanged): New function.
1180         (Sized_incremental_binary::Sized_input_reader): New class.
1181         (Sized_incremental_binary::get_input_reader): New function.
1182         (Sized_incremental_binary::find_incremental_inputs_sections):
1183         Rename do_find_incremental_inputs_sections to this.
1184         (Sized_incremental_binary::setup_readers): New function.
1185         (Sized_incremental_binary::has_incremental_info_): New data member.
1186         (Sized_incremental_binary::inputs_reader_): New data member.
1187         (Sized_incremental_binary::symtab_reader_): New data member.
1188         (Sized_incremental_binary::relocs_reader_): New data member.
1189         (Sized_incremental_binary::got_plt_reader_): New data member.
1190         (Sized_incremental_binary::current_input_file_): New data member.
1191
1192 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1193
1194         PR gold/12640
1195         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1196         violation.
1197
1198 2011-03-30  Cary Coutant  <ccoutant@google.com>
1199
1200         * archive.cc (Archive::include_member): Adjust call to report_object.
1201         (Add_archive_symbols::run): Add script_info to call to
1202         report_archive_begin.
1203         (Lib_group::include_member): Adjust call to report_object.
1204         (Add_lib_group_symbols::run): Adjust call to report_object.
1205         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1206         blocks.  Add object count for script input files.
1207         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1208         script_info parameter; change all callers.
1209         (Incremental_inputs::report_object): Add script_info parameter;
1210         change all callers.
1211         (Incremental_inputs::report_script): Store backpointer to
1212         incremental info entry.
1213         (Output_section_incremental_inputs::set_final_data_size): Record
1214         additional information for scripts.
1215         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1216         * incremental.h (Incremental_script_entry::add_object): New function.
1217         (Incremental_script_entry::get_object_count): New function.
1218         (Incremental_script_entry::get_object): New function.
1219         (Incremental_script_entry::objects_): New data member; adjust
1220         constructor.
1221         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1222         (Incremental_inputs::report_object): Add script_info parameter.
1223         (Incremental_inputs_reader::get_object_count): New function.
1224         (Incremental_inputs_reader::get_object_offset): New function.
1225         * options.cc (Input_arguments::add_file): Return reference to
1226         new input argument.
1227         * options.h (Input_argument::set_script_info): New function.
1228         (Input_argument::script_info): New function.
1229         (Input_argument::script_info_): New data member; adjust all
1230         constructors.
1231         (Input_file_group::add_file): Return reference to new input argument.
1232         (Input_file_lib::add_file): Likewise.
1233         (Input_arguments::add_file): Likewise.
1234         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1235         * script.cc (Parser_closure::Parser_closure): Add script_info
1236         parameter; adjust all callers.
1237         (Parser_closure::script_info): New function.
1238         (Parser_closure::script_info_): New data member.
1239         (read_input_script): Report scripts earlier to incremental info.
1240         (script_add_file): Set script_info in Input_argument.
1241         (script_add_library): Likewise.
1242         * script.h (Script_options::Script_info): Rewrite class.
1243
1244 2011-03-29  Cary Coutant  <ccoutant@google.com>
1245
1246         * archive.cc (Library_base::should_include_member): Move
1247         method here from class Archive.
1248         (Archive::Archive): Initialize base class.
1249         (Archive::should_include_member): Move to base class.
1250         (Archive::do_for_all_unused_symbols): New function.
1251         (Add_archive_symbols::run): Remove redundant access to
1252         incremental_inputs.
1253         (Lib_group::Lib_group): Initialize base class.
1254         (Lib_group::do_filename): New function.
1255         (Lib_group::include_member): Pass pointer to Lib_group to
1256         report_object.
1257         (Lib_group::do_for_all_unused_symbols): New function.
1258         (Add_lib_group_symbols::run): Report archive information for
1259         incremental links.
1260         * archive.h (class Library_base): New base class.
1261         (class Archive): Derive from Library_base.
1262         (Archive::filename): Move to base class.
1263         (Archive::set_incremental_info): Likewise.
1264         (Archive::incremental_info): Likewise.
1265         (Archive::Should_include): Likewise.
1266         (Archive::should_include_member): Likewise.
1267         (Archive::Armap_entry): Remove.
1268         (Archive::Unused_symbol_iterator): Remove.
1269         (Archive::unused_symbols_begin): Remove.
1270         (Archive::unused_symbols_end): Remove.
1271         (Archive::do_filename): New function.
1272         (Archive::do_get_mtime): New function.
1273         (Archive::do_for_all_unused_symbols): New function.
1274         (Archive::task_): Move to base class.
1275         (Archive::incremental_info_): Likewise.
1276         (class Lib_group): Derive from Library_base.
1277         (Lib_group::do_filename): New function.
1278         (Lib_group::do_get_mtime): New function.
1279         (Lib_group::do_for_all_unused_symbols): New function.
1280         (Lib_group::task_): Move to base class.
1281         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1282         function.
1283         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1284         function.
1285         * incremental.cc (Incremental_inputs::report_archive_begin):
1286         Use Library_base; call library's get_mtime; add incremental inputs
1287         entry before members.
1288         (class Unused_symbol_visitor): New class.
1289         (Incremental_inputs::report_archive_end): Use Library_base; use
1290         visitor class to record unused symbols; don't add incremental inputs
1291         entry after members.
1292         (Incremental_inputs::report_object): Use Library_base.
1293         * incremental.h
1294         (Incremental_archive_entry::Incremental_archive_entry): Remove
1295         unused Archive parameter.
1296         (Incremental_inputs::report_archive_begin): Use Library_base.
1297         (Incremental_inputs::report_archive_end): Likewise.
1298         (Incremental_inputs::report_object): Likewise.
1299         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1300         function.
1301         * object.h (Object::for_all_global_symbols): New function.
1302         (Object::do_for_all_global_symbols): New function.
1303         (Sized_relobj::do_for_all_global_symbols): New function.
1304         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1305         function.
1306         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1307         function.
1308
1309 2011-03-27  Ian Lance Taylor  <iant@google.com>
1310
1311         * archive.cc (Archive::interpret_header): Return -1 if something
1312         goes wrong.  Change callers accordingly.
1313
1314 2011-03-25  Cary Coutant  <ccoutant@google.com>
1315
1316         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1317         * testsuite/Makefile.in: Regenerate.
1318
1319 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1320
1321         * plugin.cc (get_view): New.
1322         (Plugin::load): Pass get_view to the plugin.
1323         (Plugin_manager::get_view): New.
1324
1325 2011-03-21  Ian Lance Taylor  <iant@google.com>
1326
1327         * testsuite/final_layout.sh: Rewrite to not use dc.
1328         * testsuite/relro_test.sh: Fail if dc is not present.
1329
1330 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1331
1332         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1333         Change == to -eq.
1334         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1335         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1336         Change == to -eq.
1337         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1338         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1339
1340 2011-03-14  Ian Lance Taylor  <iant@google.com>
1341
1342         * script-sections.cc (Sort_output_sections::script_compare):
1343         Rename from is_before, change return type.
1344         (Sort_output_sections::operator()): Adjust accordingly.
1345
1346 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1347
1348         PR gold/12572
1349         * testsuite/odr_violation2.cc: Add comment to make all error line
1350         numbers double digits.
1351         * testsuite/debug_msg.sh: Adjust expected errors.
1352
1353 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1354
1355         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1356         but mark earlier ones as non-canonical
1357         (offset_to_iterator): Update search target and example
1358         (do_addr2line): Return extra lines in a vector*
1359         (format_file_lineno): Extract from do_addr2line
1360         (one_addr2line): Add vector* out-param
1361         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1362         when a lineno entry appeared last for its instruction
1363         (Dwarf_line_info): Add vector* out-param
1364         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1365         * symtab.cc (Odr_violation_compare): Include the lineno in the
1366         comparison again.
1367         (linenos_from_loc): New. Combine the canonical line for an
1368         address with its other lines.
1369         (True_if_intersect): New. Helper functor to make
1370         std::set_intersection a query.
1371         (detect_odr_violations): Compare sets of lines instead of just
1372         one line for each function. This became less deterministic, but
1373         has fewer false positives.
1374         * symtab.h: Declarations.
1375         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1376         mix an optimized and non-optimized object in the same binary
1377         (odr_violation2.so): Same.
1378         * testsuite/Makefile.in: Regenerate from Makefile.am.
1379         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1380         * testsuite/debug_msg.sh: Update line numbers and add
1381         assertions.
1382         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1383         non-optimized context.
1384         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1385         isn't inlined, and use OdrDerived in an optimized context.
1386         * testsuite/odr_header1.h: Defines OdrDerived, where
1387         optimization will change the
1388         first-instruction-in-the-destructor's file and line number.
1389         * testsuite/odr_header2.h: Defines OdrBase.
1390
1391 2011-03-09  Ian Lance Taylor  <iant@google.com>
1392
1393         * fileread.cc (File_read::clear_views): Don't delete the whole
1394         file view.
1395
1396 2011-03-08  Ian Lance Taylor  <iant@google.com>
1397
1398         PR gold/12525
1399         * fileread.cc: #include <climits>.
1400         (GOLD_IOV_MAX): Define.
1401         (File_read::read_multiple): Limit number of entries by iov_max.
1402         * fileread.h (class File_read): Always set max_readv_entries to
1403         128.
1404
1405 2011-03-07  Ian Lance Taylor  <iant@google.com>
1406
1407         PR gold/12525
1408         * options.h (class General_options): Add -dy and -dn.
1409
1410 2011-03-02  Cary Coutant  <ccoutant@google.com>
1411
1412         * testsuite/script_test_9.t: Add TLS segment.
1413
1414 2011-03-02  Simon Baldwin  <simonb@google.com>
1415
1416         * configure.ac: Add check for gnu_indirect_function support in
1417         the toolchain building binutils.
1418         * configure: Rebuild.
1419
1420 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1421
1422         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1423         plugin only symbols.
1424         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1425         in plugin files as not needed in the symbol table.
1426
1427 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1428
1429         * output.cc (Output_section::add_input_section): Delay fill
1430         generation for section ordering.
1431
1432 2011-02-09  Ian Lance Taylor  <iant@google.com>
1433
1434         PR gold/12316
1435         * object.h (class Sized_relobj): Remove clear_local_symbols.
1436         * reloc.cc (Sized_relobj::do_relocate): Don't call
1437         clear_local_symbols.
1438
1439 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1440
1441         * plugin.cc (is_visible_from_outside): Return true for symbols
1442         in the -u option.
1443
1444 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1445
1446         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1447         filename.
1448
1449 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1450
1451         * icf.h (is_section_foldable_candidate): Change type of parameter
1452         to std::string.
1453         * icf.cc (Icf::find_identical_sections): Change type of local variable
1454         section_name to be std::string.
1455         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1456
1457 2011-01-25  Ian Lance Taylor  <iant@google.com>
1458
1459         * script.cc (script_add_extern): Rewrite to use
1460         add_symbol_reference.
1461
1462 2011-01-25  Doug Kwan  <dougkwan@google.com>
1463
1464         * icf.cc (get_section_contents): Always lock section's object.
1465
1466 2011-01-24  Ian Lance Taylor  <iant@google.com>
1467
1468         * options.h (class General_options): Accept
1469         --no-detect-odr-violations.
1470
1471 2011-01-24  Ian Lance Taylor  <iant@google.com>
1472
1473         * version.cc (version_string): Bump to 1.11.
1474
1475 2011-01-24  Ian Lance Taylor  <iant@google.com>
1476
1477         * plugin.cc (class Plugin_rescan): Define new class.
1478         (Plugin_manager::claim_file): Set any_claimed_.
1479         (Plugin_manager::save_archive): New function.
1480         (Plugin_manager::save_input_group): New function.
1481         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1482         necessary.
1483         (Plugin_manager::new_undefined_symbol): New function.
1484         (Plugin_manager::rescan): New function.
1485         (Plugin_manager::rescannable_defines): New function.
1486         (Plugin_manager::add_input_file): Set any_added_.
1487         * plugin.h (class Plugin_manager): define new fields rescannable_,
1488         undefined_symbols_, any_claimed_, and any_added_.  Declare
1489         Plugin_rescan as friend.  Declare new functions.
1490         (Plugin_manager::Rescannable): Define type.
1491         (Plugin_manager::Rescannable_list): Define type.
1492         (Plugin_manager::Undefined_symbol_list): Define type.
1493         (Plugin_manager::Plugin_manager): Initialize new fields.
1494         * archive.cc (Archive::defines_symbol): New function.
1495         (Add_archive_symbols::run): Pass archive to plugins if any.
1496         * archive.h (class Archive): Declare defines_symbol.
1497         * readsyms.cc (Input_group::~Input_group): New function.
1498         (Finish_group::run): Pass input_group to plugins if any.
1499         * readsyms.h (class Input_group): Declare destructor.
1500         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1501         any.
1502
1503 2011-01-10  Ian Lance Taylor  <iant@google.com>
1504
1505         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1506         section as relro.
1507         (Layout::set_segment_offsets): Reset increase_relro before calling
1508         set_section_addresses a second time.
1509
1510 2011-01-04  Cary Coutant  <ccoutant@google.com>
1511
1512         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1513         sections before NOBITS sections.
1514
1515 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1516
1517         * version.cc (print_version): Update copyright to 2011.
1518
1519 2010-12-23  Cary Coutant  <ccoutant@google.com>
1520
1521         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1522         of OS to this->add.  Add OD parameter to second form of the function.
1523
1524 2010-12-20  Ian Lance Taylor  <iant@google.com>
1525
1526         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1527         second of two consecutive entries with same offset.
1528
1529 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1530
1531         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1532         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1533         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1534         to avoid unneeded links against $(LDADD).
1535         * testsuite/Makefile.in: Regenerate.
1536
1537 2010-12-15  Ian Lance Taylor  <iant@google.com>
1538
1539         PR gold/12324
1540         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1541         for R_X86_64_32 and R_X86_64_PC32.
1542         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1543         ver_matching_def_pic.o.
1544         (ver_matching_def_pic.o): New target.
1545
1546 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1547
1548         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1549         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1550         Move definition before File_read::View member definitions.
1551         (File_read::View::~View): Initialize and hold lock before
1552         updating current_mapped_bytes.
1553
1554 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1555
1556         * dwarf_reader.cc: Remove outdated comment.
1557         * gold-threads.cc: Fix typo in error message.
1558         * archive.cc: Fix typos in comments.
1559         * archive.h: Likewise.
1560         * arm-reloc-property.cc: Likewise.
1561         * arm-reloc-property.h: Likewise.
1562         * arm-reloc.def: Likewise.
1563         * arm.cc: Likewise.
1564         * attributes.h: Likewise.
1565         * cref.cc: Likewise.
1566         * ehframe.cc: Likewise.
1567         * fileread.h: Likewise.
1568         * gold.h: Likewise.
1569         * i386.cc: Likewise.
1570         * icf.cc: Likewise.
1571         * incremental.h: Likewise.
1572         * int_encoding.cc: Likewise.
1573         * layout.h: Likewise.
1574         * main.cc: Likewise.
1575         * merge.h: Likewise.
1576         * object.cc: Likewise.
1577         * object.h: Likewise.
1578         * options.cc: Likewise.
1579         * readsyms.cc: Likewise.
1580         * reduced_debug_output.cc: Likewise.
1581         * reloc.cc: Likewise.
1582         * script-sections.cc: Likewise.
1583         * sparc.cc: Likewise.
1584         * symtab.h: Likewise.
1585         * target-reloc.h: Likewise.
1586         * target.cc: Likewise.
1587         * target.h: Likewise.
1588         * timer.cc: Likewise.
1589         * timer.h: Likewise.
1590         * x86_64.cc: Likewise.
1591
1592 2010-12-09  Cary Coutant  <ccoutant@google.com>
1593
1594         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1595         stack.
1596         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1597         parameter; change all callers.
1598         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1599         * options.h (warn_execstack): New option.
1600
1601 2010-12-07  Doug Kwan  <dougkwan@google.com>
1602
1603         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1604         like function call relocations.
1605
1606 2010-12-07  Ian Lance Taylor  <iant@google.com>
1607
1608         * archive.cc (Archive::get_elf_object_for_member): Permit
1609         punconfigured to be NULL.
1610         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1611         (Archive::include_member): Pass NULL to get_elf_object_for_member
1612         if we searched for the archive and this is the first included
1613         object.
1614
1615 2010-12-01  Ian Lance Taylor  <iant@google.com>
1616
1617         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1618         track_relocs_type_ field.
1619         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1620         Set track_relocs_type_.
1621         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1622         contents when using RELA relocs.
1623         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1624         reloc_map_.
1625         * reloc.cc (Track_relocs::next_addend): New function.
1626         * reloc.h (class Track_relocs): Declare next_addend.
1627
1628 2010-12-01  Ian Lance Taylor  <iant@google.com>
1629
1630         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1631         virtual destructor.
1632
1633 2010-12-01  Ian Lance Taylor  <iant@google.com>
1634
1635         * README: Update compilers known to work and fail.
1636
1637 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1638
1639         * configure.in: For --enable-gold, handle value `default' instead of
1640         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1641         not the default.
1642         * configure: Regenerate.
1643
1644 2010-11-18  Doug Kwan  <dougkwan@google.com>
1645
1646         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1647         and right_alignment to be zero.  Store result alignment only if it is
1648         greater than existing alignment.
1649
1650 2010-11-16  Cary Coutant  <ccoutant@google.com>
1651
1652         PR gold/12220
1653         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1654         Check for ".zdebug_line".
1655
1656 2010-11-16  Doug Kwan  <dougkwan@google.com>
1657             Cary Coutant  <ccoutant@google.com>
1658
1659         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1660         by reference; adjust all callers.
1661         * output.cc (Output_segment::set_section_addresses): Adjust references
1662         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1663         list is empty.
1664         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1665         end at page boundary.
1666
1667 2010-11-16  Cary Coutant  <ccoutant@google.com>
1668
1669         PR gold/12220
1670         * layout.cc (Layout::choose_output_section): Transform names of
1671         compressed sections even when using a script with a SECTIONS clause.
1672         (Layout::output_section_name): Remove code to transform
1673         compressed debug section names.
1674         * output.cc (Output_section::add_input_section): Use uncompressed
1675         section size when tracking input sections.
1676
1677 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1678
1679         * symtab.h (Symbol::NON_PIC_REF): Remove.
1680         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1681         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1682         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1683         (Symbol::use_plt_offset): Take a flags argument and pass it
1684         directly to needs_dynamic_reloc.  Restrict check for undefined
1685         weak symbols to function calls.
1686         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1687         (Target_arm::Scan::global): Use it.
1688         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1689         (Target_arm::Relocate::relocate): Likewise.
1690         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1691         parameter with an r_type parameter.  Use get_reference_flags
1692         to get the flags.
1693         (Target_arm::Relocate::relocate): Update accordingly.
1694         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1695         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1696         (Target_i386::Scan::global): Likewise.
1697         (Target_i386::Relocate::relocate): Likewise.
1698         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1699         parameter with an r_type parameter.  Use get_reference_flags
1700         to get the flags.
1701         (Target_i386::Relocate::relocate): Update accordingly.
1702         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1703         (Target_powerpc::Scan::global): Use it.
1704         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1705         (Target_powerpc::Relocate::relocate): Likewise.
1706         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1707         (Target_sparc::Scan::global): Use it.
1708         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1709         (Target_sparc::Relocate::relocate): Likewise.
1710         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1711         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1712         (Target_x86_64::Scan::global): Likewise.
1713         (Target_x86_64::Relocate::relocate): Likewise.
1714
1715 2010-11-08  Doug Kwan  <dougkwan@google.com>
1716             Cary Coutant  <ccoutant@google.com>
1717
1718         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1719         (Arm_exidx_merge_section::section_contents_): New data member.
1720         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1721         (Arm_input_section::~Arm_input_section): De-allocate memory.
1722         (Arm_input_section::original_contents_): New data member.       
1723         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1724         in parameters instead of calling Object::section_contents without
1725         locking.
1726         (Arm_output_section::group_section): New parameter TASK.  Pass it
1727         to callees that need locking objects.
1728         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1729         to lock EXIDX input sections.  Fix a formatting issue.  Call
1730         Arm_exidx_merged_section::build_contents to create merged section
1731         contents.
1732         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1733         to lock object of stub table owner.
1734         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1735         TEXT_SIZE to initialize data member TEXT_SIZE_.
1736         (Arm_exidx_input_section::addralign): Fix typo in comment.
1737         (Arm_exidx_input_section::text_size): New method.
1738         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1739         that require locking objects.  Lock objects before scanning for stubs
1740         and updating local symbols.
1741         (Arm_input_section<big_endian>::init): Copy contents of original
1742         input section.
1743         (Arm_input_section<big_endian>::do_write): Use saved contents of
1744         original input section instead of calling Object::section_contents
1745         without locking.
1746         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1747         size without calling Object::section_size().
1748         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1749         for size.  Allocate a buffer for merged EXIDX entries.
1750         (Arm_exidx_merged_section::build_contents): New method.
1751         (Arm_exidx_merged_section::do_write): Move merge section contents
1752         building code to Arm_exidx_merged_section::build_contetns.  Write
1753         out contetns in buffer instead of building it on the fly.
1754         (Arm_relobj::make_exidx_input_section): Also pass text section size
1755         to Arm_exidx_input_section constructor.
1756         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1757         (Arm_dynobj::do_read_symbols): Fix memory leak.
1758         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1759         * target.h: (class Task): Add forward declaration.
1760         (Target::relax): Add new parameter TASK and pass it to
1761         Target::do_relax().
1762         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1763
1764 2010-11-05  Cary Coutant  <ccoutant@google.com>
1765
1766         PR gold/10708
1767         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1768         object when reading from the file.
1769         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1770         second layout pass.
1771         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1772         when reading section contents.
1773         (get_section_contents): Likewise.
1774         (icf::find_identical_sections): Likewise.
1775         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1776         object when reading from the file.
1777         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1778         the object when doing deferred section layout.
1779
1780 2010-11-03  Nick Clifton  <nickc@redhat.com>
1781
1782         PR gold/12001
1783         * script.h (class Symbol_assignment: name): New member.  Returns
1784         the name of the symbol.
1785         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1786         Returns true if the given symbol name is on the list of
1787         assignments wating to be processed.
1788         * archive.cc (should_incldue_member): If the symbol is undefined,
1789         check to see if it is on the list of symbols pending assignment.
1790
1791 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1792
1793         * script-sections.cc (Script_sections::find_memory_region): Check
1794         for a NULL output section pointer.
1795
1796 2010-10-29  Doug Kwan  <dougkwan@google.com>
1797
1798         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1799         Output_section::add_relaxed_input_section.
1800         * output.cc (Output_section::add_relaxed_input_section): Add new
1801         arguments LAYOUT and NAME.  Set section order index.
1802         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1803         Copy section order index.
1804         * output.h (Output_section::add_relaxed_input_section): Add new
1805         arguments LAYOUT and NAME.
1806
1807 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1808
1809         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1810         NATIVE_OR_CROSS_LINKER.
1811         * testsuite/Makefile.in: Regenerate.
1812
1813 2010-10-20  Doug Kwan  <dougkwan@google.com>
1814
1815         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1816         without SHF_LINK_ORDER flags.
1817         * layout.cc (Layout::choose_output_section): Do not filter
1818         SHF_LINK_ORDER flag in a relocatable link.
1819
1820 2010-10-17  Cary Coutant  <ccoutant@google.com>
1821
1822         * output.h (Output_segment::set_section_addresses): Change function
1823         signature.  Update all callers.
1824         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1825         sections.
1826         (Output_segment::set_section_addresses): Align after last TLS
1827         section.  Add padding before last relro section instead of after.
1828
1829 2010-10-17  Doug Kwan  <dougkwan@google.com>
1830
1831         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1832         GOT output section to be writable.
1833
1834 2010-10-14  Cary Coutant  <ccoutant@google.com>
1835
1836         * debug.h (DEBUG_INCREMENTAL): New flag.
1837         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1838         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1839         mode.
1840         * incremental.cc (report_command_line): Ignore all forms of
1841         --incremental.
1842         * layout.cc (Layout::Layout): Check parameters for incremental link
1843         mode.
1844         * options.cc (General_options::parse_incremental): New function.
1845         (General_options::parse_no_incremental): New function.
1846         (General_options::parse_incremental_full): New function.
1847         (General_options::parse_incremental_update): New function.
1848         (General_options::incremental_mode_): New data member.
1849         (General_options::finalize): Check incremental_mode_.
1850         * options.h (General_options): Update help text for --incremental.
1851         Add --no-incremental, --incremental-full, --incremental-update.
1852         (General_options::Incremental_mode): New enum type.
1853         (General_options::incremental_mode): New function.
1854         (General_options::incremental_mode_): New data member.
1855         * parameters.cc (Parameters::incremental_mode_): New data member.
1856         (Parameters::set_options): Set incremental_mode_.
1857         (Parameters::set_incremental_full): New function.
1858         (Parameters::incremental): New function.
1859         (Parameters::incremental_update): New function.
1860         (set_parameters_incremental_full): New function.
1861         * parameters.h (Parameters::set_incremental_full): New function.
1862         (Parameters::incremental): New function.
1863         (Parameters::incremental_update): New function.
1864         (Parameters::incremental_mode_): New data member.
1865         (set_parameters_incremental_full): New function.
1866         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1867         incremental link mode.
1868         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1869         (Sized_relobj::do_relocate_sections): Likewise.
1870         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1871         option.
1872         * testsuite/Makefile.in: Regenerate.
1873         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1874
1875 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1876
1877         * script-sections.h (class Script_sections): Make
1878         Sections_elements typedef public.
1879         * script-sections.cc (class Sort_output_sections): Add elements_
1880         field.  Add constructor which sets it; change all callers.
1881         (Sort_output_sections::is_before): New function.
1882         (Sort_output_sections::operator()): Call is_before.
1883         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1884         conditional.
1885         * testsuite/script_test_10.sh: New test. Test script section
1886         order.
1887         * testsuite/script_test_10.t: Likewise.
1888         * testsuite/script_test_10.s: Likewise.
1889         * testsuite/Makefile.am: Wrap the cross linker tests and the
1890         common tests into NATIVE_OR_CROSS_LINKER.
1891         (check_SCRIPTS): Add script_test_10.sh.
1892         (check_DATA): Add script_test_10.stdout.
1893         (script_test_10.o, script_test_10): New targets.
1894         (script_test_10.stdout): New target.
1895         * configure, testsuite/Makefile.in: Regenerate.
1896
1897 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1898
1899         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1900         error for the deprecated relocations.
1901         (Target_arm::Scan::global): Likewise.
1902         (Target_arm::Relocate::relocate): Likewise.
1903
1904 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1905
1906         * fileread.cc (Input_file::find_file): Initialize *found_name
1907         and *namep when using the fallback search for case 4.
1908
1909 2010-10-11  Cary Coutant  <ccoutant@google.com>
1910
1911         * options.h (class General_options): Redefine -z lazy as an alias for
1912         the negation of -z now.
1913
1914 2010-10-11  Ian Lance Taylor  <iant@google.com>
1915
1916         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1917         binding.
1918
1919 2010-10-06  Nick Clifton  <nickc@redhat.com>
1920
1921         * script-sections.cc(class Memory_region): Remove
1922         current_lma_offset_ field.  Rename current_vma_offset_ to
1923         current_offset_.  Add last_section_ field.
1924         (Memory_region::get_current_vma_address): Rename to
1925         get_current_address.
1926         (Memory_region::get_current_lma_address): Delete.
1927         (Memory_region::increment_vma_offset): Rename to
1928         increment_offset.
1929         (Memory_region::increment_lma_offset): Delete.
1930         (Memory_region::attributes_compatible): New method.  Returns
1931         true if the provided section is compatible with the region.
1932         (Memory_region::get_last_section): New method.  Returns the last
1933         section to use the region.
1934         (Memory_region::set_last_section): New method.  Stores the last
1935         section to use the region.
1936         (Script_sections::block_in_region): New method.  Returns true if
1937         a block of memory is contained within a region.
1938         (Script_sections::find_memory_region): New method.  Locates a
1939         memory region to be used to set a VMA or LMA address.
1940         (Output_section_definition::set_section_addresses): Add code to
1941         check for addresses set by memory regions.
1942         (Output_segment::set_section_addresses): Remove memory region
1943         walking code.
1944         (Script_sections::create_segment): Add a warning if a header
1945         segment is created outside of any region.
1946         * script-sections.h (class Script_sections): Add prototypes for
1947         find_memory_region and block_in_region methods.
1948         * testsuite/memory_test.s: Use .long instead of .word.
1949         * testsuite/memory_test.t: Add some more output sections.
1950         * testsuite/memory_test.sh: Update expected output.
1951
1952 2010-10-02  Doug Kwan  <dougkwan@google.com>
1953
1954         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1955         defintion to symtab.h
1956         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1957         declaration to defintion.
1958
1959 2010-10-01  Nick Clifton  <nickc@redhat.com>
1960
1961         * expression.cc (eval): Replace dummy argument with NULL.
1962         (eval_maybe_dot): Check for a NULL result section pointer.
1963         (Symbol_expression::value): Likewise.
1964         (Dot_expression::value): Likewise.
1965         (BINARY_EXPRESSION): Likewise.
1966         (Max_expression::value): Likewise.
1967         (Min_expression::value): Likewise.
1968         (Absolute_expression::value): Likewise.
1969         (Addr_expression::value_from_output_section): Likewise.
1970         (Loaddddr_expression::value_from_output_section): Likewise.
1971         (Segment_start_expression::value): Likewise.
1972         * script-sections.cc
1973         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1974         argument with NULL.
1975         (Sections_elememt_dot_assignment::set_section_addresses):
1976         Likewise.
1977         (Output_data_expression::do_write_to_buffer): Likewise.
1978         (Output_section_definition::finalize_symbols): Likewise.
1979         (Output_section_definition::set_section_addresses): Likewise.
1980
1981 2010-09-30  Doug Kwan  <dougkwan@google.com>
1982
1983         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1984
1985 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1986
1987         * target.h (Target::can_icf_inline_merge_sections): New virtual
1988         function.
1989         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1990         virtual function.
1991         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1992         virtual function.
1993         * icf.cc (get_section_contents): Inline merge sections only when
1994         target allows it.
1995
1996 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1997
1998         * configure: Regenerate.
1999
2000 2010-09-17  Ian Lance Taylor  <iant@google.com>
2001
2002         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2003         * testsuite/Makefile.am (memory_test.o): New target.
2004         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2005         memory_test.t.
2006         * testsuite/Makefile.in: Rebuild.
2007
2008 2010-09-17  Doug Kwan  <dougkwan@google.com>
2009
2010         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2011         defintion if relocation uses GOT entries of the symbol.
2012         * testsuite/icf_safe_test.sh: Fix test.
2013         * testsuite/icf_safe_so_test.sh: Fix test.
2014
2015 2010-09-16  Cary Coutant  <ccoutant@google.com>
2016
2017         * script_sections.cc (class Memory_region): Remove "NULL" from
2018         vector initializations.
2019
2020 2010-09-15  Cary Coutant  <ccoutant@google.com>
2021
2022         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2023         Resolve forwarding symbols.
2024
2025 2010-09-15  Doug Kwan  <dougkwan@google.com>
2026
2027         * gold/testsuite/script_test_3.t: Add ARM special sections.
2028         * gold/testsuite/script_test_4.t: Same.
2029         * gold/testsuite/script_test_5.t: Same.
2030         * gold/testsuite/script_test_6.t: Same.
2031         * gold/testsuite/script_test_7.t: Same.
2032         * gold/testsuite/script_test_7.t: Same.
2033         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2034
2035 2010-09-14  Cary Coutant  <ccoutant@google.com>
2036
2037         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2038         (Target_x86_64::Relocate::relocate_tls): Replace check for
2039         saw_tls_block_reloc_ with test for executable section.
2040
2041 2010-09-12  Cary Coutant  <ccoutant@google.com>
2042
2043         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2044         position-independent executables to shared libraries need dynamic
2045         relocations.
2046         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2047         position-independent executables.
2048         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2049         * testsuite/Makefile.in: Regenerate.
2050
2051 2010-09-10  Nick Clifton  <nickc@redhat.com>
2052
2053         PR gold/11997
2054         * testsuite/memory_test.t: Discard any sections that are not
2055         needed.
2056
2057 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2058
2059         PR gold/11996
2060         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2061         "This::" to work around a bug in gcc 4.2.
2062
2063         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2064
2065 2010-09-09  Rafael Espindola  <espindola@google.com>
2066
2067         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2068         sections with different PF_X flags in the same segment.
2069         (Layout::find_first_load_seg): Search all segments to find the first
2070         one.
2071         * options.h (rosegment): New.
2072
2073 2010-09-08  Rafael Espindola  <espindola@google.com>
2074
2075         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2076
2077 2010-09-08  Doug Kwan  <dougkwan@google.com>
2078
2079         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2080         (Arm_relobj::do_relocate_sections): Add new parameter for output
2081         file to match the parent.
2082         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2083         of local symbols instead of input values.  Update code to track
2084         changes in gold::relocate_section.
2085         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2086         (Sized_relobj::compute_final_local_value_internal): New methods.
2087         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2088         body into private version of Sized_relobj::compute_final_local_value.
2089         Call the inline method.
2090         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2091         merged symbol value if there is one.
2092         (Symbol_value::has_output_value): New method defintiion.
2093         (Sized_relobj::Compute_final_local_value_status): New enum type.
2094         (Sized_relobj::compute_final_local_value): New methods.
2095         (Sized_relobj::compute_final_local_value_internal): New methods.
2096         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2097         and arm_cortex_a8.sh.
2098         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2099         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2100         New tests.
2101         * Makefile.in: Regenerate.
2102         * testsuite/arm_bl_out_of_range.s: Update test.
2103         * testsuite/thumb_bl_out_of_range.s: Ditto.
2104         * testsuite/thumb_blx_out_of_range.s: Ditto.
2105         * testsuite/arm_branch_out_of_range.sh: New file.
2106         * testsuite/arm_cortex_a8.sh: Ditto.
2107         * testsuite/arm_cortex_a8_b.s: Ditto.
2108         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2109         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2110         * testsuite/arm_cortex_a8_bl.s: Ditto.
2111         * testsuite/arm_cortex_a8_blx.s: Ditto.
2112         * testsuite/arm_cortex_a8_local.s: Ditto.
2113         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2114         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2115
2116 2010-09-08  Rafael Espindola  <espindola@google.com>
2117
2118         * Makefile.am (memory_test.stdout): Run readelf with -W.
2119         * Makefile.in: Regenerate.
2120         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2121         64 bit output.
2122
2123 2010-09-08  Rafael Espindola  <espindola@google.com>
2124
2125         * script-sections.cc (Script_sections::add_memory_region): Convert
2126         field precision to int.
2127         * script.cc (script_set_section_region, script_set_section_region):
2128         Convert field precision to int.
2129
2130 2010-09-08  Rafael Espindola  <espindola@google.com>
2131
2132         * arm.cc (do_finalize_sections): Create the __exidx_start and
2133         __exdix_end symbols even when the section is missing.
2134
2135 2010-09-08  Nick Clifton  <nickc@redhat.com>
2136
2137         * README: Remove claim that MEMORY is not supported.
2138         * expression.cc (script_exp_function_origin)
2139         (script_exp_function_length): Move from here to ...
2140         * script.cc: ... here.
2141         (script_set_section_region, script_add_memory)
2142         (script_parse_memory_attr, script_include_directive): New
2143         functions.
2144         * script-sections.cc
2145         (class Memory_region): New class.
2146         (class Output_section_definition): Add set_memory_region,
2147         set_section_vma, set_section_lma and get_section_name methods.
2148         (class Script_Sections): Add add_memory_region,
2149         find_memory_region, find_memory_region_origin,
2150         find_memory_region_length and set_memory_region methods.
2151         Have set_section_addresses method walk the list of set memory
2152         regions.
2153         Extend the print methos to display memory regions.
2154         * script-sections.h: Add prototypes for new methods.
2155         Add enum for MEMORY region attributes.
2156         * yyscript.y: Add support for parsing MEMORY regions.
2157         * script-c.h: Add prototypes for new functions.
2158         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2159         * testsuite/Makefile.in: Regenerate.
2160         * testsuite/memory_test.sh: New script.
2161         * testsuite/memory_test.s: New assembler source file.
2162         * testsuite/memory_test.t: New linker script.
2163
2164 2010-08-27  Doug Kwan  <dougkwan@google.com>
2165
2166         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2167         reference override an existing dynamic weak reference.
2168         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2169         * testsuite/Makefile.in: Regenerate.
2170         * testsuite/dyn_weak_ref.sh: New file.
2171         * testsuite/dyn_weak_ref_1.c: Ditto.
2172         * testsuite/dyn_weak_ref_2.c: Ditto.
2173
2174 2010-08-27  Ian Lance Taylor  <iant@google.com>
2175
2176         * incremental.h (class Incremental_input_entry): Add virtual
2177         destructor.
2178
2179 2010-08-27  Ian Lance Taylor  <iant@google.com>
2180
2181         * testsuite/start_lib_test_3.c: Mark t3 as used.
2182
2183 2010-08-27  Nick Clifton  <nickc@redhat.com>
2184
2185         * options.cc (version_script): Fix small typo in previous
2186         whitespace tidyup.
2187
2188 2010-08-25  Nick Clifton  <nickc@redhat.com>
2189
2190         * archive.cc: Formatting fixes: Remove whitespace between
2191         typename and following asterisk.  Remove whitespace between
2192         function name and opening parenthesis.
2193         * archive.h: Likewise.
2194         * arm.cc: Likewise.
2195         * attributes.cc: Likewise.
2196         * attributes.h: Likewise.
2197         * common.cc: Likewise.
2198         * copy-relocs.cc: Likewise.
2199         * dirsearch.h: Likewise.
2200         * dynobj.cc: Likewise.
2201         * ehframe.cc: Likewise.
2202         * ehframe.h: Likewise.
2203         * expression.cc: Likewise.
2204         * fileread.cc: Likewise.
2205         * fileread.h: Likewise.
2206         * gc.h: Likewise.
2207         * gold-threads.cc: Likewise.
2208         * gold.cc: Likewise.
2209         * i386.cc: Likewise.
2210         * icf.h: Likewise.
2211         * incremental-dump.cc: Likewise.
2212         * incremental.cc: Likewise.
2213         * layout.cc: Likewise.
2214         * layout.h: Likewise.
2215         * main.cc: Likewise.
2216         * merge.cc: Likewise.
2217         * merge.h: Likewise.
2218         * object.cc: Likewise.
2219         * object.h: Likewise.
2220         * options.cc: Likewise.
2221         * options.h: Likewise.
2222         * output.cc: Likewise.
2223         * output.h: Likewise.
2224         * plugin.cc: Likewise.
2225         * plugin.h: Likewise.
2226         * powerpc.cc: Likewise.
2227         * reloc.cc: Likewise.
2228         * script-c.h: Likewise.
2229         * script-sections.cc: Likewise.
2230         * script.cc: Likewise.
2231         * stringpool.cc: Likewise.
2232         * symtab.cc: Likewise.
2233         * symtab.h: Likewise.
2234         * target.cc: Likewise.
2235         * timer.cc: Likewise.
2236         * timer.h: Likewise.
2237         * version.cc: Likewise.
2238         * x86_64.cc: Likewise.
2239
2240 2010-08-24  Nick Clifton  <nickc@redhat.com>
2241
2242         PR 11899
2243         * layout.cc (segment_precedes): Sort segments by their physical
2244         addresses, if they have been set.
2245
2246 2010-08-23  Cary Coutant  <ccoutant@google.com>
2247
2248         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2249         symbols data.
2250         (Lib_group::include_member): Unlock object after deleting its
2251         symbols data.
2252         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2253         the bug fixed here.
2254
2255 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2256             Cary Coutant  <ccoutant@google.com>
2257
2258         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2259         constructor, and set_blocker.
2260         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2261         readsyms_blocker_.
2262         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2263         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2264         * testsuite/Makefile.am (start_lib_test): New test case.
2265         * testsuite/Makefile.in: Regenerate.
2266         * testsuite/start_lib_test_main.c: New file.
2267         * testsuite/start_lib_test_1.c: New file.
2268         * testsuite/start_lib_test_2.c: New file.
2269         * testsuite/start_lib_test_3.c: New file.
2270
2271 2010-08-19  Ian Lance Taylor  <iant@google.com>
2272
2273         * Makefile.in: Rebuild with automake 1.11.1.
2274         * aclocal.m4: Likewise.
2275         * testsuite/Makefile.in: Likewise.
2276
2277 2010-08-19  Ian Lance Taylor  <iant@google.com>
2278
2279         PR 10893
2280         * i386.cc (class Output_data_plt_i386): Update declarations.
2281         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2282         local_ifuncs_ fields.
2283         (Target_i386::do_plt_section_for_global): New function.
2284         (Target_i386::do_plt_section_for_local): New function.
2285         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2286         parameter; change all callers.  Initialize global_ifuncs_ and
2287         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2288         __rel_iplt_end.
2289         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2290         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2291         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2292         symbols.
2293         (Target_i386::make_plt_section): New function, broken out of
2294         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2295         (Target_i386::make_plt_entry): Call make_plt_section.
2296         (Target_i386::make_local_ifunc_plt_entry): New function.
2297         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2298         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2299         R_386_IRELATIVE to switch.
2300         (Target_i386::Scan::global): Likewise.
2301         (Target_i386::Relocate::relocate): Likewise.
2302         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2303         switch.
2304         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2305         (Target_x86_64::do_plt_section_for_global): New function.
2306         (Target_x86_64::do_plt_section_for_local): New function.
2307         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2308         parameter; change all callers.  If doing a static link define
2309         __rela_iplt_start and __rela_iplt_end.
2310         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2311         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2312         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2313         to point to .plt.
2314         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2315         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2316         switch.
2317         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2318         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2319         R_X86_64_IRELATIVE to switch.
2320         (Target_x86_64::Scan::global): Likewise.
2321         (Target_x86_64::Relocate::relocate): Likewise.
2322         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2323         switch.
2324         * target.h (class Target): Add plt_section_for_global and
2325         plt_section_for_local functions.  Add do_plt_section_for_global
2326         and do_plt_section_for_local virtual functions.
2327         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2328         clarifying comments.
2329         (Symbol::use_plt_offset): Handle IFUNC symbol.
2330         * object.cc (Sized_relobj::Sized_relobj): Initialize
2331         local_plt_offsets_.
2332         (Sized_relobj::local_has_plt_offset): New function.
2333         (Sized_relobj::local_plt_offset): New function.
2334         (Sized_relobj::set_local_plt_offset): New function.
2335         (Sized_relobj::do_count): Handle IFUNC symbol.
2336         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2337         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2338         is_ifunc_symbol functions.
2339         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2340         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2341         local_plt_offsets_ field.
2342         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2343         * output.h (class Output_section_data): Add non-const
2344         output_section function.
2345         (class Output_data_got): Update declarations.
2346         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2347         Add use_plt_offset parameter to global and local constructors.
2348         Change all callers.  Change local_sym_index_ field to 31 bits.
2349         Change GSYM_CODE and CONSTANT_CODE accordingly.
2350         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2351         doing a static link don't set sh_link field.
2352         (Output_data_got::Got_entry::write): Use PLT offset if
2353         appropriate.
2354         (Output_data_got::add_global_plt): New function.
2355         (Output_data_got::add_local_plt): New function.
2356         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2357         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2358         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2359         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2360         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2361         IFUNC conditional.
2362         * testsuite/ifunc-sel.h: New file.
2363         * testsuite/ifuncmain1.c: New file.
2364         * testsuite/ifuncmain1vis.c: New file.
2365         * testsuite/ifuncmod1.c: New file.
2366         * testsuite/ifuncdep2.c: New file.
2367         * testsuite/ifuncmain2.c: New file.
2368         * testsuite/ifuncmain3.c: New file.
2369         * testsuite/ifuncmod3.c: New file.
2370         * testsuite/ifuncmain4.c: New file.
2371         * testsuite/ifuncmain5.c: New file.
2372         * testsuite/ifuncmod5.c: New file.
2373         * testsuite/ifuncmain6pie.c: New file.
2374         * testsuite/ifuncmod6.c: New file.
2375         * testsuite/ifuncmain7.c: New file.
2376         * configure, testsuite/Makefile.in: Rebuild.
2377
2378 2010-08-18  Ian Lance Taylor  <iant@google.com>
2379
2380         * incremental.cc
2381         (Output_section_incremental_inputs::write_input_files): Add cast
2382         to avoid signed/unsigned comparison warning.
2383         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2384
2385 2010-08-12  Cary Coutant  <ccoutant@google.com>
2386
2387         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2388
2389 2010-08-13  Ian Lance Taylor  <iant@google.com>
2390
2391         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2392
2393 2010-08-12  Cary Coutant  <ccoutant@google.com>
2394             Doug Kwan  <dougkwan@google.com>
2395
2396         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2397         defintion overrides non-weak undef, remember that the original undef
2398         is not weak.
2399         * symtab.cc (Symbol_table::sized_write_global): For undef without
2400         an original weak binding, set binding to global in output.
2401         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2402         * testsuite/Makefile.in: Regenerate.
2403         * testsuite/strong_ref_weak_def.sh: New file.
2404         * testsuite/strong_ref_weak_def_1.c: Ditto.
2405         * testsuite/strong_ref_weak_def_2.c: Ditto.
2406
2407 2010-08-12  Cary Coutant  <ccoutant@google.com>
2408
2409         * testsuite/incremental_test.sh: Rewrite.
2410         * testsuite/incremental_test_1.c: Rewrite.
2411         * testsuite/incremental_test_2.c: Rewrite.
2412
2413 2010-08-12  Cary Coutant  <ccoutant@google.com>
2414
2415         * arm.cc (Target_arm::got_size): Add const.
2416         (Target_arm::got_entry_count): New function.
2417         (Target_arm::plt_entry_count): New function.
2418         (Target_arm::first_plt_entry_offset): New function.
2419         (Target_arm::plt_entry_size): New function.
2420         (Output_data_plt_arm::entry_count): New function.
2421         (Output_data_plt_arm::first_plt_entry_offset): New function.
2422         (Output_data_plt_arm::get_plt_entry_size): New function.
2423         * i386.cc (Target_i386::got_size): Add const.
2424         (Target_i386::got_entry_count): New function.
2425         (Target_i386::plt_entry_count): New function.
2426         (Target_i386::first_plt_entry_offset): New function.
2427         (Target_i386::plt_entry_size): New function.
2428         (Output_data_plt_i386::entry_count): New function.
2429         (Output_data_plt_i386::first_plt_entry_offset): New function.
2430         (Output_data_plt_i386::get_plt_entry_size): New function.
2431         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2432         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2433         * incremental.cc: Include target.h.
2434         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2435         parameter.  Adjust all callers.  Find incremental_got_plt section.
2436         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2437         section.
2438         (Output_section_incremental_inputs::set_final_data_size): Calculate
2439         size of incremental_got_plt section.
2440         (Output_section_incremental_inputs::do_write): Write the
2441         incremental_got_plt section.
2442         (Got_plt_view_info): New struct.
2443         (Local_got_offset_visitor): New class.
2444         (Global_got_offset_visitor): New class.
2445         (Global_symbol_visitor_got_plt): New class.
2446         (Output_section_incremental_inputs::write_got_plt): New function.
2447         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2448         Add parameter.  Adjust all callers.
2449         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2450         (Incremental_inputs::got_plt_section): New function.
2451         (Incremental_inputs::got_plt_section_): New data member.
2452         (Incremental_got_plt_reader): New class.
2453         * layout.cc (Layout::create_incremental_info_sections): Add the
2454         incremental_got_plt section.
2455         * object.h (Got_offset_list::get_list): New function.
2456         (Got offset_list::for_all_got_offsets): New function.
2457         (Sized_relobj::local_got_offset_list): New function.
2458         * powerpc.cc (Target_powerpc::got_size): Add const.
2459         (Target_powerpc::got_entry_count): New function.
2460         (Target_powerpc::plt_entry_count): New function.
2461         (Target_powerpc::first_plt_entry_offset): New function.
2462         (Target_powerpc::plt_entry_size): New function.
2463         (Output_data_plt_powerpc::entry_count): New function.
2464         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2465         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2466         * sparc.cc (Target_sparc::got_size): Add const.
2467         (Target_sparc::got_entry_count): New function.
2468         (Target_sparc::plt_entry_count): New function.
2469         (Target_sparc::first_plt_entry_offset): New function.
2470         (Target_sparc::plt_entry_size): New function.
2471         (Output_data_plt_sparc::entry_count): New function.
2472         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2473         (Output_data_plt_sparc::get_plt_entry_size): New function.
2474         * symtab.h (Symbol::got_offset_list): New function.
2475         (Symbol_table::for_all_symbols): New function.
2476         * target.h (Sized_target::got_entry_count): New function.
2477         (Sized_target::plt_entry_count): New function.
2478         (Sized_target::plt_entry_size): New function.
2479         * x86_64.cc (Target_x86_64::got_size): Add const.
2480         (Target_x86_64::got_entry_count): New function.
2481         (Target_x86_64::plt_entry_count): New function.
2482         (Target_x86_64::first_plt_entry_offset): New function.
2483         (Target_x86_64::plt_entry_size): New function.
2484         (Output_data_plt_x86_64::entry_count): New function.
2485         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2486         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2487
2488 2010-08-12  Cary Coutant  <ccoutant@google.com>
2489
2490         * archive.cc: Include incremental.h.
2491         (Archive::Archive): Initialize incremental_info_.
2492         (Archive::include_member): Record archive members in incremental info.
2493         (Add_archive_symbols::run): Record begin and end of an archive in
2494         incremental info.
2495         (Lib_group::include_member): Record objects in incremental info.
2496         * archive.h (Incremental_archive_entry): Forward declaration.
2497         (Archive::set_incremental_info): New member function.
2498         (Archive::incremental_info): New member function.
2499         (Archive::Unused_symbol_iterator): New class.
2500         (Archive::unused_symbols_begin): New member function.
2501         (Archive::unused_symbols_end): New member function.
2502         (Archive::incremental_info_): New data member.
2503         * incremental-dump.cc (find_input_containing_global): New function.
2504         (dump_incremental_inputs): Dump new incremental info sections.
2505         * incremental.cc: Include symtab.h.
2506         (Output_section_incremental_inputs): New class.
2507         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2508         new incremental info sections.
2509         (Sized_incremental_binary::do_check_inputs): Likewise.
2510         (Incremental_inputs::report_archive): Remove.
2511         (Incremental_inputs::report_archive_begin): New function.
2512         (Incremental_inputs::report_archive_end): New function.
2513         (Incremental_inputs::report_object): New function.
2514         (Incremental_inputs::finalize_inputs): Remove.
2515         (Incremental_inputs::report_input_section): New function.
2516         (Incremental_inputs::report_script): Rewrite.
2517         (Incremental_inputs::finalize): Do nothing but finalize string table.
2518         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2519         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2520         (Incremental_inputs::create_data_sections): New function.
2521         (Incremental_inputs::relocs_entsize): New function.
2522         (Output_section_incremental_inputs::set_final_data_size): New function.
2523         (Output_section_incremental_inputs::do_write): New function.
2524         (Output_section_incremental_inputs::write_header): New function.
2525         (Output_section_incremental_inputs::write_input_files): New function.
2526         (Output_section_incremental_inputs::write_info_blocks): New function.
2527         (Output_section_incremental_inputs::write_symtab): New function.
2528         * incremental.h (Incremental_script_entry): Forward declaration.
2529         (Incremental_object_entry): Forward declaration.
2530         (Incremental_archive_entry): Forward declaration.
2531         (Incremental_inputs): Forward declaration.
2532         (Incremental_inputs_header_data): Remove.
2533         (Incremental_inputs_header): Remove.
2534         (Incremental_inputs_header_write): Remove.
2535         (Incremental_inputs_entry_data): Remove.
2536         (Incremental_inputs_entry): Remove.
2537         (Incremental_inputs_entry_write): Remove.
2538         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2539         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2540         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2541         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2542         Likewise.
2543         (Incremental_input_entry): New class.
2544         (Incremental_script_entry): New class.
2545         (Incremental_object_entry): New class.
2546         (Incremental_archive_entry): New class.
2547         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2548         (Incremental_inputs::report_inputs): Remove.
2549         (Incremental_inputs::report_archive): Remove.
2550         (Incremental_inputs::report_archive_begin): New function.
2551         (Incremental_inputs::report_archive_end): New function.
2552         (Incremental_inputs::report_object): Change prototype.
2553         (Incremental_inputs::report_input_section): New function.
2554         (Incremental_inputs::report_script): Change prototype.
2555         (Incremental_inputs::get_reloc_count): New function.
2556         (Incremental_inputs::set_reloc_count): New function.
2557         (Incremental_inputs::create_data_sections): New function.
2558         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2559         (Incremental_inputs::inputs_section): New function.
2560         (Incremental_inputs::symtab_section): New function.
2561         (Incremental_inputs::relocs_section): New function.
2562         (Incremental_inputs::get_stringpool): Add const.
2563         (Incremental_inputs::command_line): Add const.
2564         (Incremental_inputs::inputs): Remove.
2565         (Incremental_inputs::command_line_key): New function.
2566         (Incremental_inputs::input_file_count): New function.
2567         (Incremental_inputs::input_files): New function.
2568         (Incremental_inputs::relocs_entsize): New function.
2569         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2570         (Incremental_inputs::finalize_inputs): Remove.
2571         (Incremental_inputs::Input_info): Remove.
2572         (Incremental_inputs::lock_): Remove.
2573         (Incremental_inputs::inputs_): Change type.
2574         (Incremental_inputs::inputs_map_): Remove.
2575         (Incremental_inputs::current_object_entry_): New data member.
2576         (Incremental_inputs::inputs_section_): New data member.
2577         (Incremental_inputs::symtab_section_): New data member.
2578         (Incremental_inputs::relocs_section_): New data member.
2579         (Incremental_inputs::reloc_count_): New data member.
2580         (Incremental_inputs_reader): New class.
2581         (Incremental_symtab_reader): New class.
2582         (Incremental_relocs_reader): New class.
2583         * layout.cc (Layout::finalize): Move finalization of incremental info
2584         and creation of incremental info sections to follow finalization of
2585         symbol table.  Set offsets for postprocessing sections.
2586         (Layout::create_incremental_info_sections): Call
2587         Incremental_inputs::create_data_sections.  Add incremental symtab
2588         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2589         sections to layout after input sections.
2590         * layout.h (struct Timespec): Forward declaration.
2591         (Layout::incremental_inputs): Add const.
2592         (Layout::create_incremental_info_sections): Add parameter.
2593         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2594         * object.cc: Include incremental.h.
2595         (Relobj::finalize_incremental_relocs): New function.
2596         (Sized_relobj::do_layout): Record input sections in incremental info.
2597         * object.h (Object::output_section): New function.
2598         (Object::output_section_offset): Moved from Relobj.
2599         (Object::get_incremental_reloc_base): New function.
2600         (Object::get_incremental_reloc_count): New function.
2601         (Object::do_output_section): New function.
2602         (Object::do_output_section_offset): Moved from Relobj.
2603         (Object::do_get_incremental_reloc_base): New function.
2604         (Object::do_get_incremental_reloc_count): New function.
2605         (Object::Object): Initialize new data members.
2606         (Relobj::output_section): Renamed do_output_section and moved to
2607         protected.
2608         (Relobj::output_section_offset): Moved to Object.
2609         (Relobj::do_get_incremental_reloc_base): New function.
2610         (Relobj::do_get_incremental_reloc_count): New function.
2611         (Relobj::allocate_incremental_reloc_counts): New function.
2612         (Relobj::count_incremental_reloc): New function.
2613         (Relobj::finalize_incremental_relocs): New function.
2614         (Relobj::next_incremental_reloc_index): New function.
2615         (Relobj::reloc_counts_): New data member.
2616         (Relobj::reloc_bases_): New data member.
2617         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2618         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2619         (Sized_relobj::incremental_relocs_scan): New function.
2620         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2621         (Sized_relobj::incremental_relocs_write): New function.
2622         (Sized_relobj::incremental_relocs_write_reltype): New function.
2623         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2624         incremental link.
2625         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2626         archives and object files elsewhere.
2627         (Add_symbols::run): Report object files here.
2628         (Finish_group::run): Report end of archive at end of group.
2629         * reloc.cc: Include layout.h, incremental.h.
2630         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2631         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2632         (Sized_relobj::incremental_relocs_scan): New function.
2633         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2634         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2635         (Sized_relobj::incremental_relocs_write): New function.
2636         (Sized_relobj::incremental_relocs_write_reltype): New function.
2637         * script.cc (read_input_script): Rewrite test for incremental link.
2638         Change call to Incremental_inputs::report_script.
2639         * symtab.h (Symbol_table::first_global_index): New function.
2640         (Symbol_table::output_count): New function.
2641
2642 2010-08-12  Doug Kwan  <dougkwan@google.com>
2643
2644         * arm.cc (Target_arm::merge_object_attributes): Check command line
2645         options --no-wchar-size-warning and --no-enum-size-warning.
2646         * options.h (General_options): Add ld-compatible options
2647         --no-enum-size-warning and --no-wchar-size-warning.
2648
2649 2010-08-04  Ian Lance Taylor  <iant@google.com>
2650
2651         * x86_64.cc (Target_x86_64::Scan::local): Use
2652         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2653         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2654         (Target_x86_64::Scan::global): Likewise.
2655         (Target_x86_64::Relocate::relocate): Likewise.
2656         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2657         Likewise.
2658
2659 2010-08-03  Cary Coutant  <ccoutant@google.com>
2660
2661         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2662         to reserve space in merged_strings vector. Keep total input size
2663         for stats.
2664         (Output_merge_string::do_print_merge_stats): Print total input size.
2665         * merge.h (Output_merge_string): Add input_size_ field.
2666         * stringpool.cc (Stringpool_template::string_length): Move
2667         implementations out of Stringpool_template class and place in
2668         stringpool.h.
2669         * stringpool.h (string_length): Move out of Stringpool_template.
2670
2671 2010-08-03  Ian Lance Taylor  <iant@google.com>
2672
2673         PR 11712
2674         * layout.cc (relaxation_loop_body): If address of load segment is
2675         set, adjust address to include headers if possible.
2676
2677 2010-08-03  Ian Lance Taylor  <iant@google.com>
2678
2679         * version.cc (version_string): Bump to 1.10.
2680
2681 2010-08-03  Ian Lance Taylor  <iant@google.com>
2682
2683         PR 11805
2684         * layout.h (enum Output_section_order): Define.
2685         (class Layout): Update declarations.
2686         * layout.cc (Layout::get_output_section): Add order parameter.
2687         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2688         is_first_non_relro parameters.  Change all callers.
2689         (Layout::choose_output_section): Likewise.
2690         (Layout::add_output_section_data): Likewise.
2691         (Layout::make_output_section): Likewise.  Set order.
2692         (Layout::default_section_order): New function.
2693         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2694         * output.cc (Output_section::Output_section): Initialize order_.
2695         Don't initialize deleted fields.
2696         (Output_segment::Output_segment): Don't initialize deleted
2697         fields.
2698         (Output_segment::add_output_section_to_load): New function
2699         replacing add_output_section.  Change all callers to call this or
2700         add_output_section_to_nonload.
2701         (Output_segment::add_output_section_to_nonload): New function.
2702         (Output_segment::remove_output_section): Rewrite.
2703         (Output_segment::add_initial_output_data): Likewise.
2704         (Output_segment::has_any_data_sections): Likewise.
2705         (Output_segment::is_first_section_relro): Likewise.
2706         (Output_segment::maximum_alignment): Likewise.
2707         (Output_segment::has_dynamic_reloc): New function replacing
2708         dynamic_reloc_count.  Change all callers.
2709         (Output_segment::has_dynamic_reloc_list): New function replacing
2710         dynamic_reloc_count_list.  Change all callers.
2711         (Output_segment::set_section_addresses): Rewrite.
2712         (Output_segment::set_offset): Rewrite.
2713         (Output_segment::find_first_and_last_list): Remove.
2714         (Output_segment::set_tls_offsets): Rewrite.
2715         (Output_segment::first_section_load_address): Likewise.
2716         (Output_segment::output_section_count): Likewise.
2717         (Output_segment::section_with_lowest_load_address): Likewise.
2718         (Output_segment::write_section_headers): Likewise.
2719         (Output_segment::print_sections_to_map): Likewise.
2720         * output.h (class Output_data): Remove dynamic_reloc_count_
2721         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2722         (Output_data::add_dynamic_reloc): Rewrite.
2723         (Output_data::has_dynamic_reloc): New function.
2724         (Output_data::dynamic_reloc_count): Remove.
2725         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2726         is_last_relro_, is_first_non_relro_, is_interp_,
2727         is_dynamic_linker_section_ fields.  Add order and set_order
2728         functions.  Remove is_relro_local, set_is_relro_local,
2729         is_last_relro, set_is_last_relro, is_first_non_relro,
2730         set_is_first_non_relro functions, is_interp, set_is_interp,
2731         is_dynamic_linker_section, and set_is_dynamic_linker_section
2732         functions.
2733         (class Output_segment): Change Output_data_list from std::list to
2734         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2735         output_bss_ fields.  Update declarations.
2736
2737 2010-08-02  Ian Lance Taylor  <iant@google.com>
2738
2739         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2740         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2741         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2742
2743 2010-08-02  Ian Lance Taylor  <iant@google.com>
2744
2745         PR 11855
2746         * script.cc (Script_options::Script_options): Initialize
2747         symbol_definitions_ and symbol_references_.
2748         (Script_options::add_symbol_assignment): Update
2749         symbol_definitions_ and symbol_references_.
2750         (Script_options::add_symbol_reference): New function.
2751         (script_symbol): New function.
2752         * script.h (class Script_options): Add symbol_definitions_ and
2753         symbol_references_ fields.
2754         (Script_options::referenced_const_iterator): New type.
2755         (Script_options::referenced_begin): New function.
2756         (Script_options::referenced_end): New function.
2757         (Script_options::is_referenced): New function.
2758         (Script_options::any_unreferenced): New function.
2759         * script-c.h (script_symbol): Declare.
2760         * yyscript.y (exp): Call script_symbol.
2761         * symtab.cc: Include "script.h".
2762         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2763         Change all callers.  Check symbols referenced by scripts.
2764         (Symbol_table::add_undefined_symbols_from_command_line): Add
2765         layout parameter.  Change all callers.
2766         (Symbol_table::do_add_undefined_symbols_from_command_line):
2767         Likewise.  Break out loop body.  Check symbols referenced by
2768         scripts.
2769         (Symbol_table::add_undefined_symbol_from_command_line): New
2770         function broken out of
2771         do_add_undefined_symbols_from_command_line.
2772         * symtab.h (class Symbol_table): Update declarations.
2773         * archive.cc: Include "layout.h".
2774         (Archive::should_include_member): Add layout parameter.  Change
2775         all callers.  Check for symbol mentioned in expression.
2776         * archive.h (class Archive): Update declaration.
2777         * object.cc (Sized_relobj::do_should_include_member): Add layout
2778         parameter.
2779         * object.h (Object::should_include_member): Add layout parameter.
2780         Change all callers.
2781         (Object::do_should_include_member): Add layout parameter.
2782         (class Sized_relobj): Update declaration.
2783         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2784         parameter.
2785         * dynobj.h (class Sized_dynobj): Update declaration.
2786         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2787         layout parameter.
2788         * plugin.h (class Sized_pluginobj): Update declaration.
2789
2790 2010-08-02  Ian Lance Taylor  <iant@google.com>
2791
2792         PR 11866
2793         * output.cc (Output_segment::set_offset): Search for the first and
2794         last sections rather than assuming that the list is in order.
2795         (Output_segment::find_first_and_last_list): New function.
2796         * output.h (class Output_segment): Update declarations.
2797         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2798         (relro_strip_test_SOURCES): New variable.
2799         (relro_strip_test_DEPENDENCIES): New variable.
2800         (relro_strip_test_LDFLAGS): New variable.
2801         (relro_strip_test_LDADD): New variable.
2802         (relro_strip_test.so): New target.
2803
2804 2010-08-02  Ian Lance Taylor  <iant@google.com>
2805
2806         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2807         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2808         (Target_i386::got_tlsdesc_section): New function.
2809         (Target_i386::got_section): Create space for GOT entries for
2810         TLSDESC relocations.
2811         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2812         R_386_TLS_GOTDESC.
2813         (Target_i386::Scan::global): Likewise.
2814         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2815         using TLSDESC GOT.
2816         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2817         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2818         (Target_x86_64::got_tlsdesc_section): New function.
2819         (Target_x86_64::got_section): Create space for GOT entries for
2820         TLSDESC relocations.
2821         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2822         R_386_TLS_GOTDESC.
2823         (Target_x86_64::Scan::global): Likewise.
2824         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2825         using TLSDESC GOT.
2826
2827 2010-08-02  Ian Lance Taylor  <iant@google.com>
2828
2829         * testsuite/final_layout.sh: Use dc to convert from hex to
2830         decimal.
2831
2832 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2833
2834         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2835         paramter to the call to gold::gc_process_relocs.
2836         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2837         paramter to the call to gold::gc_process_relocs.
2838         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2839         parameter to the call to gold::gc_process_relocs.
2840         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2841         template parameter to the call to gold::gc_process_relocs.
2842         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2843         paramter to the call to gold::gc_process_relocs.
2844         * gc.h (get_embedded_addend_size): New function.
2845         (gc_process_relocs): Save the size of the reloc for use by ICF.
2846         * icf.cc (get_section_contents): Get the addend from the text section
2847         for SHT_REL relocation sections.
2848         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2849         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2850         * int_encoding.h (read_from_pointer): New overloaded function.
2851         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2852         * testsuite/icf_sht_rel_addend_test.sh: New file.
2853         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2854         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2855
2856 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2857
2858         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2859         * Makefile.in: Regenerate.
2860         * testsuite/Makefile.in: Regenerate.
2861
2862 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2863
2864         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2865         * gold/testsuite/debug_msg.cc: Likewise.
2866         * gold/testsuite/odr_violation1.cc
2867         * gold/testsuite/odr_violation2.cc
2868
2869 2010-07-21  Cary Coutant  <ccoutant@google.com>
2870
2871         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2872         string, and length fields.
2873         (Output_merge_string::Merged_strings_list): New type.
2874         (Output_merge_string::Merged_strings_lists): New typedef.
2875         (Output_merge_string): Replace merged_strings_ with
2876         merged_strings_lists_.
2877         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2878         Merged_strings_list per input object and section.  Don't store pointer
2879         to the string.  Don't store length with each merged string entry.
2880         (Output_merge_string::finalize_merged_data): Loop over list of merged
2881         strings lists.  Recompute length of each merged string.
2882
2883 2010-07-15  Cary Coutant  <ccoutant@google.com>
2884
2885         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2886         here.
2887
2888 2010-07-14  Ian Lance Taylor  <iant@google.com>
2889
2890         * descriptors.cc (Descriptors::open): Report correct name in error
2891         message.
2892
2893 2010-07-13  Doug Kwan  <dougkwan@google.com>
2894
2895         * arm.cc (Arm_input_section::Arm_input_section): For a
2896         SHT_ARM_EXIDX section, always keeps the input sections.
2897         (Arm_input_section::set_exidx_section_link): New method.
2898         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2899         has_errors_ to false.
2900         (Arm_exidx_input_section::has_errors,
2901         Arm_exidx_input_section::set_has_errors): New methods.
2902         (Arm_exidx_input_section::has_errors_): New data member.
2903         (Arm_relobj::get_exidx_shndx_list): New method.
2904         (Arm_output_section::append_text_sections_to_list): Do not skip
2905         section without SHF_EXECINSTR.
2906         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2907         errors.
2908         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2909         section header.  Make error messages more verbose.  Check for
2910         a non-executable section linked to an EXIDX section.
2911         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2912         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2913         check that there is no deferred EXIDX section if we exit early.
2914         Instead of not making an EXIDX section in case of an error, make one
2915         and set the has_errors flag of it.
2916         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2917         in a relocatable link.
2918         (Target_arm::do_relax): Look for the EXIDX output section instead of
2919         assuming that it is called .ARM.exidx.
2920         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2921         section list.  Do not check for SHF_EXECINSTR section flags but
2922         skip any input section with errors.
2923         * output.cc (Output_section::Output_section): Initialize
2924         always_keeps_input_sections_ to false.
2925         (Output_section::add_input_section): Check for
2926         always_keeps_input_sections_.
2927         *  output.h (Output_section::always_keeps_input_sections,
2928         Output_section::set_always_keeps_input_sections): New methods.
2929         (Output_section::always_keeps_input_sections): New data member.
2930
2931 2010-07-13  Rafael Espindola  <espindola@google.com>
2932
2933         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2934         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2935
2936 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2937             Ian Lance Taylor  <iant@google.com>
2938
2939         * output.h (Output_section_lookup_maps::add_merge_section):
2940         Correct check of whether value was inserted.
2941         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2942         (Output_section_lookup_maps::add_relaxed_input_section):
2943         Likewise.
2944         * arm.cc (Target_arm::got_section): Remove used local os.
2945         * i386.cc (Target_i386::got_section): Likewise.
2946         * x86_64.cc (Target_x86_64::got_section): Likewise.
2947         * sparc.cc (Target_sparc::got_section): Likewise.
2948         (Target_sparc::relocate): Remove unused local have_got_offset.
2949         * powerpc.cc (Target_powerpc::relocate): Likewise.
2950
2951 2010-07-13  Ian Lance Taylor  <iant@google.com>
2952
2953         * compressed_output.cc (zlib_decompress): Fix signature in
2954         !HAVE_ZLIB_H case.
2955
2956         * archive.cc (Archive::include_member): Unlock an external member
2957         of a thin archive.  Don't bother to delete an object we know is
2958         NULL.
2959
2960 2010-07-12  Cary Coutant  <ccoutant@google.com>
2961
2962         * compressed_output.cc (zlib_decompress): New function.
2963         (get_uncompressed_size): New function.
2964         (decompress_input_section): New function.
2965         * compressed_output.h (get_uncompressed_size): New function.
2966         (decompress_input_section): New function.
2967         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2968         Handle compressed debug sections.
2969         * layout.cc (is_compressed_debug_section): New function.
2970         (Layout::output_section_name): Map compressed section names to
2971         canonical names.
2972         * layout.h (is_compressed_debug_section): New function.
2973         (is_debug_info_section): Recognize compressed debug sections.
2974         * merge.cc: Include compressed_output.h.
2975         (Output_merge_data::do_add_input_section): Handle compressed
2976         debug sections.
2977         (Output_merge_string::do_add_input_section): Handle compressed
2978         debug sections.
2979         * object.cc: Include compressed_output.h.
2980         (Sized_relobj::Sized_relobj): Initialize new data members.
2981         (build_compressed_section_map): New function.
2982         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2983         * object.h (Object::section_is_compressed): New method.
2984         (Object::do_section_is_compressed): New method.
2985         (Sized_relobj::Compressed_section_map): New type.
2986         (Sized_relobj::do_section_is_compressed): New method.
2987         (Sized_relobj::compressed_sections_): New data member.
2988         * output.cc (Output_section::add_input_section): Handle compressed
2989         debug sections.
2990         * reloc.cc: Include compressed_output.h.
2991         (Sized_relobj::write_sections): Handle compressed debug sections.
2992
2993 2010-07-08  Cary Coutant  <ccoutant@google.com>
2994
2995         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2996         weak when resolving to a dynamic def.
2997         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2998         for weak undef/dynamic def cases. Adjust callers.
2999         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3000         undef_binding_weak_.
3001         (Symbol_table::sized_write_globals): Adjust symbol binding.
3002         (Symbol_table::sized_write_symbol): Add binding parameter.
3003         * symtab.h (Symbol::set_undef_binding): New method.
3004         (Symbol::is_undef_binding_weak): New method.
3005         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3006         (Symbol_table::should_override): Add new parameter.
3007         (Symbol_table::sized_write_symbol): Add new parameter.
3008
3009         * testsuite/weak_undef_file1.cc: Add new test case.
3010         * testsuite/weak_undef_file2.cc: Fix header comment.
3011         * testsuite/weak_undef_test.cc: Add new test case.
3012
3013 2010-06-29  Doug Kwan  <dougkwan@google.com>
3014
3015         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3016         Initialize USE_SYMBOL_.
3017         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3018         definition.
3019         (Arm_reloc_property::uses_symbol_): New data member declaration.
3020         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3021         uses symbol value and symbol is undefined but not weakly undefined.
3022
3023 2010-06-28  Rafael Espindola  <espindola@google.com>
3024
3025         * plugin.cc (Plugin::load): Use dlerror.
3026
3027 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3028
3029         * symtab.cc (detect_odr_violations): When reporting an ODR
3030         violation, report an object where the symbol is defined.
3031
3032 2010-06-25  Doug Kwan  <dougkwan@google.com>
3033
3034         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3035         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3036         definition.
3037         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3038         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3039         target hook to detect function points.
3040         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3041         * icf.h (Icf::check_section_for_function_pointers): Change type of
3042         parameter SECTION_NAME to const reference to std::string.  Use
3043         target hook to determine if section may have unsafe pointers.
3044         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3045         method definition.
3046
3047 2010-06-21  Rafael Espindola  <espindola@google.com>
3048
3049         * fileread.cc (Input_file::find_fie): New
3050         (Input_file::open): Use Input_file::find_fie.
3051         * fileread.h (Input_file::find_fie): New
3052         * plugin.cc (set_extra_library_path): New.
3053         (Plugin::load): Add set_extra_library_path to the transfer vector.
3054         (Plugin_manager::set_extra_library_path): New.
3055         (Plugin_manager::add_input_file): Use the extra search path if set.
3056         (set_extra_library_path(): New.
3057         * plugin.h (Plugin_manager): Add set_extra_library_path and
3058         extra_search_path_.
3059
3060 2010-06-19  Cary Coutant  <ccoutant@google.com>
3061
3062         * layout.cc (gdb_sections): Add .debug_types.
3063         (lines_only_debug_sections): Likewise.
3064
3065 2010-06-18  Rafael Espindola  <espindola@google.com>
3066
3067         * plugin.cc (add_input_file,add_input_library)
3068         (Plugin_manager::add_input_file): Make filename arguments const.
3069         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3070         const.
3071
3072 2010-06-16  Doug Kwan  <dougkwan@google.com>
3073
3074         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3075         .ARM.attributes section if we have not merged any input
3076         attributes sections.
3077
3078 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3079
3080         * arm.cc: Allow combining objects with no EABI version
3081         information.
3082
3083 2010-06-15  Rafael Espindola  <espindola@google.com>
3084
3085         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3086
3087 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3088
3089         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3090         (struct iovec): Correct !HAVE_READV definition.
3091
3092 2010-06-10  Cary Coutant  <ccoutant@google.com>
3093
3094         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3095         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3096         reloc sections.
3097         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3098
3099         PR 11683
3100         * symtab.h (Symbol::is_placeholder): New member function.
3101         * target-reloc.h (relocate_section): Check for placeholder symbols.
3102
3103         * testsuite/Makefile.am (plugin_test_8): New test.
3104         (plugin_test_9): New test.
3105         * testsuite/Makefile.in: Regenerate.
3106
3107 2010-06-09  Nick Clifton  <nickc@redhat.com>
3108
3109         * yyscript.y (input_list_element): Allow strings prefixed with
3110         the '-' character.  Treat these as libraries.
3111         * script.cc (script_add_library): New function.  Adds a library
3112         specified by "-l<name>" found in an input script.
3113         * script-c.h: Add prototype for script_add_library.
3114
3115 2010-06-07  Doug Kwan  <dougkwan@google.com>
3116
3117         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3118         Restrict stub-group size to be within long conditional branch
3119         range when working around cortex-A8 erratum.
3120
3121 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3122
3123         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3124         #ifdef typo.
3125
3126 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3127
3128         PR gold/11658
3129         * output.cc
3130         (Output_section::Input_section_sort_entry::compare_section_ordering):
3131         Change to return non-zero correctly.
3132         (Output_section::Input_section_sort_section_order_index_compare
3133         ::operator()): Change to fix ambiguity in comparisons.
3134
3135 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3136
3137         * gold.h (is_wildcard_string): New function.
3138         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3139         (Layout::layout_eh_frame): Ditto.
3140         (Layout::find_section_order_index): New method.
3141         (Layout::read_layout_from_file): New method.
3142         * layout.h (Layout::find_section_order_index): New method.
3143         (Layout::read_layout_from_file): New method.
3144         (Layout::input_section_position_): New private member.
3145         (Layout::input_section_glob_): New private member.
3146         * main.cc (main): Call read_layout_from_file here.
3147         * options.h (--section-ordering-file): New option.
3148         * output.cc (Output_section::input_section_order_specified_): New
3149         member.
3150         (Output_section::Output_section): Initialize new member.
3151         (Output_section::add_input_section): Add new parameter.
3152         Keep input sections when --section-ordering-file is used.
3153         (Output_section::set_final_data_size): Sort input sections when
3154         section ordering file is specified.
3155         (Output_section::Input_section_sort_entry): Add new parameter.
3156         Check sorting type.
3157         (Output_section::Input_section_sort_entry::compare_section_ordering):
3158         New method.
3159         (Output_section::Input_section_sort_compare::operator()): Change to
3160         consider section_order_index.
3161         (Output_section::Input_section_sort_init_fini_compare::operator()):
3162         Change to consider section_order_index.
3163         (Output_section::Input_section_sort_section_order_index_compare
3164         ::operator()): New method.
3165         (Output_section::sort_attached_input_sections): Change to sort
3166         according to section order when specified.
3167         (Output_section::add_input_section<32, true>): Add new parameter.
3168         (Output_section::add_input_section<64, true>): Add new parameter.
3169         (Output_section::add_input_section<32, false>): Add new parameter.
3170         (Output_section::add_input_section<64, false>): Add new parameter.
3171         * output.h (Output_section::add_input_section): Add new parameter.
3172         (Output_section::input_section_order_specified): New
3173         method.
3174         (Output_section::set_input_section_order_specified): New method.
3175         (Input_section::Input_section): Initialize section_order_index_.
3176         (Input_section::section_order_index): New method.
3177         (Input_section::set_section_order_index): New method.
3178         (Input_section::section_order_index_): New member.
3179         (Input_section::Input_section_sort_section_order_index_compare): New
3180         struct.
3181         (Output_section::input_section_order_specified_): New member.
3182         * script-sections.cc (is_wildcard_string): Delete and move modified
3183         method to gold.h.
3184         (Output_section_element_input::Output_section_element_input): Modify
3185         call to is_wildcard_string.
3186         (Output_section_element_input::Input_section_pattern
3187         ::Input_section_pattern): Ditto.
3188         (Output_section_element_input::Output_section_element_input): Ditto.
3189         * testsuite/Makefile.am (final_layout): New test case.
3190         * testsuite/Makefile.in: Regenerate.
3191         * testsuite/final_layout.cc: New file.
3192         * testsuite/final_layout.sh: New file.
3193
3194 2010-06-01  Rafael Espindola  <espindola@google.com>
3195
3196         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3197
3198 2010-06-01  Rafael Espindola  <espindola@google.com>
3199
3200         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3201         visibility of symbols.
3202
3203 2010-05-27  Doug Kwan  <dougkwan@google.com>
3204
3205         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3206         from start of output section instead of address for a local symbol
3207         in a merged or relaxed section when doing a relocatable link.
3208
3209 2010-05-26  Rafael Espindola  <espindola@google.com>
3210
3211        PR 11604
3212         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3213         adding sections the garbage collector removed.
3214         * gold/testsuite/Makefile.am: Add test.
3215         * gold/testsuite/Makefile.in: Regenerate.
3216         * gold/testsuite/plugin_test_7.sh: New.
3217         * gold/testsuite/plugin_test_7_1.c: New.
3218         * gold/testsuite/plugin_test_7_2.c: New.
3219
3220 2010-05-26  Rafael Espindola  <espindola@google.com>
3221
3222         * script-sections.cc (Output_section_definition::set_section_addresses):
3223         Check for --section-start.
3224
3225 2010-05-26  Doug Kwan  <dougkwan@google.com>
3226
3227         * arm.cc (Arm_scan_relocatable_relocs): New class.
3228         (Target_arm::relocate_special_relocatable): New method.
3229         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3230         (Arm_relocate_functions::thumb_branch_common): Same.
3231         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3232         instead of Default_scan_relocatable_relocs.
3233         * target-reloc.h (relocate_for_relocatable): Let target handle
3234         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3235         * target.h (Sized_target::relocate_special_relocatable): New method.
3236
3237 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3238
3239         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3240
3241 2010-05-23  Doug Kwan  <dougkwan@google.com>
3242
3243         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3244         instead of a cast.
3245         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3246         with a direct branch, not a conditional branch, to a stub.
3247         * merge.cc (Output_merge_base::record_input_section): New method
3248         defintion.
3249         (Output_merge_data::do_add_input_section): Record input section if
3250         keeps-input-sections flag is set.
3251         (Output_merge_string::do_add_input_section): Ditto.
3252         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3253         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3254         INPUT_SECTIONS_.
3255         (Output_merge_base::keeps_input_sections,
3256         Output_merge_base::set_keeps_input_sections,
3257         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3258         method definitions.
3259         (Output_merge_base::Input_sections): New type declaration.
3260         (Output_merge_base::input_sections_begin,
3261         Output_merge_base::input_sections_end,
3262         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3263         (Output_merge_base::bool keeps_input_sections_,
3264         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3265         Output_merge_base::input_sections_): New data members.
3266         (Output_merge_data::do_set_keeps_input_sections): New method
3267         defintion.
3268         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3269         * output.cc (Output_section::Input_section::relobj): Move method
3270         defintion from class declaration to here and handle merge sections.
3271         (Output_section::Input_section::shndx): Ditto.
3272         (Output_section::Output_section): Remove initializations of removed
3273         data members and initialize new data member LOOKUP_MAPS_.
3274         (Output_section::add_input_section): Set keeps-input-sections flag
3275         for a newly created merge output section as appropriate.  Adjust code
3276         to use Output_section_lookup_maps class.
3277         (Output_section::add_relaxed_input_section): Adjst code for lookup
3278         maps code refactoring.
3279         (Output_section::add_merge_input_section): Add a new parameter
3280         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3281         class.  If adding input section to a newly created merge output
3282         section fails, remove the new merge section.
3283         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3284         Adjust code for use of the Output_section_lookup_maps class.
3285         (Output_section::find_merge_section): Ditto.
3286         (Output_section::build_lookup_maps): New method defintion.
3287         (Output_section::find_relaxed_input_section): Adjust code to use
3288         Output_section_lookup_maps class.
3289         (Output_section::get_input_sections): Export merge sections.  Adjust
3290         code to use Output_section_lookup_maps class.
3291         (Output_section:::add_script_input_section): Adjust code to use
3292         Output_section_lookup_maps class.  Update lookup maps for merge
3293         sections also.
3294         (Output_section::discard_states): Use Output_section_lookup_maps.
3295         (Output_section::restore_states): Same.
3296         * output.h (Merge_section_properties): Move class defintion out of
3297         Output_section.
3298         (Output_section_lookup_maps): New class.
3299         (Output_section::Input_section::is_merge_section): New method
3300         defintion.
3301         (Output_section::Input_section::relobj): Move defintion out of class
3302         defintion.  Declare method only.
3303         (Output_section::Input_section::shndx): Ditto.
3304         (Output_section::Input_section::output_merge_base): New method defintion.
3305         (Output_section::Input_section::u2_.pomb): New union field.
3306         (Output_section::Merge_section_by_properties_map,
3307         Output_section::Output_section_data_by_input_section_map,
3308         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3309         Remove types.
3310         (Output_section::add_merge_input_section): Add new parameter
3311         KEEPS_INPUT_SECTIONS.
3312         (Output_section::build_lookup_maps): New method declaration.
3313         (Output_section::merge_section_map_,
3314         Output_section::merge_section_by_properties_map_,
3315         Output_section::relaxed_input_section_map_,
3316         Output_section::is_relaxed_input_section_map_valid_): Remove data
3317         members.
3318         (Output_section::lookup_maps_): New data member.
3319
3320 2010-05-21  Doug Kwan  <dougkwan@google.com>
3321
3322         PR gold/11619
3323         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3324         avoid a compilation error.
3325
3326 2010-05-19  Rafael Espindola  <espindola@google.com>
3327
3328         * script-sections.cc (Output_section_definition::allocate_to_segment):
3329         Update the phdrs_list even when the output section is NULL.
3330         * testsuite/Makefile.am: Add test.
3331         * testsuite/Makefile.in: Regenerate.
3332         * testsuite/script_test_9.cc: New.
3333         * testsuite/script_test_9.sh: New.
3334         * testsuite/script_test_9.t: New.
3335
3336 2010-05-19  Doug Kwan  <dougkwan@google.com>
3337
3338         * arm.cc (Arm_input_section::original_size): New method.
3339         (Arm_input_section::do_addralign): Add a cast.
3340         (Arm_input_section::do_output_offset): Remove static cast.
3341         (Arm_input_section::original_addralign,
3342          Arm_input_section::original_size_): Change type to uint32_t.
3343         (Arm_input_section::init): Add safe casts for section alignment
3344         and size.
3345         (Arm_input_section::set_final_data_size): Do not set address and
3346         offset of stub table.
3347         (Arm_output_section::fix_exidx_coverage): Change use of of
3348         Output_section::Simple_input_section to that of
3349         Output_section::Input_section.
3350         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3351         except for the first pass.
3352         * output.cc (Output_section::get_input_sections): Change type of
3353         input_sections to std::list<Input_section>.
3354         (Output_section::add_script_input_section): Rename from
3355         Output_section::add_simple_input_section.  Change type of SIS
3356         parameter from Simple_input_section to Input_section.
3357         * output.h (Output_section::Simple_input_section): Remove class.
3358         (Output_section::Input_section): Change class visibility to public.
3359         (Output_section::Input_section::addralign): Use stored alignments
3360         for special input sections if set.
3361         (Output_section::Input_section::set_addralign): New method.
3362         (Output_section::get_input_sections): Change parameter type from
3363         list of Simple_input_section to list of Input_section.
3364         (Output_section::add_script_input_section): Rename from
3365         Output_section::add_simple_input_section. Change first parameter's
3366         type from Simple_input_section to Input_section and remove the
3367         second and third parameters.
3368         * script-sections.cc (Input_section::Input_section_list): Change
3369         type to list of Output_section::Input_section/
3370         (Input_section_info::Input_section_info): Change parameter type of
3371         INPUT_SECTION to Output_section::Input_section.
3372         (Input_section_info::input_section): Change return type.
3373         (Input_section_info::input_section_): Change type to
3374         Output_section::Input_section.
3375         (Output_section_element_input::set_section_addresses): Adjust code
3376         to use Output_section::Input_section instead of
3377         Output_section::Simple_input_section.  Adjust code for renaming
3378         of Output_section::add_simple_input_section.
3379         (Orphan_output_section::set_section_addresses): Ditto.
3380
3381 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3382
3383         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3384         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3385
3386 2010-05-18  Rafael Espindola  <espindola@google.com>
3387
3388         * options.cc (General_options::finalize): Handle -nostdlib.
3389         * options.h (nostdlib): New option.
3390         * script.cc (script_add_search_dir): Handle -nostdlib.
3391
3392 2010-05-12  Doug Kwan  <dougkwan@google.com>
3393
3394         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3395         attributes section only if there no attributes section after merging.
3396         (Target_arm::merge_object_attributes): Move value of
3397         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3398         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3399         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3400         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3401         and arm_attr_merge_7.stdout.
3402         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3403         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3404         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3405         arm_attr_merge_7b.o): New rules.
3406         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3407         arm_attr_merge_7
3408         * testsuite/Makefile.in: Regenerate.
3409         * testsuite/arm_attr_merge.sh: New file.
3410         * testsuite/arm_attr_merge_[67][ab].s: Same.
3411
3412 2010-05-05  Nick Clifton  <nickc@redhat.com>
3413
3414         * po/es.po: Updated Spanish translation.
3415
3416 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3417
3418         * Makefile.am (install-exec-local): Properly install gold as
3419         default cross linker.
3420         * Makefile.in: Regenerated.
3421
3422 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3423             Nick Clifton  <nickc@redhat.com>
3424
3425         * configure.ac (install_as_default): Define and set to false
3426         unless --enable-gold or --enable-gold=both/gold has been
3427         specified.
3428         * configure: Regenerate.
3429
3430         * Makefile.am (install-exec-local): Install the executable as
3431         'ld.gold'.  If install_as_default is true then also install it as
3432         'ld'.
3433         * Makefile.in: Regenerated.
3434
3435 2010-04-24  Ian Lance Taylor  <iant@google.com>
3436
3437         * layout.cc (Layout::layout_reloc): In relocatable link don't
3438         combine reloc sections for grouped sections.
3439
3440 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3441
3442         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3443         sections that are not ordinary to icf.
3444         * icf.cc (get_section_contents): Handle relocation pointing to section
3445         with no object or shndx information.
3446         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3447         * testsuite/Makefile.in: Regenerate.
3448         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3449         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3450
3451 2010-04-22  Ian Lance Taylor  <iant@google.com>
3452
3453         * expression.cc (Expression::Expression_eval_info): Add
3454         result_alignment_pointer field.
3455         (Expression::eval_with_dot): Add result_alignment_pointer
3456         parameter.  Change all callers.
3457         (Expression::eval_maybe_dot): Likewise.
3458         (class Binary_expression): Add alignment_pointer parameter to
3459         left_value and right_value.  Change all callers.
3460         (BINARY_EXPRESSION): Set result alignment.
3461         (class Trinary_expression): Add alignment_pointer parameter to
3462         arg2_value and arg3_value.  Change all callers.
3463         (Trinary_cond::value): Set result alignment.
3464         (Max_expression::value, Min_expression::value): Likewise.
3465         (Align_expression::value): Likewise.
3466         * script-sections.cc (class Sections_element): Add dot_alignment
3467         parameter to set_section_addresses virtual function.  Update
3468         instantiations.
3469         (class Output_section_element): Likewise.
3470         (Script_sections::create_segments): Add dot_alignment parameter.
3471         Change all callers.
3472         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3473         (Script_sections::set_phdrs_clause_addresses): Likewise.
3474         * script-sections.h: Update declarations.
3475         * script.h: Update declarations.
3476         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3477         min_p_align.
3478         * testsuite/script_test_3.t: Set large alignment.
3479         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3480         segment has expected alignment.
3481
3482 2010-04-22  Nick Clifton  <nickc@redhat.com>
3483
3484         * po/gold.pot: Updated by the Translation project.
3485         * po/vi.po: Updated Vietnamese translation.
3486
3487 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3488
3489         * testsuite/Makefile.am (check_PROGRAMS): Add
3490         icf_virtual_function_folding_test.
3491         * testsuite/Makefile.in: Regenerated.
3492
3493 2010-04-15  Andrew Haley  <aph@redhat.com>
3494
3495         * options.h (merge_exidx_entries): New option.
3496         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3497         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3498         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3499         (Target_arm::merge_exidx_entries): New function.
3500         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3501         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3502         to Arm_exidx_fixup constructor.
3503         Add new arg, merge_exidx_entries.
3504         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3505         Arm_output_section::fix_exidx_coverage.
3506
3507 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3508
3509         * icf.cc (get_section_contents): Check for preemptible functions.
3510         Ignore addend when appropriate.
3511         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3512         section folded.
3513         (add_from_relobj): Check for section folded.
3514         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3515         * symtab.h (should_add_dynsym_entry): Add new parameter.
3516         * target-reloc.h (scan_relocs): Check for section folded.
3517         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3518         Check reloc types for function pointers in shared objects.
3519         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3520         case.
3521         (icf_preemptible_functions_test): New test case.
3522         (icf_string_merge_test): New test case.
3523         * testsuite.Makefile.in: Regenerate.
3524         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3525         bar_glob.  Refactor code.
3526         * testsuite/icf_preemptible_functions_test.cc: New file.
3527         * testsuite/icf_preemptible_functions_test.sh: New file.
3528         * testsuite/icf_string_merge_test.cc: New file.
3529         * testsuite/icf_string_merge_test.sh: New file.
3530         * testsuite/icf_virtual_function_folding_test.cc: New file.
3531         * testsuite/icf_virtual_function_folding_test.sh: New file.
3532
3533 2010-04-14  Doug Kwan  <dougkwan@google.com>
3534
3535         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3536         for local symbol recounting if we remove a section due to ICF.
3537         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3538         there are no regular objects in input.
3539
3540 2010-04-13  Doug Kwan  <dougkwan@google.com>
3541
3542         * arm.cc (Arm_input_section::set_final_data_size): Compute
3543         accurate final data size instead of using current data size.
3544
3545 2010-04-09  Doug Kwan  <dougkwan@google.com>
3546
3547         * layout.cc (Layout::choose_output_section): Handle script section
3548         types.
3549         (Layout::make_output_section_for_script): Add section type parameter.
3550         Handle script section types.
3551         * layout.h (Layout::make_output_section_for_script): Add section
3552         type parameter.
3553         * output.cc (Output_section::Output_section): Initialize data member
3554         is_noload_.
3555         (Output_section::do_reset_address_and_file_offset): Do not set address
3556         to 0 if section is a NOLOAD section.
3557         * output.h (Output_section::is_noload): New method.
3558         (Output_section::set_is_noload): Ditto.
3559         (Output_section::is_noload_): New data member.
3560         * script-c.h (Script_section_type): New enum type.
3561         (struct Parser_output_section_header): Add new file section_type.
3562         * script-sections.cc (Sections_element::output_section_name): Add
3563         parameter for returning script section type.
3564         (Output_section_definition::output_section_name): Ditto.
3565         (Output_section_definition::section_type)P; New method.
3566         (Output_section_definiton::script_section_type_name): Ditto.
3567         (Output_section_definition::script_section_type_): New data member.
3568         (Output_section_definition::Output_section_definition): Initialize
3569         data member Output_section_definition::script_section_type_.
3570         (Output_section_definition::create_sections): Pass script section type
3571         to Layout::make_output_section_for_script.
3572         (Output_section_definition::output_section_name): Return script
3573         section type to caller.
3574         (Output_section_definition::set_section_address): Do not advance
3575         dot value and load address if section type is NOLOAD.  Set address
3576         of NOLOAD sections regardless of section flags.
3577         (Output_section_definition::print): Print section type if it is
3578         not SCRIPT_SECTION_TYPE_NONE.
3579         (Output_section_definition::section_type): New method.
3580         (Output_section_definition::script_section_type_name): Ditto.
3581         (Script_sections::output_section_name): Add new parameter
3582         PSECTION_TYPE for returning script section type.  Pass it to
3583         section elements.  Handle discard sections.
3584         (Sort_output_sections::operator()): Handle NOLOAD sections.
3585         * script-sections.h (Script_sections::Section_type): New enum type.
3586         (Script_sections::output_section_name): Add a new parameter for
3587         returning script section type.
3588         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3589         INFO and NOLOAD.
3590         * yyscript.y (union): Add new field SECTION_TYPE.
3591         (COPY, DSECT, INFO, NOLOAD): New tokens.
3592         (opt_address_and_section_type): Change type to output_section_header.
3593         (section_type): New non-terminal
3594         (section_header): Handle section type.
3595         (opt_address_and_section_type): Return section type value.
3596
3597 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3598
3599         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3600         * testsuite/plugin_common_test_2.c (foo): Likewise.
3601
3602 2010-04-08  Doug Kwan  <dougkwan@google.com>
3603
3604         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3605         Output_merge_data.
3606         * output.cc (Output_section::add_merge_input_section): Simplify
3607         code and return status of Output_merge_base::add_input_section.
3608         Update merge section map only if Output_merge_base::add_input_section
3609         returns true.
3610
3611 2010-04-07  Doug Kwan  <dougkwan@google.com>
3612
3613         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3614         if section is marked as containing instructions but has no mapping
3615         symbols.
3616         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3617         correct section index.
3618         (Arm_relobj::find_linked_text_section): Ditto.
3619
3620 2010-04-07  Cary Coutant  <ccoutant@google.com>
3621
3622         * archive.cc (include_member): Destroy Read_symbols_data object before
3623         releasing file.
3624         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3625         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3626         (Read_symbols_data::~Read_symbols_data) New destructor.
3627         (Section_relocs::Section_relocs) New constructor.
3628         (Section_relocs::~Section_relocs) New destructor.
3629         (Read_relocs_data::Read_relocs_data) New constructor.
3630         (Read_relocs_data::~Read_relocs_data) New destructor.
3631         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3632         pointers to NULL after deleting.
3633
3634 2010-04-07  Doug Kwan  <dougkwan@google.com>
3635
3636         * arm.cc: Replace "endianity" with "endianness" in comments.
3637         (Arm_exidx_cantunwind): Ditto.
3638         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3639         (Arm_relobj::merge_flags_and_attributes): New method.
3640         (Arm_relobj::merge_flags_and_attributes_): New data member.
3641         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3642         (Arm_relobj::scan_sections_for_stubs): Ditto.
3643         (Arm_relobj::do_read_symbols): Check to see if we really want to
3644         merge processor-specific flags and attributes.  Exit early if
3645         an object is empty except for section names and the undefined symbol.
3646         (Target_arm::do_finalize_sections): Move check for ELF format to
3647         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3648         attributes from a regular object only when we have determined that
3649         it is aapropriate.  Do not create an .ARM.attributes section in
3650         output if there is no regular input object.
3651         (Target_arm::merge_processor_specific_flags): Check
3652         --warn-mismatch before printing any error.
3653         (Target_arm::merge_object_attributes): Ditto.
3654         * gold.cc (queue_middle_tasks): Handle the case in which there is
3655         no regular object in input.
3656         * options.cc (General_options::parse_EB): New method.
3657         (General_options::parse_EL): Same.
3658         (General_options::General_options): Initialize endianness_.
3659         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3660         New options.
3661         (General_options::Endianness): New enum.
3662         (General_options::endianness): New method.
3663         (General_options::endianness_): New data member.
3664         * parameters.cc (Parameters::set_options): Check target endianness.
3665         (Parameters::set_target_once): Ditto.
3666         (Parameters::check_target_endianness): New method.
3667         (parameters_force_valid_target): If either -EL or -EB is specified,
3668         use it to define endianness of default target.
3669         * parameters.h (Parameters::check_target_endianness): New method
3670         declaration.
3671         * target.h (class Target): Change "endianity" to "endianness"
3672         in comments.
3673
3674 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3675
3676         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3677         * configure: Regenerate.
3678         * Makefile.in: Regenerate.
3679         * testsuite/Makefile.in: Regenerate.
3680
3681 2010-04-06  Cary Coutant  <ccoutant@google.com>
3682
3683         gcc PR lto/42757
3684         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3685         prevailing definitions of common symbols.
3686         * testsuite/plugin_test_6.sh: New test case.
3687         * testsuite/plugin_common_test_1.c: New test case.
3688         * testsuite/plugin_common_test_2.c: New test case.
3689         * testsuite/Makefile.am (plugin_test_6): New test case.
3690         * testsuite/Makefile.in: Regenerate.
3691
3692 2010-04-06  Nick Clifton  <nickc@redhat.com>
3693
3694         * po/vi.po: New Vietnamese translation.
3695
3696 2010-03-30  Doug Kwan  <dougkwan@google.com>
3697
3698         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3699
3700 2010-03-25  Doug Kwan  <dougkwan@google.com>
3701
3702         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3703         to avoid a conversion warning on a 32-bit host.
3704
3705 2010-03-24  Ian Lance Taylor  <iant@google.com>
3706
3707         * testsuite/script_test_3.t: Add a TLS segment.
3708         * testsuite/Makefile.am (check_PROGRAMS): Add
3709         tls_phdrs_script_test.
3710         (tls_phdrs_script_test_SOURCES): Define.
3711         (tls_phdrs_script_test_DEPENDENCIES): Define.
3712         (tls_phdrs_script_test_LDFLAGS): Define.
3713         (tls_phdrs_script_test_LDADD): Define.
3714         * testsuite/Makefile.in: Rebuild.
3715
3716 2010-03-23  Cary Coutant  <ccoutant@google.com>
3717
3718         * fileread.cc (find_or_make_view): Fix comment.
3719
3720 2010-03-23  Ian Lance Taylor  <iant@google.com>
3721
3722         * script-sections.cc (class Orphan_section_placement): Define
3723         PLACE_TLS and PLACE_TLS_BSS.
3724         (Orphan_section_placement::Orphan_section_placement): Initialize
3725         new places.
3726         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3727         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3728         (tls_script_test_SOURCES): Define.
3729         (tls_script_test_DEPENDENCIES): Define.
3730         (tls_script_test_LDFLAGS): Define.
3731         (tls_script_test_LDADD): Define.
3732         * testsuite/Makefile.in: Rebuild.
3733
3734 2010-03-22  Doug Kwan  <dougkwan@google.com>
3735
3736         * arm.cc (Arm_relocate_functions::abs8,
3737         Arm_relocate_functions::abs16): Use correct check for overflow
3738         specified in the ARM ELF specs.
3739         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3740         target of a BLX instruction specially.
3741         (Reloc_stub::stub_type_for_reloc): Ditto.
3742         (Relocate::relocate): Use symbolic names instead of numeric relocation
3743         codes to report error.
3744         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3745         workaround.
3746         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3747         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3748         thumb2_blx_out_of_range.stdout
3749         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3750         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3751         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3752         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3753         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3754         thumb2_blx_in_range, thumb2_blx_in_range.o,
3755         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3756         thumb2_blx_out_of_range.o): New rules.
3757         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3758         thumb2_blx_in_range and thumb2_blx_out_of_range.
3759         * testsuite/Makefile.in: Regenerate.
3760         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3761         * testsuite/thumb_blx_in_range.s: New file.
3762         * testsuite/thumb_blx_out_of_range.s: New file.
3763
3764 2010-03-22  Rafael Espindola  <espindola@google.com>
3765
3766         * archive.cc (Should_include): Move to archive.h.
3767         (should_include_member): Make it a member of Archive.
3768         (Lib_group): New.
3769         (Add_lib_group_symbols): New.
3770         * archive.h: Include options.h.
3771         (Archive_member): Moved from Archive.
3772         (Should_include): Moved from archive.cc.
3773         (Lib_group): New.
3774         (Add_lib_group_symbols): New.
3775         * dynobj.cc (do_should_include_member): New.
3776         * dynobj.h (do_should_include_member): New.
3777         * gold.cc (queue_initial_tasks): Update call to queue.
3778         * main.cc (main): Print lib group stats.
3779         * object.cc (do_should_include_member): New.
3780         * object.h: Include archive.h.
3781         (Object::should_include_member): New.
3782         (Object::do_should_include_member): New.
3783         (Sized_relobj::do_should_include_member): New.
3784         * options.cc (General_options::parse_start_lib): New.
3785         (General_options::parse_end_lib): New.
3786         (Input_arguments::add_file): Handle lib groups.
3787         (Input_arguments::start_group): Check we are not in a lib.
3788         (Input_arguments::start_lib): New.
3789         (Input_arguments::end_lib): New.
3790         * options.h (General_options): Add start_lib and end_lib.
3791         (Input_argument::lib_): New.
3792         (Input_argument::lib): New.
3793         (Input_argument::is_lib): New.
3794         (Input_file_lib): New.
3795         (Input_arguments::in_lib_): New.
3796         (Input_arguments::in_lib): New.
3797         (Input_arguments::start_lib): New.
3798         (Input_arguments::end_lib_): New.
3799         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3800         in unused members as preempted.
3801         (Sized_pluginobj::do_should_include_member): New.
3802         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3803         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3804         return the blocker.
3805         (Read_symbols::do_whole_lib_group): New.
3806         (Read_symbols::do_lib_group): New.
3807         (Read_symbols::do_read_symbols): Handle lib groups.
3808         (Read_symbols::get_name): Handle lib groups.
3809         * readsyms.h (Read_symbols): Add an archive member pointer.
3810         (Read_symbols::do_whole_lib_group): New.
3811         (Read_symbols::do_lib_group): New.
3812         (Read_symbols::member_): New.
3813         * script.cc (read_input_script): Update call to queue_soon.
3814
3815 2010-03-19  Doug Kwan  <dougkwan@google.com>
3816
3817         * arm.cc (Stub_table::Stub_table): Initialize new data members
3818         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3819         (Stub_table::add_reloc_stub): Assign stub offset and update
3820         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3821         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3822         New data members.
3823         (Stub_table::update_data_size_and_addralign): Use
3824         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3825         instead of going over all reloc stubs.
3826         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3827         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3828         Stringpool_template::offset_ to size of Stringpool_char.
3829         (Stringpool_template::new_key_offset): Remove code to initialize
3830         Stringpool_template::offset_.
3831         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3832         Stringpool_template::offset_ to zero.
3833
3834 2010-03-15  Doug Kwan  <dougkwan@google.com>
3835
3836         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3837         offset_.
3838         (Stringpool_template::new_key_offset): New method.
3839         (Stringpool_template::add_string): Assign offsets when adding new
3840         strings.
3841         (Stringpool_template::set_string_offsets): Do not set string offsets
3842         when not optimizing.
3843         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3844         member size_.
3845         (Chunked_vector::clear): Clear size_.
3846         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3847         (Chunked_vector::size): Return size_.
3848         (Chunked_vector::push_back): Use size_ to find insert position.
3849         (Chunked_vector::size_): New data member.
3850         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3851         (Stringpool_template::new_key_offset): New method declaration.
3852         (Stringpool_template::offset_): New data member.
3853
3854 2010-03-15   Rafael Espindola  <espindola@google.com>
3855
3856         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3857         Add_symbols' constructor.
3858         * readsyms.h (Add_symbols): Remove the input_group member.
3859
3860 2010-03-10  Ian Lance Taylor  <iant@google.com>
3861
3862         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3863         target to ask whether a reference to a symbol requires a stack
3864         split.
3865         * target.h (Target::is_call_to_non_split): New function.
3866         (Target::do_is_call_to_non_split): Declare virtual function.
3867         * target.cc: Include "symtab.h".
3868         (Target::do_is_call_to_non_split): New function.
3869         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3870
3871 2010-03-10  Cary Coutant  <ccoutant@google.com>
3872
3873         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3874         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3875         (File_read::open[2]): Add whole_file_view_ to list of views.
3876         (File_read::make_view): Remove test of whole_file_view_.
3877         (File_read::find_or_make_view): Create whole_file_view_ if
3878         necessary.
3879         (File_read::clear_views): Replace bool parameter with enum;
3880         adjust all callers.  Don't delete views with permanent data;
3881         do delete cached views and views from archives if
3882         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3883         if clearing the corresponding view.
3884         * fileread.h (File_read::Clear_views_mode): New enum.
3885         (File_read::View::is_permanent_view): New method.
3886         (File_read::clear_views): Replace bool parameter
3887         with enum; adjust all callers.
3888         * options.h (General_options): Change keep_files_mapped option;
3889         add map_whole_files.
3890         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3891         releasing the file.
3892         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3893         the file.
3894
3895 2010-03-10  David S. Miller  <davem@davemloft.net>
3896
3897         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3898
3899 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3900
3901         * icf.cc (get_section_contents): Add '@' marker after processing the
3902         merge reloc.
3903
3904 2010-03-08  Doug Kwan  <dougkwan@google.com>
3905
3906         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3907         due to a conversion warning.
3908         (Arm_relobj::update_output_local_symbol_count): Check for local
3909         symbol with unset output index.
3910
3911 2010-03-05  Ian Lance Taylor  <iant@google.com>
3912
3913         * options.h (class General_options): Add --spare-dynamic-tags.
3914         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3915         --spare-dynamic-tags.
3916
3917 2010-03-05  Ian Lance Taylor  <iant@google.com>
3918
3919         * incremental.cc: Include "libiberty.h".
3920
3921 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3922
3923         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3924         function, is_info_ member.
3925         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3926         (Versions::Versions): Update caller.
3927         (Versions::define_base_version): Likewise.
3928         (Versions::add_def): Likewise.
3929
3930 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3931
3932         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3933         (Scan::possible_function_pointer_reloc): New function.
3934         (Scan::local_reloc_may_be_function_pointer): Change to call
3935         possible_function_pointer_reloc.
3936         (Scan::global_reloc_may_be_function_pointer): Ditto.
3937         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3938         relocations in ".data.rel.ro._ZTV" section.
3939         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3940         * testsuite/icf_safe_so_test.cc: Ditto.
3941         * testsuite/icf_safe_test.cc: Ditto.
3942         * testsuite/icf_safe_test.sh: Ditto.
3943
3944 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3945             Ian Lance Taylor  <iant@google.com>
3946
3947         * target-reloc.h (relocate_section): Check the symbol table index
3948         for -1U before setting the local symbol index.
3949         (scan_relocatable_relocs): If copying the relocation, record that
3950         the local symbol is required.
3951         * object.h (Symbol_value::is_output_symtab_index_set): New
3952         function.
3953         (Symbol_value::may_be_discarded_from_output_symtab): New
3954         function.
3955         (Symbol_value::has_output_symtab_entry): New function.
3956         (Symbol_value::needs_output_symtab_entry): Remove.
3957         (Symbol_value::output_symtab_index): Make sure the symbol index is
3958         set.
3959         (Symbol_value::set_output_symtab_index): Make sure the symbol
3960         index is not set.  Make sure the new index is valid.
3961         (Symbol_value::set_must_have_output_symtab_entry): New function.
3962         (Symbol_value::has_output_dynsym_entry): New function.
3963         (Symbol_value::set_output_dynsym_index): Make sure the new index
3964         is valid.
3965         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3966         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3967         local symbol if permitted.
3968         (Sized_relobj::do_finalize_local_symbols): Call
3969         is_output_symtab_index_set rather than needs_output_symtab_entry.
3970         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3971         rather than needs_output_symtab_entry.  Call
3972         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3973         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3974         is_output_symtab_index_set rather than needs_output_symtab_entry.
3975         * testsuite/discard_locals_relocatable_test.c: New file.
3976         * testsuite/discard_locals_test.sh: Test -r.
3977         * testsuite/Makefile.am (check_DATA): Add
3978         discard_locals_relocatable_test1.syms,
3979         discard_local_relocatable_test2.syms.
3980         (MOSTLYCLEANFILES): Likewise.  Also add
3981         discard_locals_relocatable_test1.lout and
3982         discard_locals_relocatable_test2.out.
3983         (discard_locals_relocatable_test1.syms): New target.
3984         (discard_locals_relocatable_test.o): New target.
3985         (discard_locals_relocatable_test1.out): New target.
3986         (discard_locals_relocatable_test2.syms): New target.
3987         (discard_locals_relocatable_test2.out): New target.
3988         (various): Add missing ../ld-new dependencies.
3989         * testsuite/Makefile.in: Rebuild.
3990
3991 2010-03-03  Nick Clifton  <nickc@redhat.com>
3992
3993         * po/fi.po: New Finnish translation.
3994
3995 2010-03-01  Doug Kwan  <dougkwan@google.com>
3996
3997         * layout.cc (Layout::Layout): Force section types of .init_array*,
3998         .preinit_array* and .fini_array* sections.
3999         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4000         Fix check of return value of std::string::find.().
4001         (Output_section::Input_section_sort_compare::operator()): Remove
4002         comment about .init_array.
4003         (Output_section::Input_section_sort_init_fini_compare::operator()):
4004         New method.
4005         (Output_section::sort_attached_input_sections): Handle .init_array
4006         and .fini_array specially.
4007         * output.h (Output_section::Inut_section_sort_compare): Update
4008         comment.
4009         (Output_section::Input_section_sort_init_fini_compare): New struct.
4010
4011 2010-02-26  Doug Kwan  <dougkwan@google.com>
4012
4013         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4014         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4015         * testsuite/debug_msg.sh: Avoid matching source line number for
4016         use of global variable undef_int.
4017
4018 2010-02-26  Doug Kwan  <dougkwan@google.com>
4019
4020         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4021         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4022         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4023         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4024         * options.cc (General_options::General_options): Initialize member
4025         fix_v4bx_.
4026         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4027         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4028         and rm_no_fix_v4bx.stdout
4029         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4030         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4031         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4032         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4033         and arm_no_fix_v4bx.
4034         * Makefile.in: Regenerate.
4035         * testsuite/arm_fix_v4bx.s: New file.
4036         * testsuite/arm_fix_v4bx.sh: Ditto.
4037
4038 2010-02-24  Doug Kwan  <dougkwan@google.com>
4039
4040         * arm.cc (Target_arm::got_section): Make the .got section the first
4041         non RELRO section in the data segment.
4042         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4043         suffixes of section names.
4044
4045 2010-02-24  Doug Kwan  <dougkwan@google.com>
4046
4047         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4048         flags and attributes merging if an input file is a binary file.
4049         * fileread.cc (Input_file::open): Record format of original file.
4050         * fileread.h (Input_file::Format): New enum type.
4051         (Input_file::Input_file): Initialize data member format_.
4052         (Input_file::format): New method definition.
4053         (Input_file::format_):: New data member.
4054
4055 2010-02-24  Doug Kwan  <dougkwan@google.com>
4056
4057         * arm.cc (Arm_output_data_got): New class.
4058         (ARM_TCB_SIZE): New constant
4059         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4060         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4061         If user uses a script with a SECTIONS clause, issue only a warning
4062         for a misplaced EXIDX input section.  Otherwise, issue an error.
4063         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4064         garbage collection.
4065         (Target_arm::got_mode_index_entry): Handle static linking.
4066         (Target_arm::Scan::local): Ditto.
4067         (Target_arm::Scan::global): Ditto.
4068         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4069         all incorrectly implemented relocations.
4070         (Target_arm::fix_exidx_coverage): Pass layout to
4071         Arm_output_section::fix_exidx_coverage.
4072         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4073         from ".ARM.exidx." and ".ARM.extab.".
4074
4075 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4076
4077         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4078         section if it does not already exist.
4079         * attributes.cc (Attributes_section_data::Attributes_section_data):
4080         Don't crash if size is zero.
4081
4082 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4083             Ian Lance Taylor  <iant@google.com>
4084
4085         * gold.cc (queue_middle_tasks): If no input files were opened,
4086         exit.
4087         * workqueue.h (Task_function::Task_function): Assert that there is
4088         a blocker.
4089
4090 2010-02-22  Doug Kwan  <dougkwan@google.com>
4091
4092         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4093         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4094         types to avoid warnings due to different uint64_t implementations
4095         on different hosts.
4096
4097 2010-02-21  Doug Kwan  <dougkwan@google.com>
4098
4099         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4100         handling of the maximum backward branch offset.
4101         (Arm_relocate_functions::thumb_branch_common): Ditto.
4102         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4103         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4104         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4105         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4106         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4107         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4108         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4109         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4110         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4111         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4112         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4113         thumb2_bl_out_of_range.o): New rules.
4114         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4115         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4116         thumb2_bl_out_of_range
4117         * testsuite/Makefile.in: Regenerate.
4118         * testsuite/arm_bl_in_range.s: New file.
4119         * testsuite/arm_bl_out_of_range.s: Ditto.
4120         * testsuite/arm_branch_in_range.sh: Ditto.
4121         * testsuite/arm_branch_range.t: Ditto.
4122         * testsuite/thumb2_branch_range.t: Ditto.
4123         * testsuite/thumb_bl_in_range.s: Ditto.
4124         * testsuite/thumb_bl_out_of_range.s: Ditto.
4125         * testsuite/thumb_branch_range.t: Ditto.
4126
4127 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4128
4129         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4130         Add reloc offset information.
4131         * icf.cc (get_section_contents): Change iterators to point to the new
4132         vectors. Add reloc offset information to the contents.
4133         * icf.h (Icf::Sections_reachable_info): New typedef.
4134         (Icf::Sections_reachable_list): New typedef.
4135         (Icf::Offset_info): New typedef.
4136         (Icf::Reloc_info): New struct typedef.
4137         (Icf::Reloc_info_list): New typedef.
4138         (Icf::symbol_reloc_list): Delete method.
4139         (Icf::addend_reloc_list): Delete method.
4140         (Icf::section_reloc_list): Delete method.
4141         (Icf::reloc_info_list): New method.
4142         (Icf::reloc_info_list_): New member.
4143
4144 2010-02-19  Doug Kwan  <dougkwan@google.com>
4145
4146         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4147         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4148         * arm.cc (Arm_relocation_functions): New forward declaration.
4149         (Target_arm::Target_arm): Initialize new data members
4150         got_mod_index_offset_ and tls_base_symbol_defined_.
4151         (Target_arm::Relocate::relocate_tls): New method.
4152         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4153          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4154         New methods.
4155         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4156         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4157         (Target_arm::got_mod_index_offset_,
4158         Target_arm::tls_base_symbol_defined_): New data members.
4159         (Target_arm::Scan::local, Target::Scan::global,
4160         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4161         relocations.
4162
4163 2010-02-18  Doug Kwan  <dougkwan@google.com>
4164
4165         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4166         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4167         text section as a parameter becuase some broken tools may not set
4168         the link in section header.
4169         (Target_arm::has_got_section): New method.
4170         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4171         without any mapping symbol as data only.  Remove warning.
4172         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4173         link in its section header, try to discover the link by inspecting the
4174         REL31 relocation at the beginning of the section.
4175         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4176         in error message.
4177         (Target_arm::Scan::global): Treat any reference to the symbol
4178         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4179
4180 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4181
4182         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4183         (Scan::global_reloc_may_be_function_pointer): New function.
4184         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4185         (Scan::global_reloc_may_be_function_pointer): New function.
4186         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4187         (Scan::global_reloc_may_be_function_pointer): New function.
4188         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4189         (Scan::global_reloc_may_be_function_pointer): New function.
4190         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4191         (Scan::global_reloc_may_be_function_pointer): New function.
4192         (Scan::possible_function_pointer_reloc): New function.
4193         (Target_x86_64::can_check_for_function_pointers): New function.
4194         * gc.h (gc_process_relocs): Scan relocation types to determine if
4195         function pointers were taken for targets that support it.
4196         * icf.cc (Icf::find_identical_sections): Include functions for
4197         folding in safe ICF whose pointer is not taken.
4198         * icf.h (Secn_fptr_taken_set): New typedef.
4199         (fptr_section_id_): New member.
4200         (section_has_function_pointers): New function.
4201         (set_section_has_function_pointers): New function.
4202         (check_section_for_function_pointers): New function.
4203         * options.h: Fix comment for safe ICF option.
4204         * target.h (can_check_for_function_pointers): New function.
4205         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4206         Modify icf_safe_test for X86-64.
4207         * testsuite/Makefile.in: Regenerate.
4208         * testsuite/icf_safe_so_test.cc: New file.
4209         * testsuite/icf_safe_so_test.sh: New file.
4210         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4211         (main): Change to take pointer to function kept_func_3.
4212         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4213         folding is done correctly for X86-64.
4214
4215 2010-02-12  David S. Miller  <davem@davemloft.net>
4216
4217         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4218         is_symbolless parameter.
4219         (Output_reloc<SHT_REL>::is_symbolless): New.
4220         (Output_reloc<SHT_REL>::is_symbolless_): New.
4221         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4222         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4223         (Output_reloc<SHT_RELA>::is_symbolless): New.
4224         (Output_data_reloc::add_global): Handle is_symbolless.
4225         (Output_data_reloc::add_global_relative): Likewise.
4226         (Output_data_reloc::add_local): Likewise.
4227         (Output_data_reloc::add_local_relative): Likewise.
4228         (Output_data_reloc::add_symbolless_global_addend): New.
4229         (Output_data_reloc::add_symbolless_local_addend): New.
4230         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4231         is_symbolless.
4232         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4233         instead of ->is_relative_
4234         (Output_reloc::write): Likewise.
4235         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4236         (Output_reloc::write_rel): Simplify.
4237
4238         * sparc.cc (Target_sparc::Scan::local): Use
4239         ->add_symbolless_local_addend as needed.
4240         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4241         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4242         based upon relocation offset.
4243
4244 2010-02-11  Doug Kwan  <dougkwan@google.com>
4245
4246         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4247         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4248         beginning of function.
4249         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4250         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4251         parameter is_32bit in calls to should_apply_static_reloc.
4252         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4253         (check_DATA): Add arm_abs_global.stdout.
4254         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4255         arm_abs_global.stdout): New rules.
4256         (MOSTLLYCLEANFILES): Add arm_abs_global
4257         * Makefile.in: Regenerate.
4258         * testsuite/arm_abs_global.s: New file.
4259         * testsuite/arm_abs_global.sh: Ditto.
4260         * testsuite/arm_abs_lib.s: Ditto.
4261
4262 2010-02-11  Ian Lance Taylor  <iant@google.com>
4263
4264         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4265         Read_relocs task.
4266         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4267         Allocate_commons_task first.
4268         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4269         task, rather than symtab_lock_.
4270         (Gc_process_relocs::~Gc_process_relocs): New function.
4271         (Gc_process_relocs::is_runnable): Check this_blocker_.
4272         (Gc_process_relocs::locks): Use next_blocker_ rather than
4273         blocker_.
4274         (Scan_relocs::~Scan_relocs): New function.
4275         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4276         symtab_lock_.
4277         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4278         next_blocker_.
4279         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4280         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4281         constructor accordingly.
4282         (class Gc_process_relocs): Likewise.
4283         (class Scan_relocs): Likewise.
4284         * common.h (class Allocate_commons_task): Remove symtab_lock_
4285         field, and corresponding constructor parameter.
4286         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4287         symtab_lock_.
4288         (Allocate_commons_task::locks): Likewise.
4289
4290 2010-02-11  Ian Lance Taylor  <iant@google.com>
4291
4292         * gold-threads.h (class Once): Define.
4293         (class Initialize_lock): Rewrite as child of Once.
4294         * gold-threads.cc (class Once_initialize): Define.
4295         (once_pointer_control): New static variable.
4296         (once_pointer, once_arg): New static variables.
4297         (c_run_once): New static function.
4298         (Once::Once, Once::run_once, Once::internal_run): New functions.
4299         (class Initialize_lock_once): Remove.
4300         (initialize_lock_control): Remove.
4301         (initialize_lock_pointer): Remove.
4302         (initialize_lock_once): Remove.
4303         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4304         (Initialize_lock::initialize): Rewrite.
4305         (Initialize_lock::do_run_once): New function.
4306         * archive.cc (Archive::interpret_header): Only clear name if it is
4307         not already empty.
4308         * fileread.cc: Include "gold-threads.h"
4309         (file_counts_lock): New static variable.
4310         (file_counts_initialize_lock): Likewise.
4311         (File_read::release): Only increment counts when using --stats.
4312         Use a lock around the increment.
4313         * parameters.cc (class Set_parameters_target_once): Define.
4314         (set_parameters_target_once): New static variable.
4315         (Parameters::Parameters): Move here from parameters.h.
4316         (Parameters::set_target): Rewrite.
4317         (Parameters::set_target_once): New function.
4318         (Parameters::clear_target): Move here and rewrite.
4319         * parameters.h (class Parameters): Update declarations.  Add
4320         set_parameters_target_once_ field.
4321         (Parameters::Parameters): Move to parameters.cc.
4322         (Parameters::clear_target): Likewise.
4323         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4324         task.
4325         (Start_group::~Start_group): New function.
4326         (Start_group::is_runnable): New function.
4327         (Start_group::locks, Start_group::run): New functions.
4328         (Finish_group::run): Change saw_undefined to size_t.
4329         * readsyms.h (class Start_group): Define.
4330         (class Finish_group): Change saw_undefined_ field to size_t.
4331         (Finish_group::Finish_group): Remove saw_undefined and
4332         this_blocker parameters.  Change all callers.
4333         (Finish_group::set_saw_undefined): New function.
4334         (Finish_group::set_blocker): New function.
4335         * symtab.h (class Symbol_table): Change saw_undefined to return
4336         size_t.  Change saw_undefined_ field to size_t.
4337         * target-select.cc (Set_target_once::do_run_once): New function.
4338         (Target_selector::Target_selector): Initialize set_target_once_
4339         field.  Don't initialize lock_ and initialize_lock_ fields.
4340         (Target_selector::instantiate_target): Rewrite.
4341         (Target_selector::set_target): New function.
4342         * target-select.h (class Set_target_once): Define.
4343         (class Target_selector): Update declarations.  Make
4344         Set_target_once a friend.  Remove lock_ and initialize_lock_
4345         fields.  Add set_target_once_ field.
4346
4347 2010-02-10  Ian Lance Taylor  <iant@google.com>
4348
4349         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4350         queueing any tasks.
4351         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4352         (queue_middle_tasks): Add all blockers before queueing any tasks.
4353         (queue_final_tasks): Likewise.
4354         * token.h (Task_token::add_blockers): New function.
4355         * object.h (Input_objects::number_of_relobjs): New function.
4356
4357 2010-02-10  Ian Lance Taylor  <iant@google.com>
4358
4359         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4360         shared, not if not position independent.
4361         * x86_64.cc (Relocate::relocate_tls): Likewise.
4362         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4363         (tls_pie_pic_test): New target.
4364         * testsuite/Makefile.in: Rebuild.
4365
4366         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4367         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4368         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4369         * testsuite/Makefile.in: Rebuild.
4370
4371 2010-02-09  David S. Miller  <davem@davemloft.net>
4372
4373         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4374         R_SPARC_RELATIVE using ->add_local_relative().
4375         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4376
4377         * output.h (Output_data_dynamic::add_section_size): New method
4378         that takes two Output_data objects.
4379         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4380         entry param.  Handle it in initializers.
4381         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4382         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4383         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4384         arg.
4385         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4386         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4387         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4388         for dynrel_includes_plt.
4389         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4390         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4391         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4392         before .rela.plt
4393         (Target_sparc::do_finalize_sections): Update to pass true for
4394         dynrel_includes_plt.
4395         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4396         output before .rela.plt
4397         (Target_powerpc::do_finalize_sections): Update to pass true for
4398         dynrel_includes_plt when 32-bit.
4399
4400 2010-02-08  Doug Kwan  <dougkwan@google.com>
4401
4402         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4403         method.
4404         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4405         Arm_relobj::scan_section_for_cortex_a8_stubs,
4406         Arm_relobj::do_relocation_section): Instead of calling
4407         Output_section::output_address, use faster
4408         Arm_relobj::simple_input_section_output_address.
4409
4410 2010-02-08  David S. Miller  <davem@davemloft.net>
4411
4412         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4413         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4414         relocation helper function.
4415
4416         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4417         just like R_SPARC_GOT{10,13,22}.
4418         (Target_sparc::Scan::local): Likewise.
4419         (Target_sparc::Relocate:relocate): Likewise.
4420
4421 2010-02-06  Ian Lance Taylor  <iant@google.com>
4422
4423         * configure.ac: Rewrite targetobjs duplicate removal code to use
4424         only shell constructs.
4425         * configure: Rebuild.
4426
4427 2010-02-05  Doug Kwan  <dougkwan@google.com>
4428
4429         PR 11247
4430         * arm.cc (Arm_relobj::section_is_scannable): New method.
4431         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4432         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4433
4434 2010-02-04  Doug Kwan  <dougkwan@google.com>
4435
4436         PR 11247
4437         * arm-reloc-property.cc (cstdio): Include.
4438         * configure.ac (targetobjs): Remove duplicates.
4439         * configure: Regenerate.
4440         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4441         big and little endian version for a given address size.
4442
4443 2010-02-03  Doug Kwan  <dougkwan@google.com>
4444
4445         * arm-reloc-property.cc
4446         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4447         definition.
4448         * arm-reloc-property.h
4449         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4450         New method definition.
4451         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4452         declaration.
4453         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4454         overflow to N.
4455         (GOT_PREL): Change implemented to Y.
4456         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4457         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4458         (Arm_relocate_functions::movw_abs_nc): Remove method.
4459         (Arm_relocate_functions::movt_abs): Ditto.
4460         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4461         (Arm_relocate_functions::thm_movt_abs): Ditto.
4462         (Arm_relocate_functions::movw_rel_nc): Ditto.
4463         (Arm_relocate_functions::movw_rel): Ditto.
4464         (Arm_relocate_functions::movt_rel): Ditto.
4465         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4466         (Arm_relocate_functions:thm_movw_rel): Ditto.
4467         (Arm_relocate_functions:thm_movt_rel): Ditto.
4468         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4469         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4470         New method definitions.
4471         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4472         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4473         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4474         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4475         (Target_arm::Relocate::relocate): Check for non-static or
4476         unimplemented relocation code and exit early.  Change calls to
4477         Target_arm::reloc_uses_thumb_bit and
4478         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4479         instead.  Refactor code to handle similar relocations to increase
4480         code sharing.  Remove check for unsupported relocation code in switch
4481         statement.
4482         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4483         relocation property table to find out size.  Change error message to
4484         print out the name of a relocation code instead of the numeric value.
4485         (Target_arm::scan_reloc_for_stub): Use relocation property table
4486         instead of calling Target_arm::reloc_uses_thumb_bit().
4487
4488 2010-02-02  Doug Kwan  <dougkwan@google.com>
4489
4490         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4491         types of relaxed input section.
4492
4493 2010-02-02  Doug Kwan  <dougkwan@google.com>
4494
4495         * Makefile.am (HFILES): Add arm-reloc-property.h.
4496         (DEFFILES): New.
4497         (TARGETSOURCES): Add arm-reloc-property.cc
4498         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4499         (libgold_a_SOURCES): $(DEFFILES)
4500         * Makefile.in: Regenerate.
4501         * arm-reloc-property.cc: New file.
4502         * arm-reloc-property.h: New file.
4503         * arm-reloc.def: New file.
4504         * arm.cc: Update comments.
4505         (arm-reloc-property.h): New included header.
4506         (arm_reloc_property_table): New global variable.
4507         (Target_arm::do_select_as_default_target): New method definition.
4508         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4509         arm-reloc-property to targ_extra_obj.
4510         * parameters.cc (set_parameters_target): Call
4511         Target::select_as_default_target().
4512         * target.h (Target::select_as_default_target): New method definition.
4513         (Target::do_select_as_default_target): Same.
4514
4515 2010-02-01  Doug Kwan  <dougkwan@google.com>
4516
4517         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4518         first_output_text_section_.
4519         (Arm_exidx_fixup::first_output_text_section): New method definition.
4520         (Arm_exidx_fixup::first_output_text_section_): New data member.
4521         (Arm_exidx_fixup::process_exidx_section): Record the first text
4522         output section seen.
4523         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4524         and entsize in output section header.
4525
4526 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4527
4528         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4529         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4530         (Arm_relocate_functions::thm_alu11): New Method.
4531         (Arm_relocate_functions::thm_pc8): New Method.
4532         (Arm_relocate_functions::thm_pc12): New Method.
4533         (Target_arm::Scan::local): Handle the relocations.
4534         (Target_arm::Scan::global): Likewise.
4535         (Target_arm::Relocate::relocate): Likewise.
4536         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4537
4538 2010-01-29  Doug Kwan  <dougkwan@google.com>
4539
4540         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4541         of relocation types as ld.
4542
4543 2010-01-29  Doug Kwan  <dougkwan@google.com>
4544
4545         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4546         to public.
4547         (Arm_relocate_functions::thumb_branch_common): Ditto.
4548         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4549         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4550         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4551         Arm_relocate_functions::jump24): Remove.
4552         (Target_arm::Relocate::relocate): Adjust code to call
4553         Arm_relocation_functions::arm_branch_common and
4554         Arm_relocation_functions::thumb_branch_common instead of their removed
4555         wrappers.  Merge switch-cases together to reduce source code size.
4556
4557 2010-01-29  Doug Kwan  <dougkwan@google.com>
4558
4559         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4560         output_local_symbol_count_needs_update_.
4561         (Arm_relobj::output_local_symbol_count_needs_update,
4562          Arm_relobj::set_output_local_symbol_count_needs_update,
4563          Arm_relobj::update_output_local_symbol_count): New methods.
4564         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4565         member.
4566         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4567         of pointed function as in a R_ARM_PREL31 relocation.
4568         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4569         for output local symbol count updating.
4570         (Target_arm::do_relax): Update output local symbol counts in objects
4571         if necessary.
4572         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4573
4574 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4575
4576         * arm.cc: Added support for the ARM relocations:
4577         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4578         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4579         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4580         movw_prel_nc).
4581         (Arm_relocate_functions::movw_rel): New method.
4582         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4583         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4584         thm_movw_prel_nc).
4585         (Arm_relocate_functions::thm_movw_rel): New method.
4586         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4587         thm_movt_prel).
4588         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4589         relocations.
4590         (Target_arm::Scan::global): Likewise.
4591         (Target_arm::Relocate::relocate): Likewise.
4592         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4593         Likewise.
4594
4595 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4596
4597         * arm.cc: Added support for ARM group relocations.
4598         (Target_arm::reloc_needs_sym_origin): New method.
4599         (Arm_relocate_functions::calc_grp_kn): New method.
4600         (Arm_relocate_functions::calc_grp_residual): New method.
4601         (Arm_relocate_functions::calc_grp_gn): New method.
4602         (Arm_relocate_functions::arm_grp_alu): New Method.
4603         (Arm_relocate_functions::arm_grp_ldr): New Method.
4604         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4605         (Arm_relocate_functions::arm_grp_ldc): New Method.
4606         (Target_arm::Scan::local): Handle the ARM group relocations.
4607         (Target_arm::Scan::global): Likewise.
4608         (Target_arm::Relocate::relocate): Likewise.
4609         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4610         Likewise.
4611
4612 2010-01-26  Doug Kwan  <dougkwan@google.com>
4613
4614         * arm.cc (set): Include.
4615         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4616         pointer type.
4617         (Arm_output_section::Text_section_list): New type.
4618         (Arm_output_section::append_text_sections_to_list): New method.
4619         (Arm_output_section::fix_exidx_coverage): Ditto.
4620         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4621         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4622         Relobj::set_section_offset() instead of
4623         Sized_relobj::invalidate_section_offset().
4624         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4625         parameter for section headers. Ignore relocation sections for
4626         unallocated sections and EXIDX sections.
4627         (Target_arm::fix_exidx_coverage): New method.
4628         (Target_arm::output_section_address_less_than): New type.
4629         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4630         linked text section instead of the EXIDX section.
4631         (Arm_output_section::create_stub_group): Add an assertion to check
4632         that this is not an EXIDX output section.
4633         (Arm_output_section::append_text_sections_to_list): New method.
4634         (Arm_output_section::fix_exidx_coverage): Ditto.
4635         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4636         Arm_relobj::section_needs_reloc_stub_scanning.
4637         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4638         first pass.
4639         (Target_arm::fix_exidx_coverage): New method.
4640         * object.h (Relobj::set_output_section): New method.
4641         (Sized_relobj::invalidate_section_offset): Remove method.
4642         (Sized_relobj::do_invalidate_section_offset): Remove method.
4643         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4644
4645 2010-01-25  Doug Kwan  <dougkwan@google.com>
4646
4647         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4648         Fix warning due to signed and unsigned comparison on a 32-bit host.
4649
4650 2010-01-22  Doug Kwan  <dougkwan@google.com>
4651
4652         * arm.cc (Target_arm::do_relax): Record an output section for section
4653         offset adjustment it contains any stub table that has changed.
4654         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4655         offsets in an output section if necessary.
4656         * output.cc (Output_section::Output_section): Initialize
4657         section_offsets_need_adjustments_.
4658         (Output_section::add_input_section_for_script): Renamed to
4659         Output_section::add_simple_input_section.
4660         (Output_section::save_states): Add a comment.
4661         (Output_section::discard_states): New method defintion.
4662         (Output_section::adjust_section_offsets): Same.
4663         * output.h (Output_section::add_input_section_for_script): Renamed to
4664         Output_section::add_simple_input_section.
4665         (Output_section::discard_states): New method declaration.
4666         (Output_section::adjust_section_offsets): Same.
4667         (Output_section::section_offsets_need_adjustment,
4668         Output_section::set_section_offsets_need_adjustment): New method
4669         definitions.
4670         (Output_section::section_offsets_need_adjustment_): New data member.
4671         * script-sections.cc
4672         (Output_section_element_input::set_section_address): Adjust code for
4673         renaming of Output_section::add_input_section_for_script.
4674         (Orphan_output_section::set_section_address): Same.
4675
4676 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4677
4678         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4679         Fix_v4bx enum values .
4680         * gold/options.h (General_options): New option definitions.
4681         (General_options::fix_v4bx): New method.
4682         (General_options::Fix_v4bx): New enum.
4683         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4684         (General_options::parse_fix_v4bx_interworking): New method.
4685
4686 2010-01-22  Doug Kwan  <dougkwan@google.com>
4687
4688         * arm.cc (Arm_exidx_fixup): New class.
4689
4690 2010-01-21  Doug Kwan  <dougkwan@google.com>
4691
4692         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4693         classes.
4694         (Arm_exidx_section_offset_map): New type.
4695
4696 2010-01-21  Doug Kwan  <dougkwan@google.com>
4697
4698         * arm.cc (Arm_exidx_input_section): New class.
4699         (Arm_relobj::exidx_input_section_by_link,
4700         Arm_relobj::exidx_input_section_by_shndx,
4701         Arm_relobj::make_exidx_input_section): New methods.
4702         (read_arm_attributes_section): Remove.
4703         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4704         information about them.
4705         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4706         to here.
4707
4708 2010-01-20  Doug Kwan  <dougkwan@google.com>
4709
4710         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4711         Input_section_specifier to Section_id.
4712         (Target_arm::new_arm_input_section: Adjust code for change of key
4713         type.
4714         (Target_arm::find_arm_input_section): Ditto.
4715         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4716         (Section_id): Remove.
4717         (Garbage_collection::Section_id_hash): Remove.
4718         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4719         (Section_id): Remove.
4720         (Icf::Section_id_hash): Remove.
4721         * object.h (Section_id, Const_section_id, Section_id_hash,
4722         Const_section_id_hash): New type definitions.
4723         * output.cc (Output_section::add_relaxed_input_section): Change to
4724         use Const_section_id instead of Input_section_specifier as key type.
4725         (Output_section::add_merge_input_section): Ditto.
4726         (Output_section::build_relaxation_map): Change to use Section_id
4727         instead of Input_section_specifier as key type.
4728         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4729         Ditto.
4730         (Output_section::convert_input_sections_to_relaxed_sections): Change
4731         to use Const_section_id instead of Input_section_specifier as key type.
4732         (Output_section::find_merge_section): Ditto.
4733         (Output_section::find_relaxed_input_section): Ditto.
4734         * output.h (Input_section_specifier): Remove class.
4735         (Output_section::Output_section_data_by_input_section_map): Change
4736         key type to Const_section_id.
4737         (Output_section::Output_relaxed_input_section_by_input_section_map):
4738         Ditto.
4739         (Output_section::Relaxation_map): Change key type to Section_id.
4740
4741 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4742
4743         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4744         (class Arm_v4bx_stub): New class.
4745         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4746         (Stub_factory::make_arm_v4bx_stub): New method.
4747         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4748         (Stub_table::empty): Handle v4bx stubs.
4749         (Stub_table::add_arm_v4bx_stub): New method.
4750         (Stub_table::find_arm_v4bx_stub): New method.
4751         (Arm_relocate_functions::v4bx): New method.
4752         (Target_arm::fix_v4bx): New method.
4753         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4754         (Stub_table::relocate_stubs): Likewise.
4755         (Stub_table::do_write): Likewise.
4756         (Stub_table::update_data_size_and_addralign): Likewise.
4757         (Stub_table::finalize_stubs):  Likewise.
4758         (Target_arm::Scan::local): Likewise.
4759         (Target_arm::Scan::global): Likewise.
4760         (Target_arm::do_finalize_sections): Likewise.
4761         (Target_arm::Relocate::relocate): Likewise.
4762         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4763         Likewise.
4764         (Target_arm::scan_reloc_for_stub): Likewise.
4765         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4766
4767 2010-01-19  Ian Lance Taylor  <iant@google.com>
4768
4769         * output.cc (Output_section_headers::do_sized_write): Write large
4770         segment count to sh_info field.
4771         (Output_file_header::do_sized_write): For large segment count,
4772         write PN_XNUM to e_phnum field.
4773
4774 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4775
4776         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4777         (Arm_relocate_functions::thm_jump8): New function.
4778         (Arm_relocate_functions::thm_jump11): New function.
4779         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4780         R_ARM_THM_JUMP11.
4781         (Target_arm::Scan::global): Likewise.
4782         (Target_arm::Relocate::relocate): Likewise.
4783         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4784         Likewise.
4785
4786 2010-01-14  Doug Kwan  <dougkwan@google.com>
4787
4788         * arm.cc (map, utility): Include headers.
4789         (Target_arm::apply_cortex_a8_workaround): New method.
4790         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4791         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4792         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4793         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4794         the --[no-]fix-cortex-a8 command line options.
4795         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4796         (Target_arm::relocate_stub): Use addend in instruction template.
4797         * options.h (DEFINE_bool): Set the user-set flag.
4798         (General_options): Add --[no-]-fix-cortex options.
4799         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4800         : Update fast look-up map after conversion.
4801
4802 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4803
4804         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4805         in the first pass of do_layout.
4806
4807 2010-01-13  Doug Kwan  <dougkwan@google.com>
4808
4809         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4810         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4811         apparent compiler problem of not folding static constant integral
4812         data members of elfcpp::Elf_sizes<32>.
4813
4814 2010-01-13  Doug Kwan  <dougkwan@google.com>
4815
4816         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4817         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4818         Arm_relobj::scan_section_for_cortex_a8_erratum,
4819         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4820         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4821         sections to scan for relocation stubs into a new method
4822         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4823         relocation and Cortex-A8 stub scanning.
4824         (Target_arm::do_relax): Force stubs to be after stubbed sections
4825         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4826         the beginning of a new relaxation pass.  Update a comment.
4827         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4828
4829 2010-01-12  Ian Lance Taylor  <iant@google.com>
4830
4831         * target-reloc.h (visibility_error): New inline function.
4832         (relocate_section): Call visibility_error.
4833         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4834         (MOSTLYCLEANFILES): Likewise.
4835         (protected_4_pic.o, protected_3.err): New targets.
4836         * testsuite/protected_4.cc: New file.
4837
4838 2010-01-12  Doug Kwan  <dougkwan@google.com>
4839
4840         * arm.cc (Cortex_a8_reloc): New class.
4841         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4842         and cortex_a8_relocs_info_.
4843         (Target_arm::fix_cortex_a8): New method definition.
4844         (Target_arm::Cortex_a8_relocs_info): New type.
4845         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4846         New data member declarations.
4847         (Target_arm::scan_reloc_for_stub): Record information about
4848         relocations for THUMB branches that might be exempted from the
4849         Cortex-A8 workaround.
4850         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4851         at the beginning of a relaxation pass.
4852
4853 2010-01-12  Doug Kwan  <dougkwan@google.com>
4854
4855         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4856         (Arm_relobj::Mapping_symbol_position,
4857          Arm_reloj::Mapping_symbol_position_less,
4858          Arm_relobj::Mapping_symbols_info): New types.
4859         (Target_arm::is_mapping_symbol_name): New method definition.
4860         (Arm_relobj::do_count_local_symbols): Save information about mapping
4861         symbols.
4862
4863 2010-01-11  Doug Kwan  <dougkwan@google.com>
4864
4865         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4866         Arm_relocate_functions::thumb32_branch_upper,
4867         Arm_relocate_functions::thumb32_branch_lower,
4868         Arm_relocate_functions::thumb32_cond_branch_offset,
4869         Arm_relocate_functions::thumb32_cond_branch_upper,
4870         Arm_relocate_functions::thumb32_cond_branch_lower,
4871         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4872         branch offset encoding.
4873         (Arm_relocate_functions::thumb_branch_common): Use new branch
4874         offset encoding methods to avoid code duplication.
4875         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4876         (Stub_addend_reader::operator()): Use new branch encoding method
4877         to avoid code duplication.
4878
4879 2010-01-11  Doug Kwan  <dougkwan@google.com>
4880
4881         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4882         (Target_arm::do_finalize_sections): Define special EXIDX section
4883         symbols only if referenced.
4884         * gc.h (Garbage_collection::add_reference): New method.
4885         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4886         code duplication.
4887
4888 2010-01-11  Ian Lance Taylor  <iant@google.com>
4889
4890         * script.cc (Version_script_info::build_expression_list_lookup):
4891         Change complaing about duplicate wildcard match from error to
4892         warning.
4893
4894         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4895         of 2009-12-30.
4896         (Version_script_info::Version_script_info): Initialize globs_,
4897         default_version_, default_is_global_, and exact_.  Don't
4898         initialize globals_ or locals_.
4899         (Version_script_info::build_lookup_tables): Build local symbols
4900         first.
4901         (Version_script_info::unquote): New function.
4902         (Version_script_info::add_exact_match): New function.
4903         (Version_script_info::build_expression_list_lookup): Remove lookup
4904         parameter.  Add is_global parameter.  Change all callers.  Handle
4905         wildcard pattern specially.  Unquote pattern.  Call
4906         add_exact_match.
4907         (Version_script_info::get_name_to_match): New function.
4908         (Version_script_info::get_symbol_version): New function.
4909         (Version_script_info::get_symbol_version_helper): Remove.
4910         (Version_script_info::check_unmatched_names): Call unquote.
4911         * script.h (class Version_script_info): Change get_symbol_version
4912         to be non-inline and add is_global parameter; change all callers.
4913         Rewrite symbol_is_local.  Update declarations.  Define struct
4914         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4915         Remove globals_ and locals_ members.  Add exact_, globs_,
4916         default_version_, is_global_.
4917         (Version_script_info::Glob): Remove pattern, add expression and
4918         is_global.  Update constructor.  Change all callers.
4919         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4920         default version.
4921         (Versions::symbol_section_contents): If a symbol is undefined, or
4922         defined in a dynamic object, set the version index to
4923         VER_NDX_LOCAL.
4924         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4925         symbol_is_local.
4926         (Symbol_table::add_from_pluginobj): Likewise.
4927         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4928
4929 2010-01-11  Doug Kwan  <dougkwan@google.com>
4930
4931         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4932         (incremental_dump_LDADD): Add linking option for libintl.
4933         * Makefile.in: Regenerate.
4934
4935 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4936
4937         PR gold/11144
4938         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4939         instead of -Ds.
4940         * testsuite/Makefile.in: Regenerated.
4941
4942 2010-01-10  Doug Kwan  <dougkwan@google.com>
4943
4944         * options.h (DEFINE_var): Use parentheses around argument varname__
4945         in macro body to avoid any unintended subsequent substitutions.
4946
4947 2010-01-10  Ian Lance Taylor  <iant@google.com>
4948
4949         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4950         candidates before doing symbol resolution.
4951
4952         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4953         ODR candidates if only one is weak.
4954
4955 2010-01-08  Ian Lance Taylor  <iant@google.com>
4956
4957         * script.cc (Version_script_info::build_expression_list_lookup):
4958         Don't warn about ambiguous version, just record the ambiguity.
4959         (Version_script_info::get_symbol_version_helper): Give error if
4960         version is ambiguous.
4961
4962 2010-01-08  Doug Kwan  <dougkwan@google.com>
4963
4964         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4965           prev_data_size_ and prev_addralign_.  Remove initializer for
4966           deleted data member has_been_changed_.
4967           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4968           to determine if the table is empty.
4969           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4970           Remove.
4971           (Stub_table::add_reloc_stub): Define method in class definition
4972           instead of just declaring it there.
4973           (Stub_table::add_cortex_a8_stub): New method definition.
4974           (Stub_table::update_data_size_and_addralign): Ditto.
4975           (Stub_table::finalize_stubs): Ditto.
4976           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4977           (Stub_table::do_addralign_): Return address alignment in the
4978           (Stub_table::do_reset_address_and_file_offset): Define method in
4979           class definition instead of declaring it there.  Set current data
4980           size to be the data size of the previous pass.
4981           (Stub_table::set_final_data_size): Use current data size as the
4982           final data size.
4983           (Stub_table::relocate_stub): Change parameter type of stub from
4984           Reloc_stub pointer to Stub pointer.
4985           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4986           (Stub_table::Cortex_a8_stub_list): New typedef.
4987           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4988            Stub_table::prev_addralign_): New data member.
4989           (Arm_relobj::Arm_relobj): Initialize data member
4990           section_has_cortex_a8_workaround_.
4991           (Arm_relobj::section_has_cortex_a8_workaround,
4992            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4993            definitions.
4994           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4995           declarations.
4996           (Target_arm::relocate_stub): Change parameter type of stub from
4997           Reloc_stub pointer to Stub pointer.
4998           (Insn_template::size, Insn_template::alignment): Handle
4999           THUMB16_SPECIAL_TYPE.
5000           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5001            Stub_table::update_data_size_and_addralign,
5002            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5003           definitions.
5004           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5005           (Stub_table::do_write): Ditto.
5006           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5007
5008 2010-01-08  Ian Lance Taylor  <iant@google.com>
5009
5010         PR 11108
5011         * symtab.h (class Symbol): Remove fields is_target_special_ and
5012         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5013         (Symbol::is_defined_in_discarded_section): New function.
5014         (Symbol::set_is_defined_in_discarded_section): New function.
5015         (Symbol::has_plt_offset): Rewrite.
5016         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5017         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5018         Don't initialize is_target_special_ or has_plt_offset_.
5019         Initialize is_defined_in_discarded_section_.
5020         (Symbol_table::add_from_relobj): If appropriate, set
5021         is_defined_in_discarded_section.
5022         * resolve.cc (Symbol::override_base_with_special): Don't test
5023         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5024         * target-reloc.h (relocate_section): Do special handling for
5025         symbols defined in discarded sections for global symbols as well
5026         as local symbols.
5027
5028 2010-01-08  Ian Lance Taylor  <iant@google.com>
5029
5030         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5031         the SHT_SYMTAB case.
5032
5033 2010-01-08  Ian Lance Taylor  <iant@google.com>
5034
5035         * object.cc (Sized_relobj::do_layout): Don't get confused if
5036         layout_eh_frame returns NULL.
5037
5038 2010-01-08  Ian Lance Taylor  <iant@google.com>
5039
5040         PR 11084
5041         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5042         dynamic symbol table, use the normal symbol table.
5043         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5044         symbol table.
5045
5046 2010-01-08  Ian Lance Taylor  <iant@google.com>
5047
5048         PR 11072
5049         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5050         sections.
5051
5052 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5053
5054         * version.cc (print_version): Change to "Copyright 2010".
5055
5056 2010-01-08  Ian Lance Taylor  <iant@google.com>
5057
5058         PR 10287
5059         PR 11063
5060         * i386.cc (class Target_i386): Change return type of plt_section
5061         to be non-const.
5062         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5063         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5064         tls_desc_rel_ field.
5065         (Output_data_plt_i386::rel_tls_desc): New function.
5066         (Target_i386::rel_tls_desc_section): New function.
5067         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5068         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5069         R_386_TLS_DESC reloc in rel_tls_desc_section.
5070         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5071         Define struct Tlsdesc_info.
5072         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5073         (Target_x86_64::do_reloc_symbol_index): New function.
5074         (Target_x86_64::add_tlsdesc_info): New function.
5075         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5076         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5077         tlsdesc_rel_ field.
5078         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5079         all callers.
5080         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5081         (Target_x86_64::rela_tlsdesc_section): New function.
5082         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5083         handling.
5084         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5085         (Target_x86_64::do_reloc_addend): New function.
5086         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5087         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5088         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5089         (Output_reloc::type): New function.
5090         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5091         (Output_reloc::is_target_specific): New function.
5092         (Output_reloc::target_arg): New function.
5093         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5094         absolute relocs and target specific relocs.
5095         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5096         add_target_specific.
5097         (class Output_data_reloc) [SHT_RELA]: Likewise.
5098         * output.cc (Output_reloc::Output_reloc): Add four new versions
5099         for absolute relocs and target specific relocs.
5100         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5101         (Output_reloc::get_symbol_index): Likewise.
5102         (Output_reloc::local_section_offset): Check that local_sym_index_
5103         is not TARGET_CODE or 0.
5104         (Output_reloc::symbol_value): Likewise.
5105         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5106         reloc.
5107         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5108         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5109         functions.
5110         * layout.cc (add_target_dynamic_tags): Use output section for
5111         DT_PLTRELSZ and DT_JMPREL.
5112
5113 2010-01-07  Ian Lance Taylor  <iant@google.com>
5114
5115         PR 11061
5116         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5117         function.
5118         (class Output_data_reloc_generic): Define.
5119         (class Output_data_reloc_base): Change base class to
5120         Output_data_reloc_generic.  Change add() method to call
5121         bump_relative_reloc_count for a relative reloc.  Remove
5122         sort_relocs_ field.
5123         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5124         to sort_relocs().
5125         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5126         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5127         appropriate.
5128         * layout.h (class Layout): Update declaration.
5129
5130 2010-01-07  Ian Lance Taylor  <iant@google.com>
5131
5132         * output.h (class Output_data): Add const version of
5133         output_section and do_output_section.
5134         (class Output_section_data): Add const version of
5135         do_output_section.
5136         (class Output_section): Likewise.
5137         * layout.cc (Layout::add_target_dynamic_tags): New function.
5138         * layout.h (class Layout): Update declarations.
5139         * arm.cc (Target_arm::do_finalize_sections): Use
5140         add_target_dynamic_tags.
5141         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5142         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5143         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5144         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5145
5146 2010-01-07  Ian Lance Taylor  <iant@google.com>
5147
5148         PR 11042
5149         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5150         object as needed.
5151
5152 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5153             Ian Lance Taylor  <iant@google.com>
5154
5155         PR 11019
5156         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5157         Xindex::read_symtab_xindex.
5158
5159 2010-01-07  Doug Kwan  <dougkwan@google.com>
5160
5161         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5162         (Insn_template::thumb16_bcond_insn): New method declaration.
5163         (Insn_template): Fix spelling.
5164         (Stub::thumb16_special): New method declaration.
5165         (Stub::do_write): Define virtual method which was previously pure
5166         virtual.
5167         (Stub::do_thumb16_special): New method declaration.
5168         (Stub::do_fixed_endian_write): New template member.
5169         (Reloc_stub::do_write): Remove.
5170         (Reloc_stub::do_fixed_endian_write): Remove.
5171         (Cortex_a8_stub): New class definition.
5172         (Stub_factory::make_cortex_a8_stub): New method definition.
5173         (Stub_factory::Stub_factory): Add missing static storage class
5174         qualifier for elf32_arm_stub_a8_veneer_blx.
5175
5176 2010-01-07  Ian Lance Taylor  <iant@google.com>
5177
5178         PR 10980
5179         * options.h (class General_options): Add --warn-unresolved-symbols
5180         and --error-unresolved-symbols.
5181         * errors.cc (Errors::undefined_symbol): Implement
5182         --warn-unresolved-symbols.
5183
5184         * options.h (class General_options): Add -z text and -z textoff.
5185         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5186
5187 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5188
5189         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5190         (Garbage_collection::cident_sections): New function.
5191         (Garbage_collection::add_cident_section): New function.
5192         (Garbage_collection::cident_sections_): New member.
5193         (gc_process_relocs): Add references to sections whose names are C
5194         identifiers.
5195         * gold.h (cident_section_start_prefix): New constant.
5196         (cident_section_stop_prefix): New constant.
5197         (is_cident): New function.
5198         * layout.cc (Layout::define_section_symbols): Replace string constants
5199         with the newly defined constants.
5200         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5201         C identifiers.
5202         * testsuite/Makefile.am: Add gc_orphan_section_test.
5203         * testsuite/Makefile.in: Regenerate.
5204         * testsuite/gc_orphan_section_test.cc: New file.
5205         * testsuite/gc_orphan_section_test.sh: New file.
5206
5207 2010-01-06  Ian Lance Taylor  <iant@google.com>
5208
5209         PR 10980
5210         * options.h (class General_options): Add --warn-shared-textrel.
5211         * layout.cc (Layout::finish_dynamic_section): Implement
5212         --warn-shared-textrel.
5213
5214         PR 10980
5215         * options.h (class General_options): Add --warn-multiple-gp.
5216
5217 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5218
5219         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5220         $(THREADSLIB) and $(LIBDL).
5221         * Makefile.in: Rebuild.
5222
5223 2010-01-06  Ian Lance Taylor  <iant@google.com>
5224
5225         PR 10980
5226         * options.cc (General_options::parse_section_start): New function.
5227         (General_options::section_start): New function.
5228         (General_options::General_options): Initialize all members.
5229         * options.h: Include <map>
5230         (class General_options): Add --section-start.  Add section_starts_
5231         member.
5232         * layout.cc (Layout::attach_allocated_section_to_segment): If
5233         --section-start was used, set the address of the segment.  Remove
5234         local sort_sections.
5235         (Layout::relaxation_loop_body): If the address of the load segment
5236         has been set by --section-start, don't use it.
5237         * output.h (Output_segment::update_flags_for_output_section): New
5238         function.
5239         * output.cc (Output_segment::add_output_section): Call
5240         update_flags_for_output_section.
5241
5242 2010-01-05  Ian Lance Taylor  <iant@google.com>
5243
5244         PR 10980
5245         * options.h (class General_options): Add --undefined-version.
5246         * script.cc (struct Version_expression): Add was_matched_by_symbol
5247         field.
5248         (Version_script_info::matched_symbol): New function.
5249         (Version_script_info::get_symbol_version_helper): Call
5250         matched_symbol.
5251         (Version_script_info::check_unmatched_names): New function.
5252         * script.h (class Version_script_info): Update declarations.
5253         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5254
5255         * options.h (class General_options): Use DEFINE_bool_alias for
5256         allow_multiple_definition.
5257         * resolve.cc (Symbol_table::should_override): Don't test
5258         allow_multiple_definition.
5259
5260         PR 10980
5261         * options.h (class General_options): Add --cref.
5262         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5263         until after printing cref table.
5264         * cref.cc: Include "symtab.h".
5265         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5266         (Cref_table_compare::operator()): New function.
5267         (Cref_inputs::gather_cref): New function.
5268         (filecol): New static const.
5269         (Cref_inputs::print_cref): New function.
5270         (Cref::print_cref): New function.
5271         * cref.h: Include <cstdio>.
5272         (class Cref): Update declarations.
5273         * mapfile.h (Mapfile::file): New function.
5274         * object.h (class Object): Define Symbols.  Declare virtual
5275         do_get_global_symbols.
5276         (Object::get_global_symbols): New function.
5277         * object.cc (Input_objects::add_object): Pass object to cref_ if
5278         --cref.
5279         (Input_objects::archive_start): Likewise.
5280         (Input_objects::archive_stop): Likewise.
5281         (Input_objects::print_cref): New function.
5282         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5283         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5284         --cref.
5285         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5286         function.
5287         * plugin.h (class Sized_pluginobj): Update declarations.
5288
5289 2010-01-05  Ian Lance Taylor  <iant@google.com>
5290
5291         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5292         to is_default_version.  Rename insdef to insdefault.
5293         (Symbol_table::add_from_relobj): Rename def to is_default_version
5294         and local to is_forced_local.
5295         (Symbol_table::add_from_pluginobj): Likewise.
5296         (Symbol_table::add_from_dynobj): Likewise.
5297         (Symbol_table::define_special_symbol): Rename insdef to
5298         insdefault.
5299
5300 2010-01-04  Ian Lance Taylor  <iant@google.com>
5301
5302         PR 10980
5303         * options.h (class General_options): Add
5304         --allow-multiple-definition and -z muldefs.
5305         * resolve.cc (Symbol_table::should_override): Don't warn about a
5306         multiple symbol definition if --allow-multiple-definition or -z
5307         muldefs.
5308
5309         PR 10980
5310         * options.h (class General_options): Add --add-needed and
5311         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5312         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5313         error if --copy-dt-needed-entries aka --add-needed is used and
5314         would cause a change in behaviour.
5315
5316         PR 10980
5317         * options.h (class General_options): Add -G as a short version of
5318         --shared.  Add no-op options -assert, -g, and -i.
5319
5320 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5321
5322         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5323         check for .text or .gnu.linkonce.t sections.
5324         * icf.cc (Icf::find_identical_sections): Ditto.
5325         Change the detection for mangled function name within the section
5326         name.
5327         * icf.h (is_section_foldable_candidate): New function.
5328
5329 2009-12-30  Ian Lance Taylor  <iant@google.com>
5330
5331         PR 10980
5332         * options.h (class General_options): Permit two dashes with
5333         --retain-symbols-file.
5334
5335 2009-12-30  Ian Lance Taylor  <iant@google.com>
5336
5337         PR 10979
5338         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5339         don't put the file header and segment headers in the text
5340         segment.
5341
5342         PR 10979
5343         * common.cc (Sort_commons::operator()): Stabilize sort when both
5344         entries are NULL.
5345         (Symbol_table::do_allocate_commons_list): When allocating common
5346         symbols, skip a symbol which is no longer common.
5347         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5348         an object before checking its type.
5349         * testsuite/common_test_2.c: New file.
5350         * testsuite/common_test_3.c: New file.
5351         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5352         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5353         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5354         (common_test_2_pic.o, common_test_2.so): New targets.
5355         (common_test_3_pic.o, common_test_3.so): New targets.
5356         * testsuite/Makefile.in: Rebuild.
5357
5358         PR 10979
5359         * script.cc (read_input_script): If we see a new SECTIONS clause,
5360         and we have added an input section, give an error.
5361         * layout.h (class Layout): Add have_added_input_section function.
5362         Add have_added_input_section_ field.
5363         * layout.cc (Layout::Layout): Initialize
5364         have_added_input_section_.
5365         (Layout::layout): Set have_added_input_section_.
5366         (Layout::layout_eh_frame): Likewise.
5367
5368 2009-12-30  Ian Lance Taylor  <iant@google.com>
5369
5370         PR 10931
5371         * options.h (class General_options): Add --sort-common option.
5372         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5373         * common.cc (Sort_common): Add sort_order parameter to
5374         constructor.  Add sort_order_ field.
5375         (Sort_commons::operator): Check sort_order_.
5376         (Symbol_table::allocate_commons): Determine the sort order.
5377         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5378         Change all callers.
5379         (Symbol_table::do_allocate_commons_list): Likewise.
5380
5381 2009-12-30  Ian Lance Taylor  <iant@google.com>
5382
5383         PR 10916
5384         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5385         symbols from this object, don't change the visibility of an
5386         undefined symbol.
5387         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5388
5389 2009-12-30  Ian Lance Taylor  <iant@google.com>
5390
5391         PR 10861
5392         * script.h (class Version_script_info): Define Language enum.
5393         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5394         new fields globals_, locals_, and is_finalized_.
5395         * script.cc: Various formatting fixes.
5396         (class Parser_closure): Change language_stack_ from a vector of
5397         std::string to one of Version_script_info::Language.  Adjust all
5398         uses accordingly.
5399         (class Lazy_demangler): Remove.
5400         (struct Version_expression): Change language from std::string to
5401         Version_script_info::Language.
5402         (Version_script_info::Version_script_info): New function.
5403         (Version_script_info::~Version_script_info): Don't call clear.
5404         (Version_script_info::finalize): New function.
5405         (Version_script_info::build_lookup_tables): New function.
5406         (Version_script_info::build_expression_list_lookup): New
5407         function.
5408         (Version_script_info::get_symbol_version_helper): Rewrite to use
5409         lookup tables.
5410         (Version_script_info::print_expression_list): Adjust to use
5411         Version_script_info::Language.
5412         (script_push_lex_into_version_mode): Check that the version script
5413         has not been finalized.
5414         (version_script_push_lang): Change language string to
5415         Version_script_info::Language.
5416         * options.cc (Command_line::version_script): New function.
5417         * options.h (class General_options): Add finalize_dynamic_list
5418         function.  Change version_script from declaration to definition.
5419         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5420         * testsuite/version_script.map: Remove duplicate def of foo.
5421         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5422         version_script.map.
5423         * testsuite/Makefile.in: Rebuild.
5424
5425 2009-12-30  Ian Lance Taylor  <iant@google.com>
5426
5427         PR 10843
5428         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5429         if the input symbol index is 0, make the output symbol index 0.
5430
5431 2009-12-30  Ian Lance Taylor  <iant@google.com>
5432
5433         PR 10670
5434         * options.h (class General_options): Add -x/--discard-all.
5435         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5436         --discard-all.  If the local symbol needs a dynamic entry, check
5437         that before handling --discard-locals.
5438
5439 2009-12-30  Ian Lance Taylor  <iant@google.com>
5440
5441         PR 10450
5442         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5443         flags to PF_R.
5444         (Output_segment::add_output_section): Don't change the flags if
5445         the type is PT_TLS.
5446
5447         PR 10450
5448         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5449         GNU hash table if they need a dynamic value.  Otherwise, don't add
5450         them if they are defined in a dynamic object or are forced local.
5451
5452 2009-12-29  Ian Lance Taylor  <iant@google.com>
5453
5454         PR 10450
5455         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5456         .gnu.hash table for a 32-bit target.
5457
5458         PR 10450
5459         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5460         regular and a dynamic object only needs a dynamic symbol table
5461         entry if it is externally visible.
5462
5463         PR 10450
5464         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5465         constructor.  Add global_offset_table_ field.
5466         (Target_i386::got_section): Set global_offset_table_.
5467         (Target_i386::do_finalize_sections): Set global_offset_table_
5468         size.
5469         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5470         in constructor.  Add global_offset_table_ field.
5471         (Target_x86_64::got_section): Set global_offset_table_.
5472         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5473         size.
5474
5475         * layout.cc (Layout::Layout): Initialize increase_relro_.
5476         (Layout::get_output_section): Add is_relro, is_last_relro, and
5477         is_first_non_relro parameters.  Change all callers.
5478         (Layout::choose_output_section): Likewise.
5479         (Layout::add_output_section_data): Likewise.
5480         (Layout::make_output_section): Likewise.
5481         (Layout::set_segment_offsets): Clear increase_relro when using a
5482         linker script.
5483         * layout.h (class Layout): Add increase_relro method.  Add
5484         increase_relro_ field.  Update declarations.
5485         * output.cc (Output_section::Output_section): Initialize
5486         is_last_relro_ and is_first_non_relro_.
5487         (Output_segment::add_output_section): Group relro sections is
5488         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5489         (Output_segment::maximum_alignment): Remove relro handling.
5490         (Output_segment::set_section_addresses): Add increase_relro
5491         parameter.  Change all callers.  Add initial alignment to align
5492         relro sections on separate page.  Remove old relro handling.
5493         (Output_segment::set_section_list_addresses): Remove in_relro
5494         parameter.  Change all callers.
5495         (Output_segment::set_offset): Add increase parameter.  Change all
5496         callers.  Remove old relro handling.
5497         * output.h (class Output_section): Add new methods: is_last_relro,
5498         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5499         Add is_last_relro_ and is_first_non_relro_ fields.
5500         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5501         Create separate .got.plt section.  Call increase_relro.
5502         * x86_64.cc (Target_x86_64::got_section): Likewise.
5503         * testsuite/relro_script_test.t: Add .got.plt.
5504
5505         PR 10450
5506         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5507         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5508         (Layout::finalize): Call set_dynamic_symbol_size.
5509         (Layout::set_dynamic_symbol_size): New function.
5510         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5511         set_dynamic_symbol_size.
5512
5513         PR 10450
5514         * output.h (class Output_section): Add is_entsize_zero_ field.
5515         * output.cc (Output_section::Output_section): Initialize
5516         is_entsize_zero_.
5517         (Output_section::set_entsize): If two different entsizes are
5518         requested, force it to zero.
5519         (Output_section::add_input_section): Set flags for .debug_str
5520         before updating section flags.  Set entsize.
5521         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5522         and SHF_STRING if all input sections have those flags.
5523
5524 2009-12-29   Rafael Espindola  <espindola@google.com>
5525
5526         * main.cc (main): Fix the sys time reporting.
5527         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5528         reporting.
5529
5530 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5531
5532         * options.cc (General_options::parse_version): Allow -v to exit
5533         without an error if there is nothing to link.
5534
5535 2009-12-29  Ian Lance Taylor  <iant@google.com>
5536
5537         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5538         using a version of gcc before 4.1.
5539         * configure: Rebuild.
5540
5541 2009-12-28  Chris Demetriou  <cgd@google.com>
5542
5543         * attributes.cc (Output_attributes_section_data::do_write): Use
5544         std::vector::front rather than std::vector::data.
5545
5546 2009-12-28  Ian Lance Taylor  <iant@google.com>
5547
5548         * symtab.h (class Symbol_table): Add enum Defined.
5549         * resolve.cc (Symbol_table::should_override): Add defined
5550         parameter.  Change all callers.  Test whether object is NULL
5551         before calling a method on it.
5552         (Symbol_table::report_resolve_problem): Add defined parameter.
5553         Change all callers.
5554         (Symbol_table::should_override_with_special): Likewise.
5555         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5556         parameter.  Change all callers.
5557         (Symbol_table::do_define_in_output_data): Likewise.
5558         (Symbol_table::define_in_output_segment): Likewise.
5559         (Symbol_table::do_define_in_output_segment): Likewise.
5560         (Symbol_table::define_as_constant): Likewise.
5561         (Symbol_table::do_define_as_constant): Likewise.
5562         * script.h (class Symbol_assignment): Add is_defsym parameter to
5563         constructor; change all callers.
5564         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5565         parameter.  Change all callers.  Add is_defsym_ field.
5566         (class Parser_closure): Add parsing_defsym parameter to
5567         constructor; change all callers.  Add parsing_defsym accessor
5568         function.  Add parsing_defsym_ field.
5569
5570 2009-12-28  Ian Lance Taylor  <iant@google.com>
5571
5572         * gold.cc (queue_middle_tasks): Fix formatting.
5573         * object.cc (Relobj::is_section_name_included): Likewise.
5574
5575 2009-12-23  Ian Lance Taylor  <iant@google.com>
5576
5577         * i386.cc (Target_i386::do_calls_non_split): Recognize
5578         -fsplit-stack prologue for a function with a static chain.
5579         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5580         -fsplit-stack prologue when using %r11.
5581
5582 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5583
5584         * options.cc (General_options::parse_version): Make -v continue and do
5585         the link like GNU ld does.
5586
5587 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5588
5589         * Makefile.am (CCFILES): Add timer.cc.
5590         (HFILES): Add timer.h.
5591         * configure.ac: Check for sysconf and times.
5592         * main.cc: include timer.h.
5593         (main): Use Timer instead of get_run_time.
5594         * timer.cc: New.
5595         * timer.h: New.
5596         * workqueue.cc: include timer.h.
5597         (Workqueue::find_and_run_task):
5598         Report user, sys and wall time.
5599         * Makefile.in: Regenerate.
5600         * config.in: Regenerate.
5601         * configure: Regenerate.
5602
5603 2009-12-16  Doug Kwan  <dougkwan@google.com>
5604
5605         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5606         sections.
5607         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5608         relaxed input sections.
5609         * output.cc (Output_section::find_relaxed_input_section): Change
5610         return type to Output_relaxed_input_section pointer.  Adjust code
5611         for new type of relaxed_input_section_map_.
5612         * output.h (Output_section::find_relaxed_input_section): Change
5613         return type to Output_relaxed_input_section pointer.
5614         (Output_section::Output_relaxed_input_section_by_input_section_map):
5615         New type.
5616         (Output_section::relaxed_input_section_map_): Change type to
5617         Output_section::Output_relaxed_input_section_by_input_section_map.
5618         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5619         input section.
5620
5621 2009-12-15  Ian Lance Taylor  <iant@google.com>
5622
5623         * layout.cc (Layout::create_shstrtab): Only write out after input
5624         sections if we are compressing debug sections.
5625
5626 2009-12-15  Ian Lance Taylor  <iant@google.com>
5627
5628         * archive.cc (Archive::add_symbols): Only look up a symbol without
5629         a version if there is, in fact, a version.
5630
5631 2009-12-14  Ian Lance Taylor  <iant@google.com>
5632
5633         Revert -Wshadow changes, all changes from:
5634         2009-12-11  Doug Kwan  <dougkwan@google.com>
5635         2009-12-11  Nick Clifton  <nickc@redhat.com>
5636         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5637
5638 2009-12-11  Doug Kwan  <dougkwan@google.com>
5639
5640         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5641         due to -Wshadow.
5642         * attributes.cc (Object_attribute::size): Ditto.
5643         (Attributes_section_data::size): Ditto.
5644         (Attributes_section_data::Attributes_section_data): Ditto.
5645         (Output_attributes_section_data::do_write): Ditto.
5646         * attributes.h (Object_attribute::set_type): Ditto.
5647         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5648
5649 2009-12-11  Nick Clifton  <nickc@redhat.com>
5650
5651         * archive.cc: Fix shadowed variable warnings.
5652         * arm.cc: Likewise.
5653         * compressed_output.cc: Likewise.
5654         * compressed_output.h: Likewise.
5655         * configure: Likewise.
5656         * dwarf_reader.cc: Likewise.
5657         * dynobj.cc: Likewise.
5658         * dynobj.h: Likewise.
5659         * ehframe.cc: Likewise.
5660         * ehframe.h: Likewise.
5661         * errors.cc: Likewise.
5662         * expression.cc: Likewise.
5663         * fileread.cc: Likewise.
5664         * fileread.h: Likewise.
5665         * freebsd.h: Likewise.
5666         * i386.cc: Likewise.
5667         * icf.cc: Likewise.
5668         * incremental.h: Likewise.
5669         * layout.cc: Likewise.
5670         * layout.h: Likewise.
5671         * mapfile.cc: Likewise.
5672         * merge.cc: Likewise.
5673         * merge.h: Likewise.
5674         * object.cc: Likewise.
5675         * object.h: Likewise.
5676         * options.h: Likewise.
5677         * output.cc: Likewise.
5678         * output.h: Likewise.
5679         * parameters.cc: Likewise.
5680         * plugin.cc: Likewise.
5681         * powerpc.cc: Likewise.
5682         * reduced_debug_output.cc: Likewise.
5683         * reduced_debug_output.h: Likewise.
5684         * reloc.cc: Likewise.
5685         * reloc.h: Likewise.
5686         * resolve.cc: Likewise.
5687         * script-sections.cc: Likewise.
5688         * script.cc: Likewise.
5689         * script.h: Likewise.
5690         * sparc.cc: Likewise.
5691         * symtab.cc: Likewise.
5692         * symtab.h: Likewise.
5693         * target-select.cc: Likewise.
5694         * target-select.h: Likewise.
5695         * token.h: Likewise.
5696         * workqueue.cc: Likewise.
5697         * workqueue.h: Likewise.
5698         * x86_64.cc: Likewise.
5699
5700 2009-12-10  Doug Kwan  <dougkwan@google.com>
5701
5702         * arm.cc (attributes.h): New include.
5703         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5704         (Arm_relobj::~Arm_relobj): Delete object pointed by
5705         attributes_section_data_.
5706         (Arm_relobj::attributes_section_data): New method definition.
5707         (Arm_relobj::attributes_section_data_): New data member declaration.
5708         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5709         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5710         attributes_section_data_.
5711         (Arm_dynobj::attributes_section_data): New method definition.
5712         (Arm_dynobj::attributes_section_data_): New data member declaration.
5713         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5714         initialization value of may_use_blx_ to false.
5715         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5716         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5717         object attributes to compute results instead of hard-coding.
5718         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5719         Target_arm::get_secondary_compatible_arch,
5720         Target_arm::set_secondary_compatible_arch
5721         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5722         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5723         New method declarations.
5724         (Target_arm::get_aeabi_object_attribute): New method definition.
5725         (Target_arm::attributes_section_data_): New data member declaration.
5726         (read_arm_attributes_section): New template definition.
5727         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5728         (Arm_dynobj::do_read_symbols): Ditto.
5729         (Target_arm::do_finalize_sections): Merge attributes sections from
5730         input.  Check for BLX use after attributes section merging.
5731         Fix __exidx_start and __exidx_end visibility.  Create an
5732         .ARM.attributes section if necessary.
5733         (Target_arm::get_secondary_compatible_arch,
5734         Target_arm::set_secondary_compatible_arch,
5735         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5736         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5737         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5738         New method definitions.
5739
5740 2009-12-09  Ian Lance Taylor  <iant@google.com>
5741
5742         * plugin.cc (Plugin::load): Don't cast from void* to a function
5743         pointer.
5744
5745 2009-12-09  Ian Lance Taylor  <iant@google.com>
5746
5747         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5748         information fields.
5749
5750 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5751
5752         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5753         Replace two_file_shared_1.so with two_file_shared_2.so.
5754         * testsuite/Makefile.in: Regenerated.
5755
5756 2009-12-08  Doug Kwan  <dougkwan@google.com>
5757
5758         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5759         (HFILES): Add attributes.h and int_encoding.h.
5760         * Makefile.in: Regenerate.
5761         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5762         function definitions to int_encoding.cc
5763         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5764         prototypes to int_encoding.h
5765         * reduced_debug_output.cc (int_encoding.h): New include.
5766         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5767         function definitions to int_encoding.cc
5768         (insert_into_vector, read_from_pointer): Move template definitions to
5769         int_encoding.h
5770         * attributes.cc: New file.
5771         * attributes.h: New file.
5772         * int_encoding.cc: New file.
5773         * int_encoding.h: New file.
5774
5775 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5776
5777         PR gold/11055
5778         * incremental-dump.cc (dump_incremental_inputs): New.
5779         (main): Use dump_incremental_inputs.
5780
5781 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5782
5783         PR gold/10893
5784         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5785         checking elfcpp::STT_FUNC.
5786         (Target_i386::Relocate::relocate): Likewise.
5787         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5788
5789         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5790         symbols from shared libraries into normal FUNC symbols.
5791
5792         * symtab.h (Symbol): Add is_func and use it.
5793
5794 2009-12-05  Doug Kwan  <dougkwan@google.com>
5795
5796         * arm.cc (Target_arm::arm_info): Initialize new fields
5797         attributes_section and attributes_vendor.
5798         * i386.cc (Target_i386::i386_info): Same.
5799         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5800         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5801         fields attributes_section and attributes_vendor.
5802         * sparc.cc (Target_sparc::sparc_info): Same.
5803         * target.h (Target::attributes_section, Target::attributes_vendor,
5804         Target::is_attributes_section, Target::attribute_arg_type,
5805         Target::attributes_order): New method definitions.
5806         (Target::Target_info::attributes_section,
5807         Target::Target_info::attributes_vendor): New fields.
5808         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5809         virtual method definitions.
5810         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5811         attributes_section and attributes_vendor.
5812         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5813
5814 2009-12-05  Doug Kwan  <dougkwan@google.com>
5815
5816         * arm.cc: Update comments about interworking and stub generation.
5817         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5818         considered as non-PIC.
5819         (Arm_relocate_functions::base_abs): Fix formatting.
5820         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5821         of function to use GOT entry address instead of offset.
5822         (Target_arm::Scan::global): Issue an error if a symbol would need a
5823         PLT does not get one because it is untyped.  Remove code to create
5824         dynamic symbols for relative branches.
5825         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5826         takes unsigned integer instead of boolean.
5827
5828 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5829
5830         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5831         (two_file_test_LDADD): Likewise.
5832         (common_test_1_LDADD): Likewise.
5833         (exception_test_LDADD) Likewise.
5834         (weak_test_LDADD): Likewise.
5835         (many_sections_test_LDADD): Likewise.
5836         (initpri1_LDADD): Likewise.
5837         (script_test_1_LDADD): Likewise.
5838         (script_test_2_LDADD): Likewise.
5839         (justsyms_LDADD): Likewise.
5840         (binary_test_LDADD): Likewise.
5841         (large_LDADD): Likewise.
5842         * testsuite/Makefile.in: Regenerated.
5843
5844 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5845
5846         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5847         (Symbol_table::override_with_special): Likewise.
5848         (Symbol_table::add_from_object): Likewise.
5849
5850 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5851
5852         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5853         Don't set the data_offset twice.
5854
5855 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5856
5857         * testsuite/Makefile.in: Regenerate.
5858
5859 2009-12-03  Doug Kwan  <dougkwan@google.com>
5860
5861         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5862         (Target_arm::do_finalize_sections): Add parameter for symbol table
5863         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5864         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5865         parameter for symbol table pointer.
5866         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5867         an additional parameter for a pointer to symbol table.
5868         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5869         parameter for a symbol table pointer.
5870         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5871         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5872         Ditto.
5873         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5874         parameter for a symbol table pointer.
5875
5876 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5877
5878         * incremental.cc (Incremental_inputs_header)
5879         (Incremental_inputs_header_write, Incremental_inputs_entry)
5880         (Incremental_inputs_entry_write): Move ...
5881         * incremental.h (Incremental_inputs_header)
5882         (Incremental_inputs_header_write, Incremental_inputs_entry)
5883         (Incremental_inputs_entry_write): here.
5884
5885 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5886
5887         * incremental.cc (make_sized_incremental_binary): Set the target.
5888         Error if it is incompatible.
5889         * output.h (Output_file): Add filename method.
5890
5891 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5892
5893         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5894         from the get_* methods.
5895
5896 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5897
5898         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5899         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5900         Write 0 for the data_offset of scripts.
5901
5902 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5903
5904         * testsuite/Makefile.am: Add the incremental_test.sh test.
5905         * testsuite/incremental_test.sh: New.
5906         * testsuite/incremental_test_1.c: New.
5907         * testsuite/incremental_test_2.c: New.
5908
5909 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5910
5911        * incremental-dump.cc (main): Fix typos.
5912
5913 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5914
5915         PR gold/11025
5916         * incremental-dump.cc (main): Use llu to print 64 bit values.
5917
5918 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5919             H.J. Lu  <hongjiu.lu@intel.com>
5920
5921         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5922         $(LIBDL).
5923         (incremental_dump_LDADD): Likewise.
5924         * Makefile.in: Regenerated.
5925
5926 2009-11-25  Doug Kwan  <dougkwan@google.com>
5927
5928         Revert:
5929
5930         2009-11-25  Doug Kwan  <dougkwan@google.com>
5931
5932                 * arm.cc (Target_arm::Target_arm): Move method definition
5933                 outside of class definition.  Add code to handle
5934                 --target1-rel, --target1-abs and --target2= options.
5935                 (Target_arm::get_reloc_reloc_type): Change method to be
5936                 non-static and const.
5937                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5938                 New data member declaration.
5939                 (Target_arm::Scan::local, Target_arm::Scan::global,
5940                 Target_arm::Relocate::relocate,
5941                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5942                 Adjust call to Target_arm::get_real_reloc_type.
5943                 (Target_arm::get_real_reloc_type): Use command line options
5944                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5945                 * options.h (--target1-rel, --target1-abs, --target2): New
5946                 ARM-only options.
5947
5948 2009-11-25  Doug Kwan  <dougkwan@google.com>
5949
5950         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5951         class definition.  Add code to handle --target1-rel, --target1-abs
5952         and --target2= options.
5953         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5954         and const.
5955         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5956         member declaration.
5957         (Target_arm::Scan::local, Target_arm::Scan::global,
5958         Target_arm::Relocate::relocate,
5959         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5960         call to Target_arm::get_real_reloc_type.
5961         (Target_arm::get_real_reloc_type): Use command line options to
5962         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5963         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5964         options.
5965
5966 2009-11-25  Doug Kwan  <dougkwan@google.com>
5967
5968         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5969         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5970         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5971         formatting.
5972         (Arm_relocate_functions::thm_call): Replace body with a call to
5973         Arm_relocate_functions::thumb_branch_common.
5974         (Arm_relocate_functions::thm_jump24,
5975         Arm_relocate_functions::thm_xpc22): New method definitions.
5976         (Arm_relocate_functions::thumb_branch_common): New method definition.
5977         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5978         operator.
5979         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5980         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5981
5982 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5983
5984         * Makefile.am: Build incremental-dump
5985         * Makefile.in: Regenerate.
5986         * incremental-dump.cc: New.
5987         * incremental.cc (Incremental_inputs_header_data,
5988         Incremental_inputs_entry_data): Move to incremental.h
5989         * incremental.h: (Incremental_inputs_header_data,
5990         Incremental_inputs_entry_data): Move from incremental.cc
5991
5992 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5993
5994         * incremental.cc (Incremental_inputs_header,
5995         Incremental_inputs_header_write, Incremental_inputs_entry,
5996         Incremental_inputs_entry_write): Add a typedef with the data type.
5997
5998 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5999
6000         * incremental.cc (Incremental_inputs_header,
6001         Incremental_inputs_header_write, Incremental_inputs_entry,
6002         Incremental_inputs_entry_write): Update comment about which
6003         type has the filed descriptions.
6004
6005 2009-11-15  Doug Kwan  <dougkwan@google.com>
6006
6007         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6008         (Arm_relocate_functions::arm_branch_common): Change method defintion
6009         in class definition to a method declaration and update list of formal
6010         parameters.
6011         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6012         Arm_relocation_functions::jump24): Adjust call to
6013         Arm_relocate_functions::arm_branch_common.  Update list of formal
6014         parameters.
6015         (Arm_relocate_functions::xpc25): New method definition.
6016         (Arm_relocate_functions::arm_branch_common): Move method defintion
6017         out from class definition.  Use stubs for mode-switching and extending
6018         branch ranges.
6019         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6020         specially.  Change code to enable use of stubs in ARM branches.
6021
6022 2009-11-10  Doug Kwan  <dougkwan@google.com>
6023
6024         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6025         in method declaration.
6026         (Target_arm::relocate_stub): New method declaration.
6027         (Target_arm::default_target): Change to return a pointer instead of
6028         a const reference.
6029         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6030         Target_arm::default_target.
6031         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6032         method definition.
6033         (Target_arm::relocate_section): Adjust view.
6034         (Target_arm::relocate_stub): New method definition.
6035
6036 2009-11-10  Doug Kwan  <dougkwan@google.com>
6037
6038         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6039         a format warning.
6040         * incremental.cc (open_incremental_binary): Initialized local
6041         variables to avoid warnings.
6042         * object.cc (make_elf_object): Ditto.
6043         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6044         a format warning.
6045
6046 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6047
6048         PR gold/10930
6049         * testsuite/plugin_test.c: Include "config.h".
6050
6051 2009-11-09  Doug Kwan  <dougkwan@google.com>
6052
6053         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6054         (arm_symbol_value): Remove.
6055         (Arm_relocate_functions::arm_branch_common,
6056         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6057         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6058         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6059         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6060         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6061         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6062         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6063         Arm_relocate_functions::thm_mobw_abs_nc,
6064         Arm_relocate_functions::thm_mov_abs,
6065         Arm_relocate_functions::movw_prel_nc,
6066         Arm_relocate_functions::thm_movt_abs,
6067         Arm_relocate_functions::movt_prel,
6068         Arm_relocate_functions::thm_movw_prel_nc,
6069         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6070         (Target_arm::Relocate::relocate): Only decompose address into two
6071         parts if relocation type uses the thumb-bit and pass the actual
6072         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6073         calls to methods in Arm_relocate_functions for this change.
6074
6075 2009-11-08  Ian Lance Taylor  <iant@google.com>
6076
6077         PR 10925
6078         * reloc.cc: Instantiate
6079         Sized_relobj::initialize_input_to_output_maps and
6080         Sized_relobj:free_input_to_output_maps.
6081
6082 2009-11-06  Ian Lance Taylor  <iant@google.com>
6083
6084         PR 10876
6085         * defstd.cc (in_segment): Set only_if_ref true for "end".
6086
6087 2009-11-06  Doug Kwan  <dougkwan@google.com>
6088
6089         * arm.cc (class Reloc_stub): Correct a comment.
6090         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6091         (Target_arm::scan_section_for_stubs): New method declaration.
6092         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6093         Change methods from private to protected.
6094         (Target_arm::do_may_relax): New method definition.
6095         (Target_arm::do_relax, Target_arm::group_sections,
6096         Target_arm::scan_reloc_for_stub,
6097         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6098         (Target_arm::arm_input_section_map_): New data member declaration.
6099         (Target_arm::scan_reloc_for_stub,
6100         Target_arm::scan_reloc_section_for_stubs,
6101         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6102         Target_arm::do_relax): New method definitions.
6103
6104 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6105
6106         * configure.ac: Check for (struct stat)::st_mtim
6107         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6108         * config.in: Regenerate.
6109         * configure: Regenerate.
6110
6111 2009-11-05  Ian Lance Taylor  <iant@google.com>
6112
6113         PR 10910
6114         * output.cc (Output_segment::add_output_section): Add missing
6115         return statement.
6116
6117 2009-11-04  Ian Lance Taylor  <iant@google.com>
6118
6119         PR 10880
6120         * object.h (class Object): Add is_needed and set_is_needed
6121         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6122         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6123         defined in a dynamic object and referenced by a regular object,
6124         set is_needed for the dynamic object.
6125         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6126         if the file is marked with as_needed and it is not needed.
6127
6128 2009-11-04  Ian Lance Taylor  <iant@google.com>
6129
6130         PR 10887
6131         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6132         tags if data is discarded by linker script.
6133         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6134         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6135         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6136         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6137
6138 2009-11-04  Ian Lance Taylor  <iant@google.com>
6139
6140         * layout.cc (Layout::get_output_section): Add is_interp and
6141         is_dynamic_linker_section parameters.  Change all callers.
6142         (Layout::choose_output_section): Likewise.
6143         (Layout::make_output_section): Likewise.
6144         (Layout::add_output_section_data): Add is_dynamic_linker_section
6145         parameter.  Change all callers.
6146         * layout.h (class Layout): Update declarations.
6147         * output.h (class Output_section): Add is_interp, set_is_interp,
6148         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6149         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6150         generate_code_fills_at_write_ to a bitfield.
6151         * output.cc (Output_section::Output_sections): Initialize new
6152         fields.
6153         (Output_segment::add_output_section): Add do_sort parameter.
6154         Change all callers.
6155
6156 2009-11-03  Ian Lance Taylor  <iant@google.com>
6157
6158         PR 10860
6159         * options.h (class General_options): Add --warn-common.
6160         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6161         merging two common symbols.
6162         (Symbol_table::should_override): Handle --warn-common when merging
6163         a common symbol with a defined symbol.  Use report_resolve_problem
6164         for multiple definitions.
6165         (Symbol_table::report_resolve_problem): New function.
6166         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6167
6168 2009-11-03  Doug Kwan  <dougkwan@google.com>
6169
6170         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6171         stub_factory_.
6172         (Target_arm::stub_factory): New method definition.
6173         (Target_arm::new_arm_input_section,
6174         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6175         Target_arm::reloc_uses_thumb_bit): New method declarations.
6176         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6177         New type definitions.
6178         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6179         member declarations.
6180         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6181         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6182         New method definitions.
6183
6184 2009-11-03  Ian Lance Taylor  <iant@google.com>
6185
6186         * options.h (class General_options): Add --warn_constructors.
6187
6188 2009-11-03  Ian Lance Taylor  <iant@google.com>
6189
6190         PR 10893
6191         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6192         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6193
6194 2009-11-03  Ian Lance Taylor  <iant@google.com>
6195
6196         PR 10895
6197         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6198         --msgid-bugs-address.
6199         (install-pdf): New target.
6200         (install-data_yes): Look up one directory to find mkinstalldirs.
6201
6202 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6203
6204         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6205         tree.
6206
6207 2009-10-30  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6210
6211 2009-10-30  Doug Kwan  <dougkwan@google.com>
6212
6213         * arm.cc (Stub_addend_reader): New struct template definition
6214         and partial specializations.
6215         (Stub_addend_reader::operator()): New method definition for a
6216         partially specialized template.
6217
6218 2009-10-30  Doug Kwan  <dougkwan@google.com>
6219
6220         * arm.cc (Arm_relobj::processor_specific_flags): New method
6221         definition.
6222         (Arm_relobj::do_read_symbols): New method declaration.
6223         (Arm_relobj::processor_specific_flags_): New data member declaration.
6224         (Arm_dynobj): New class definition.
6225         (Target_arm::do_finalize_sections): Add input_objects parameter.
6226         (Target_arm::do_adjust_elf_header): New method declaration.
6227         (Target_arm::are_eabi_versions_compatible,
6228         (Target_arm::merge_processor_specific_flags): New method declaration.
6229         (Target_arm::do_make_elf_object): New overloaded method definitions
6230         and declaration.
6231         (Arm_relobj::do_read_symbols): New method definition.
6232         (Arm_dynobj::do_read_symbols): Ditto.
6233         (Target_arm::do_finalize_sections): Add input_objects parameters.
6234         Merge processor-specific flags from all input objects.
6235         (Target_arm::are_eabi_versions_compatible,
6236         Target_arm::merge_processor_specific_flags,
6237         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6238         New method definitions.
6239         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6240         Input_objects pointer type parameter.
6241         * layout.cc (Layout::finalize): Pass input objects to target's.
6242         finalize_sections function.
6243         * output.cc (Output_file_header::do_sized_write): Set ELF file
6244         header's processor-specific flags.
6245         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6246         Input_objects pointer type parameter.
6247         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6248         * target.h (Input_objects): New forward class declaration.
6249         (Target::processor_specific_flags,
6250         Target::are_processor_specific_flags_sect): New method definitions.
6251         (Target::finalize_sections): Add input_objects parameter.
6252         (Target::Target): Initialize processor_specific_flags_ and
6253         are_processor_specific_flags_set_.
6254         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6255         parameter.
6256         (Target::set_processor_specific_flags): New method definition.
6257         (Target::processor_specific_flags_,
6258         Target::are_processor_specific_flags_set_): New data member
6259         declarations.
6260         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6261         Input_objects pointer type parameter.
6262
6263 2009-10-30  Doug Kwan  <dougkwan@google.com>
6264
6265         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6266
6267 2009-10-28  Ian Lance Taylor  <iant@google.com>
6268
6269         * object.h (class Relobj): Drop options parameter from
6270         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6271         do_scan_relocs, do_relocate.  Change all callers.
6272         (class Sized_relobj): Drop options parameters from
6273         do_gc_process_relocs, do_scan_relocs, do_relocate,
6274         do_relocate_sections, relocate_sections, emit_relocs_scan,
6275         emit_relocs_scan_reltype.  Change all callers.
6276         (struct Relocate_info): Remove options field and all references to
6277         it.
6278         * reloc.h (class Read_relocs): Remove options constructor
6279         parameter and options_ field.  Change all callers.
6280         (class Gc_process_relocs, class Scan_relocs): Likewise.
6281         (class Relocate_task): Likewise.
6282         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6283         all callers.
6284         (scan_relocatable_relocs): Likewise.
6285         * target.h (class Sized_target): Remove options parameter from
6286         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6287         all callers.
6288         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6289         callers.
6290         * arm.cc: Update functions to remove options parameters.
6291         * i386.cc: Likewise.
6292         * powerpc.cc: Likewise.
6293         * sparc.cc: Likewise.
6294         * x86_64.cc: Likewise.
6295         * testsuite/testfile.cc: Likewise.
6296
6297 2009-10-28  Doug Kwan  <dougkwan@google.com>
6298
6299         * arm.cc (Arm_relobj): New class definition.
6300         (Arm_relobj::scan_sections_for_stubs,
6301         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6302         New method definitions.
6303
6304 2009-10-28  Cary Coutant  <ccoutant@google.com>
6305
6306         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6307         (Plugin::cleanup_done_): New member.
6308         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6309         (Plugin_manager::cleanup_done_): Remove.
6310         (Plugin_manager::add_input_file): Edit error message.
6311         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6312         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6313
6314 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6315
6316         * fileread.cc: (File_read::View::~View): Use the new
6317         data_ownership_ filed.
6318         (File_read::~File_read): Dispose the new whole_file_view_.
6319         (File_read::open): Mmap the whole file if needed.
6320         (File_read::open): Use whole_file_view_ instead of contents_.
6321         (File_read::find_view): Use whole_file_view_ if applicable.
6322         (File_read::do_read): Use whole_file_view_ instead of contents_.
6323         (File_read::make_view): Use whole_file_view_ instead of contents_,
6324         update File_read::View::View call.
6325         (File_read::find_or_make_view): Update File_read::View::View
6326         call.
6327         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6328         remove contents_
6329         (File_read::View::Data_ownership): New enum.
6330         (File_read::View::View): Replace bool mapped_ with Data_ownership
6331         argument.
6332         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6333         (File_read::View::data_ownership_): New field.
6334         (File_read::contents_): Remove (replaced by whole_file_view_).
6335         (File_read::whole_file_view_): New field.
6336         * options.h (class General_options): Add --keep-files-mapped.
6337
6338 2009-10-27  Cary Coutant  <ccoutant@google.com>
6339
6340         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6341         * testsuite/Makefile.am (plugin_test_5): New test case.
6342         * testsuite/Makefile.in: Regenerate.
6343
6344 2009-10-25  Doug Kwan  <dougkwan@google.com>
6345
6346         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6347         from private to protected to allow access by child class.
6348         (Sized_relobj::do_relocate_sections): New method declaration.
6349         (Sized_relobj::relocate_sections): Virtualize.
6350         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6351         Sized_relobj::relocate_sections.  Instantiate template explicitly
6352         for different target sizes and endianity.
6353
6354 2009-10-24  Doug Kwan  <dougkwan@google.com>
6355
6356         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6357         (Arm_input_section::as_arm_input_section): New method.
6358         (Arm_output_section): New class definition.
6359         (Arm_output_section::create_stub_group,
6360         Arm_output_section::group_sections): New method definitions.
6361
6362 2009-10-22  Doug Kwan  <dougkwan@google.com>
6363
6364         * arm.cc (Arm_input_section): New class definition.
6365         (Arm_input_section::init, Arm_input_section:do_write,
6366         Arm_input_section::set_final_data_size,
6367         Arm_input_section::do_reset_address_and_file_offset): New method
6368         definitions.
6369
6370 2009-10-21  Doug Kwan  <dougkwan@google.com>
6371
6372         * arm.cc (Stub_table, Arm_input_section): New forward class
6373         declarations.
6374         (Stub_table): New class defintion.
6375         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6376         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6377         New method definition.
6378
6379 2009-10-21  Doug Kwan  <dougkwan@google.com>
6380
6381         * arm.cc: Update copyright comments.
6382         (Target_arm): New forward class template declaration.
6383         (Arm_address): New type.
6384         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6385         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6386         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6387         constants.
6388         (Insn_template): Same.
6389         (DEF_STUBS): New macro.
6390         (Stub_type): New enum type.
6391         (Stub_template): New class definition.
6392         (Stub): Same.
6393         (Reloc_stub): Same.
6394         (Stub_factory): Same.
6395         (Target_arm::Target_arm): Initialize may_use_blx_ and
6396         should_force_pic_veneer_.
6397         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6398         Target_arm::should_force_pic_veneer,
6399         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6400         Target_arm::using_thumb_only, Target_arm:;default_target): New
6401         method defintions.
6402         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6403         New data member declarations.
6404         (Insn_template::size, Insn_template::alignment): New method defintions.
6405         (Stub_template::Stub_template): New method definition.
6406         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6407         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6408         (Stub_factory::Stub_factory): New method definition.
6409         * gold.h (string_hash): New template.
6410         * output.h (Input_section_specifier::hash_value): Use
6411         gold::string_hash.
6412         (Input_section_specifier::string_hash): Remove.
6413         * stringpool.cc (Stringpool_template::string_hash): Use
6414         gold::string_hash.
6415
6416 2009-10-20  Doug Kwan  <dougkwan@google.com>
6417
6418         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6419         symbols of relaxed input sections.
6420         * output.h (Output_section::find_relaxed_input_section): Make
6421         method public.
6422
6423 2009-10-16  Doug Kwan  <dougkwan@google.com>
6424
6425         * dynobj.cc (Versions::Versions): Initialize version_script_.
6426         Only insert base version symbol definition for a shared object
6427         if version script defines any version versions.
6428         (Versions::define_base_version): New method definition.
6429         (Versions::add_def): Check that base version is not needed.
6430         (Versions::add_need): Define base version lazily.
6431         * dynobj.h (Versions::define_base_version): New method declaration.
6432         (Versions::needs_base_version_): New data member declaration.
6433         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6434         (check_DATA): Add no_version_test.stdout.
6435         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6436         New make rules.
6437         * testsuite/Makefile.in: Regenerate.
6438         * testsuite/no_version_test.c: New file.
6439         * testsuite/no_version_test.sh: Ditto.
6440
6441 2009-10-16  Doug Kwan  <dougkwan@google.com>
6442
6443         * expression.cc (class Segment_start_expression): New class definition.
6444         (Segment_start_expression::value): New method definition.
6445         (script_exp_function_segment_start): Return a new
6446         Segment_start_expression.
6447         * gold/script-c.h (script_saw_segment_start_expression): New function
6448         prototype.
6449         * script-sections.cc (Script_sections::Script_sections): Initialize
6450         SAW_SEGMENT_START_EXPRESSION_ to false.
6451         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6452         and -Tbbs options to specify section addresses if given in
6453         command line and no SEGMENT_START expression is seen in a script.
6454         * script-sections.h (Script_sections::saw_segment_start_expression,
6455         Script_sections::set_saw_segment_start_expression): New method
6456         definition.
6457         (Script_sections::saw_segment_start_expression_): New data member
6458         declaration.
6459         * script.cc (script_saw_segment_start_expression): New function.
6460         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6461         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6462         script_test_7.sh and script_test_8.sh.
6463         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6464         script_test_8.stdout.
6465         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6466         (script_test_6, script_test_6.stdout, script_test_7,
6467         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6468         * Makefile.in: Regenerate.
6469         * testsuite/script_test_6.sh: New file.
6470         * testsuite/script_test_6.t: Same.
6471         * testsuite/script_test_7.sh: Same.
6472         * testsuite/script_test_7.t: Same.
6473         * testsuite/script_test_8.sh: Same.
6474
6475 2009-10-16  Doug Kwan  <dougkwan@google.com>
6476
6477         * output.cc (Output_segment::set_section_list_address): Cast
6478         expressions to unsigned long long type to avoid format warnings.
6479
6480 2009-10-15  Ian Lance Taylor  <iant@google.com>
6481
6482         * script.cc (Script_options::add_symbol_assignment): Always add a
6483         dot assignment to script_sections_.
6484         * script-sections.cc (Script_sections::add_dot_assignment):
6485         Initialize if necessary.
6486
6487         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6488         program headers with no load segment if there is a linker script.
6489
6490         * layout.cc (Layout::set_segment_offsets): Align the file offset
6491         to the segment aligment for -N or -n with no load segment.
6492         * output.cc (Output_segment::add_output_section): Don't crash if
6493         the first section is a TLS section.
6494         (Output_segment::set_section_list_addresses): Print an error
6495         message if the address moves backward in a linker script.
6496         * script-sections.cc
6497         (Output_section_element_input::set_section_addresses): Don't
6498         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6499         (Orphan_output_section::set_section_addresses): Likewise.
6500
6501 2009-10-15  Doug Kwan  <dougkwan@google.com>
6502
6503         * layout.cc (Layout::finish_dynamic_section): Generate tags
6504         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6505         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6506         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6507
6508 2009-10-14  Ian Lance Taylor  <iant@google.com>
6509
6510         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6511         fields.
6512         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6513         data_shdr fields of relinfo.
6514         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6515         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6516         R_386_TLS_LDO_32, adjust based on section flags.
6517         (Target_i386::Relocate::fix_up_ldo): Remove.
6518
6519 2009-10-13  Ian Lance Taylor  <iant@google.com>
6520
6521         Add support for -pie.
6522         * options.h (class General_options): Add -pie and
6523         --pic-executable.
6524         (General_options::output_is_position_independent): Test -pie.
6525         (General_options::output_is_executable): Return true if not shared
6526         and not relocatable.
6527         (General_options::output_is_pie): Remove.
6528         * options.cc (General_options::finalize): Reject incompatible uses
6529         of -pie.
6530         * gold.cc (queue_middle_tasks): A -pie link is not static.
6531         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6532         * symtab.cc (Symbol::final_value_is_known): Return false if
6533         output_is_position_independent.
6534         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6535         output_is_position_independent.
6536         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6537         output_is_position_independent.
6538         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6539         output_is_position_independent.
6540         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6541         two_file_pie_test.
6542         (basic_pie_test.o, basic_pie_test): New targets.
6543         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6544         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6545         (two_file_pie_test): New target.
6546         * testsuite/Makefile.in: Rebuild.
6547         * README: Remove note saying that -pie is not supported.
6548
6549 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6550
6551         * options.h (class General_options): Add -init and -fini.
6552         * layout.cc (Layout::finish_dynamic_section): Emit
6553         given init and fini functions.
6554
6555 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6556
6557         * gc.h (gc_process_relocs): Check if icf is enabled using new
6558         function.
6559         * gold.cc (queue_initial_tasks): Likewise.
6560         (queue_middle_tasks): Likewise.
6561         * object.cc (do_layout): Likewise.
6562         * symtab.cc (is_section_folded): Likewise.
6563         * main.cc (main): Likewise.
6564         * reloc.cc (Read_relocs::run): Likewise.
6565         (Sized_relobj::do_scan_relocs): Likewise.
6566         * icf.cc (is_function_ctor_or_dtor): New function.
6567         (Icf::find_identical_sections): Check if function is ctor or dtor when
6568         safe icf is chosen.
6569         * options.h (General_options::icf): Change option to be an enum.
6570         (Icf_status): New enum.
6571         (icf_enabled): New method.
6572         (icf_safe_folding): New method.
6573         (set_icf_status): New method.
6574         (icf_status_): New variable.
6575         * (options.cc) (General_options::finalize): Set icf_status_.
6576         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6577         icf_test and icf_keep_unique_test to use the --icf enum flag.
6578         * testsuite/icf_safe_test.sh: New file.
6579         * testsuite/icf_safe_test.cc: New file.
6580
6581 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6582
6583         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6584         includes to gc.h and icf.h.
6585         * arm.cc: Include gc.h.
6586         * gold.cc: Likewise.
6587         * i386.cc: Likewise.
6588         * powerpc.cc: Likewise.
6589         * sparc.cc: Likewise.
6590         * x86_64.cc: Likewise.
6591         * gc.h: Include icf.h.
6592
6593 2009-10-11  Ian Lance Taylor  <iant@google.com>
6594
6595         * plugin.cc: Include "gold.h" before other header files.
6596
6597 2009-10-10  Chris Demetriou  <cgd@google.com>
6598
6599         * options.h (Input_file_argument::Input_file_type): New enum.
6600         (Input_file_argument::is_lib_): Replace with...
6601         (Input_file_argument::type_): New member.
6602         (Input_file_argument::Input_file_argument): Take Input_file_type
6603         'type' rather than boolean 'is_lib' as second argument.
6604         (Input_file_argument::is_lib): Use type_.
6605         (Input_file_argument::is_searched_file): New function.
6606         (Input_file_argument::may_need_search): Handle is_searched_file.
6607         * options.cc (General_options::parse_library): Support -l:filename.
6608         (General_options::parse_just_symbols): Update for Input_file_argument
6609         changes.
6610         (Command_line::process): Likewise.
6611         * archive.cc (Archive::get_file_and_offset): Likewise.
6612         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6613         * script.cc (read_script_file, script_add_file): Likewise.
6614         * fileread.cc (Input_file::Input_file): Likewise.
6615         (Input_file::will_search_for): Handle is_searched_file.
6616         (Input_file::open): Likewise.
6617         * readsyms.cc (Read_symbols::get_name): Likewise.
6618         * testsuite/Makefile.am (searched_file_test): New test.
6619         * testsuite/Makefile.in: Regenerate.
6620         * testsuite/searched_file_test.cc: New file.
6621         * testsuite/searched_file_test_lib.cc: New file.
6622
6623 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6624             Ian Lance Taylor  <iant@google.com>
6625
6626         * descriptor.cc: Include <cstdio> and "binary-io.h".
6627         (Descriptors::open): Open the files in binary mode always.
6628         * script.cc (Lex::get_token): Treat \r as whitespace.
6629
6630 2009-10-09  Ian Lance Taylor  <iant@google.com>
6631
6632         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6633
6634 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6635             Ian Lance Taylor  <iant@google.com>
6636
6637         * configure.ac: Check for readv function also.
6638         * fileread.cc (readv): Define if not HAVE_READV.
6639         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6640         does not exist.
6641         * config.in: Regenerate.
6642         * configure: Regenerate.
6643
6644 2009-10-09  Doug Kwan  <dougkwan@google.com>
6645
6646         * layout.cc (Layout::make_output_section): Call target hook to make
6647         ordinary output section.
6648         (Layout::finalize): Adjust parameter list of call the
6649         Target::may_relax().
6650         * layout.h (class Layout::section_list): New method.
6651         * merge.h (Output_merge_base::entsize): Change visibility to public.
6652         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6653         New methods.
6654         (Output_merge_string::do_is_string): New method.
6655         * object.cc (Sized_relobj::do_setup): renamed from
6656         Sized_relobj::set_up.
6657         * object.h (Sized_relobj::adjust_shndx,
6658         Sized_relobj::initializ_input_to_output_maps,
6659         Sized_relobj::free_input_to_output_maps): Change visibilities to
6660         protected.
6661         (Sized_relobj::setup): Virtualize.
6662         (Sized_relobj::do_setup): New method declaration.
6663         (Sized_relobj::invalidate_section_offset,
6664         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6665         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6666         * options.cc (parse_int): New function.
6667         * options.h (parse_int): New declaration.
6668         (DEFINE_int): New macro.
6669         (stub_group_size): New option.
6670         * output.cc (Output_section::Output_section): Initialize memebers
6671         merge_section_map_, merge_section_by_properties_map_,
6672         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6673         (Output_section::add_input_section): Handled deferred code-fill
6674         generation and remove an old comment.
6675         (Output_section::add_relaxed_input_section): New method definition.
6676         (Output_section::add_merge_input_section): Use merge section by
6677         properties map to speed to search.  Update merge section maps
6678         as appropriate.
6679         (Output_section::build_relaxation_map): New method definition.
6680         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6681         Same.
6682         (Output_section::relax_input_section): Renamed to
6683         Output_section::convert_input_sections_to_relaxed_sections and change
6684         interface to take a vector of pointers to relaxed sections.
6685         (Output_section::find_merge_section,
6686         Output_section::find_relaxed_input_section): New method definitions.
6687         (Output_section::is_input_address_mapped,
6688         Output_section::output_offset, Output_section::output_address):
6689         Use output section data maps to speed up searching.
6690         (Output_section::find_starting_output_address): Add comments.
6691         (Output_section::do_write,
6692         Output_section::write_to_postprocessing_buffer): Do code-fill
6693         generation as appropriate.
6694         (Output_section::get_input_sections): Invalidate relaxed input section
6695         map.
6696         (Output_section::restore_states): Adjust type of checkpoint .
6697         Invalidate relaxed input section map.
6698         * output.h (Output_merge_base): New class declaration.
6699         (Input_section_specifier): New class defintion.
6700         (class Output_relaxed_input_section) Change base class to
6701         Output_section_data_build.
6702         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6703         base class initializer.
6704         (Output_section::add_relaxed_input_section): New method declaration.
6705         (Output_section::Input_section): Change visibility to protected.
6706         (Output_section::Input_section::relobj,
6707         Output_section::Input_section::shndx): Handle relaxed input sections.
6708         Output_section::input_sections) Change visibility to protected.  Also
6709         define overload to return a non-const pointer.
6710         (Output_section::Merge_section_properties): New class defintion.
6711         (Output_section::Merge_section_by_properties_map,
6712         Output_section::Output_section_data_by_input_section_map,
6713         Output_section::Relaxation_map): New types.
6714         (Output_section::relax_input_section): Rename method to
6715         Output_section::convert_input_sections_to_relaxed_sections and change
6716         interface to take a vector of relaxed section pointers.
6717         (Output_section::find_merge_section,
6718         Output_section::find_relaxed_input_section,
6719         Output_section::build_relaxation_map,
6720         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6721         New method declarations.
6722         (Output_section::merge_section_map_
6723         Output_section::merge_section_by_properties_map_,
6724         Output_section::relaxed_input_section_map_,
6725         Output_section::is_relaxed_input_section_map_valid_,
6726         Output_section::generate_code_fills_at_write_): New data members.
6727         * script-sections.cc
6728         (Output_section_element_input::set_section_addresses): Call
6729         current_data_size and addralign methods of relaxed input sections.
6730         (Orphan_output_section::set_section_addresses): Call current_data_size
6731         and addralign methods of relaxed input sections.
6732         * symtab.cc (Symbol_table::compute_final_value): Extract template
6733         from the body of Symbol_table::sized_finalize_symbol.
6734         (Symbol_table::sized_finalized_symbol): Call
6735         Symbol_table::compute_final_value.
6736         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6737         (Symbol_table::compute_final_value): New templated method declaration.
6738         * target.cc (Target::do_make_output_section): New method defintion.
6739         * target.h (Target::make_output_section): New method declaration.
6740         (Target::relax): Add more parameters for input objects, symbol table
6741         and layout.  Adjust call to do_relax.
6742         (Target::do_make_output_section): New method declaration.
6743         (Target::do_relax): Add parameters for input objects, symbol table
6744         and layout.
6745
6746 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6747
6748         * pread.c: Include stdio.h.
6749
6750 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6751
6752         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6753         defined.
6754
6755 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6756
6757         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6758         Change read_shndx type to unsigned int.
6759         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6760         int.
6761         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6762         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6763         Change read_shndx type to unsigned int.
6764         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6765         int.
6766         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6767         * layout.cc (Layout::create_symtab_sections): Cast the result of
6768         local_symcount * symsize to off_t in the gold_assert.
6769
6770 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6771
6772         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6773         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6774         R_ARM_BASE_ABS.
6775         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6776         (Arm_relocate_functions::thm_abs5): New function.
6777         (Arm_relocate_functions::abs12): New function.
6778         (Arm_relocate_functions::abs16): New function.
6779         (Arm_relocate_functions::base_abs): New function.
6780         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6781         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6782         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6783         R_ARM_BASE_ABS.
6784         (Scan::global): Likewise.
6785         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6786         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6787         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6788         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6789         R_ARM_BASE_ABS.
6790
6791 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6792
6793         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6794         (Arm_relocate_functions::movt_prel): New function.
6795         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6796         (Arm_relocate_functions::thm_movt_prel): New function.
6797         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6798         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6799         (Scan::global, Relocate::relocate): Likewise.
6800         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6801
6802 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6803
6804         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6805         Incremental_checker.
6806         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6807         unsigned int.
6808         (class Incremental_inputs_header): New class.
6809         (Incremental_inputs_header_writer): Edit comment.
6810         (Incremental_inputs_entry): New class.
6811         (Incremental_inputs_entry_writer): Edit comment.
6812         (Sized_incremental_binary::do_find_incremental_inputs_section):
6813         Add *strtab_shndx parameter, fill it.
6814         (Sized_incremental_binary::do_check_inputs): New method.
6815         (Incremental_checker::can_incrementally_link_output_file): Use
6816         Sized_incremental_binary::check_inputs.
6817         (Incremental_inputs::report_command_line): Save command line in
6818         command_line_.
6819         * incremental.h:
6820         (Incremental_binary::find_incremental_inputs_section): New
6821         method.
6822         (Incremental_binary::do_find_incremental_inputs_section): Add
6823         strtab_shndx parameter.
6824         (Incremental_binary::do_check_inputs): New pure virtual method.
6825         (Sized_incremental_binary::do_check_inputs): Declare.
6826         (Incremental_checker::Incremental_checker): Add incremental_inputs
6827         parameter, use it to initialize incremental_inputs_.
6828         (Incremental_checker::incremental_inputs_): New field.
6829         (Incremental_checker::command_line): New method.
6830         (Incremental_checker::inputs): New method.
6831         (Incremental_checker::command_line_): New field.
6832
6833 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6834
6835         * incremental.cc: Include <cstdarg> and "target-select.h".
6836         (vexplain_no_incremental): New function.
6837         (explain_no_incremental): New function.
6838         (Incremental_binary::error): New method.
6839         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6840         method.
6841         (make_sized_incremental_binary): New function.
6842         (open_incremental_binary): New function.
6843         (can_incrementally_link_file): Add checks if output is ELF and has
6844         inputs section.
6845         * incremental.h: Include "elfcpp_file.h" and "output.h".
6846         (Incremental_binary): New class.
6847         (Sized_incremental_binary): New class.
6848         (open_incremental_binary): Declare.
6849         * object.cc (is_elf_object): Use
6850         elfcpp::Elf_recognizer::is_elf_file.
6851         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6852         * output.h (Output_file::filesize): New method.
6853
6854 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6855
6856         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6857         New function.
6858         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6859         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6860         function.
6861         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6862         function.
6863         (Arm_relocate_functions::movw_abs_nc): New function.
6864         (Arm_relocate_functions::movt_abs): New function.
6865         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6866         (Arm_relocate_functions::thm_movt_abs): New function.
6867         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6868         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6869         (Scan::global): Likewise.
6870         (Relocate::relocate): Likewise.
6871         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6872
6873 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6874
6875         * arm.cc (Arm_relocate_functions::got_prel) New function.
6876         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6877         (Relocate::relocate): Likewise.
6878         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6879
6880 2009-10-06  Ian Lance Taylor  <iant@google.com>
6881
6882         * options.h (class General_options): Define
6883         split_stack_adjust_size parameter.
6884         * object.h (class Object): Add uses_split_stack_ and
6885         has_no_split_stack_ fields.  Add uses_split_stack and
6886         has_no_split_stack accessor functions.  Declare
6887         handle_split_stack_section.
6888         (class Reloc_symbol_changes): Define.
6889         (class Sized_relobj): Define Function_offsets.  Declare
6890         split_stack_adjust, split_stack_adjust_reltype, and
6891         find_functions.
6892         * object.cc (Object::handle_split_stack_section): New function.
6893         (Sized_relobj::do_layout): Call handle_split_stack_section.
6894         * dynobj.cc (Sized_dynobj::do_layout): Call
6895         handle_split_stack_section.
6896         * reloc.cc (Sized_relobj::relocate_sections): Call
6897         split_stack_adjust for executable sections in split_stack
6898         objects.  Pass reloc_map to relocate_section.
6899         (Sized_relobj::split_stack_adjust): New function.
6900         (Sized_relobj::split_stack_adjust_reltype): New function.
6901         (Sized_relobj::find_functions): New function.
6902         * target-reloc.h: Include "object.h".
6903         (relocate_section): Add reloc_symbol_changes parameter.  Change
6904         all callers.
6905         * target.h (class Target): Add calls_non_split method.  Declare
6906         do_calls_non_split virtual method.  Declare match_view and
6907         set_view_to_nop.
6908         * target.cc: Include "elfcpp.h".
6909         (Target::do_calls_non_split): New function.
6910         (Target::match_view): New function.
6911         (Target::set_view_to_nop): New function.
6912         * gold.cc (queue_middle_tasks): Give an error if mixing
6913         split-stack and non-split-stack objects with -r.
6914         * i386.cc (Target_i386::relocate_section): Add
6915         reloc_symbol_changes parameter.
6916         (Target_i386::do_calls_non_split): New function.
6917         * x86_64.cc (Target_x86_64::relocate_section): Add
6918         reloc_symbol_changes parameter.
6919         (Target_x86_64::do_calls_non_split): New function.
6920         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6921         parameter.
6922         * powerpc.cc (Target_powerpc::relocate_section): Add
6923         reloc_symbol_changes parameter.
6924         * sparc.cc (Target_sparc::relocate_section): Add
6925         reloc_symbol_changes parameter.
6926         * configure.ac: Call AM_CONDITIONAL for the default target.
6927         * configure: Rebuild.
6928         * testsuite/Makefile.am (TEST_AS): New variable.
6929         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6930         (check_DATA): Add split_i386 and split_x86_64 files.
6931         (SPLIT_DEFSYMS): Define.
6932         (split_i386_[1234n].o): New targets.
6933         (split_i386_[124]): New targets.
6934         (split_i386_[1234r].stdout): New targets.
6935         (split_x86_64_[1234n].o): New targets.
6936         (split_x86_64_[124]): New targets.
6937         (split_x86_64_[1234r].stdout): New targets.
6938         (MOSTLYCLEANFILES): Add new executables.
6939         * testsuite/split_i386.sh: New file.
6940         * testsuite/split_x86_64.sh: New file.
6941         * testsuite/split_i386_1.s: New file.
6942         * testsuite/split_i386_2.s: New file.
6943         * testsuite/split_i386_3.s: New file.
6944         * testsuite/split_i386_4.s: New file.
6945         * testsuite/split_i386_n.s: New file.
6946         * testsuite/split_x86_64_1.s: New file.
6947         * testsuite/split_x86_64_2.s: New file.
6948         * testsuite/split_x86_64_3.s: New file.
6949         * testsuite/split_x86_64_4.s: New file.
6950         * testsuite/split_x86_64_n.s: New file.
6951         * testsuite/testfile.cc (Target_test): Update relocation_section
6952         function.
6953         * testsuite/Makefile.in: Rebuild.
6954
6955 2009-10-06  Ian Lance Taylor  <iant@google.com>
6956
6957         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6958         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6959         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6960         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6961         the address on ldo_addrs_.
6962         (Target_i386::Relocate::fix_up_ldo): New function.
6963
6964 2009-10-06   Rafael Espindola  <espindola@google.com>
6965
6966         * plugin.cc (add_input_library): New.
6967         (Plugin::load): Add add_input_library to tv.
6968         (Plugin_manager::add_input_file): Add the is_lib argument.
6969         (add_input_file): Update call to Plugin_manager::add_input_file.
6970         (add_input_library): New.
6971         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6972
6973 2009-09-30  Doug Kwan  <dougkwan@google.com>
6974
6975         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6976         symbol and call Symbol::may_need_copy_reloc to determine if
6977         a copy reloc is needed.
6978         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6979         nocopyreloc is given in command line.
6980         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6981         given in command line.
6982         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6983         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6984         of the removed Target_i386::may_need_copy_reloc.
6985         * options.h (copyreloc): New option with default value false.
6986         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6987         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6988         instead of the removed Target_powerpc::may_need_copy_reloc.
6989         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6990         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6991         instead of the removed Target_sparc::may_need_copy_reloc.
6992         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6993         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6994         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6995         instead of the removed Target_x86_64::may_need_copy_reloc.
6996
6997 2009-09-30  Ian Lance Taylor  <iant@google.com>
6998
6999         * object.h (class Object): Remove target_ field, and target,
7000         sized_target, and set_target methods.
7001         (Object::sized_target): Remove.
7002         (class Sized_relobj): Update declarations.  Remove sized_target.
7003         * object.cc (Sized_relobj::setup): Remove target parameter.
7004         Change all callers.
7005         (Input_objects::add_object): Don't do anything with the target.
7006         (make_elf_sized_object): Add punconfigured parameter.  Change all
7007         callers.  Set or test parameter target.
7008         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7009         Change all callers.
7010         * parameters.cc (Parameters::set_target): Change parameter type to
7011         be non-const.
7012         (Parameters::default_target): Remove.
7013         (set_parameters_target): Change parameter type to be non-const.
7014         (parameters_force_valid_target): New function.
7015         (parameters_clear_target): New function.
7016         * parameters.h (class Parameters): Update declarations.  Remove
7017         default_target method.  Add sized_target and clear_target
7018         methods.  Change target_ to be non-const.
7019         (set_parameters_target): Update declaration.
7020         (parameters_force_valid_target): Declare.
7021         (parameters_clear_target): Declare.
7022         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7023         as NULL if we aren't searching.
7024         (Add_symbols::run): Don't check for compatible target.
7025         * fileread.cc (Input_file::open_binary): Call
7026         parameters_force_valid_target.
7027         * gold.cc (queue_middle_tasks): Likewise.
7028         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7029         set_target on object.
7030         * dynobj.h (class Sized_dynobj): Update declarations.
7031         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7032         make_elf_object returns NULL.
7033         (Archive::include_member): Don't check whether object target is
7034         compatible.
7035         * output.cc (Output_section::add_input_section): Get target from
7036         parameters.
7037         (Output_section::relax_input_section): Likewise.
7038         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7039         parameters.
7040         (Sized_relobj::do_scan_relocs): Likewise.
7041         (Sized_relobj::relocate_sections): Likewise.
7042         * resolve.cc (Symbol_table::resolve): Likewise.
7043         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7044         parameter.  Change all callers.
7045         (Symbol_table::add_from_object): Get target from parameters.
7046         (Symbol_table::add_from_relobj): Don't check object target.
7047         (Symbol_table::add_from_dynobj): Likewise.
7048         (Symbol_table::define_special_symbol): Get target from
7049         parameters.
7050         * symtab.h (class Symbol_table): Update declaration.
7051         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7052         parameter.  Change all callers.  Clear parameter target.
7053         (Binary_test): Test target here.
7054         * testsuite/object_unittest.cc (gold_testsuite): Remove
7055         target_test_pointer parameter.  Change all callers.
7056         (Object_test): Test target here.
7057
7058 2009-09-26  Ian Lance Taylor  <iant@google.com>
7059
7060         * testsuite/initpri1.c: Don't try to use constructor priorities if
7061         compiling with gcc before 4.3.
7062
7063 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7064
7065         * testsuite/retain_symbols_file_test.sh (check_present): Change
7066         output file name to retain_symbols_file_test.stdout.
7067         (check_absent): Likewise.
7068
7069 2009-09-18  Craig Silverstein  <csilvers@google.com>
7070
7071         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7072         * options.cc: Include <cerrno> and <fstream>.
7073         (General_options::finalize): Parse -retain-symbols-file tag.
7074         * options.h: New flag.
7075         (General_options): New method should_retain_symbol, new
7076         variable symbols_to_retain.
7077         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7078         should_retain_symbol map.
7079         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7080         * testsuite/Makefile.in: Regenerate.
7081         * testsuite/retain_symbols_file_test.sh: New file.
7082
7083 2009-09-18  Nick Clifton  <nickc@redhat.com>
7084
7085         * po/es.po: Updated Spanish translation.
7086
7087 2009-09-17  Doug Kwan  <dougkwan@google.com>
7088
7089         * debug.h (DEBUG_RELAXATION): New constant.
7090         (DEBUG_ALL): Add DEBUG_RELAXATION.
7091         (debug_string_to_enum): Add relaxation debug option.
7092         * layout.cc
7093         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7094         Layout::Relaxation_debug_check::read_sections,
7095         Layout::Relaxation_debug_check::read_sections): New method definitions.
7096         (Layout::Layout): Initialize data members
7097         record_output_section_data_from_scrips_,
7098         script_output_section_data_list_ and relaxation_debug_check_.
7099         (Layout::save_segments, Layout::restore_segments,
7100         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7101         Layout::relaxation_loop_body): New method definitions.
7102         (Layout::finalize): Support relaxation.  Move section layout code to
7103         Layout::relaxation_loop_body.
7104         (Layout::set_asection_address_from_script): Move code for orphan
7105         section placement out.
7106         (Layout::place_orphan_sections_in_script): New method definition.
7107         * layout.h (Output_segment_headers, Output_file_header):
7108         New forward class declarations.
7109         (Layout::~Layout): Define.
7110         (Layout::new_output_section_data_from_script): New method definition.
7111         (Layout::place_orphan_sections_in_script): New method declaration.
7112         (Layout::Segment_states): New type declaration.
7113         (Layout::save_segments, Layout::restore_segments,
7114         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7115         Layout::relaxation_loop_body): New method declarations.
7116         (Layout::Output_section_data_list): New type declaration.
7117         (Layout::Relaxation_debug_check): New class definition.
7118         (Layout::record_output_section_data_from_script_,
7119         Layout::script_output_section_data_list_, Layout::segment_states_,
7120         Layout::relaxation_debug_check_): New data members.
7121         * output.cc: (Output_section_headers::do_size): New method definition.
7122         (Output_section_headers::Output_section_headers): Move size
7123         computation to Output_section_headers::do_size.
7124         (Output_segment_headers::do_size): New method definition.
7125         (Output_file_header::Output_file_header): Move size computation to
7126         Output_file_header::do_size and call it.
7127         (Output_file_header::do_size): New method definition.
7128         (Output_data_group::Output_data_group): Adjust call to
7129         Output_section_data.
7130         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7131         (Output_symtab_xindex::do_write): Add array bound check.
7132         (Output_section::Input_section::print_to_mapfile): Handle
7133         RELAXED_INPUT_SECTION_CODE.
7134         (Output_section::Output_section): Initialize data member checkpoint_.
7135         (Output_section::~Output_section): Delete checkpoint object pointed
7136         by checkpoint_.
7137         (Output_section::add_input_section): Always add an Input_section if
7138         relaxing.
7139         (Output_section::add_merge_input_section): Add assert.
7140         (Output_section::relax_input_section): New method definition.
7141         (Output_section::set_final_data_size): Set load address to zero for
7142         an unallocated section.
7143         (Output_section::do_address_and_file_offset_have_reset_values):
7144         New method definition.
7145         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7146         Handle relaxed input section.
7147         (Output_section::sort_attached_input_sections): Checkpoint input
7148         section list lazily.
7149         (Output_section::get_input_sections): Change type of input_sections to
7150         list of Simple_input_section pointers.  Checkpoint input section list
7151         lazily.  Also handle relaxed input sections.
7152         (Output_section::add_input_section_for_script): Take a reference to
7153         a Simple_input_section object instead of Relobj pointer and section
7154         index as parameter.  Handle relaxed input sections.
7155         (Output_section::save_states, Output_section::restore_states): New
7156         method definitions.
7157         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7158         (Output_data::is_data_size_fixed): New method definition.
7159         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7160         if it is fixed.
7161         (Output_data::address_and_file_offset_have_reset_values): New method
7162         definition.
7163         (Output_data::do_address_and_file_offset_have_reset_values): New method
7164         definition.
7165         (Output_data::set_data_size): Check that data size is not fixed.
7166         (Output_data::fix_data_size): New method definition.
7167         (Output_data::is_data_size_fixed_): New data member.
7168         (Output_section_headers::set_final_data_size): New method definition.
7169         (Output_section_headers::do_size): New method declaration.
7170         (Output_segment_headers::set_final_data_size): New method definition.
7171         (Output_segment_headers::do_size): New method declaration.
7172         (Output_file_header::set_final_data_size)::New method definition.
7173         (Output_file_header::do_size)::New method declaration.
7174         (Output_section_data::Output_section_data): Add new parameter
7175         is_data_size_fixed and use it to fix data size.
7176         (Output_data_const::Output_data_const): Adjust call to base class
7177         constructor and fix data size.
7178         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7179         base class constructor and fix data size.
7180         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7181         base class constructor and fix data size.
7182         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7183         class constructor and fix data size.
7184         (Output_data_group::set_final_data_size): New method definition.
7185         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7186         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7187         class constructor and fix data size.
7188         (Output_relaxed_input_section): New class definition.
7189         (Output_section::Simple_input_section): New class definition.
7190         (Output_section::get_input_sections): Adjust parameter list.
7191         (Output_section::add_input_section_for_script): Same.
7192         (Output_section::save_states, Output_section::restore_states,
7193         Output_section::do_address_and_file_offset_have_reset_values,
7194         (Output_section::Input_section::Input_section): Handle
7195         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7196         Output_relaxed_input_section.
7197         (Output_section::Input_section::is_input_section,
7198         Output_section::Input_section::set_output_section): Handle relaxed
7199         input section.
7200         (Output_section::Input_section::is_relaxed_input_section,
7201         Output_section::Input_section::output_section_data,
7202         Output_section::Input_section::relaxed_input_section): New method
7203         definitions.
7204         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7205         value.
7206         (Output_section::Input_section::u1_): Update comments.
7207         (Output_section::Input_section::u2_): Add new union member poris.
7208         (Output_section::Checkpoint_output_section): New classs definition.
7209         (Output_section::relax_input_section): New method declaration.
7210         (Output_section::checkpoint_): New data member.
7211         (Output_segment): Update comments.
7212         (Output_segment::Output_segment): Un-privatize copy constructor.
7213         (Output_segment::operator=): Un-privatize.
7214         * script-sections.cc (Output_section_element::Input_section_list):
7215         Change element type to Output_section::Simple_input_section.
7216         (Output_section_element_dot_assignment::set_section_addresses):
7217         Register output section data for relaxation clean up.
7218         (Output_data_exression::Output_data_expression): Adjust call to base
7219         constructor to fix data size.
7220         (Output_section_element_data::set_section_addresses): Register
7221         Output_data_expression object for relaxation clean up.
7222         (struct Input_section_info): Replace Relobj pointer and section index
7223         pair with Output_section::Simple_input_section and Convert struct to a
7224         class.
7225         (Input_section_sorter::operator()): Adjust access to
7226         Input_section_info data member to use accessors.
7227         (Output_section_element_input::set_section_addresses): Use layout
7228         parameter.  Adjust code to use Output_section::Simple_input_section
7229         and Input_secction_info classes.  Register filler for relaxation
7230         clean up.
7231         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7232         and section index pair with Output_section::Simple_input_section
7233         class.  Adjust code accordingly.
7234         (Phdrs_element::release_segment): New method definition.
7235         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7236         segment list.
7237         (Script_sections::release_segments): New method definition.
7238         * gold/script-sections.h (Script_sections::release_segments): New
7239         method declaration.
7240         * gold/target.h (Target::may_relax, Target::relax,
7241         Target::do_may_relax, Target::do_relax): New method definitions.
7242
7243 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7244
7245         * arm.cc (has_signed_unsigned_overflow): New function.
7246         (Arm_relocate_functions::abs8): New function.
7247         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7248         (Target_arm::Scan::global): Likewise.
7249         (Target_arm::relocate::relocate): Likewise.
7250         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7251         Likewise.
7252
7253 2009-09-16  Cary Coutant  <ccoutant@google.com>
7254
7255         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7256         * testsuite/Makefile.in: Regenerate.
7257
7258 2009-09-11  Nick Clifton  <nickc@redhat.com>
7259
7260         * po/gold.pot: Updated by the Translation project.
7261
7262 2009-09-08  Cary Coutant  <ccoutant@google.com>
7263
7264         * output.cc (Output_file::open): Add execute permission to empty file.
7265         * testsuite/Makefile.am (permission_test): New test.
7266         * testsuite/Makefile.in: Regenerate.
7267
7268 2009-09-02  Ian Lance Taylor  <iant@google.com>
7269
7270         * output.cc (Output_file::resize): Call map_no_anonymous rather
7271         than map.
7272
7273 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7274
7275         * gold.cc: Include "incremental.h".
7276         (queue_initial_tasks): Call Incremental_checker methods.
7277         * incremental.cc: Include "output.h".
7278         (Incremental_checker::can_incrementally_link_output_file): New
7279         method.
7280         * incremental.h (Incremental_checker): New class.
7281
7282         * output.cc (Output_file::open_for_modification): New method.
7283         (Output_file::map_anonymous): Changed return type to bool.  Record
7284         map in base_ field.
7285         (Output_file::map_no_anonymous): New method, broken out of map.
7286         (Output_file::map): Use map_no_anonymous and map_anonymous.
7287         * output.h (class Output_file): Update declarations.
7288
7289 2009-08-24  Cary Coutant  <ccoutant@google.com>
7290
7291         * options.h (Command_line::Pre_options): New class.
7292         (Command_line::pre_options): New member.
7293         * options.cc (gold::options::ready_to_register): New variable.
7294         (One_option::register_option): Do nothing if not registering options.
7295         Assert if same short option registered twice.
7296         (General_options::General_options): Turn off option registration when
7297         done constructing.
7298         (Command_line::Pre_options::Pre_options): New constructor.
7299
7300 2009-08-24  Cary Coutant  <ccoutant@google.com>
7301
7302         * options.h (General_options::no_keep_memory): Remove incorrect
7303         short option.
7304
7305 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7306
7307         * Makefile.am (am__skiplex, am__skipyacc): New.
7308         * Makefile.in: Regenerate.
7309
7310 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7311
7312         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7313         (INCLUDES): ... this.
7314         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7315         (AM_CPPFLAGS): Renamed from ...
7316         (INCLUDE): ... this.
7317         * Makefile.in, testsuite/Makefile.in: Regenerate.
7318
7319         * Makefile.in: Regenerate.
7320         * aclocal.m4: Likewise.
7321         * config.in: Likewise.
7322         * configure: Likewise.
7323         * testsuite/Makefile.in: Likewise.
7324
7325         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7326         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7327         * Makefile.in: Regenerate.
7328         * testsuite/Makefile.in: Regenerate.
7329
7330 2009-08-19  Cary Coutant  <ccoutant@google.com>
7331
7332         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7333         symbols in shared libraries overridden by hidden or internal symbols
7334         in the main program.
7335
7336 2009-08-19  Chris Demetriou  <cgd@google.com>
7337
7338         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7339         checking source file names in error messages.
7340
7341 2009-08-18  Doug Kwan  <dougkwan@google.com>
7342
7343         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7344         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7345         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7346         an elfcpp::Ehdr as parameter.
7347         * object.cc (Object::set_target): Remove the version that looks up
7348         a target and sets it.
7349         (Sized_relobj::setup): Take a Target object instead of
7350         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7351         (make_elf_sized_object): Find target and ask target to
7352         make an ELF object.
7353         * object.h: (Object::set_target): Remove the version that looks up
7354         a target and sets it.
7355         (Sized_relobj::setup): Take a Target object instead of
7356         an elfcpp:Ehdr as parameter.
7357         * target.cc: Include dynobj.h.
7358         (Target::do_make_elf_object_implementation): New.
7359         (Target::do_make_elf_object): New.
7360         * target.h (Target::make_elf_object): New template declaration.
7361         (Target::do_make_elf_object): New method declarations.
7362         (Target::do_make_elf_object_implementation): New template declaration.
7363
7364 2009-08-14  Ian Lance Taylor  <iant@google.com>
7365
7366         * gold.h (FUNCTION_NAME): Define.
7367         (gold_unreachable): Use FUNCTION_NAME.
7368
7369 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7370
7371         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7372         symbol in the --keep-unique list is not found.
7373
7374 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7375
7376         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7377         been maked as --keep-unique.
7378         (Icf::unfold_section): New function.
7379         * icf.h (Icf::unfold_section): New function.
7380         * options.h (General_options::keep_unique): New option.
7381         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7382         * testsuite/Makefile.in: Regenerate.
7383         * testsuite/icf_keep_unique_test.sh: New file.
7384         * testsuite/icf_keep_unique_test.cc: New file.
7385
7386 2009-08-12  Cary Coutant  <ccoutant@google.com>
7387
7388         PR 10471
7389         * resolve.cc (Symbol_table::resolve): Check for references from
7390         dynamic objects to hidden and internal symbols.
7391         * testsuite/Makefile.am (hidden_test.sh): New test.
7392         * testsuite/Makefile.in: Regenerate.
7393         * testsuite/hidden_test.sh: New script.
7394         * testsuite/hidden_test_1.c: New test source.
7395         * testsuite/hidden_test_main.c: New test source.
7396
7397 2009-08-11  Doug Kwan  <dougkwan@google.com>
7398
7399         * arm.cc: Update comments.
7400         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7401         segment to locate the .ARM.exidx section if present.
7402
7403 2009-08-09  Doug Kwan  <dougkwan@google.com>
7404
7405         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7406         patch.
7407
7408 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7409         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7410         compiler warnings.
7411
7412 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7413
7414         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7415         valid tls_segment only for non-debug-section relocations.
7416         * testsuite/Makefile.am: Add gc_tls_test.
7417         * testsuite/Makefile.in: Regenerate.
7418         * testsuite/gc_tls_test.cc: New file.
7419         * testsuite/gc_tls_test.sh: New file.
7420
7421 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7422
7423         * icf.cc: New file.
7424         * icf.h: New file.
7425         * Makefile.am (CCFILES): Add icf.cc.
7426         (HFILES): Add icf.h
7427         * Makefile.in: Regenerate.
7428         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7429         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7430         section, symbol and addend information for the relocs.
7431         * gold.cc (queue_middle_tasks): Call identical code folding.
7432         * gold.h: Add defines for multimap.
7433         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7434         to the call of finalize_local_symbols.
7435         * main.cc (main): Create object of class Icf.
7436         * object.cc (Sized_relobj::do_layout): Allow this function to be
7437         called twice during icf.
7438         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7439         to sections marked as identical by icf.
7440         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7441         when available.
7442         (Sized_relobj::do_section_entsize): New function.
7443         * object.h (Object::section_entsize): New function.
7444         (Object::do_section_entsize): New pure virtual function.
7445         (Relobj::finalize_local_symbols): Add new parameter.
7446         (Relobj::do_section_entsize): New function.
7447         * options.h (General_options::icf): New option.
7448         (General_options::icf_iterations): New option.
7449         (General_options::print_icf_sections): New option.
7450         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7451         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7452         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7453         icf.
7454         * symtab.cc (Symbol_table::is_section_folded): New function.
7455         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7456         to sections marked as identical by icf.
7457         * symtab.h (Symbol_table::set_icf): New function.
7458         (Symbol_table::icf): New function.
7459         (Symbol_table::is_section_folded): New function.
7460         (Symbol_table::icf_): New data member.
7461         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7462         * testsuite/Makefile.am: Add commands to build icf_test.
7463         * testsuite/Makefile.in: Regenerate.
7464         * testsuite/icf_test.sh: New file.
7465         * testsuite/icf_test.cc: New file.
7466
7467 2009-07-24  Chris Demetriou  <cgd@google.com>
7468
7469         * layout.cc (is_compressible_debug_section): Fix incorrect
7470         comment about compressed section names.
7471
7472 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7473
7474         PR 10419
7475         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7476
7477 2009-07-16  Ian Lance Taylor  <iant@google.com>
7478
7479         PR 10400
7480         * layout.h: #include <map>.
7481         (class Kept_section): Change from struct to class.  Add accessors
7482         and setters.  Add section size to Comdat_group mapping.  Change
7483         Comdat_group to std::map.  Add is_comdat_ field.  Add
7484         linkonce_size field in union.
7485         (class Layout): Update declaration of find_or_add_kept_section.
7486         Don't declare find_kept_object.
7487         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7488         parameter.  Add object, shndx, is_comdat, and is_group_name
7489         parameters.  Change all callers.  Adjust for new Kept_section.
7490         (Layout::find_kept_object): Remove.
7491         * object.cc (Sized_relobj::include_section_group): Update use of
7492         Kept_section.  Rename secnum to shndx.  Only record
7493         Kept_comdat_section if sections are the same size.
7494         (Sized_relobj::include_linkonce_section): Update use of
7495         Kept_section.  Only record Kept_comdat_section if sections are the
7496         same size.  Set size of linkonce section.
7497         (Sized_relobj::map_to_kept_section): Update call to
7498         get_kept_comdat_section.
7499         * object.h (class Sized_relobj): Rename fields in
7500         Kept_comdat_section to drop trailing underscores; change object
7501         field to Relobj*.  Change Kept_comdat_section_table to store
7502         struct rather than pointer.
7503         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7504         Add kept_object and kept_shndx parameters.  Change all callers.
7505         (Sized_relobj::get_kept_comdat_section): Change return type to
7506         bool.  Add kept_object and kept_shndx parameters.  Change all
7507         callers.
7508         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7509         Layout::find_or_add_kept_section.
7510
7511 2009-07-09  Ian Lance Taylor  <iant@google.com>
7512
7513         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7514         Reserve space in the hash table.
7515
7516 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7517
7518         * fileread.cc (File_read::get_mtime): New method.
7519         * fileread.h (Timespec): New structure.
7520         (File_read::get_mtime): New method.
7521         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7522         Renamed from timestamp_nsec.
7523         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7524         Elf_Xword.
7525         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7526         timestamp_nsec.
7527         (Incremental_inputs::report_archive): Save mtime; style fix.
7528         (Incremental_inputs::report_obejct): Save mtime; style fix.
7529         (Incremental_inputs::report_script): Save mtime; style fix.
7530         (Incremental_inputs::finalize_inputs): Style fix.
7531         (Incremental_inputs::finalize): Style fix.
7532         (Incremental_inputs::create_input_section_data): Store inputs
7533         mtime.
7534         * incremental.h (Incremental_inputs::report_script): Add mtime
7535         argument.
7536         (Incremental_inputs::Input_info::Input_info): Intialize only one
7537         union member.
7538         (Incremental_inputs::Input_info::archive): Move to nameless
7539         union.
7540         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7541         (Incremental_inputs::Input_info::script): Move to nameless union.
7542         (Incremental_inputs::mtime): New field.
7543         * script.cc (read_input_script): Pass file mtime to
7544         Incremental_input.
7545         * script.h (Script_info::inputs): Style fix.
7546
7547 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7548
7549         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7550         instead of 32.
7551
7552 2009-06-24  Ian Lance Taylor  <iant@google.com>
7553
7554         PR 10156
7555         * layout.cc (Layout::choose_output_section): If we find an
7556         existing section, update the flags.
7557         (Layout::create_notes): New function, broken out of
7558         Layout::finalize.
7559         (Layout::finalize): Don't create note sections.
7560         (Layout::create_note): Don't crash if linker script discards
7561         section.
7562         (Layout::create_gold_note): Likewise.
7563         (Layout::create_build_id): Likewise.  Don't set
7564         after_input_sections on the section.
7565         (Layout::create_executable_stack_info): Remove target parameter.
7566         Change caller.
7567         * layout.h (class Layout): Declare create_notes.  Update
7568         declaration of create_executable_stack_info.
7569         * gold.cc (queue_middle_tasks): Call create_notes.
7570         * output.cc (Output_section::update_flags_for_input_section): Move
7571         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7572         invalid.
7573         * output.h (Output_data::mark_address_invalid): New function.
7574         (class Output_section): Only declare, not define,
7575         update_flags_for_input_section.  Remove set_flags.
7576
7577 2009-06-24  Ian Lance Taylor  <iant@google.com>
7578
7579         * script-sections.cc (Output_section_definition::
7580         set_section_addresses): Rename shadowing local load_address to
7581         laddr.
7582
7583 2009-06-24  Ian Lance Taylor  <iant@google.com>
7584
7585         PR 10244
7586         * reloc.cc (relocate_sections): Skip empty relocation sections.
7587
7588 2009-06-23  Ian Lance Taylor  <iant@google.com>
7589
7590         PR 10156
7591         * layout.cc (Layout::create_note): Use choose_output_section
7592         rather than make_output_section.
7593
7594 2009-06-23  Ian Lance Taylor  <iant@google.com>
7595
7596         PR 10237
7597         * options.cc (General_options::parse_V): Set printed_version_.
7598         (General_options::General_options): Initialize printed_version_.
7599         * options.h (class General_options): Add printed_version_ field.
7600         * gold.cc (queue_initial_tasks): If there are no input files,
7601         don't give a fatal error if we printed the version information.
7602         (queue_middle_tasks): If using -r with a shared object, give a
7603         fatal error rather than an ordinary error.
7604
7605 2009-06-23  Ian Lance Taylor  <iant@google.com>
7606
7607         PR 10219
7608         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7609         (Layout::make_output_section): Set have_stabstr_section_ if we see
7610         a .stab*str section.
7611         (Layout::finalize): Call link_stabs_sections.
7612         (Layout::link_stabs_sections): New file.
7613         * layout.h (class Layout): Add have_stabstr_section_ field.
7614         Declare link_stabs_sections.
7615
7616 2009-06-23  Doug Kwan  <dougkwan@google.com>
7617
7618         * Makefile.am (libgold_a_LIBADD): New.
7619         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7620         * Makefile.in: Regenerate.
7621         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7622         * configure: Regenerate.
7623         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7624         * fileread.cc: Include sys/state.h
7625         * gold.h: Declare memmem and strndup if found missing.
7626         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7627
7628 2009-06-23  Ian Lance Taylor  <iant@google.com>
7629
7630         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7631         * configure: Rebuild.
7632
7633 2009-06-23  Ian Lance Taylor  <iant@google.com>
7634
7635         PR 10147
7636         * object.cc (Object::section_contents): Don't try to get a view if
7637         the section has length zero.
7638         (Object::handle_gnu_warning_section): If the section is empty, use
7639         the name of the section as the warning.
7640
7641 2009-06-23  Ian Lance Taylor  <iant@google.com>
7642
7643         PR 10133
7644         * stringpool.h (class Stringpool_template): Add optimize_ field.
7645         (Stringpool_template::set_optimize): New function.
7646         * stringpool.cc (Stringpool_template::Stringpool_template):
7647         Initialize optimize_ field.
7648         (Stringpool_template::set_string_offsets): Test local optimize
7649         fild rather than parameter.
7650         * layout.cc (Layout::Layout): Call set_optimize on the section
7651         name stringpool.
7652
7653 2009-06-22  Ian Lance Taylor  <iant@google.com>
7654
7655         PR 10030
7656         * yyscript.y: Parse TARGET.
7657         * script.cc (script_set_target): New function.
7658         * script-c.h (script_set_target): Declare.
7659         * options.cc (General_options::string_to_object_format): Rename
7660         from string_to_object_format in anonymous namespace.  Change
7661         callers.
7662         * options.h (class General_options): Declare
7663         string_to_object_format.
7664
7665 2009-06-22  Ian Lance Taylor  <iant@google.com>
7666
7667         * script-sections.cc (Script_sections::create_segments): Don't put
7668         program headers in a PT_LOAD segment if -n or -N.
7669
7670 2009-06-22  Ian Lance Taylor  <iant@google.com>
7671
7672         PR 10141
7673         * options.h (class General_options): Add -z lazy and -z now.  Sort
7674         -z options into alphabetical order.
7675         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7676
7677 2009-06-21  Ian Lance Taylor  <iant@google.com>
7678
7679         * layout.cc (Layout::make_output_section): Call
7680         Target::new_output_section.
7681         (Layout::attach_allocated_section_to_segment): Put large section
7682         sections in a separate load segment with the large segment flag
7683         set.
7684         (Layout::segment_precedes): Sort large data segments after other
7685         load segments.
7686         (align_file_offset): New static function.
7687         (Layout::set_segment_offsets): Use align_file_offset.
7688         * output.h (class Output_section): Add is_small_section_ and
7689         is_large_section_ fields.
7690         (Output_section::is_small_section): New function.
7691         (Output_section::set_is_small_section):  New function.
7692         (Output_section::is_large_section): New function.
7693         (Output_section::set_is_large_section): New function.
7694         (Output_section::is_large_data_section): New function.
7695         (class Output_segment): Add is_large_data_segment_ field.
7696         (Output_segment::is_large_data_segment): New function.
7697         (Output_segment::set_is_large_data_segment): New function.
7698         * output.cc (Output_section::Output_section): Initialize new
7699         fields.
7700         (Output_segment::Output_segment): Likewise.
7701         (Output_segment::add_output_section): Add assertion that large
7702         data sections always go in large data segments.  Force small data
7703         sections to the end of the list of data sections.  Force small BSS
7704         sections to the start of the list of BSS sections.  For large BSS
7705         sections to the end of the list of BSS sections.
7706         * symtab.h (class Symbol): Declare is_common_shndx.
7707         (Symbol::is_defined): Check Symbol::is_common_shndx.
7708         (Symbol::is_common): Likewise.
7709         (class Symbol_table): Define enum Commons_section_type.  Update
7710         declarations.  Add small_commons_ and large_commons_ fields.
7711         * symtab.cc (Symbol::is_common_shndx): New function.
7712         (Symbol_table::Symbol_table): Initialize new fields.
7713         (Symbol_table::add_from_object): Put small and large common
7714         symbols in the right list.
7715         (Symbol_table::sized_finalized_symbol): Check
7716         Symbol::is_common_shndx.
7717         (Symbol_table::sized_write_globals): Likewise.
7718         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7719         common symbol lists.  Don't call do_allocate_commons_list if the
7720         list is empty.
7721         (Symbol_table::do_allocate_commons_list): Remove is_tls
7722         parameter.  Add comons_section_type parameter.  Change all
7723         callers.  Handle small and large common symbols.
7724         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7725         Symbol::is_common_shndx.
7726         * resolve.cc (symbol_to_bits): Likewise.
7727         * target.h (Target::small_common_shndx): New function.
7728         (Target::small_common_section_flags): New function.
7729         (Target::large_common_shndx): New function.
7730         (Target::large_common_section_flags): New function.
7731         (Target::new_output_section): New function.
7732         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7733         small_common_section_flags, and large_common_section_flags
7734         fields.
7735         (Target::do_new_output_section): New virtual function.
7736         * arm.cc (Target_arm::arm_info): Initialize new fields.
7737         * i386.cc (Target_i386::i386_info): Likewise.
7738         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7739         Likewise.
7740         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7741         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7742         (Target_x86_64::do_new_output_section): New function.
7743         * configure.ac: Define conditional MCMODEL_MEDIUM.
7744         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7745         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7746         (large_LDFLAGS): Define.
7747         * testsuite/large.c: New file.
7748         * testsuite/testfile.cc (Target_test::test_target_info):
7749         Initialize new fields.
7750         * configure, testsuite/Makefile.in: Rebuild.
7751
7752 2009-06-05  Doug Kwan  <dougkwan@google.com>
7753
7754         * Makefile.am (CCFILES): Add target.cc.
7755         * Makefile.in: Regenerate.
7756         * i386.cc (class Target_i386): Define new virtual method to
7757         override do_is_local_label_name in parent.
7758         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7759         local symbols if --discard-locals or -X is given.
7760         * options.h (class General_options): Declare new options
7761         '--discard-locals' and '-X' for discarding locals.
7762         * target.h (class Target): Define new methods is_local_label_name.
7763         Declare new virtual method do_is_local_label_name.
7764         * target.cc: New file.
7765         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7766         (check_SCRIPTS): Add discard_locals_test.sh.
7767         (check_DATA): Add discard_local_tests.syms.
7768         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7769         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7770         * testsuite/Makefile.in: Regenerate.
7771         * testsuite/discard_locals_test.c: New file.
7772         * testsuite/discard_locals_test.sh: Same.
7773
7774 2009-06-05  Doug Kwan  <dougkwan@google.com>
7775
7776         * object.cc (Sized_relobj::Sized_relobj): Initialize
7777         discarded_eh_frame_shndx_ to -1U.
7778         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7779         section.
7780         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7781         a discarded .eh_frame section.
7782         (Sized_relobj::do_finalize_local_symbols): Ditto.
7783         * object.h (class Sized_relobj): Declare new member
7784         discarded_eh_frame_shndx_.
7785         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7786         (local_labels_test.o, local_labels_test): New rules.
7787         * testsuite/Makefile.in: Regenerate.
7788
7789 2009-06-04  Doug Kwan  <dougkwan@google.com>
7790
7791         * layout.cc (Layout::section_name_mapping): Add mapping for
7792         special ARM sections.
7793
7794 2009-06-03  Doug Kwan  <dougkwan@google.com>
7795
7796         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7797         (utils::has_overflow): Same.
7798
7799 2009-06-03  Ian Lance Taylor  <iant@google.com>
7800
7801         * layout.cc (Layout::section_name_mapping): New array, replacing
7802         Layout::linkonce_mapping.
7803         (Layout::section_name_mapping_count): New variable, replacing
7804         Layout::linkonce_mapping_count.
7805         (Layout::linkonce_output_name): Remove.
7806         (Layout::output_section_name): Rewrite.
7807         * layout.h (class Layout): Rename Linkonce_mapping to
7808         Section_name_mapping, linkonce_mapping to section_name_mapping,
7809         linkonce_mapping_count to section_name_mapping_count.  Don't
7810         declare linkonce_output_name.
7811
7812 2009-06-03  Doug Kwan  <dougkwan@google.com>
7813
7814         * gold/arm.cc (namespace utils): New.
7815         (Target_arm::reloc_is_non_pic): Define new method.
7816         (class Arm_relocate_functions): New.
7817         (Target_arm::Relocate::relocate): Handle relocation types used by
7818         Android.
7819
7820 2009-06-03  Ian Lance Taylor  <iant@google.com>
7821
7822         * arm.cc (Target_arm::scan::global): Use || instead of |.
7823
7824 2009-06-02  Doug Kwan  <dougkwan@google.com>
7825
7826         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7827         issued_non_pic_error_.
7828         (class Target_arm::Scan): Declare new method check_non_pic.
7829         Define new method symbol_needs_plt_entry.
7830         Declare new data member issued_non_pic_error_.
7831         (class Target_arm::Relocate): Declare new method
7832         should_apply_static_reloc.
7833         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7834         (Target_arm::Scan::check_non_pic): Define new method.
7835         (Target_arm::Scan::local): Handle a small subset of reloc types used
7836         by Android.
7837         (Target_arm::Scan::local): Same.
7838         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7839
7840 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7841
7842         * incremental.cc (Incremental_inputs::report_command_line): Filter
7843         out --incremental-* options.
7844
7845 2009-05-29  Doug Kwan  <dougkwan@google.com>
7846
7847         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7848         template class.
7849         (class Target_arm): Update comment.
7850         (Target_arm::Target_arm): Initialize new data members GOT_,
7851         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7852         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7853         and Target_arm::rel_dyn_section.
7854         Declare new_enum Target_arm::Got_type.
7855         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7856         and DYNBSS_.
7857         Update commments for member do_dynsym_value.
7858         (Target_arm::got_size, Target_arm::plt_section,
7859         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7860         new methods inside class defintion.
7861         (Target_arm::got_section): Define new method.
7862         (Target_arm::rel_dyn_section): Same.
7863         (Output_data_plt_arm): New template class.
7864         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7865         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7866         (Output_data_plt_arm::add_entry): Same.
7867         (Output_data_plt_arm::first_plt_entry): Define new
7868         static data member for PLT instruction template.
7869         (Output_data_plt_arm::plt_entry): Same.
7870         (Output_data_plt_arm::do_write): Define new method.
7871         (Target_arm::make_plt_entry): Same.
7872         (Target_arm::do_finalize_sections): Same.
7873         (Target_arm::do_dynsym_value): Same.
7874
7875 2009-05-28  Doug Kwan  <dougkwan@google.com>
7876
7877         * Makefile.am (TARGETSOURCES): Add arm.cc.
7878         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7879         * Makefile.in: Regenerate.
7880         * arm.cc: New file.
7881         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7882
7883 2009-05-26  Doug Kwan  <dougkwan@google.com>
7884
7885         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7886         (General_options::check_excluded_libs): Strip off directories in
7887         archive name before matching like GNU ld does.
7888         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7889         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7890         (exclude_libs_test_LDFLAGS): Add linker option
7891         -Wl,--exclude-libs,libexclude_libs_test_3
7892         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7893         an explicit archive without using -l.
7894         (alt/libexclude_libs_test_3.a): New make rule.
7895         * testsuite/Makefile.in: Regenerate.
7896         * testsuite/exclude_libs_test.c : Declare lib3_default().
7897         (main): Call it.
7898         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7899         * exclude_libs_test_3.c: New file.
7900
7901 2009-05-26  Nick Clifton  <nickc@redhat.com>
7902
7903         * po/id.po: New Indonesian translation.
7904         * po/gold.pot: Updated template file.
7905
7906 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7907
7908         * testsuite/Makefile.am: Add -ffunction-sections to compile
7909         gc_comdat_test files.  Add -Wl,--gc-sections to build
7910         gc_comdat_test.
7911         * testsuite/Makefile.in: Regenerate.
7912         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7913
7914 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7915
7916         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7917         kept comdat section was garbage collected.
7918         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7919         * testsuite/Makefile.in: Regenerate.
7920         * testsuite/gc_comdat_test.sh: New file.
7921         * testsuite/gc_comdat_test_1.cc: New file.
7922         * testsuite/gc_comdat_test_2.cc: New file.
7923
7924 2009-05-19  Doug Kwan  <dougkwan@google.com>
7925
7926         * archive.cc (Archive::Archive): Move constructor from archive.h
7927         to here.  Initialize no_export_.
7928         (Archive::get_elf_object_for_member): Set no_export flag of object.
7929         * archive.h (Archive::Archive): Move constructor body to
7930         archive.cc.
7931         (Archive::no_export): New method.
7932         (Archive::no_export_): New field.
7933         * object.h (Object::Object): Initialize no_export_ to false.
7934         (Object::no_export, Object::set_no_export): New methods.
7935         (Object::no_export_): New field.
7936         * options.cc (General_options::parse_exclude_libs): New method.
7937         (General_options::check_excluded_libs) Same.
7938         * options.h (exclude_libs): New option.
7939         (General_options::check_excluded_libs): New method declaration.
7940         (General_options::excluded_libs_): New field.
7941         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7942         default or protected visibility if an object has no-export flag set.
7943         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7944         (check_SCRIPTS): Add exclude_libs_test.sh.
7945         (check_DATA): Add exclude_libs_test.syms.
7946         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7947         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7948         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7949         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7950         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7951         libexclude_libs_test_2.a): New rules.
7952         * testsuite/Makefile.in: Regenerate.
7953         * testsuite/exclude_libs_test.c: New file.
7954         * testsuite/exclude_libs_test.sh: Ditto.
7955         * testsuite/exclude_libs_test_1.c: Ditto.
7956         * testsuite/exclude_libs_test_2.c: Ditto.
7957
7958 2009-05-15  Ian Lance Taylor  <iant@google.com>
7959
7960         * configure.ac: Check for declarations for cases where libiberty.h
7961         checks HAVE_DECL_xxx.
7962         * configure, config.in: Rebuild.
7963
7964 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7965
7966         * gold.h (Incremental_argument_list): Remove (invalid) forward
7967         declaration.
7968         * incremental.cc (Incremental_inputs::report_achive): New method.
7969         (Incremental_inputs::report_object): New method.
7970         (Incremental_inputs::report_script): New method.
7971         (Incremental_inputs::finalize_inputs): New method.
7972         (Incremental_inputs::finalize): Call finalize_inputs().
7973         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7974         Create inputs entries.
7975         * incremental.h (Incremental_input_type): New enum.
7976         (Incremental_inputs::Incremental_input): Initialize new fields.
7977         (Incremental_inputs::report_inputs): New method.
7978         (Incremental_inputs::report_achive): New method.
7979         (Incremental_inputs::report_object): New method.
7980         (Incremental_inputs::report_script): New method.
7981         (Incremental_inputs::finalize_inputs): New method.
7982         (Incremental_inputs::Input_info): New struct.
7983         (Incremental_inputs::Input_info_map): New typedef.
7984         (Incremental_inputs::lock_): New field.
7985         (Incremental_inputs::Inputs_): New field.
7986         (Incremental_inputs::Inputs_map): New field.
7987         * main.cc (main): Call Incremental_input::report_inputs.
7988         * options.h (Input_argument_list): Typedef moved from
7989         Input_arguments.
7990         (Input_file_group::Files): Remove, use ::Input_argument_list.
7991         (Input_file_group::Input_argument_list): Remove, use
7992         ::Input_argument_list.
7993         * plugin.cc (Plugin_manager::add_input_file): Add error in
7994         incremental build.
7995         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7996         functions.
7997         * script.cc (read_input_script): Call
7998         Incremental_input::report_script.
7999         * script.h (Script_info): New class.
8000
8001 2009-04-27  Ian Lance Taylor  <iant@google.com>
8002
8003         * x86_64.cc (do_adjust_output_section): Set entsize to
8004         plt_entry_size.
8005
8006 2009-04-23  Elliott Hughes  <enh@google.com>
8007
8008         * output.cc (Output_file::close): After short writes, continue
8009         writing from the correct offset in the buffer being written.
8010
8011 2009-04-23  Chris Demetriou  <cgd@google.com>
8012
8013         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8014         * configure: Regenerate.
8015         * config.in: Regenerate.
8016         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8017         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8018
8019 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8020
8021         * incremental.cc (Incremental_inputs_header_data): Renamed from
8022         Incremental_input_header_data.
8023         (Incremental_inputs_header_data::data_size): New field.
8024         (Incremental_inputs_header_data::put_input_file_count): Renamed
8025         from input_file_count.
8026         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8027         from command_line_offset.
8028         (Incremental_inputs_header_data::put_reserved): Renamed from
8029         put_reserved.
8030         (Incremental_inputs_entry_data): Renamed from
8031         Incremental_input_entry_data.
8032         (Incremental_inputs_entry_data::data_size): New field.
8033         (Incremental_inputs::report_command_line): New method.
8034         (Incremental_inputs::finalize): New method.
8035         (Incremental_inputs::create_incremental_inputs_data): New method.
8036         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8037         * incremental.h: New file.
8038         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8039        (Layout::finalize): Create incremental inputs section in
8040         incremental builds.
8041        (Layout::create_incremental_info_sections): New method.
8042         * layout.h (Layout::incremental_inputs): New method.
8043        (Layout::create_incremental_info_sections): New method.
8044        (Layout::incremental_inputs_): New field.
8045         * main.cc (main): Notify Incremental_input of the command line.
8046
8047 2009-04-01  Ian Lance Taylor  <iant@google.com>
8048             Mikolaj Zalewski  <mikolajz@google.com>
8049
8050         * gold.h (reserve_unordered_map): Define, three versions, one for
8051         each version of Unordered_map.
8052         * layout.cc (Layout::Layout): Remove options parameter.  Add
8053         number_of_input_files parameter.  Don't initialize options_.
8054         Initialize number_of_input_files_ and resized_signatures_.  Move
8055         sections_are_attached_.
8056         (Layout::layout_group): Reserve space for group_signatures_.
8057         (Layout::find_or_add_kept_section): Change name parameter to be a
8058         reference.  Resize signatures_ map when it gets large enough.
8059         (Layout::layout_eh_frame): Use parameters->options() instead of
8060         this->options_.
8061         (Layout::make_output_section): Likewise.
8062         (Layout::attach_allocated_section_to_segment): Likewise.
8063         (Layout::finalize, Layout::create_executable_stack): Likewise.
8064         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8065         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8066         * layout.h (class Layout): Update declarations.  Remove options_
8067         field.  Add number_of_input_files_ and resized_signatures_
8068         fields.  Move sections_are_attached_ field.
8069         * main.cc (main): Pass number of input files to Layout
8070         constructor.  Don't pass options.
8071
8072 2009-03-30  Ian Lance Taylor  <iant@google.com>
8073
8074         * ffsll.c (ffsll): Correct implementation.
8075
8076 2009-03-27  Ian Lance Taylor  <iant@google.com>
8077
8078         * ffsll.c: New file.
8079         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8080         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8081         * ftruncate.c (ftruncate): Declare before definition.
8082         * mremap.c (mremap): Likewise.
8083         * pread.c (pread): Likewise.
8084         * configure, Makefile.in, config.in: Rebuild.
8085
8086         * mremap.c: New file.
8087         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8088         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8089         (mremap): Declare if HAVE_MREMAP is not defined.
8090         * configure, Makefile.in, config.in: Rebuild.
8091
8092 2009-03-27  Cary Coutant  <ccoutant@google.com>
8093
8094         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8095         position independent.
8096         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8097         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8098
8099 2009-03-24  Cary Coutant  <ccoutant@google.com>
8100
8101         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8102         an executable.
8103         (needs_dynamic_reloc): Likewise.
8104
8105 2009-03-24  Ian Lance Taylor  <iant@google.com>
8106
8107         * yyscript.y (file_cmd): Recognize EXTERN.
8108         (extern_name_list, extern_name_list_body): New nonterminals.
8109         * script.cc (script_add_extern): Define.
8110         * script-c.h (script_add_extern): Declare.
8111
8112 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8113
8114         * object.cc (is_elf_object): Define.
8115         * object.h (is_elf_object): Declare.
8116         * archive.cc (Archive::get_elf_object_for_member): Call
8117         is_elf_object.
8118         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8119
8120 2009-03-24  Elliott Hughes  <enh@google.com>
8121
8122         * output.cc (Output_file::map_anonymous): Define.
8123         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8124         try an anonymous one.  Report the size if the mmap fails.
8125         * output.h (class Output_file): Declare map_anonymous.
8126
8127 2009-03-24  Ian Lance Taylor  <iant@google.com>
8128
8129         * target-select.cc (instantiate_target): Don't acquire the lock if
8130         the instantiated_target_ field has already been set.
8131
8132 2009-03-23  Ian Lance Taylor  <iant@google.com>
8133
8134         * gold-threads.h (class Initialize_lock): Define.
8135         * gold-threads.cc (class Initialize_lock_once): Define.
8136         (initialize_lock_control): New static variable.
8137         (initialize_lock_pointer): New static variable.
8138         (initialize_lock_once): New static function.
8139         (Initialize_lock::Initialize_lock): Define.
8140         (Initialize_lock::initialize): Define.
8141         * target-select.h: Include "gold-threads.h".
8142         (class Target_selector): Add lock_ and initialize_lock_ fields.
8143         Don't define instantiate_target, just declare it.
8144         * target-select.cc (Target_selector::Target_selector): Initialize
8145         new fields.
8146         (Target_selector::instantiate_target): Define.
8147         * descriptors.h: Include "gold-threads.h".
8148         (class Descriptors): Add initialize_lock_ field.
8149         * descriptors.cc (Descriptors::Descriptors): Initialize new
8150         field.
8151         (Descriptors::open): Use initialize_lock_ field
8152         * errors.h (class Errors): Add initialize_lock_ field.
8153         * errors.cc (Errors::Errors): Initialize new field.
8154         (Errors::initialize_lock): Use initialize_lock_ field.
8155         * powerpc.cc (class Target_selector_powerpc): Remove
8156         instantiated_target_ field.  In do_recognize call
8157         instantiate_target rather than do_instantiate_target.  In
8158         do_instantiate_target just allocate a new target.
8159         * sparc.cc (class Target_selector_sparc): Likewise.
8160
8161         * freebsd.h: New file.
8162         * i386.cc: Include "freebsd.h".
8163         (Target_i386): Derive from Target_freebsd rather than
8164         Sized_target.
8165         (Target_selector_i386): Derive from Target_selector_freebsd rather
8166         than Target_selector.
8167         * x86_64.cc: Include "freebsd.h".
8168         (Target_x86_64): Derive from Target_freebsd rather than
8169         Sized_target.
8170         (Target_selector_x86_64): Derive from Target_selector_freebsd
8171         rather than Target_selector.
8172         * target.h (class Target): Add adjust_elf_header and
8173         do_adjust_elf_header.
8174         * output.cc (Output_file_header:: do_sized_write): Call target
8175         adjust_elf_header routine.
8176         * configure.tgt: Set targ_osabi.
8177         * configure.ac: Define GOLD_DEFAULT_OSABI.
8178         * parameters.cc (Parameters::default_target): Pass
8179         GOLD_DEFAULT_OSABI to select_target.
8180         * target-select.h (class Target_selector): Make instantiate_target
8181         protected rather than private.
8182         * Makefile.am (HFILES): Add freebsd.h.
8183         * configure, Makefile.in, config.in: Rebuild.
8184
8185         * merge.cc (do_add_input_section): Correct pend value.  Change
8186         message about last entry not being null terminated from error to
8187         warning.
8188
8189 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8190
8191         * incremental.cc: New file.
8192         * Makefile.am (CCFILES): Add incremental.cc.
8193         * Makefile.in: Rebuild.
8194
8195 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8196
8197         * layout.cc (Layout::output_section_name): Preserve names
8198         of '.note.' sections.
8199
8200 2009-03-19  Ian Lance Taylor  <iant@google.com>
8201
8202         * descriptors.cc (Descriptors::open): Check that the options are
8203         valid before using them.
8204
8205 2009-03-18  Ian Lance Taylor  <iant@google.com>
8206
8207         * script-sections.h: Include <list>.
8208         (class Script_sections): Change Sections_elements from std::vector
8209         to std::list.  Typedef public Elements_iterator.  Add
8210         orphan_section_placement_, data_segment_align_start_, and
8211         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8212         field.
8213         * script-sections.cc (class Orphan_section_placement): New class.
8214         (class Sections_element): Add virtual functions is_relro and
8215         orphan_section_init.  Remove virtual function place_orphan_here.
8216         (class Output_section_definition): Add is_relro and
8217         orphan_section_init.  Remove place_orphan_here.
8218         (class Orphan_output_section): Likewise.
8219         (Script_sections::Script_sections): Update for field changes.
8220         (Script_sections::data_segment_align): Set saw_data_segment_align_
8221         and data_segment_align_start_, not data_segment_align_index.
8222         (Script_sections::data_segment_relro_end): Check
8223         saw_data_segment_align_.  Use data_segment_align_start_ rather
8224         than data_segment_align_index_.
8225         (Script_sections::place_orphan): Rewrite to use
8226         Orphan_section_placement.
8227
8228 2009-03-17  Ian Lance Taylor  <iant@google.com>
8229
8230         * archive.cc (Archive::add_symbols): Check for a version attached
8231         to the symbol name in the archive map.
8232         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8233         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8234         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8235         (ver_test_11.a): New target.
8236         * testsuite/Makefile.in: Rebuild.
8237
8238         * configure.ac: Check for chsize and posix_fallocate.  Replace
8239         ftruncate.
8240         * ftruncate.c: New file, from gnulib.
8241         * output.cc (posix_fallocate): Define dummy version if not
8242         HAVE_POSIX_FALLOCATE.
8243         (Output_file::map): Call posix_fallocate rather than lseek and
8244         write.
8245         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8246         * configure, Makefile.in, config.in: Rebuild.
8247
8248 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8249
8250         * layout.h (Layout::create_note): Add section_name parameter.
8251         * layout.cc (Layout::create_note): Likewise.
8252         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8253
8254 2009-03-17  Ian Lance Taylor  <iant@google.com>
8255
8256         * descriptors.cc: Include "options.h".
8257         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8258         (Descriptors::open): Always use O_CLOEXEC when opening a new
8259         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8260         then set FD_CLOEXEC.
8261
8262         * sparc.cc (class Target_sparc): Add has_got_section.
8263         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8264         make sure we have a GOT section.
8265
8266         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8267         (Target_sparc::Scan::local): Likewise.
8268         (Target_sparc::Scan::global): Likewise.
8269         (Target_sparc::Relocate::relocate): Likewise.
8270         (Target_sparc::Relocate::relocate_tls): Likewise.
8271
8272         * symtab.cc (Symbol_table::define_default_version): New function,
8273         broken out of add_from_object.
8274         (Symbol_table::add_from_object): Call define_default_version.
8275         (Symbol_table::define_special_symbol): Add resolve_oldsym
8276         parameter.  Change all callers.  If the version for a symbol comes
8277         from a version script, resolve it with the symbol with the same
8278         name with no version.  Also add the symbol without a version if
8279         appropriate.
8280         (do_define_in_output_data): If resolving with oldsym, don't delete
8281         sym.
8282         (do_define_in_output_segment): Likewise.
8283         (do_define_as_constant): Likewise.
8284         * symtab.h (class Symbol_table): Update declarations.
8285
8286 2009-03-13  Ian Lance Taylor  <iant@google.com>
8287
8288         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8289         (Read_symbols::requeue): New function.
8290         (Read_symbols::do_read_symbols): If make_elf_object fails because
8291         the target type is not configured, and the file was searched for,
8292         issue a warning and retry with the next directory.
8293         (Add_symbols::run): If the file has an incompatible format, and
8294         it was searched for, requeue the Read_symbols task.  On error,
8295         release the object.
8296         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8297         dirindex parameter to constructor.  Change all callers.  Declare
8298         incompatible_warning and requeue.
8299         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8300         input_argument_ and input_group_ fields.  Add them to
8301         constructor.  Change all callers.
8302         (class Read_script): Add dirindex_ field.  Add it to constructor.
8303         Change all callers.
8304         * archive.cc (Archive::setup): Remove input_objects parameter.
8305         Change all callers.
8306         (Archive::get_file_and_offset): Likewise.
8307         (Archive::read_all_symbols): Likewise.
8308         (Archive::read_symbols): Likewise.
8309         (Archive::get_elf_object_for_member): Remove input_objects
8310         parameter.  Add punconfigured parameter.  Change all callers.
8311         (Archive::add_symbols): Change return type to bool.  Check return
8312         value of include_member.
8313         (Archive::include_all_members): Likewise.
8314         (Archive::include_member): Change return type to bool.  Return
8315         false if first included object has incompatible target.  Set
8316         included_member_ field.
8317         (Add_archive_symbols::run): If add_symbols returns false, requeue
8318         Read_symbols task.
8319         * archive.h (class Archive): Add included_member_ field.
8320         Initialize it in constructor.  Add input_file and searched_for
8321         methods.  Update declarations.
8322         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8323         input_argument_ fields.  Add them to constructor.  Change all
8324         callers.
8325         * script.cc: Include "target-select.h".
8326         (class Parser_closure): Add skip_on_incompatible_target_ and
8327         found_incompatible_target_ fields.  Add
8328         skip_on_incompatible_target parameter to constructor.  Change all
8329         callers.  Add methods skip_on_incompatible_target,
8330         clear_skip_on_incompatible_target, found_incompatible_target, and
8331         set_found_incompatible_target.
8332         (read_input_script): Add dirindex parameter.  Change all callers.
8333         If parser finds an incompatible target, requeue Read_symbols
8334         task.
8335         (script_set_symbol): Clear skip_on_incompatible_target in
8336         closure.
8337         (script_add_assertion, script_parse_option): Likewise.
8338         (script_start_sections, script_add_phdr): Likewise.
8339         (script_check_output_format): New function.
8340         * script.h (read_input_script): Update declaration.
8341         * script-c.h (script_check_output_format): Declare.
8342         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8343         (ignore_cmd): Remove OUTPUT_FORMAT.
8344         * fileread.cc (Input_file::Input_file): Add explicit this.
8345         (Input_file::will_search_for): New function.
8346         (Input_file::open): Add pindex parameter.  Change all callers.
8347         * fileread.h (class Input_file): Add input_file_argument method.
8348         Declare will_search_for.  Update declarations.
8349         * object.cc (make_elf_object): Add punconfigured parameter.
8350         Change all callers.
8351         * object.h (class Object): Make input_file public.  Add
8352         searched_for method.
8353         (make_elf_object): Update declaration.
8354         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8355         restart search.
8356         * dirsearch.h (class Dirsearch): Update declaration.
8357         * options.h (class General_options): Add --warn-search-mismatch.
8358         * parameters.cc (Parameters::is_compatible_target): New function.
8359         * parameters.h (class Parameters): Declare is_compatible_target.
8360         * workqueue.cc (Workqueue::add_blocker): New function.
8361         * workqueue.h (class Workqueue): Declare add_blocker.
8362
8363         * fileread.cc (Input_file::open): Remove options parameter.
8364         Change all callers.
8365         (Input_file::open_binary): Likewise.
8366         * script.cc (read_input_script): Likewise.
8367         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8368         options parameter from constructor.  Change all callers.
8369         (class Read_script): Likewise.
8370         * fileread.h (class Input_file): Update declarations.
8371         * script.h (read_input_script): Update declaration.
8372
8373 2009-03-10  Nick Clifton  <nickc@redhat.com>
8374
8375         * po/es.po: New Spanish translation.
8376
8377 2009-03-06  Cary Coutant  <ccoutant@google.com>
8378
8379         * options.cc (parse_short_option): Keep dash_z from registering itself.
8380
8381 2009-03-03  Ian Lance Taylor  <iant@google.com>
8382
8383         PR 9918
8384         * target-reloc.h (relocate_section): Pass output_section to
8385         relocate.
8386         * i386.cc (Target_i386::should_apply_static_reloc): Add
8387         output_section parameter.  Change all callers.
8388         (Target_i386::Relocate::relocate): Add output_section parameter.
8389         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8390         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8391         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8392         * testsuite/two_file_shared.sh: New script.
8393         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8394         (check_DATA): Add two_file_shared.dbg.
8395         (two_file_shared.dbg): New target.
8396         * testsuite/Makefile.in: Rebuild.
8397
8398 2009-03-01  Ian Lance Taylor  <iant@google.com>
8399
8400         * configure.ac: Check for byteswap.h.
8401         * configure: Rebuild.
8402         * config.in: Rebuild.
8403
8404 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8405
8406         * layout.cc (Layout::find_or_add_kept_section): New function.
8407         (Layout::add_comdat): Removed.
8408         * layout.h (struct Kept_section): Move out of class Layout.
8409         Remove trailing underscores from field names.  Add group_sections
8410         field.  Rename group_ field to is_group.  Change all uses.
8411         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8412         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8413         comdat_groups_ field.
8414         (Sized_relobj::include_section_group): Use
8415         find_or_add_kept_section and Kept_section::group_sections.
8416         (Sized_relobj::include_linkonce_section): Likewise.
8417         * object.cc (class Sized_relobj): Don't define Comdat_group or
8418         Comdat_group_table.  Remove find_comdat_group and
8419         add_comdat_group.  Remove comdat_groups_ field.
8420         * plugin.cc (include_comdat_group): Use
8421         Layout::find_or_add_kept_section.
8422
8423 2009-02-28  Ian Lance Taylor  <iant@google.com>
8424
8425         * README: --gc-sections and map files are now supported.  Document
8426         some build requirements.
8427
8428         PR 6992
8429         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8430         relocatable link set the value of the section symbol to zero.
8431         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8432         relocatable link don't include the section address in the local
8433         symbol value.
8434
8435 2009-02-27  Ian Lance Taylor  <iant@google.com>
8436
8437         PR 6811
8438         * options.h (class Search_directory): Add is_system_directory.
8439         (class General_options): Declare is_in_system_directory.
8440         * options.cc (get_relative_sysroot): Make static.
8441         (get_default_sysroot): Make static.
8442         (General_optoins::is_in_system_directory): New function.
8443         * fileread.cc (Input_file::is_in_system_directory): New function.
8444         * fileread.h (class Input_file): Declare is_in_system_directory.
8445         * object.h (class Object): Add is_in_system_directory.
8446         (class Input_objects): Remove system_library_directory_ field.
8447         * object.cc (Input_objects::add_object): Don't set
8448         system_library_directory_.
8449         (input_objects::found_in_system_library_directory): Remove.
8450         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8451         parameter.  Change all callers.
8452         (Symbol_table::sized_write_globals): Likewise.
8453         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8454         Call Object::is_in_system_directory.
8455         * symtab.h (class Symbol_table): Update declarations.
8456
8457         PR 5990
8458         * descriptors.h (Open_descriptor): Add is_on_stack field.
8459         * descriptors.cc (Descriptors::open): If the descriptor is on the
8460         top of the stack, remove it.  Initialize is_on_stack field.
8461         (Descriptors::release): Only add pod to stack if it is not on the
8462         stack already.
8463         (Descriptors::close_some_descriptor): Clear stack_next and
8464         is_on_stack fields.
8465
8466         PR 7091
8467         * output.cc (Output_section::find_starting_output_address): Rename
8468         from starting_output_address; add PADDR parameter; change return
8469         type.
8470         * output.h (class Output_section): Declare
8471         find_starting_output_address instead of starting_output_address.
8472         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8473         section symbol for which we can't find a merge section.
8474
8475         PR 9836
8476         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8477         hidden or internal, force the symbol to be local.
8478         * resolve.cc (Symbol::override_visibility): Define.
8479         (Symbol::override_base): Use override_visibility.
8480         (Symbol_table::resolve): Likewise.
8481         (Symbol::override_base_with_special): Likewise.
8482         (Symbol_table::override_with_special): If the visibility is hidden
8483         or internal, force the symbol to be local.
8484         * symtab.h (class Symbol): Add set_visibility and
8485         override_visibility.
8486         * testsuite/ver_test_1.sh: New file.
8487         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8488         (check_DATA): Add ver_test_1.syms.
8489         (ver_test_1.syms): New target.
8490         * testsuite/Makefile.in: Rebuild.
8491
8492 2009-02-25  Cary Coutant  <ccoutant@google.com>
8493
8494         * layout.cc (Layout::choose_output_section): Don't rename sections
8495         when using a linker script that has a SECTIONS clause.
8496         * Makefile.in: Regenerate.
8497
8498         * testsuite/Makefile.am (script_test_5.sh): New test case.
8499         * testsuite/Makefile.in: Regenerate.
8500         * testsuite/script_test_5.cc: New file.
8501         * testsuite/script_test_5.sh: New file.
8502         * testsuite/script_test_5.t: New file.
8503
8504 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8505
8506         * archive.cc (Archive::include_member): Update calls to add_symbols.
8507         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8508         the Layout argument.
8509         * dynobj.h (do_add_symbols): Add the Layout argument.
8510         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8511         Layout argument.
8512         * object.h (Object::add_symbols): Add the Layout argument.
8513         (Object::do_add_symbols): Add the Layout argument.
8514         (Sized_relobj::do_add_symbols): Add the Layout argument.
8515         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8516         Unify the two versions.
8517         (Add_plugin_symbols): Remove.
8518         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8519         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8520         (Add_plugin_symbols): Remove.
8521         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8522         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8523         (Add_symbols::run): Make it work with Pulginobj.
8524
8525 2009-02-06  Ian Lance Taylor  <iant@google.com>
8526
8527         * object.cc (Sized_relobj::do_layout): Make info message start
8528         with lower case letter.
8529
8530 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8531
8532         * binary.cc: Fix file comment.
8533
8534         * options.h (enum Incremental_disposition): Define.
8535         (class General_options): Add new options: --incremental,
8536         --incremental_changed, --incremental_unchanged,
8537         --incremental_unknown.  Add incremental_disposition_ and
8538         implicit_incremental_ fields.
8539         (General_options::incremental_disposition): New function.
8540         (class Position_dependent_options): Add incremental_disposition
8541         option.
8542         (Position_dependent_options::copy_from_options): Set incremental
8543         dispositions.
8544         * options.cc (General_options::parse_incremental_changed): New
8545         function.
8546         (General_options::parse_incremental_unchanged): New function.
8547         (General_options::parse_incremental_unknown): New function.
8548         (General_options::General_options): Initialize new fields
8549         incremental_disposition_ and implicit_incremental_.
8550         (General_options::finalize): Check for uasge of --incremental-*
8551         without --incremental.
8552
8553 2009-02-06  Chris Demetriou  <cgd@google.com>
8554
8555         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8556         pointer and to report location as the file name associated with
8557         the symbol.
8558         (gold_undefined_symbol_at_location): New function to replace the
8559         old gold_undefined_symbol functionality.
8560         * target-reloc.h (relocate_section): Update to use
8561         gold_undefined_symbol_at_location.
8562         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8563         Call gold_undefined_symbol function rather than gold_error.
8564         * errors.h (Errors::undefined_symbol): Take location as a
8565         string, rather than calculating it from a relocation.
8566         * errors.cc (Errors::fatal): Print "fatal error:" before the
8567         formatted message.
8568         (Errors::error, Errors::error_at_location): Print "error: "
8569         before the formatted message.
8570         (Errors::undefined_symbol): Take location as a string, rather
8571         than calculating it from a relocation.
8572         (gold_undefined_symbol_at_location): New function akin to
8573         old gold_undefined_symbol, calculates location from relocation.
8574         (gold_undefined_symbol): Change to take only a Symbol pointer
8575         and to report location as the file name associated with the symbol.
8576         * testsuite/debug_msg.sh: Update for changed error messages.
8577         * testsuite/undef_symbol.sh: Likewise.
8578
8579 2009-02-04  Duncan Sands  <baldrick@free.fr>
8580
8581         PR 9812
8582         * reduced_debug_output.h
8583         (Output_reduced_debug_abbrev_section::failed): Use format for
8584         gold_warning.
8585         (Output_reduced_debug_info_section::faild): Likewise.
8586
8587 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8588
8589         * script.cc (Lazy_demangler): New class.
8590         (Version_script_info::get_symbol_version_helper): Demangle a
8591         symbol only once.
8592
8593 2009-01-29  Cary Coutant  <ccoutant@google.com>
8594
8595         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8596         to __tls_get_addr.
8597         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8598
8599 2009-01-28  Ian Lance Taylor  <iant@google.com>
8600
8601         * version.cc (version_string): Bump to 1.9.
8602
8603         * gold.h: Include <cstring> and <stdint.h>.
8604         * version.cc: Include <cstdio>.
8605         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8606         warning.
8607         * reduced_debug_output.cc (insert_into_vector): Rename from
8608         Insert_into_vector; change all callers.  Use Swap_unaligned to
8609         avoid aliasing issue; remove union since it is unnecessary.
8610
8611 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8612
8613         * Makefile.am (CCFILES): Add gc.cc.
8614         (HFILES): Add gc.h.
8615         * Makefile.in: Regenerate.
8616         * gold.cc (Gc_runner): New class.
8617         (queue_initial_tasks): Call garbage collection related tasks
8618         when corresponding options are invoked.
8619         (queue_middle_gc_tasks): New function.
8620         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8621         processed early before laying out sections during garbage collection.
8622         * gold.h (queue_middle_gc_tasks): New function.
8623         (is_prefix_of): Move from "layout.cc".
8624         * i386.cc (Target_i386::gc_process_relocs): New function.
8625         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8626         * main.cc (main): Create object of class "Garbage_collection".
8627         * object.cc (Relobj::copy_symbols_data): New function.
8628         (Relobj::is_section_name_included): New function.
8629         (Sized_relobj::do_layout): Allow this function to be called twice
8630         during garbage collection and defer layout of section during the
8631         first call.
8632         * object.h (Relobj::get_symbols_data): New function.
8633         (Relobj::is_section_name_included): New function.
8634         (Relobj::copy_symbols_data): New function.
8635         (Relobj::set_symbols_data): New function.
8636         (Relobj::get_relocs_data): New function.
8637         (Relobj::set_relocs_data): New function.
8638         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8639         (Relobj::gc_process_relocs): New function.
8640         (Relobj::do_gc_process_relocs): New pure virtual function.
8641         (Relobj::sd_): New data member.
8642         (Sized_relobj::is_output_section_offset_invalid): New function.
8643         (Sized_relobj::do_gc_process_relocs): New function.
8644         * options.h (General_options::gc_sections): Modify to not be a no-op.
8645         (General_options::print_gc_sections): New option.
8646         * plugin.cc (Plugin_finish::run): Remove function call to
8647         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8648         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8649         * reloc.cc (Read_relocs::run): Add task to process relocs and
8650         determine unreferenced sections when doing garbage collection.
8651         (Gc_process_relocs): New class.
8652         (Sized_relobj::do_gc_process_relocs): New function.
8653         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8654         sections that are garbage collected.
8655         * reloc.h (Gc_process_relocs): New class.
8656         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8657         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8658         symbols whose corresponding sections are garbage collected.
8659         (Symbol_table::Symbol_table): Add new parameter for the garbage
8660         collection object.
8661         (Symbol_table::gc_mark_undef_symbols): New function.
8662         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8663         (Symbol_table::gc_mark_dyn_syms): New function.
8664         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8665         as garbage.
8666         (Symbol_table::add_from_object): Likewise.
8667         (Symbol_table::add_from_relobj): When building shared objects, do not
8668         treat externally visible symbols as garbage.
8669         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8670         table information for static and relocatable links.
8671         * symtab.h (Symbol_table::set_gc): New function.
8672         (Symbol_table::gc): New function.
8673         (Symbol_table::gc_mark_undef_symbols): New function.
8674         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8675         (Symbol_table::gc_mark_dyn_syms): New function.
8676         (Symbol_table::gc_): New data member.
8677         * target.h (Sized_target::gc_process_relocs): New pure virtual
8678         function.
8679         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8680         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8681
8682 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8683
8684         * options.h (General_options::gc_sections): Define as a no-op for now.
8685         (General_options::no_keep_memory): Ditto.
8686         (General_options::Bshareable): Define.
8687         * options.cc (General_options::finalize): Honor -Bshareable.
8688
8689 2009-01-20  Andreas Schwab  <schwab@suse.de>
8690
8691         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8692         read the value in the contents, since we don't use it.  Use the
8693         template endianness when writing.
8694         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8695
8696 2009-01-19  Andreas Schwab  <schwab@suse.de>
8697
8698         * configure.tgt (powerpc64-*): Fix targ_obj.
8699
8700 2009-01-15  Ian Lance Taylor  <iant@google.com>
8701
8702         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8703         local symbols when stripping all symbols.
8704
8705 2009-01-14  Cary Coutant  <ccoutant@google.com>
8706
8707         * output.cc (Output_reloc): Add explicit instantiations.
8708
8709 2009-01-14  Cary Coutant  <ccoutant@google.com>
8710
8711         * archive.cc (Archive::get_elf_object_for_member): Remove call
8712         to File_read::claim_for_plugin.
8713         * descriptors.cc (Descriptors::open): Remove reference to
8714         is_claimed.
8715         (Descriptors::claim_for_plugin): Remove.
8716         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8717         (Descriptors::is_claimed): Remove.
8718         (claim_descriptor_for_plugin): Remove.
8719         * fileread.cc (File_read::claim_for_plugin): Remove.
8720         * fileread.h (File_read::claim_for_plugin): Remove.
8721         (File_read::descriptor): Reopen descriptor if necessary.
8722         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8723         (Plugin_manager::all_symbols_read): Add task parameter. Change
8724         all callers.
8725         (Plugin_manager::get_input_file): New function.
8726         (Plugin_manager::release_input_file): New function.
8727         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8728         corresponding data member.
8729         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8730         and pass to base constructor. Change all callers.
8731         (get_input_file, release_input_file): New functions.
8732         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8733         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8734         (Plugin_manager::all_symbols_read): Add task parameter.
8735         (Plugin_manager::get_input_file): New function.
8736         (Plugin_manager::release_input_file): New function.
8737         (Plugin_manager::task_): New data member.
8738         (Pluginobj::Pluginobj): Add filesize parameter.
8739         (Pluginobj::filename): New function.
8740         (Pluginobj::descriptor): New function.
8741         (Pluginobj::filesize): New function.
8742         (Pluginobj::filesize_): New data member.
8743         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8744         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8745         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8746
8747         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8748         with archive libraries.
8749         * testsuite/Makefile.in: Regenerate.
8750         * testsuite/plugin_test.c (struct sym_info): New type.
8751         (get_input_file, release_input_file): New static variables.
8752         (onload): Capture new transfer vector entries.
8753         (claim_file_hook): Stop reading at end of file according to filesize.
8754         Factor out parsing of readelf output into separate function.
8755         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8756         APIs and get the source file name from the symbol table.  Convert
8757         source file name to corresponding object file name.  Print info
8758         message when adding new input files.
8759         (parse_readelf_line): New function.
8760         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8761         * testsuite/plugin_test_2.sh: Likewise.
8762         * testsuite/plugin_test_3.sh: Likewise.
8763         * testsuite/plugin_test_4.sh: New test case.
8764
8765 2009-01-07  Ian Lance Taylor  <iant@google.com>
8766
8767         * version.cc (version_string): Bump to 1.8.
8768
8769 2008-12-23  Cary Coutant  <ccoutant@google.com>
8770
8771         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8772         * plugin.cc (Plugin_manager::finish): Rename as
8773         layout_deferred_objects.  Move cleanup to separate function.
8774         (Plugin_manager::cleanup): New function.
8775         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8776         separately.
8777         * plugin.h (Plugin_manager::finish): Rename as
8778         layout_deferred_objects.
8779         (Plugin_manager::cleanup): New function.
8780         (Plugin_manager::cleanup_done): New field.
8781
8782 2008-12-23  Cary Coutant  <ccoutant@google.com>
8783
8784         * plugin.cc (is_visible_from_outside): New function.
8785         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8786         so we don't return "IR only" status for exported symbols or -r links.
8787
8788         * testsuite/Makefile.am (plugin_test_3): New test case.
8789         * testsuite/Makefile.in: Regenerate.
8790         * testsuite/plugin_test_3.sh: New file.
8791
8792 2008-12-22  Cary Coutant  <ccoutant@google.com>
8793
8794         * object.cc (Sized_relobj::layout_section): New function.
8795         (Sized_relobj::do_layout): Defer layout of input sections until after
8796         plugin has provided replacement files.
8797         (Sized_relobj::do_layout_deferred_sections): New function.
8798         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8799         (Relobj::layout_deferred_sections): New function.
8800         (Relobj::do_layout_deferred_sections): New function.
8801         (Sized_relobj::do_layout_deferred_sections): New function.
8802         (Sized_relobj::layout_section): New function.
8803         (Sized_relobj::Deferred_layout): New structure.
8804         (Sized_relobj::deferred_layout_): New field.
8805         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8806         Change all callers.  Layout deferred sections.
8807         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8808         references.
8809         (Plugin_hook::run): Move code from do_plugin_hook inline.
8810         (Plugin_hook::do_plugin_hook): Remove.
8811         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8812         (Plugin_manager::finish): Renamed, was cleanup.
8813         (Plugin_manager::should_defer_layout): New function.
8814         (Plugin_manager::add_deferred_layout_object): New function.
8815         (Plugin_manager::Deferred_layout_list): New type.
8816         (Plugin_manager::deferred_layout_objects_): New field.
8817         (Plugin_hook::do_plugin_hook): Remove.
8818
8819 2008-12-17  Ian Lance Taylor  <iant@google.com>
8820
8821         * options.h (class General_options): Add --no case for
8822         --export-dynamic.
8823
8824 2008-12-16  Cary Coutant  <ccoutant@google.com>
8825
8826         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8827         vector.
8828         (Plugin_manager::claim_file): Create plugin object even if
8829         plugin did not call the add_symbols callback.
8830         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8831         asking for more symbols than were added.
8832         * testsuite/Makefile.am (plugin_test_1): Add test case with
8833         no global symbols.
8834         (empty.syms): New target.
8835         * testsuite/Makefile.in: Regenerate.
8836         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8837         message. Don't call add_symbols if no globals.
8838         (all_symbols_read_hook): Don't provide replacement for empty
8839         claimed file.
8840
8841 2008-12-12  Ian Lance Taylor  <iant@google.com>
8842
8843         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8844         r_type == 0 for a local symbol with r_sym == 0.
8845         (scan_relocatable_relocs): Pass r_sym to
8846         local_non_section_strategy.
8847         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8848         r_sym parameter.
8849
8850         * configure.ac: Update test for TLS descriptors: they are
8851         supported as of glibc 2.9.
8852         * configure: Rebuild.
8853
8854 2008-12-11  Ian Lance Taylor  <iant@google.com>
8855
8856         PR 7091
8857         * target-reloc.h (Default_scan_relocatable_relocs): For each
8858         function, map r_type == 0 to RELOC_DISCARD.
8859
8860 2008-12-10  Cary Coutant  <ccoutant@google.com>
8861
8862         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8863         object to override a kept COMDAT group from a plugin object.
8864
8865 2008-12-09  Ian Lance Taylor  <iant@google.com>
8866
8867         PR 7088
8868         * yyscript.y (file_cmd): Handle INPUT.
8869
8870         * testsuite/initpri1.c: Change all declarations to be full
8871         prototypes by adding void, to avoid compiler warnings.
8872
8873 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8874
8875         * options.cc (General_options::parse_plugin_opt): New.
8876         (General_options::add_plugin): The argument now is just the filename.
8877         (General_options::add_plugin_option): New.
8878         * options.h (plugin_opt): New.
8879         (add_plugin): Change argument name.
8880         (add_plugin_option): New.
8881         * plugin.cc (Plugin::load): Don't parse the plugin option.
8882         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8883         (Plugin::add_option): New.
8884         (Plugin::args_): Change type.
8885         (Plugin::filename_): New.
8886         (Plugin_manager::add_plugin_option): New.
8887         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8888         * testsuite/Makefile.in: Regenerate.
8889
8890 2008-12-05  Cary Coutant  <ccoutant@google.com>
8891
8892         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8893         Handle --strip-lto-sections option.
8894         * options.h (strip_lto_sections): New option.
8895
8896 2008-12-01  Cary Coutant  <ccoutant@google.com>
8897
8898         * plugin.cc (ld_plugin_message): Change format parameter to const.
8899         Fix mismatch between new[] and delete.
8900
8901 2008-11-14  Cary Coutant  <ccoutant@google.com>
8902
8903         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8904         instead of -1U.
8905
8906 2008-11-05  Craig Silverstein  <csilvers@google.com>
8907
8908         * options.cc (General_options::parse_dynamic_list): New function.
8909         * options.h (General_options): New flags dynamic_list,
8910         dynamic_list_data, dynamic_list_cpp_new, and
8911         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8912         (General_options::in_dynamic_list): New function.
8913         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8914         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8915         (Lex::can_continue_name): Likewise.
8916         (yylex): Likewise.
8917         (read_script_file): New parameter script_options.
8918         (read_dynamic_list): New function.
8919         (Script_options::define_dynamic_list): New function.
8920         (dynamic_list_keyword_parsecodes): New variable.
8921         (dynamic_list_keywords): New variable.
8922         * script.h (Script_options::define_dynamic_list): New function
8923         prototype.
8924         (read_dynamic_list): New function prototype.
8925         * symtab.cc (strprefix): New macro.
8926         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8927         dynamic_list_data, dynamic_list_cpp_new, and
8928         dynamic_list_cpp_typeinfo.
8929         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8930         (dynamic_list_expr): New rule.
8931         (dynamic_list_nodes): Likewise.
8932         (dynamic_list_node): Likewise.
8933         * testsuite/Makefile.am (dynamic_list): New test.
8934         * testsuite/Makefile.in: Regenerated.
8935         * testsuite/dynamic_list.t: New file.
8936         * testsuite/dynamic_list.sh: New file.
8937
8938 2008-11-05  Craig Silverstein  <csilvers@google.com>
8939
8940         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8941         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8942         (t11_last): Likewise.
8943         * testsuite/ver_test_6.c (main): Likewise.
8944
8945 2008-10-07  Cary Coutant  <ccoutant@google.com>
8946
8947         * options.c (General_options::finalize): Add check for -static and
8948         -shared.
8949         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8950         is not empty.
8951
8952 2008-10-02  Cary Coutant  <ccoutant@google.com>
8953
8954         * plugin.cc (make_sized_plugin_object): Fix conditional
8955         compilation to work when not all targets are enabled.
8956
8957 2008-09-29  Cary Coutant  <ccoutant@google.com>
8958
8959         * archive.cc (Archive::get_file_and_offset): Use filename instead
8960         of name to get library path.
8961         (Archive::include_member): Unlock external member of a thin archive.
8962
8963         * testsuite/Makefile.am (TEST_AR): New variable.
8964         (thin_archive_test_1): New test.
8965         (thin_archive_test_2): New test.
8966         * testsuite/Makefile.in: Regenerate.
8967         * testsuite/thin_archive_main.cc: New file.
8968         * testsuite/thin_archive_test_1.cc: New file.
8969         * testsuite/thin_archive_test_2.cc: New file.
8970         * testsuite/thin_archive_test_3.cc: New file.
8971         * testsuite/thin_archive_test_4.cc: New file.
8972
8973 2008-09-29  Cary Coutant  <ccoutant@google.com>
8974
8975         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8976         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8977         instead of -1U.
8978         (Sized_relobj::do_finalize_local_symbols): Likewise.
8979         (Sized_relobj::map_to_kept_section): Likewise.
8980         * object.h (Sized_relobj::invalid_address): New constant.
8981         (Sized_relobj::do_output_section_offset): Check for invalid_address
8982         and return -1ULL.
8983         * output.cc (Output_reloc::local_section_offset): Use constant
8984         invalid_address instead of -1U.
8985         (Output_reloc::get_address): Likewise.
8986         (Output_section::output_address): Change -1U to -1ULL.
8987         * output.h (Output_reloc::invalid_address): New constant.
8988         * reloc.cc (Sized_relobj::write_sections): Use constant
8989         invalid_address instead of -1U.
8990         (Sized_relobj::relocate_sections): Likewise.
8991         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8992         values for merge sections.
8993         * target-reloc.h (relocate_for_relocatable): Use constant
8994         invalid_address instead of -1U.
8995
8996 2008-09-19  Cary Coutant  <ccoutant@google.com>
8997
8998         Add plugin functionality for link-time optimization (LTO).
8999         * configure.ac (plugins): Add --enable-plugins option.
9000         * configure: Regenerate.
9001         * config.in: Regenerate.
9002         * Makefile.am (LIBDL): New variable.
9003         (CCFILES): Add plugin.cc.
9004         (HFILES): Add plugin.h.
9005         (ldadd_var): Add LIBDL.
9006         * Makefile.in: Regenerate.
9007
9008         * archive.cc: Include "plugin.h".
9009         (Archive::setup): Don't preread archive symbols when using a plugin.
9010         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9011         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9012         files.
9013         (Archive::include_member): Add symbols from plugin objects.
9014         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9015         * descriptors.cc (Descriptors::open): Check for file descriptors
9016         abandoned by plugins.
9017         (Descriptors::claim_for_plugin): New function.
9018         * descriptors.h (Descriptors::claim_for_plugin): New function.
9019         (Open_descriptor::is_claimed): New field.
9020         (claim_descriptor_for_plugin): New function.
9021         * fileread.cc (File_read::claim_for_plugin): New function.
9022         * fileread.h (File_read::claim_for_plugin): New function.
9023         (File_read::descriptor): New function.
9024         * gold.cc: Include "plugin.h".
9025         (queue_initial_tasks): Add task to call plugin hooks for generating
9026         new object files.
9027         * main.cc: Include "plugin.h".
9028         (main): Load plugin libraries.
9029         * object.h (Pluginobj): Declare.
9030         (Object::pluginobj): New function.
9031         (Object::do_pluginobj): New function.
9032         (Object::set_target): New function.
9033         * options.cc: Include "plugin.h".
9034         (General_options::parse_plugin): New function.
9035         (General_options::General_options): Initialize plugins_ field.
9036         (General_options::add_plugin): New function.
9037         * options.h (Plugin_manager): Declare.
9038         (General_options): Add --plugin option.
9039         (General_options::has_plugins): New function.
9040         (General_options::plugins): New function.
9041         (General_options::add_plugin): New function.
9042         (General_options::plugins_): New field.
9043         * plugin.cc: New file.
9044         * plugin.h: New file.
9045         * readsyms.cc: Include "plugin.h".
9046         (Read_symbols::do_read_symbols): Check for archive before checking
9047         for ELF file.  Call plugin hooks to claim files.
9048         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9049         from a real object file; force override when processing replacement
9050         files.
9051         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9052         (Symbol::init_base_object): Likewise.
9053         (Symbol::init_base_output_data): Likewise.
9054         (Symbol::init_base_output_segment): Likewise.
9055         (Symbol::init_base_constant): Likewise.
9056         (Symbol::init_base_undefined): Likewise.
9057         (Symbol::output_section): Assert that object is not a plugin.
9058         (Symbol_table::add_from_pluginobj): New function.
9059         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9060         undefined.
9061         (Symbol_table::sized_write_globals): Likewise.
9062         (Symbol_table::add_from_pluginobj): Instantiate template.
9063         * symtab.h (Sized_pluginobj): Declare.
9064         (Symbol::in_real_elf): New function.
9065         (Symbol::set_in_real_elf): New function.
9066         (Symbol::in_real_elf_): New field.
9067         (Symbol_table::add_from_pluginobj): New function.
9068
9069         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9070         (LIBDL): New variable.
9071         (LDADD): Add LIBDL.
9072         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9073         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9074         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9075         (MOSTLYCLEANFILES): Likewise.
9076         * testsuite/Makefile.in: Regenerate.
9077         * testsuite/plugin_test.c: New file.
9078         * testsuite/plugin_test_1.sh: New file.
9079         * testsuite/plugin_test_2.sh: New file.
9080
9081 2008-09-16  Ian Lance Taylor  <iant@google.com>
9082
9083         * target-reloc.h (relocate_section): Check whether a symbol is
9084         defined by the ABI before reporting an undefined symbol error.
9085         * target.h (Target::is_defined_by_abi): Make parameter const.
9086         (Target::do_is_defined_by_abi): Likewise.
9087         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9088         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9089         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9090         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9091         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9092         * testsuite/Makefile.in: Rebuild.
9093
9094         * fileread.cc (make_view): Add casts to avoid warning.
9095
9096 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9097
9098         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9099         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9100
9101 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9102
9103         * options.h (General_options::output_is_executable): New.
9104         (General_options::output_is_pie): New.
9105         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9106         for shared libraries.
9107         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9108
9109 2008-09-11  Chris Demetriou  <cgd@google.com>
9110
9111         * options.h (origin): New -z option.
9112         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9113         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9114         in DT_FLAGS_1.
9115
9116 2008-09-05  Cary Coutant  <ccoutant@google.com>
9117
9118         * fileread.cc (File_read::make_view): Add check for attempt to map
9119         beyond end of file.
9120
9121 2008-09-05  Cary Coutant  <ccoutant@google.com>
9122
9123         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9124         explicit instantiations.
9125
9126 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9127
9128         PR gold/6858
9129         * options.cc (General_options::finalize): Allow undefined symbols
9130         in shlibs if linking -shared.
9131
9132         PR gold/6859
9133         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9134         symbols as not needing a dynsym entry.
9135
9136 2008-08-20  Craig Silverstein  <csilvers@google.com>
9137
9138         * fileread.cc (File_read::open): Do not lock the file unless it
9139         was successfully opened.
9140
9141 2008-08-14  Cary Coutant  <ccoutant@google.com>
9142
9143         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9144         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9145         * testsuite/tls_test.cc (struct int128): 128-bit struct
9146         for testing TLS relocs with non-zero addend.
9147         (v12): New TLS variable.
9148         (t12): New test.
9149         (t_last): Add check for v12.
9150         * testsuite/tls_test.h (t12): New function.
9151         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9152
9153 2008-08-13  Ian Lance Taylor  <iant@google.com>
9154
9155         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9156         set tls_segment_ or relro_segment_.
9157         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9158         when appropriate.
9159         * output.h (Output_section::clear_is_relro): New function.
9160         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9161         sections specially even when output_data_ is empty.
9162         (Output_segment::maximum_alignment): When first section is relro,
9163         only force alignment for PT_LOAD segments.
9164         * script.cc (script_data_segment_align): New function.
9165         (script_data_segment_relro_end): New function.
9166         * script-c.h (script_data_segment_align): Declare.
9167         (script_data_segment_relro_end): Declare.
9168         * script-sections.h (class Script_sections): Declare
9169         data_segment_align and data_segment_relro_end.  Add fields
9170         segment_align_index_ and saw_relro_end_.
9171         * script-sections.cc (class Sections_element): Add set_is_relro
9172         virtual function.  Add new bool* parameter to place_orphan_here.
9173         Add get_output_section virtual function.
9174         (class Output_section_definition): Add set_is_relro.  Add new
9175         bool* parameter to place_orphan_here.  Add get_output_section.
9176         Add is_relro_ field.
9177         (Output_section_definition::Output_section_definition): Initialize
9178         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9179         and is_relro_ fields.
9180         (Output_section_definition::place_orphan_here): Add is_relro
9181         parameter.
9182         (Output_section_definition::set_section_addresses): Set relro for
9183         output section.
9184         (Output_section_definition::alternate_constraint): Likewise.
9185         (class Orphan_output_section): Add new bool* parameter to
9186         place_orphan_here.  Add get_output_section.
9187         (Orphan_output_section::place_orphan_here): Add is_relro
9188         parameter.
9189         (Script_sections::Script_sections): Initialize
9190         data_segment_align_index_ and saw_relro_end_.
9191         (Script_sections::data_segment_align): New function.
9192         (Script_sections::data_segment_relro_end): New function.
9193         (Script_sections::place_orphan): Set or clear is_relro.
9194         (Script_sections::set_section_addresses): Force alignment of first
9195         TLS section.
9196         * yyscript.y (exp): Call script_data_segment_align and
9197         script_data_segment_relro_end.
9198         * testsuite/relro_script_test.t: New file.
9199         * testsuite/relro_test.cc (using_script): Declare.
9200         (t1, t2): Test using_script.
9201         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9202         (relro_script_test_SOURCES): Define.
9203         (relro_script_test_DEPENDENCIES): Define.
9204         (relro_script_test_LDFLAGS): Define.
9205         (relro_script_test_LDADD): Define.
9206         (relro_script_test.so): New target.
9207         * testsuite/Makefile.in: Rebuild.
9208
9209 2008-08-06  Cary Coutant <ccoutant@google.com>
9210
9211         * archive.cc (Archive::total_archives, Archive::total_members)
9212         (Archive::total_members_loaded): New variables.
9213         (Archive::setup): Add parameter.  Add option to preread
9214         archive symbols.
9215         (Archive::read_armap): Add counter.
9216         (Archive::get_file_and_offset): New function.
9217         (Archive::get_elf_object_for_member): New function.
9218         (Archive::read_all_symbols): New function.
9219         (Archive::read_symbols): New function.
9220         (Archive::add_symbols): Add counters.
9221         (Archive::include_all_members): Use armap to find members if it's
9222         already built.
9223         (Archive::include_member): Skip reading symbols if already read.
9224         Factored code into Archive::get_file_and_offset and
9225         Archive::get_elf_object_for_member.  Changed call to
9226         Mapfile::report_include_archive_member.
9227         (Archive::print_stats): New function.
9228         * archive.h: Declare Object and Read_symbols_data classes.
9229         (Archive::Archive): Add initializers for new members.
9230         (Archive::setup): Add parameter.
9231         (Archive::print_stats): New function.
9232         (Archive::total_archives, Archive::total_members)
9233         (Archive::total_members_loaded): New variables.
9234         (Archive::get_file_and_offset): New function.
9235         (Archive::get_elf_object_for_member): New function.
9236         (Archive::read_all_symbols): New function.
9237         (Archive::read_symbols): New function.
9238         (Archive::Archive_member): New class.
9239         (Archive::members_): New member.
9240         (Archive::num_members_): New member.
9241         * main.cc: Include archive.h.
9242         (main): Call Archive::print_stats.
9243         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9244         archive parameter; member_name is now the fully-decorated name.
9245         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9246         * options.h: (General_options): Add --preread-archive-symbols option.
9247         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9248         Archive::setup.
9249
9250 2008-08-04  Ian Lance Taylor  <iant@google.com>
9251
9252         * symtab.h (Symbol::use_plt_offset): New function.
9253         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9254         * powerpc.cc (Relocate::relocate): Likewise.
9255         * sparc.cc (Relocate::relocate): Likewise.
9256         * x86_64.cc (Relocate::relocate): Likewise.
9257         * testsuite/weak_plt.sh: New test.
9258         * testsuite/weak_plt_main.cc: New test.
9259         * testsuite/weak_plt_shared.cc: New test.
9260         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9261         (check_PROGRAMS): Add weak_plt.
9262         (check_DATA): Add weak_plt_shared.so.
9263         (weak_plt_main_pic.o, weak_plt): New targets.
9264         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9265         * testsuite/Makefile.in: Rebuild.
9266
9267         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9268         gcctestdir/ld.
9269         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9270         * testsuite/Makefile.in: Rebuild.
9271
9272 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9273
9274         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9275         * Makefile.in: Regenerate.
9276         * po/POTFILES.in: Regenerate.
9277
9278 2008-07-29  Ian Lance Taylor  <iant@google.com>
9279
9280         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9281         symbols before other symbols.
9282         * testsuite/script_test_2.cc (test_addr): Declare.
9283         (test_addr_alias): Declare.
9284         (main): Check that test_addr and test_addr_alias have the right
9285         values.
9286         * testsuite/script_test_2.t: Define test_addr_alias and
9287         test_addr.
9288
9289 2008-07-24  Ian Lance Taylor  <iant@google.com>
9290
9291         PR 5990
9292         * descriptors.cc: New file.
9293         * descriptors.h: New file.
9294         * gold-threads.h (class Hold_optional_lock): New class.
9295         * fileread.cc: Include "descriptors.h".
9296         (File_read::~File_read): Release descriptor rather than closing
9297         it.
9298         (File_read::open) [file]: Call open_descriptor rather than open.
9299         Set is_descriptor_opened_.
9300         (File_read::open) [memory]: Assert that descriptor is not open.
9301         (File_read::reopen_descriptor): New function.
9302         (File_read::release): Release descriptor.
9303         (File_read::do_read): Make non-const.  Reopen descriptor.
9304         (File_read::read): Make non-const.
9305         (File_read::make_view): Reopen descriptor.
9306         (File_read::do_readv): Likewise.
9307         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9308         Update declarations.
9309         * layout.cc: Include "descriptors.h".
9310         (Layout::create_build_id): Use open_descriptor rather than open.
9311         * output.cc: Include "descriptors.h".
9312         (Output_file::open): Use open_descriptor rather than open.
9313         * archive.cc (Archive::const_iterator): Change Archive to be
9314         non-const.
9315         (Archive::begin, Archive::end): Make non-const.
9316         (Archive::count_members): Likewise.
9317         * archive.h (class Archive): Update declarations.
9318         * object.h (Object::read): Make non-const.
9319         * Makefile.am (CCFILES): Add descriptors.cc.
9320         (HFILES): Add descriptors.h.
9321         * Makefile.in: Rebuild.
9322
9323         PR 6716
9324         * gold.h: Always include <clocale>.  Add Solaris workarounds
9325         following code in binutils/sysdep.h.
9326
9327         PR 6048
9328         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9329         this->eh_frame_hdr_ is NULL before using it.
9330
9331         * dynobj.cc (Versions::Versions): Update comment.
9332
9333         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9334         the base version name.
9335
9336         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9337         array size plus one.
9338         (Stringpool_template::set_string_offsets): Subtract one from key
9339         before using it as an array index.
9340         (Stringpool_template::get_offset_with_length): Likewise.
9341         (Stringpool_template::write_to_buffer): Likewise.
9342         * stringpool.h (Stringpool_template::get_offset_from_key):
9343         Likewise.
9344
9345 2008-07-23  Ian Lance Taylor  <iant@google.com>
9346
9347         PR 6658
9348         * object.h (Merged_symbol_value::value): Do our best to handle a
9349         negative addend.
9350
9351         PR 6647
9352         * script.cc (Version_script_info::get_versions): Don't add empty
9353         version tag to return value.
9354         (Version_script_info::get_symbol_version_helper): Change return
9355         type to bool.  Add pversion parameter.  Change all callers.
9356         (script_register_vers_node): Don't require a non-NULL tag.
9357         * script.h (class Version_script_info): Update declarations.
9358         (Version_script_info::get_symbol_version): Change return type to
9359         bool.  Add version parameter.  Change all callers.
9360         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9361         handling.  Handle an empty version from a version script.
9362         (Symbol_table::define_special_symbol): Likewise.
9363         * testsuite/ver_test_10.script: New file.
9364         * testsuite/ver_test_10.sh: New file.
9365         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9366         (check_DATA): Add ver_test_10.syms.
9367         (ver_test_10.syms, ver_test_10.so): New target.
9368         * testsuite/Makefile.in: Rebuild.
9369
9370 2008-07-23  Simon Baldwin  <simonb@google.com>
9371
9372         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9373         to zero for undefined symbols from dynamic libraries.
9374
9375 2008-07-23  Ian Lance Taylor  <iant@google.com>
9376
9377         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9378         Change all callers.
9379         * symtab.h (class Symbol_table): Update declaration.
9380         * testsuite/ver_test_9.cc: New file.
9381         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9382         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9383         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9384         (ver_test_9.so, ver_test_9.o): New targets.
9385         * testsuite/Makefile.in: Rebuild.
9386
9387 2008-07-22  Ian Lance Taylor  <iant@google.com>
9388
9389         * options.h (class General_options): Define --check-sections.
9390         * layout.cc (Layout::set_segment_offsets): Handle
9391         --check-sections.
9392
9393         * options.h (class General_options): Define -n/--nmagic and
9394         -N/--omagic.
9395         * options.cc (General_options::finalize): For -n/--nmagic or
9396         -N/--omagic, set -static.
9397         * layout.cc (Layout::attach_allocated_section_to_segment): If
9398         -N/--omagic, don't put read-only and read-write sections in
9399         different segments.
9400         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9401         finding a read-only segment.
9402         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9403         don't set the minimum segment alignment to the common page size,
9404         and don't set the file offset to the address modulo the page size.
9405         * script-sections.cc (Script_sections::create_segments): If
9406         -n/--omagic, don't put read-only and read-write sections in
9407         different segments.
9408
9409         * cref.cc: New file.
9410         * cref.h: New file.
9411         * options.h (class General_options): Add --print-symbol-counts.
9412         * main.cc (main): Issue defined symbol report if requested.
9413         * archive.cc (Archive::interpret_header): Make into a const member
9414         function.
9415         (Archive::add_symbols): Call Input_objects::archive_start and
9416         archive_stop.
9417         (Archive::const_iterator): Define new class.
9418         (Archive::begin, Archive::end): New functions.
9419         (Archive::include_all_members): Rewrite to use iterator.
9420         (Archive::count_members): New function.
9421         * archive.h (class Archive): Update declarations.
9422         (Archive::filename): New function.
9423         * object.cc: Include "cref.h".
9424         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9425         (Sized_relobj::do_get_global_symbol_counts): New function.
9426         (Input_objects::add_object): Add object to cross-referencer.
9427         (Input_objects::archive_start): New function.
9428         (Input_objects::archive_stop): New function.
9429         (Input_objects::print_symbol_counts): New function.
9430         * object.h: Declare Cref and Archive.
9431         (Object::get_global_symbol_counts): New function.
9432         (Object::do_get_global_symbol_counts): New pure virtual function.
9433         (class Sized_relobj): Add defined_count_ field.  Update
9434         declarations.
9435         (class Input_objects): Add cref_ field.  Update constructor.
9436         Update declarations.
9437         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9438         defined_count_.
9439         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9440         symbol counts.
9441         (Sized_dynobj::do_get_global_symbol_counts): New function.
9442         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9443         defined_count_.  Update declarations.  Define Symbols typedef.
9444         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9445         parameter.  Change all callers.
9446         (Symbol_table::add_from_dynobj): Add sympointers and defined
9447         parameters.  Change all callers.
9448         * symtab.h (class Symbol_table): Update declarations.
9449         * Makefile.am (CCFILES): Add cref.cc.
9450         (HFILES): Add cref.h.
9451         * Makefile.in: Rebuild.
9452
9453 2008-07-22  Simon Baldwin  <simonb@google.com>
9454
9455         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9456         to zero when writing undefined symbols.
9457
9458 2008-07-22  Ian Lance Taylor  <iant@google.com>
9459
9460         * output.cc (Output_section::add_input_section): Don't try to
9461         merge empty merge sections.
9462
9463 2008-07-21  Craig Silverstein  <csilvers@google.com>
9464
9465         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9466         Include symbol version in error message.
9467
9468 2008-07-20  Chris Demetriou  <cgd@google.com>
9469
9470         * configure.ac (gold_cv_c_random_seed): New configured variable.
9471         (RANDOM_SEED_CFLAGS): New substituted variable.
9472         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9473         * configure: Rebuild.
9474         * Makefile.in: Likewise.
9475         * testsuite/Makefile.in: Likewise.
9476
9477 2008-07-18  Ian Lance Taylor  <iant@google.com>
9478
9479         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9480         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9481         * testsuite/ver_test_main.cc (main): Call t4.
9482         (t4, t4_2a): Define.
9483         * testsuite/ver_test_2.cc (t4_2): Define.
9484         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9485         * testsuite/ver_test_4.cc (t4_2a): Define.
9486         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9487         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9488
9489 2008-07-17  Ian Lance Taylor  <iant@google.com>
9490
9491         * dynobj.cc (Versions::add_def): If we give an error about a
9492         missing version, go ahead and create the version anyhow.
9493
9494 2008-07-10  Ian Lance Taylor  <iant@google.com>
9495
9496         Handle output sections with more than 0x7fffffff bytes.
9497         * object.h (class Relobj): Change map_to_output_ to
9498         output_sections_, and just keep a section pointer.  Change all
9499         uses.  Move comdat group support to Sized_relobj.
9500         (Relobj::is_section_specially_mapped): Remove.
9501         (Relobj::output_section): Remove poff parameter.  Change all
9502         callers.
9503         (Relobj::output_section_offset): New function.
9504         (Relobj::set_section_offset): Rewrite.
9505         (Relobj::map_to_output): Remove.
9506         (Relobj::output_sections): New function.
9507         (Relobj::do_output_section_offset): New pure virtual function.
9508         (Relobj::do_set_section_offset): Likewise.
9509         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9510         group support from Relobj.  Update declarations.
9511         (Sized_relobj::get_output_section_offset): New function.
9512         (Sized_relobj::do_output_section_offset): New function.
9513         (Sized_relobj::do_set_section_offset): New function.
9514         * object.cc (Relobj::output_section_address): Remove.
9515         (Sized_relobj::Sized_relobj): Initialize new fields.
9516         (Sized_relobj::include_section_group): Cast find_kept_object to
9517         Sized_relobj.
9518         (Sized_relobj::include_linkonce_section): Likewise.
9519         (Sized_relobj::do_layout): Use separate arrays for output section
9520         and output offset.
9521         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9522         output_sections.
9523         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9524         output_sections and section_offsets.
9525         (Sized_relobj::write_local_symbols): Likewise.
9526         (map_to_kept_section): Compute output address directly.
9527         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9528         output_sections and section_offsets.
9529         (Sized_relobj::write_sections): Likewise.
9530         (Sized_relobj::relocate_sections): Likewise.
9531         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9532         * output.h (class Output_reloc): Update declarations.  Change
9533         u2_.relobj to Sized_relobj*.
9534         (class Output_data_reloc): Change add functions to use
9535         Sized_relobj*.
9536         * output.cc (Output_reloc::Output_reloc): Change relobj to
9537         Sized_relobj*.
9538         (Output_reloc::local_section_offset): Change return type to
9539         Elf_Addr.  Use get_output_section_offset.
9540         (Output_reloc::get_address): Likewise.
9541         (Output_section::is_input_address_mapped): Don't call
9542         is_section_specially_mapped.
9543         (Output_section::output_offset): Likewise.
9544         (Output_section::output_address): Likewise.
9545         (Output_section::starting_output_address): Likewise.
9546         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9547         parameter to Sized_relobj*.
9548         (Copy_relocs::need_copy_reloc): Likewise.
9549         (Copy_relocs::save): Likewise.
9550         * copy-relocs.h (class Copy_relocs): Update declarations.
9551         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9552         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9553         * target-reloc.h (relocate_for_relocatable): Change
9554         offset_in_output_section type to Elf_Addr.  Change code that uses
9555         it as well.
9556         * layout.cc (Layout::layout): Always set *off.
9557         * mapfile.cc (Mapfile::print_input_section): Use
9558         output_section_offset.
9559         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9560         Sized_relobj*.
9561         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9562         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9563         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9564
9565 2008-07-03  Ian Lance Taylor  <iant@google.com>
9566
9567         * layout.cc (Layout::include_section): Do not discard unrecognized
9568         SHT_STRTAB sections.
9569
9570 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9571
9572         * script.cc (Lex::can_continue_name): Make '?' allowable in
9573         version-script names.
9574         * testsuite/version_script.map: Change glob pattern to use '?'
9575
9576 2008-06-30  Manish Singh  <yosh@gimp.org>
9577
9578         PR 6585
9579         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9580         Correct typo.
9581
9582 2008-06-30  Ian Lance Taylor  <iant@google.com>
9583
9584         PR 6660
9585         PR 6682
9586         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9587         versions]: Don't try to read the value in the contents, since we
9588         don't use it.  Use the template endianness when writing.
9589
9590 2008-06-25  Cary Coutant  <ccoutant@google.com>
9591
9592         * fileread.cc (File_read::make_view): Assert on zero-length view.
9593         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9594         symbol table when there are no symbols to read.
9595
9596 2008-06-23  Craig Silverstein  <csilvers@google.com>
9597
9598         * version.cc (version_string): Bump to 1.7
9599
9600 2008-06-18  Craig Silverstein  <csilvers@google.com>
9601
9602         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9603         constant 0xFFFF to type Valtype.
9604         (Powerpc_relocate_functions::rel16_ha): Likewise.
9605
9606 2008-06-17  Ian Lance Taylor  <iant@google.com>
9607
9608         * output.h (Output_section::Input_section): Initialize p2align_ to
9609         zero for Output_section_data constructors.
9610         (Output_section::Input_section::addralign): If not an input
9611         section, return the alignment of the Output_section_data.
9612         * testsuite/copy_test.cc: New file.
9613         * testsuite/copy_test_1.cc: New file.
9614         * testsuite/copy_test_2.cc: New file.
9615         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9616         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9617         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9618         (copy_test_1_pic.o, copy_test_1.so): New targets.
9619         (copy_test_2_pic.o, copy_test_2.so): New targets.
9620         * testsuite/Makefile.in: Rebuild.
9621
9622         * script-sections.cc (Script_sections::place_orphan): Initialize
9623         local variable exact.
9624
9625 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9626
9627         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9628
9629 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9630             David S. Miller  <davem@davemloft.net>
9631
9632         * powerpc.cc: New file.
9633         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9634         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9635         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9636         * Makefile.in: Rebuild.
9637
9638 2008-06-09  Ian Lance Taylor  <iant@google.com>
9639
9640         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9641         <exception>.
9642         (throwing, orig_terminate): New static variables.
9643         (terminate_handler): New static function.
9644         (t2): Set terminate handler.
9645
9646 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9647
9648         PR 6584
9649         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9650         alignment.
9651
9652 2008-05-30  Cary Coutant  <ccoutant@google.com>
9653
9654         * archive.cc (Archive::include_all_members) Correct to step
9655         over symbol table and extended name table in thin archives.
9656
9657 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9658
9659         PR 6407
9660         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9661         calculation.
9662
9663 2008-05-28  Caleb Howe  <cshowe@google.com>
9664
9665         * reduced_debug_output.cc: New file.
9666         * reduced_debug_output.h: New file.
9667         * options.h (class General_options): Add --strip-debug-non-line.
9668         * options.cc (General_options::finalize): Add strip_debug_non_line
9669         to the strip heirarchy.
9670         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9671         fields.
9672         * layout.cc: Include "reduced_debug_output.h".
9673         (Layout::Layout): Initialize new fields.
9674         (line_only_debug_sections): New static array.
9675         (is_lines_only_debug_sections): New static inline function.
9676         (Layout::include_section): Handle --strip-debug-non-line.
9677         (Layout::make_output_section): If --strip-debug-non-line, build
9678         new output sections for .debug_abbrev and .debug_info.
9679         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9680         gold.  Warn about possible overflow.
9681         (read_signed_LEB_128): Likewise.
9682         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9683         (read_signed_LEB_128): Declare.
9684         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9685         (HFILES): Add reduced_debug_output.h.
9686         * Makefile.in: Rebuild.
9687
9688 2008-05-21  Ian Lance Taylor  <iant@google.com>
9689
9690         * mapfile.cc: New file.
9691         * mapfile.h: New file.
9692         * options.h (class General_options): Add -M/--print-map and -Map.
9693         * options.cc (General_options::finalize): Make -M equivalent to
9694         -Map -.
9695         * main.cc: Include <cstdio> and "mapfile.h".
9696         (main): Open mapfile if requested.
9697         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9698         constructor.  Change caller.
9699         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9700         (queue_middle_tasks): Likewise.
9701         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9702         declarations.
9703         * archive.cc: Include "mapfile.h".
9704         (Archive::add_symbols): Add mapfile parameter.  Change all
9705         callers.  Pass mapfile, symbol, and reason to include_member.
9706         (Archive::include_all_members): Add mapfile parameter.  Change all
9707         callers.
9708         (Archive::include_member): Add mapfile, sym, and why parameters.
9709         Change all callers.  Report inclusion to map file.
9710         * archive.h: Include "fileread.h".
9711         (class Archive): Update declarations.
9712         (Archive::file): New const method.
9713         (class Add_archive_symbols): Add mapfile_ field.  Update
9714         constructor.  Change all callers.
9715         * readsyms.h (class Read_symbols): Likewise.
9716         (class Finish_group): Likewise.
9717         (class Read_script): Likewise.
9718         * common.cc: Include "mapfile.h".
9719         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9720         all callers.
9721         (Symbol_table::do_allocate_commons): Likewise.
9722         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9723         symbol allocation to mapfile.
9724         * common.h (class Allocate_commons_task): Add mapfile_ field.
9725         Update constructor.  Change all callers.
9726         * symtab.h (class Symbol_table): Update declarations.
9727         * layout.cc: Include "mapfile.h".
9728         (Layout_task_runner::run): Print information to mapfile.
9729         (Layout::create_gold_note): Change Output_data_fixed_space to
9730         Output_data_zero_fill.
9731         (Layout::create_build_id): Likewise.
9732         (Layout::print_to_mapfile): New function.
9733         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9734         constructor.  Change caller.
9735         (class Layout): Declare print_to_mapfile.
9736         * output.cc (Output_section::Input_section::print_to_mapfile): New
9737         function.
9738         (Output_section::add_input_section): If producing a map, always
9739         add to input_sections_ list.
9740         (Output_section::do_print_to_mapfile): New function.
9741         (Output_segment::print_sections_to_mapfile): New function.
9742         (Output_segment::print_section_list_to_mapfile): New function.
9743         * output.h: Include "mapfile.h".
9744         (Output_data::print_to_mapfile): New function.
9745         (Output_data::do_print_to_mapfile): New virtual function.
9746         (Output_segment_headers::do_print_to_mapfile): New function.
9747         (Output_file_header::do_print_to_mapfile): New function.
9748         (Output_data_const::do_print_to_mapfile): New function.
9749         (class Output_data_const_buffer): Add map_name_ field.  Update
9750         constructor.  Change all callers.  Add do_print_to_mapfile
9751         function.
9752         (class Output_data_fixed_space): Likewise.
9753         (class Output_data_space): Likewise.
9754         (class Output_data_zero_fill): New class.
9755         (Output_data_strtab::do_print_to_mapfile): New function.
9756         (Output_data_reloc_base::do_print_to_mapfile): New function.
9757         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9758         (Output_data_group::do_print_to_mapfile): New function.
9759         (Output_data_got::do_print_to_mapfile): New function.
9760         (Output_data_dynamic::do_print_to_mapfile): New function.
9761         (Output_symtab_xindex::do_print_to_mapfile): New function.
9762         (class Output_section): Declare do_print_to_mapflie.  Declare
9763         print_to_mapfile in Input_section.
9764         (class Output_segment): Declare new functions.
9765         * object.h (Sized_relobj::symbol_count): New function.
9766         * script-sections.cc
9767         (Output_section_element_dot_assignment::set_section_addresses):
9768         Change Output_data_fixed_space to Output_data_zero_fill.
9769         (Output_data_expression::do_print_to_mapfile): New function.
9770         * script.cc (read_input_script): Add mapfile parameter.  Change
9771         all callers.
9772         * script.h (read_input_script): Update declaration.
9773         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9774         (Eh_frame::do_print_to_mapfile): New function.
9775         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9776         (Output_merge_string::do_print_to_mapfile): New function.
9777         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9778         function.
9779         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9780         function.
9781         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9782         function.
9783         * Makefile.am (CCFILES): Add mapfile.cc.
9784         (HFILES): Add mapfile.h.
9785         * Makefile.in: Rebuild.
9786
9787 2008-05-19  Ian Lance Taylor  <iant@google.com>
9788
9789         * options.h (class General_options): Add -z relro.
9790         * layout.cc (Layout::Layout): Initialize relro_segment_.
9791         (Layout::add_output_section_data): Return the output section.
9792         (Layout::make_output_section): Rcognize relro sections and mark
9793         them appropriately.
9794         (Layout::attach_allocated_section_to_segment): Put relro sections
9795         in a PT_GNU_RELRO segment.
9796         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9797         section as relro.
9798         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9799         PT_TLS segments.
9800         (Layout::linkonce_mapping): Map d.rel.ro.local to
9801         .data.rel.ro.local.
9802         (Layout::output_section_name): Us .data.rel.ro.local for any
9803         section which begins with that.
9804         * layout.h (class Layout): Update add_output_section_data
9805         declaration.  Add relro_segment_ field.
9806         * output.cc (Output_section::Output_section): Initialize is_relro_
9807         and is_relro_local_ fields.
9808         (Output_segment::add_output_section): Group relro sections.
9809         (Output_segment::is_first_section_relro): New function.
9810         (Output_segment::maximum_alignment): If there is a relro section,
9811         align the segment to the common page size.
9812         (Output_segment::set_section_addresses): Track whether we are
9813         looking at relro sections.  If the last section is a relro
9814         section, align to the common page size.
9815         (Output_segment::set_section_list_addresses): Add in_relro
9816         parameter.  Change all callers.  Align to the page size when
9817         moving from relro to non-relro section.
9818         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9819         segment.
9820         * output.h (class Output_section): Add is_relro_ and
9821         is_relro_local_ fields.
9822         (Output_section::is_relro): New function.
9823         (Output_section::set_is_relro): New function.
9824         (Output_section::is_relro_local): New function.
9825         (Output_section::set_is_relro_local): New function.
9826         (class Output_segment): Update declarations.
9827         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9828         * sparc.cc (Target_sparc::got_section): Likewise.
9829         * x86_64.cc (Target_x86_64::got_section): Likewise.
9830         * testsuite/relro_test_main.cc: New file.
9831         * testsuite/relro_test.cc: New file.
9832         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9833         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9834         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9835         (relro_test.so, relro_test_pic.o): New targets.
9836         * testsuite/Makefile.in: Rebuild.
9837
9838 2008-05-16  Ian Lance Taylor  <iant@google.com>
9839
9840         * output.cc (Output_segment::add_output_section): Remove front
9841         parameter.
9842         * output.h (class Output_segment): Remove
9843         add_initial_output_section and overloaded add_output_section.
9844         Update declaration of remaining add_output_section.
9845         * layout.cc (Layout::create_interp): Call add_output_section
9846         rather than add_initial_output_section.
9847         (Layout::finish_dynamic_section): Likewise.
9848
9849         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9850         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9851         know the dynamic type.
9852         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9853         field.  Initialize it in constructor.
9854         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9855         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9856         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9857         reloc.
9858
9859         * output.cc (Output_reloc::get_address): Change return type to
9860         Elf_Addr.
9861         * output.h (class Output_reloc): Update get_address declaration.
9862         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9863         for section addresses.
9864
9865 2008-05-09  Ian Lance Taylor  <iant@google.com>
9866
9867         PR 6493
9868         * gold.cc (gold_nomem): Use return value of write.
9869
9870 2008-05-08  Ian Lance Taylor  <iant@google.com>
9871
9872         * symtab.c (Symbol::init_base_output_data): Add version
9873         parameter.  Change all callers.
9874         (Symbol::init_base_output_segment): Likewise.
9875         (Symbol::init_base_constant): Likewise.
9876         (Symbol::init_base_undefined): Likewise.
9877         (Sized_symbol::init_output_data): Likewise.
9878         (Sized_symbol::init_output_segment): Likewise.
9879         (Sized_symbol::init_constant): Likewise.
9880         (Sized_symbol::init_undefined): Likewise.
9881         (Symbol_table::do_define_in_output_data): If the new symbol has a
9882         version, mark it as the default.
9883         (Symbol_table::do_define_in_output_segment): Likewise.
9884         (Symbol_table::do_define_as_constant): Likewise.
9885         * symtab.h (class Symbol): Update declarations.
9886         (class Sized_symbol): Likewise.
9887         * resolve.cc (Symbol::override_version): New function.
9888         (Symbol::override_base): Call override_version.
9889         (Symbol::override_base_with_special): Likewise.
9890         * testsuite/ver_script_8.script: New file.
9891         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9892         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9893         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9894         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9895
9896 2008-05-06  Ian Lance Taylor  <iant@google.com>
9897
9898         PR 6049
9899         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9900         functions.
9901         (class General_options): Remove existing --undefined, and add
9902         --no-undefined instead.  Add new --undefined as synonym for -u.
9903         * archive.cc (Archive::add_symbols): Check whether symbol was
9904         named with -u.
9905         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9906         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9907         all uses.  Add IS_UNDEFINED.  Update declarations to split
9908         different versions of init_base.  Declare init_base_undefined.
9909         (Symbol::is_defined): Handle IS_UNDEFINED.
9910         (Symbol::is_undefined): Likewise.
9911         (Symbol::is_weak_undefined): Call is_undefined.
9912         (Symbol::is_absolute): Handle IS_CONSTANT.
9913         (class Sized_symbol): Update declarations to split different
9914         versions of init.  Declare init_undefined.
9915         (class Symbol_table): Declare new functions.
9916         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9917         Change all callers.
9918         (Symbol::init_base_output_data): Likewise.
9919         (Symbol::init_base_output_segment): Likewise.
9920         (Symbol::init_base_constant): Likewise.
9921         (Symbol::init_base_undefined): New function.
9922         (Sized_symbol::init_object): Rename from init.  Change all
9923         callers.
9924         (Sized_symbol::init_output_data): Likewise.
9925         (Sized_symbol::init_output_segment): Likewise.
9926         (Sized_symbol::init_constant): Likewise.
9927         (Sized_symbol::init_undefined): New function.
9928         (Symbol_table::add_undefined_symbols_from_command_line): New
9929         function.
9930         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9931         function.
9932         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9933         (Symbol::output_section): Likewise.
9934         (Symbol::set_output_section): Likewise.
9935         (Symbol_table::sized_finalize_symbol): Likewise.
9936         (Symbol_table::sized_write_globals): Likewise.
9937         * resolve.cc (Symbol_table::should_override): Likewise.
9938         (Symbol::override_base_with_special): Likewise.
9939
9940         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9941         symbol, change it to have default visibility.
9942         * testsuite/protected_1.cc: New file.
9943         * testsuite/protected_2.cc: New file.
9944         * testsuite/protected_3.cc: New file.
9945         * testsuite/protected_main_1.cc: New file.
9946         * testsuite/protected_main_2.cc: New file.
9947         * testsuite/protected_main_3.cc: New file.
9948         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9949         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9950         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9951         (protected_1.so): New target.
9952         (protected_1_pic.o, protected_2_pic.o): New targets.
9953         (protected_3_pic.o): New target.
9954         (check_PROGRAMS): Add protected_2.
9955         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9956         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9957         * testsuite/Makefile.in: Rebuild.
9958
9959         * options.h (DEFINE_var): Add set_user_set_##varname__.
9960         (DEFINE_bool_alias): New macro.
9961         (class General_options): Define -Bstatic using DEFINE_bool_alias
9962         rather than DEFINE_special.  Add --undefined as an alias for -z
9963         defs.
9964         * options.cc (General_options::parse_Bstatic): Remove.
9965
9966         * options.h (class General_options): Add --fatal-warnings.
9967         * main.cc (main): Implement --fatal-warnings.
9968         * errors.h (Errors::warning_count): New function.
9969
9970         * options.h (class General_options): Add -Bsymbolic-functions.
9971         * symtab.h (Symbol::is_preemptible): Check for
9972         -Bsymbolic-functions.
9973
9974 2008-05-05  Ian Lance Taylor  <iant@google.com>
9975
9976         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9977         as noVARNAME rather than no-VARNAME.
9978         (class General_options): Add option -z combreloc.
9979         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9980         get_address.
9981         (Output_reloc::sort_before) [SHT_REL]: New function.
9982         (Output_reloc::sort_before) [SHT_RELA]: New function.
9983         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9984         Sort_relocs_comparison.
9985         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9986         parameter.  Change all callers.
9987         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9988         sort_relocs parameter.  Change all callers.
9989         * output.cc (Output_reloc::get_address): New function, broken out
9990         of write_rel.
9991         (Output_reloc::write_rel): Call it.
9992         (Output_reloc::compare): New function.
9993         (Output_data_reloc_base::do_write): Optionally sort relocs.
9994
9995         * configure.ac: If targ_extra_obj is set, link it in.
9996         * configure.tgt: Initialize all variables.
9997         (x86_64*): Set targ_extra_obj and targ_extra_size.
9998         * configure: Rebuild.
9999
10000         * object.cc (Sized_relobj::include_section_group): Adjust section
10001         indexes read from group data.  Build vector to pass to
10002         layout_group.
10003         * layout.cc (Layout::layout_group): Add flags and shndxes
10004         parameters.  Remove contents parameter.  Change caller.  Update
10005         explicit instantiations.
10006         * layout.h (class Layout): Update layout_group declaration.
10007         * output.cc (Output_data_group::Output_data_group): Add flags and
10008         input_shndxes parameters.  Remove contents parameter.  Change
10009         caller.
10010         (Output_data_group::do_write): Change input_sections_ to
10011         input_shndxes_.
10012         * output.h (class Output_data_group): Update constructor
10013         declaration.  Rename input_sections_ to input_shndxes_.
10014         * testsuite/many_sections_test.cc: Add template.
10015
10016 2008-04-30  Cary Coutant  <ccoutant@google.com>
10017
10018         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10019
10020         * layout.cc (Layout::include_section): Refactored check for debug
10021         info section.
10022         (Layout::add_comdat): Add new parameters.  Change type
10023         of signature parameter.  Add object and shndx to signatures table.
10024         (Layout::find_kept_object): New function.
10025         * layout.h: Include <cstring>.
10026         (Layout::is_debug_info_section): New function.
10027         (Layout::add_comdat): Add new parameters.
10028         (Layout::find_kept_object): New function.
10029         (Layout::Kept_section): New struct.
10030         (Layout::Signatures): Change type of map range.
10031         * object.cc (Relobj::output_section_address): New function.
10032         (Sized_relobj::include_section_group): Add new parameters.  Change
10033         calls to Layout::add_comdat.  Change to build table of kept comdat
10034         groups and table mapping discarded sections to kept sections.
10035         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10036         (Sized_relobj::do_layout): Change calls to include_section_group and
10037         include_linkonce_section.
10038         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10039         value to zero when section is discarded.
10040         (Sized_relobj::map_to_kept_section): New function.
10041         * object.h (Relobj::output_section_address): New function.
10042         (Relobj::Comdat_group): New type.
10043         (Relobj::find_comdat_group): New function.
10044         (Relobj::Comdat_group_table): New type.
10045         (Relobj::Kept_comdat_section): New type.
10046         (Relobj::Kept_comdat_section_table): New type.
10047         (Relobj::add_comdat_group): New function.
10048         (Relobj::set_kept_comdat_section): New function.
10049         (Relobj::get_kept_comdat_section): New function.
10050         (Relobj::comdat_groups_): New field.
10051         (Relobj::kept_comdat_sections_): New field.
10052         (Symbol_value::input_value): Update comment.
10053         (Sized_relobj::map_to_kept_section) New function.
10054         (Sized_relobj::include_linkonce_section): Add new parameter.
10055         * target-reloc.h (Comdat_behavior): New type.
10056         (get_comdat_behavior): New function.
10057         (relocate_section): Add code to map a discarded section to the
10058         corresponding kept section when applying a relocation.
10059
10060 2008-04-30  Craig Silverstein  <csilvers@google.com>
10061
10062         * dwarf_reader.cc (next_generation_count): New static var.
10063         (Addr2line_cache_entry): New struct.
10064         (addr2line_cache): New static var.
10065         (Dwarf_line_info::one_addr2line): Added caching.
10066         (Dwarf_line_info::clear_addr2line_cache): New function.
10067         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10068         cache-size parameter.
10069         (Dwarf_line_info::one_addr2line_cache): New function.
10070         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10071         new cache-size argument to one_addr2line(), and clear cache.
10072
10073 2008-04-28  Cary Coutant  <ccoutant@google.com>
10074
10075         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10076         R_386_PC8 relocations.
10077
10078 2008-04-23  Ian Lance Taylor  <iant@google.com>
10079
10080         * object.cc (Sized_relobj::include_section_group): Check for
10081         invalid section group.
10082
10083         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10084         header size.
10085
10086         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10087         than read for file header.
10088         * archive.cc (Archive::include_member): Likewise.
10089
10090 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10091
10092         * aclocal.m4: Regenerate.
10093         * configure: Regenerate.
10094
10095 2008-04-19  Ian Lance Taylor  <iant@google.com>
10096
10097         * version.cc (version_string): Bump to 1.6.
10098
10099         * testsuite/Makefile.am (many_sections_r_test): New target.
10100         (many_sections_r_test_SOURCES): Remove.
10101         (many_sections_r_test_DEPENDENCIES): Remove.
10102         (many_sections_r_test_LDFLAGS): Remove.
10103         (many_sections_r_test_LDADD): Remove.
10104
10105         * object.cc (Sized_relobj::do_add_symbols): Always pass
10106         local_symbol_count_ to add_from_relobj.
10107
10108         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10109         every thousand variables.
10110         * testsuite/Makefile.in: Rebuild.
10111
10112         * object.cc (Xindex::initialize_symtab_xindex): New function.
10113         (Xindex::read_symtab_xindex): New function.
10114         (Xindex::sym_xindex_to_shndx): New function.
10115         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10116         available.
10117         (Sized_relobj::do_initialize_xindex): New function.
10118         (Sized_relobj::do_read_symbols): Adjust section links.
10119         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10120         parameter.  Change all callers.
10121         (Sized_relobj::include_section_group): Adjust section links and
10122         symbol section indexes.
10123         (Sized_relobj::do_layout): Adjust section links.
10124         (Sized_relobj::do_count_local_symbols): Adjust section links and
10125         symbol section indexes.
10126         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10127         ordinary and special symbols.
10128         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10129         dynsym_xindex parameters.  Change all callers.  Adjust section
10130         links.  Use SHN_XINDEX when needed.
10131         (Sized_relobj::get_symbol_location_info): Adjust section links.
10132         Don't get fooled by special symbols.
10133         * object.h (class Xindex): Define.
10134         (class Object): Add xindex_ parameter.  Declare virtual functoin
10135         do_initialize_xindex.
10136         (Object::adjust_sym_shndx): New function.
10137         (Object::set_xindex): New protected function.
10138         (class Symbol_value): Add is_ordinary_shndx_ field.
10139         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10140         (Symbol_value::value): Assert ordinary section.
10141         (Symbol_value::initialize_input_to_output_map): Likewise.
10142         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10143         Change all callers.
10144         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10145         all callers.
10146         (class Sized_relobj): Update declarations.
10147         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10148         parameter.  Change all callers.
10149         (Sized_relobj::adjust_shndx): New function.
10150         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10151         field.
10152         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10153         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10154         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10155         (Sized_dynobj::read_dynsym_section): Adjust section links.
10156         (Sized_dynobj::read_dynamic): Likewise.
10157         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10158         section links.
10159         (Sized_dynobj::do_initialize_xindex): New function.
10160         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10161         do_initialize_xindex.
10162         (Sized_dynobj::adjust_shndx): New function.
10163         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10164         dynsym_xindex_ fields.
10165         (Layout::finalize): Add a call to set_section_indexes before
10166         creating the symtab sections.
10167         (Layout::set_section_indexes): Don't do anything if the section
10168         already has a section index.
10169         (Layout::create_symtab_sections): Add shnum parameter.  Change
10170         caller.  Create .symtab_shndx section if needed.
10171         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10172         caller.
10173         (Layout::allocated_output_section_count): New function.
10174         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10175         needed.
10176         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10177         fields.  Update declarations.
10178         (Layout::symtab_xindex): New function.
10179         (Layout::dynsym_xindex): New function.
10180         (class Write_symbols_task): Add layout_ field.
10181         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10182         Change caller.
10183         * output.cc (Output_section_headers::Output_section_headers): Add
10184         shstrtab_section parameter.  Change all callers.
10185         (Output_section_headers::do_sized_write): Store overflow values
10186         for section count and section string table section index in
10187         section header zero.
10188         (Output_file_header::do_sized_write): Check for overflow of
10189         section count and section string table section index.
10190         (Output_symtab_xindex::do_write): New function.
10191         (Output_symtab_xindex::endian_do_write): New function.
10192         * output.h (class Output_section_headers): Add shstrtab_section_.
10193         Update declarations.
10194         (class Output_symtab_xindex): Define.
10195         (Output_section::has_out_shndx): New function.
10196         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10197         field.
10198         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10199         Change all callers.
10200         (Sized_symbol::init): Likewise.
10201         (Symbol::output_section): Check for ordinary symbol.
10202         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10203         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10204         callers.
10205         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10206         Change all callers.  Simplify handling of symbols from sections
10207         not included in the link.
10208         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10209         distinction.
10210         (Weak_alias_sorter::operator()): Assert that symbols are
10211         ordinary.
10212         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10213         distinction.
10214         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10215         parameters.  Change all callers.
10216         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10217         symbol distinction.  Use SHN_XINDEX when needed.
10218         (Symbol_table::write_section_symbol): Add symtab_xindex
10219         parameter.  Change all callers.
10220         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10221         SHN_XINDEX when needed.
10222         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10223         declarations.
10224         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10225         (Symbol::is_defined): Check is_ordinary.
10226         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10227         (Symbol::is_absolute, Symbol::is_common): Likewise.
10228         (class Sized_symbol): Update declarations.
10229         (class Symbol_table): Update declarations.
10230         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10231         parameters.  Change all callers.
10232         (Sized_symbol::override): Likewise.
10233         (Symbol_table::override): Likewise.
10234         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10235         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10236         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10237         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10238         to be in an ordinary section.
10239         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10240         object and is_ordinary parameters.  Change all callers.
10241         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10242         Change all callers.  Don't add undefined or non-ordinary symbols
10243         to reloc_map_.
10244         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10245         Change all callers.
10246         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10247         declarations.
10248         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10249         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10250         (Sized_relobj::relocate_sections): Likewise.
10251         * target-reloc.h (scan_relocs): Adjust section symbol index.
10252         (scan_relocatable_relocs): Likewise.
10253         * i386.cc (Scan::local): Check for ordinary symbols.
10254         * sparc.cc (Scan::local): Likewise.
10255         * x86_64.cc (Scan::local): Likewise.
10256         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10257         to symbol_section_and_value.
10258         * testsuite/many_sections_test.cc: New file.
10259         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10260         (check_PROGRAMS): Add many_sections_test.
10261         (many_sections_test_SOURCES): Define.
10262         (many_sections_test_DEPENDENCIES): Define.
10263         (many_sections_test_LDFLAGS): Define.
10264         (BUILT_SOURCES): Add many_sections_define.h.
10265         (many_sections_define.h): New target.
10266         (BUILT_SOURCES): Add many_sections_check.h.
10267         (many_sections_check.h): New target.
10268         (check_PROGRAMS): Add many_sections_r_test.
10269         (many_sections_r_test_SOURCES): Define.
10270         (many_sections_r_test_DEPENDENCIES): Define.
10271         (many_sections_r_test_LDFLAGS): Define.
10272         (many_sections_r_test_LDADD): Define.
10273         (many_sections_r_test.o): New target.
10274         * testsuite/Makefile.in: Rebuild.
10275
10276 2008-04-17  Cary Coutant  <ccoutant@google.com>
10277
10278         * errors.cc (Errors::info): New function.
10279         (gold_info): New function.
10280         * errors.h (Errors::info): New function.
10281         * gold.h (gold_info): New function.
10282         * object.cc (Input_objects::add_object): Print trace output.
10283         * options.cc (options::parse_set): New function.
10284         (General_options::parse_wrap): Deleted.
10285         (General_options::General_options): Deleted initializer.
10286         * options.h (options::String_set): New typedef.
10287         (options::parse_set): New function.
10288         (DEFINE_set): New macro.
10289         (General_options::wrap): Changed to use DEFINE_set. Changed
10290         callers of any_wrap_symbols and is_wrap_symbol.
10291         (General_options::trace, General_options::trace_symbol):
10292         New options.
10293         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10294         (General_options::wrap_symbols_): Deleted.
10295         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10296
10297 2008-04-17  David S. Miller  <davem@davemloft.net>
10298
10299         * options.cc (General_options::parse_V): New function.
10300         * options.h: Add entries for -V and -Qy.
10301
10302 2008-04-17  Ian Lance Taylor  <iant@google.com>
10303
10304         * common.cc (Symbol_table::allocate_commons): Remove options
10305         parameter.  Change caller.
10306         (Symbol_table::do_allocate_commons): Remove options parameter.
10307         Change caller.  Just call do_allocate_commons_list twice.
10308         (Symbol_table::do_allocate_commons_list): New function, broken out
10309         of do_allocate_commons.
10310         * common.h (class Allocate_commons_task): Remove options_ field.
10311         Update constructor.
10312         * symtab.cc (Symbol_table::Symbol_table): Initialize
10313         tls_commons_.
10314         (Symbol_table::add_from_object): Put TLS common symbols on
10315         tls_commons_ list.
10316         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10317         which are IN_OUTPUT_DATA.
10318         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10319         allocate_commons and do_allocate_commons declarations.  Declare
10320         do_allocate_commons_list.
10321         * gold.cc (queue_middle_tasks): Update creation of
10322         Allocate_commons_task to not pass options.
10323         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10324         (TLS_TEST_C_FLAGS): New variable.
10325         (tls_test_c_pic.o): New target.
10326         (tls_test_shared.so): Link in tls_test_c_pic.o.
10327         (tls_test_c_pic_ie.o): New target.
10328         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10329         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10330         (tls_test_c.o): New target.
10331         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10332         (tls_pic_test_LDADD): Likewise.
10333         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10334         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10335         (tls_test_c_gnu2.o): New target.
10336         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10337         tls_test_c_gnu2.o.
10338         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10339         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10340         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10341         * testsuite/tls_test.cc: Include "config.h".
10342         (t_last): Call t11_last.
10343         * testsuite/tls_test.h (t11, t11_last): Declare.
10344         * testsuite/tls_test_c.c: New file.
10345         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10346         * configure.ac: Check for OpenMP support.
10347         * configure, config.in, Makefile.in: Rebuild.
10348         * testsuite/Makefile.in: Rebuild.
10349
10350 2008-04-16  Cary Coutant  <ccoutant@google.com>
10351
10352         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10353         (Target_i386::tls_base_symbol_defined_): New field.
10354         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10355         (Target_i386::Scan::global): Likewise.
10356         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10357         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10358         (Target_x86_64::tls_base_symbol_defined_): New field.
10359         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10360         (Target_x86_64::Scan::global): Likewise.
10361
10362 2008-04-16  Cary Coutant  <ccoutant@google.com>
10363
10364         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10365         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10366         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10367         building shared libraries.
10368         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10369         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10370         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10371         * testsuite/Makefile.in: Rebuild.
10372         * testsuite/weak_undef.h: New file.
10373         * testsuite/weak_undef_file1.cc: Add extra test cases.
10374         * testsuite/weak_undef_file2.cc: Likewise.
10375         * testsuite/weak_undef_test.cc: Likewise.
10376
10377 2008-04-16  David S. Miller  <davem@davemloft.net>
10378
10379         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10380         Add issued_non_pic_error_ field.  Declare check_non_pic.
10381         (Target_sparc::Scan::check_non_pic): New function.
10382         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10383         (Target_sparc::Scan::global): Likewise.
10384
10385         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10386         * configure: Rebuild.
10387
10388         * options.h (DEFINE_enable): New macro.
10389         (new_dtags): New enable option.
10390         (initfirst, interpose, loadfltr, nodefaultlib,
10391         nodelete, nodlopen, nodump): New -z options.
10392         * layout.cc (Layout:finish_dynamic_section): If new
10393         dtags enabled, emit DT_RUNPATH.  Also, emit a
10394         DT_FLAGS_1 containing any specified -z flags.
10395
10396 2008-04-16  Ian Lance Taylor  <iant@google.com>
10397
10398         * copy-relocs.cc: New file.
10399         * copy-relocs.h: New file.
10400         * reloc.cc: Remove Copy_relocs code.
10401         * reloc.h: Likewise.
10402         * reloc-types.h (struct Reloc_types) [both versions]: Add
10403         get_reloc_addend_noerror.
10404         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10405         variants of add_global which take an addend which must be zero.
10406         * i386.cc: Include "copy-relocs.h".
10407         (class Target_i386): Change type of copy_relocs_ to variable,
10408         update initializer.
10409         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10410         Change all callers.
10411         (Target_i386::do_finalize_sections): Change handling of
10412         copy_relocs_.
10413         * sparc.cc: Include "copy-relocs.h".
10414         (class Target_sparc): Change type of copy_relocs_ to variable,
10415         update initializer.
10416         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10417         Change all callers.
10418         (Target_sparc::do_finalize_sections): Change handling of
10419         copy_relocs_.
10420         * x86_64.cc: Include "copy-relocs.h".
10421         (class Target_x86_64): Change type of copy_relocs_ to variable,
10422         update initializer.
10423         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10424         class.  Change all callers.
10425         (Target_x86_64::do_finalize_sections): Change handling of
10426         copy_relocs_.
10427         * Makefile.am (CCFILES): Add copy-relocs.cc.
10428         (HFILES): Add copy-relocs.h.
10429
10430         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10431
10432         * testsuite/script_test_4.sh: Permit leading zeroes.
10433
10434 2008-04-15  Ian Lance Taylor  <iant@google.com>
10435
10436         * script-sections.cc (Script_sections::create_segments): Use
10437         header_size_adjustment even when there is enough room for the
10438         headers.
10439         * testsuite/script_test_4.sh: New file.
10440         * testsuite/script_test_4.t: New file.
10441         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10442         (check_DATA): Add script_test_4.stdout.
10443         (MOSTLYCLEANFILES): Likewise.
10444         (script_test_4): New target.
10445         (script_test_4.stdout): New target.
10446         * testsuite/Makefile.in: Rebuild.
10447
10448         * sparc.cc: Add definitions for Output_data_plt_sparc class
10449         constants.
10450
10451 2008-04-14  David S. Miller  <davem@davemloft.net>
10452
10453         * sparc.cc: New file.
10454         * Makefile.am (TARGETSOURCES): Add sparc.cc
10455         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10456         * configure.tgt: Document targ_extra_size and
10457         targ_extra_big_endian.  Add entries for sparc-* and
10458         sparc64-*.
10459         * configure.ac: Handle targ_extra_size and
10460         targ_extra_big_endian.
10461         * Makefile.in: Rebuild.
10462         * configure: Likewise.
10463         * po/POTFILES.in: Likewise.
10464         * po/gold.pot: Likewise.
10465
10466 2008-04-14  Ian Lance Taylor  <iant@google.com>
10467
10468         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10469         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10470         in the name/type/flags to section mapping.  Don't call
10471         allocate_output_section.
10472         (Layout::choose_output_section): Change parameter from adjust_name
10473         to is_input_section.  Don't permit input sections after sections
10474         are attached to segments.  Don't call allocate_output_section.
10475         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10476         not write_enable_output_section.
10477         (Layout::make_output_section): Don't push to
10478         unattached_section_list_ nor call attach_to_segment.  Call
10479         attach_section_to_segment if sections are attached.
10480         (Layout::attach_sections_to_segments): New function.
10481         (Layout::attach_section_to_segment): New function.
10482         (Layout::attach_allocated_section_to_segment): Rename from
10483         attach_to_segment.  Remove flags parameter.
10484         (Layout::allocate_output_section): Remove function.
10485         (Layout::write_enable_output_section): Remove function.
10486         * layout.h (class Layout): Update for above changes.  Add new
10487         field sections_are_attached_.
10488         * output.h (Output_section::update_flags_for_input_section): New
10489         function.
10490         * output.cc (Output_section::add_input_section): Call
10491         update_flags_for_input_section.
10492         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10493
10494 2008-04-11  Cary Coutant  <ccoutant@google.com>
10495
10496         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10497         thought unnecessary.
10498         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10499
10500 2008-04-11  Ian Lance Taylor  <iant@google.com>
10501
10502         * output.h (class Output_section_data): Remove inline definition
10503         of set_addralign.
10504         * output.cc (Output_section_data::set_addralign): New function.
10505
10506 2008-04-11  Cary Coutant  <ccoutant@google.com>
10507
10508         Add support for TLS descriptors for i386 and x86_64.
10509         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10510         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10511         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10512         GOT_TYPE_TLS_DESC.
10513         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10514         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10515         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10516         relocations.
10517         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10518         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10519         Fix problem with initial-exec relocations.
10520         (Target_i386::Relocate::relocate_tls): Likewise.
10521         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10522         relaxation.
10523         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10524         support for section-plus-offset dynamic table entries.
10525         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10526         (Output_data_dynamic::Dynamic_entry): Add support for
10527         section-plus-offset dynamic table entries.
10528         (Output_data_dynamic::Classification): Likewise.
10529         (Output_data_dynamic::classification_): Renamed offset_.
10530         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10531         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10532         (Target_x86_64::make_plt_section): New function.
10533         (Target_x86_64::reserve_tlsdesc_entries): New function.
10534         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10535         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10536         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10537         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10538         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10539         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10540         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10541         add extra PLT entry for TLS descriptors.
10542         (Output_data_plt_x86_64::got_): New field.
10543         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10544         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10545         fields.
10546         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10547         descriptors.
10548         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10549         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10550         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10551         R_386_TLS_DESC_CALL relocations.
10552         (Target_x86_64::Scan::global): Likewise.
10553         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10554         for TLS descriptors.
10555         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10556         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10557         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10558         GD-to-IE relaxation.
10559         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10560         and TLS_DESCRIPTORS.
10561         * Makefile.in: Rebuild.
10562         * configure: Rebuild.
10563         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10564         (tls_test_shared2.so): New target.
10565         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10566         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10567         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10568         (tls_shared_gd_to_ie_test_LDADD): New variable.
10569         (tls_shared_gnu2_gd_to_ie_test): New target.
10570         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10571         New targets.
10572         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10573         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10574         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10575         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10576         (tls_shared_gnu2_test): New target.
10577         (tls_test_gnu2_shared.so): New target.
10578         (tls_shared_gnu2_test_SOURCES): New variable.
10579         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10580         (tls_shared_gnu2_test_LDFLAGS): New variable.
10581         (tls_shared_gnu2_test_LDADD): New variable.
10582         * testsuite/Makefile.in: Rebuild.
10583         * testsuite/Makefile.
10584
10585 2008-04-11  Ian Lance Taylor  <iant@google.com>
10586
10587         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10588         justsyms.t.
10589         * testsuite/Makefile.in: Rebuild.
10590
10591         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10592         long.
10593         * testsuite/script_test_2.cc (main): Adjust test.
10594
10595 2008-04-11  David S. Miller  <davem@davemloft.net>
10596             Ian Lance Taylor  <iant@google.com>
10597
10598         * options.h (General_options): Add entries for '-Y' and
10599         '-relax'.
10600         * options.cc (General_options:finalize): If -Y was used, add those
10601         entries to the library path instead of the default "/lib" and
10602         "/usr/lib".
10603
10604 2008-04-11  David S. Miller  <davem@davemloft.net>
10605
10606         * testsuite/justsyms.t: Start at 0x100.
10607         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10608         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10609         long.
10610         * testsuite/script_test_2.cc: Adjust string and section length
10611         checks.
10612
10613 2008-04-09  Ian Lance Taylor  <iant@google.com>
10614
10615         PR gold/5996
10616         * script-sections.cc (Sections_element::allocate_to_segment): Add
10617         orphan parameter.
10618         (Output_section_definition::allocate_to_segment): Likewise.
10619         (Orphan_output_section::allocate_to_segment): Likewise.
10620         (Script_sections::attach_sections_using_phdrs_clause): Don't
10621         propagate non-PT_LOAD segments to orphan sections.
10622         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10623         readelf rather than objdump.
10624         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10625         .interp section and PT_INTERP segment are the same size.
10626         * testsuite/Makefile.in: Rebuild.
10627
10628         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10629         aliases for symbols defined in the same object.
10630         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10631         (weak_alias_test_SOURCES): New variable.
10632         (weak_alias_test_DEPENDENCIES): New variable.
10633         (weak_alias_test_LDFLAGS): New variable.
10634         (weak_alias_test_LDADD): New variable.
10635         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10636         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10637         (weak_alias_test_3.o): New target.
10638         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10639         * testsuite/weak_alias_test_main.cc: New file.
10640         * testsuite/weak_alias_test_1.cc: New file.
10641         * testsuite/weak_alias_test_2.cc: New file.
10642         * testsuite/weak_alias_test_3.cc: New file.
10643
10644 2008-04-08  Ian Lance Taylor  <iant@google.com>
10645
10646         * options.h (class General_options): Add --noinhibit-exec option.
10647         * main.cc (main): Check --noinhibit-exec.
10648
10649         * options.h (class General_options): Define --wrap as a special
10650         option.  Add wrap_symbols_ field.
10651         (General_options::any_wrap_symbols): New function.
10652         (General_options::is_wrap_symbol): New function.
10653         * options.cc (General_options::parse_wrap): New function.
10654         (General_options::General_options): Initialize wrap_symbols_.
10655         * symtab.cc (Symbol_table::wrap_symbol): New function.
10656         (Symbol_table::add_from_object): Handle --wrap.
10657         * symtab.h (class Symbol_table): Declare wrap_symbol.
10658         * target.h (Target::wrap_char): New function.
10659         (Target::Target_info): Add wrap_char field.
10660         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10661         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10662         * testsuite/testfile.cc (Target_test::test_target_info):
10663         Likewise.
10664
10665         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10666         there is one.
10667
10668         * layout.h (class Layout): Add added_eh_frame_data_ field.
10669         * layout.cc (Layout::Layout): Initialize new field.
10670         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10671         output section until we find a section we merged successfully.
10672         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10673         that the size be non-zero.
10674
10675         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10676         qualifier.
10677
10678 2008-04-08  Craig Silverstein  <csilvers@google.com>
10679
10680         * configure.ac: Export new conditional variable HAVE_ZLIB.
10681         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10682         on HAVE_ZLIB.
10683         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10684         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10685
10686 2008-04-07  Ian Lance Taylor  <iant@google.com>
10687
10688         * version.cc (version_string): Set to "1.5".
10689
10690         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10691         Add issued_non_pic_error_ field.  Declare check_non_pic.
10692         (Target_x86_64::Scan::check_non_pic): New function.
10693         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10694         (Target_x86_64::Scan::global): Likewise.
10695
10696         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10697         addend parameter.  Change caller.  Handle merge sections.
10698         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10699         Address to Addend.  Don't add in the result of
10700         local_section_offset, pass down the addend and use the returned
10701         value.
10702         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10703         Update declarations of local_section_offset and symbol_value.
10704         * testsuite/two_file_test_1.cc (t18): New function.
10705         * testsuite/two_file_test_2.cc (f18): New function.
10706         * testsuite/two_file_test_main.cc (main): Call t18.
10707         * testsuite/two_file_test.h (t18, f18): Declare.
10708
10709         * configure.ac: Don't test for objdump, c++filt, or readelf.
10710         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10711         conditionals.
10712         (TEST_READELF): New variable.
10713         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10714         (check_PROGRAMS): Add two_file_strip_test.
10715         (two_file_strip_test): New target.
10716         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10717         (two_file_same_shared_strip_test_SOURCES): New variable.
10718         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10719         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10720         (two_file_same_shared_strip_test_LDADD): New variable.
10721         (two_file_shared_strip.so): New target.
10722         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10723         (ver_test_5.syms, ver_test_7.syms): Likewise.
10724         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10725         (strip_test_3.stdout): Use TEST_OBJDUMP.
10726         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10727
10728 2008-04-04  Cary Coutant  <ccoutant@google.com>
10729
10730         * symtab.h (Symbol::is_weak_undefined): New function.
10731         (Symbol::is_strong_undefined): New function.
10732         (Symbol::is_absolute): New function.
10733         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10734         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10735         absolute symbols.
10736         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10737         (weak_undef_test): New target.
10738         * testsuite/Makefile.in: Rebuild.
10739         * testsuite/weak_undef_file1.cc: New file.
10740         * testsuite/weak_undef_file2.cc: New file.
10741         * testsuite/weak_undef_test.cc: New file.
10742
10743 2008-04-03  Craig Silverstein  <csilvers@google.com>
10744
10745         * compressed_output.h (class Output_compressed_section): Use
10746         unsigned buffer.
10747         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10748         add zlib header.
10749         (zlib_compressed_suffix): Removed.
10750         (Output_compressed_section::set_final_data_size): Use unsigned
10751         buffers.
10752         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10753         Fix linker invocation.
10754         (flagstest_o_specialfile_and_compress_debug_sections):
10755         Likewise.
10756         * testsuite/Makefile.in: Regenerated.
10757
10758 2008-04-02  David S. Miller  <davem@davemloft.net>
10759
10760         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10761         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10762
10763 2008-04-02  Craig Silverstein  <csilvers@google.com>
10764
10765         * TODO: New file.
10766
10767 2008-04-02  Ian Lance Taylor  <iant@google.com>
10768
10769         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10770         parameters.  Update for new key type to views_.  Change all
10771         callers.
10772         (File_read::read): Adjust for byteshift in returned view.
10773         (File_read::add_view): New function, broken out of
10774         find_and_make_view.
10775         (File_read::make_view): New function, broken out of
10776         find_and_make_view.
10777         (File_read::find_or_make_view): Add offset and aligned
10778         parameters.  Rewrite accordingly.  Change all callers.
10779         (File_read::get_view): Add offset and aligned parameters.  Adjust
10780         for byteshift in return value.
10781         (File_read::get_lasting_view): Likewise.
10782         * fileread.h (class File_read): Update declarations.
10783         (class File_read::View): Add byteshift_ field.  Add byteshift to
10784         constructor.  Add byteshift method.
10785         * archive.h (Archive::clear_uncached_views): New function.
10786         (Archive::get_view): Add aligned parameter.  Change all callers.
10787         * object.h (Object::get_view): Add aligned parameter.  Change all
10788         callers.
10789         (Object::get_lasting_view): Likewise.
10790
10791         * fileread.cc (File_read::release): Don't call clear_views if
10792         there are multiple objects.
10793         * fileread.h (File_read::clear_uncached_views): New function.
10794         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10795         on the archive.
10796
10797 2008-03-31  Cary Coutant  <ccoutant@google.com>
10798
10799         Add thin archive support.
10800         * archive.cc (Archive::armagt): New const.
10801         (Archive::setup): Remove task parameter and calls to unlock.
10802         (Archive::unlock_nested_archives): New function.
10803         (Archive::read_header): Add nested_off parameter. Change
10804         all callers.
10805         (Archive::interpret_header): Likewise.
10806         (Archive::include_all_members): Change to handle thin
10807         archives.
10808         (Archive::include_member): Likewise.
10809         * archive.h (Archive::Archive): Add new parameters and
10810         initializers.
10811         (Archive::armagt): New const.
10812         (Archive::setup): Remove task parameter.
10813         (Archive::unlock_nested_archives): New function.
10814         (Archive::read_header): Add nested_off parameter.
10815         (Archive::interpret_header): Likewise.
10816         (Archive::Nested_archive_table): New typedef.
10817         (Archive::is_thin_archive_): New field.
10818         (Archive::nested_archives_): New field.
10819         (Archive::options_): New field.
10820         (Archive::dirpath_): New field.
10821         (Archive::task_): New field.
10822         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10823         for thin archives.  Pass additional parameters to
10824         Archive::Archive.  Unlock the archive file after calling
10825         Archive::setup.
10826
10827 2008-03-29  Ian Lance Taylor  <iant@google.com>
10828
10829         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10830         version symbol to be local.
10831         * testsuite/ver_test_4.sh: New file.
10832         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10833         (check_DATA): Add ver_test_4.syms.
10834         (ver_test_4.syms): New target.
10835         * testsuite/Makefile.in: Rebuild.
10836
10837         * output.cc
10838         (Output_section::Input_section_sort_entry::has_priority): New
10839         function.
10840         (Output_section::Input_section_sort_entry::match_file_name): New
10841         function.
10842         (Output_section::Input_section_sort_entry::match_section_name):
10843         Remove.
10844         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10845         Remove.
10846         (Output_section::Input_section_sort_entry::match_section_file):
10847         Remove.
10848         (Output_section::Input_section_sort_compare::operator()): Rewrite
10849         using new Input_section_sort_entry functions.  Sort crtbegin and
10850         crtend first.  Sort sections with no priority before sections with
10851         a priority.
10852         * testsuite/initpri1.c (d3): Check j != 4.
10853         (cd5): New constructor/destructor function.
10854         (main): Check j != 2.
10855
10856         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10857         new symbol when resolving, don't call set_is_default.
10858         * testsuite/ver_test_7.cc: New file.
10859         * testsuite/ver_test_7.sh: New file.
10860         * testsuite/Makefile.am (ver_test_7.so): New target.
10861         (ver_test_7.o): New target.
10862         (check_SCRIPTS): Add ver_test_7.sh.
10863         (check_DATA): Add ver_test_7.syms.
10864         (ver_test_7.syms): New target.
10865
10866 2008-03-28  Ian Lance Taylor  <iant@google.com>
10867
10868         * layout.cc (Layout::layout): If we see an input section with a
10869         name that needs sorting, set the must_sort flag for the output
10870         section.
10871         (Layout::make_output_section): If the name of the output section
10872         indicates that it might require sorting, set the may_sort flag.
10873         * output.h (Output_section::may_sort_attached_input_sections): New
10874         function.
10875         (Output_section::set_may_sort_attached_input_sections): New
10876         function.
10877         (Output_section::must_sort_attached_input_sections): New
10878         function.
10879         (Output_section::set_must_sort_attached_input_sections): New
10880         function.
10881         (class Output_section): Declare Input_section_sort_entry.  Define
10882         Input_section_sort_compare.  Declare
10883         sort_attached_input_sections.  Add new fields:
10884         may_sort_attached_input_sections_,
10885         must_sort_attached_input_sections_,
10886         attached_input_sections_are_sorted_.
10887         * output.cc (Output_section::Output_section): Initialize new
10888         fields.
10889         (Output_section::add_input_section): Add an entry to
10890         input_sections_ if may_sort or must_sort are true.
10891         (Output_section::set_final_data_size): Call
10892         sort_attached_input_sections if necessary.
10893         (Output_section::Input_section_sort_entry): Define new class.
10894         (Output_section::Input_section_sort_compare::operator()): New
10895         function.
10896         (Output_section::sort_attached_input_sections): New function.
10897         * configure.ac: Check whether the compiler supports constructor
10898         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10899         * testsuite/initpri1.c: New file.
10900         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10901         CONSTRUCTOR_PRIORITY.
10902         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10903         (initpri1_LDFLAGS): New variable.
10904         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10905
10906 2008-03-27  Ian Lance Taylor  <iant@google.com>
10907
10908         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10909         * testsuite/common_test_1.c: New file.
10910         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10911         (common_test_1_SOURCES): New variable.
10912         (common_test_1_DEPENDENCIES): New variable.
10913         (common_test_1_LDFLAGS): New variable.
10914
10915         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10916         and commons_ correctly when NAME/VERSION does not override
10917         NAME/NULL.
10918         * testsuite/ver_test_6.c: New file.
10919         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10920         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10921         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10922
10923 2008-03-26  Ian Lance Taylor  <iant@google.com>
10924
10925         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10926         of an undefined symbol from a version script.
10927         * testsuite/Makefile.am (ver_test_5.so): New target.
10928         (ver_test_5.o): New target.
10929         (check_SCRIPTS): Add ver_test_5.sh.
10930         (check_DATA): Add ver_test_5.syms.
10931         (ver_test_5.syms): New target.
10932         * testsuite/ver_test_5.cc: New file.
10933         * testsuite/ver_test_5.script: New file.
10934         * testsuite/ver_test_5.sh: New file.
10935         * Makefile.in, testsuite/Makefile.in: Rebuild.
10936
10937         PR gold/5986
10938         Fix problems building gold with gcc 4.3.0.
10939         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10940         (gold_error_at_location, gold_warning_at_location): Use it.
10941         * configure.ac: Check whether we can compile and use a template
10942         function with a printf attribute.
10943         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10944         when jumping over bytes.
10945         * object.cc: Instantiate Object::read_section_data.
10946         * debug.h: Include <cstring>
10947         * dwarf_reader.cc: Include <algorithm>
10948         * main.cc: Include <cstring>.
10949         * options.cc: Include <cstring>.
10950         * output.cc: Include <cstring>.
10951         * script.cc: Include <cstring>.
10952         * script.h: Include <string>.
10953         * symtab.cc: Include <cstring> and <algorithm>.
10954         * target-select.cc: Include <cstring>.
10955         * version.cc: Include <string>.
10956         * testsuite/testmain.cc: Include <cstdlib>.
10957         * configure, config.in: Rebuild.
10958
10959 2008-03-25  Ian Lance Taylor  <iant@google.com>
10960
10961         * options.cc: Include "../bfd/bfdver.h".
10962         (options::help): Print bug reporting address.
10963
10964         * version.cc (print_version): Adjust output for current value of
10965         BFD_VERSION_STRING.
10966
10967         * NEWS: New file.
10968
10969         * options.cc (options::help): Print list of supported targets.
10970         * target-select.h: Include <vector>.
10971         (class Target_selector): Make machine_, size_, and is_big_endian_
10972         fields const.  Add bfd_name_ and instantiated_target_ fields.
10973         (Target_selector::Target_selector): Add bfd_name parameter.
10974         (Target_selector::recognize): Make non-virtual, call
10975         do_recognize.
10976         (Target_selector::recognize_by_name): Make non-virtual, call
10977         do_recognize_by_name.
10978         (Target_selector::supported_names): New function.
10979         (Target_selector::bfd_name): New function.
10980         (Target_selector::do_instantiate_target): New pure virtual
10981         function.
10982         (Target_selector::do_recognize): New virtual function.
10983         (Target_selector::do_recognize_by_name): New virtual function.
10984         (Target_selector::instantiate_target): New private function.
10985         (supported_target_names): Declare.
10986         * target-select.cc (Target_selector::Target_selector): Update for
10987         new parameter and fields.
10988         (select_target_by_name): Check that the name matches before
10989         calling recognize_by_name.
10990         (supported_target_names): New function.
10991         * i386.cc (class Target_selector_i386): Update Target_selector
10992         constructor call.  Remove recognize and recognize_by_name.  Add
10993         do_instantiate_target.
10994         * x86_64.cc (class Target_selector_x86_64): Likewise.
10995         * testsuite/testfile.cc (class Target_selector_test): Update for
10996         changes to Target_selector.
10997
10998         * README: Rewrite, with some notes on unsupported features.
10999
11000 2008-03-24  Cary Coutant  <ccoutant@google.com>
11001
11002         * i386.cc (Target_i386::Got_type): New enum declaration.
11003         (Target_i386::Scan::local): Updated callers of Output_data_got
11004         member functions.
11005         (Target_i386::Scan::global): Likewise.
11006         (Target_i386::Relocate::relocate): Likewise.
11007         (Target_i386::Relocate::relocate_tls): Likewise.
11008         * object.h (Got_offset_list): New class.
11009         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11010         (Sized_relobj::local_got_offset): Likewise.
11011         (Sized_relobj::set_local_got_offset): Likewise.
11012         (Sized_relobj::local_has_tls_got_offset): Removed.
11013         (Sized_relobj::local_tls_got_offset): Removed.
11014         (Sized_relobj::set_local_tls_got_offset): Removed.
11015         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11016         * output.cc (Output_data_got::add_global): Added got_type parameter.
11017         (Output_data_got::add_global_with_rel): Likewise.
11018         (Output_data_got::add_global_with_rela): Likewise.
11019         (Output_data_got::add_global_pair_with_rel): New function.
11020         (Output_data_got::add_global_pair_with_rela): New function.
11021         (Output_data_got::add_local): Added got_type parameter.
11022         (Output_data_got::add_local_with_rel): Likewise.
11023         (Output_data_got::add_local_with_rela): Likewise.
11024         (Output_data_got::add_local_pair_with_rel): New function.
11025         (Output_data_got::add_local_pair_with_rela): New function.
11026         (Output_data_got::add_global_tls): Removed.
11027         (Output_data_got::add_global_tls_with_rel): Removed.
11028         (Output_data_got::add_global_tls_with_rela): Removed.
11029         (Output_data_got::add_local_tls): Removed.
11030         (Output_data_got::add_local_tls_with_rel): Removed.
11031         (Output_data_got::add_local_tls_with_rela): Removed.
11032         * output.h (Output_data_got::add_global): Added got_type parameter.
11033         (Output_data_got::add_global_with_rel): Likewise.
11034         (Output_data_got::add_global_with_rela): Likewise.
11035         (Output_data_got::add_global_pair_with_rel): New function.
11036         (Output_data_got::add_global_pair_with_rela): New function.
11037         (Output_data_got::add_local): Added got_type parameter.
11038         (Output_data_got::add_local_with_rel): Likewise.
11039         (Output_data_got::add_local_with_rela): Likewise.
11040         (Output_data_got::add_local_pair_with_rel): New function.
11041         (Output_data_got::add_local_pair_with_rela): New function.
11042         (Output_data_got::add_global_tls): Removed.
11043         (Output_data_got::add_global_tls_with_rel): Removed.
11044         (Output_data_got::add_global_tls_with_rela): Removed.
11045         (Output_data_got::add_local_tls): Removed.
11046         (Output_data_got::add_local_tls_with_rel): Removed.
11047         (Output_data_got::add_local_tls_with_rela): Removed.
11048         * resolve.cc (Symbol::override_base_with_special): Removed
11049         reference to has_got_offset_ field.
11050         * symtab.cc (Symbol::init_fields): Replaced initialization
11051         of got_offset_ with got_offsets_.  Removed initialization
11052         of has_got_offset_
11053         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11054         (Symbol::got_offset): Likewise.
11055         (Symbol::set_got_offset): Likewise.
11056         (Symbol::has_tls_got_offset): Removed.
11057         (Symbol::tls_got_offset): Removed.
11058         (Symbol::set_tls_got_offset): Removed.
11059         (Symbol::got_offset_): Removed.
11060         (Symbol::tls_mod_got_offset_): Removed.
11061         (Symbol::tls_pair_got_offset_): Removed.
11062         (Symbol::got_offsets_): New field.
11063         (Symbol::has_got_offset): Removed.
11064         (Symbol::has_tls_mod_got_offset): Removed.
11065         (Symbol::has_tls_pair_got_offset): Removed.
11066         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11067         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11068         member functions.
11069         (Target_x86_64::Scan::global): Likewise.
11070         (Target_x86_64::Relocate::relocate): Likewise.
11071         (Target_x86_64::Relocate::relocate_tls): Likewise.
11072
11073 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11074
11075         * yyscript.y: Fix spelling error in comment.
11076
11077 2008-03-24  Ian Lance Taylor  <iant@google.com>
11078
11079         * options.h (class General_options): Define build_id option.
11080         * layout.h (class Layout): Declare write_build_id, create_note,
11081         create_build_id.  Add build_id_note_ member.
11082         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11083         "libiberty.h", "md5.h", "sha1.h".
11084         (Layout::Layout): Initialize eh_frame_data_,
11085         eh_frame_hdr_section_, and build_id_note_.
11086         (Layout::finalize): Call create_build_id.
11087         (Layout::create_note): New function, broken out of
11088         Layout::create_gold_note.
11089         (Layout::create_gold_note): Call create_note.
11090         (Layout::create_build_id): New function.
11091         (Layout::write_build_id): New function.
11092         (Close_task_runner::run): Call write_build_id.
11093
11094         * x86_64.cc: Correct license to GPLv3.
11095
11096 2008-03-23  Ian Lance Taylor  <iant@google.com>
11097
11098         * options.cc: Include "demangle.h".
11099         (parse_optional_string): New function.
11100         (parse_long_option): Handle takes_optional_argument.
11101         (parse_short_option): Update dash_z initializer.  Handle
11102         takes_optional_argument.
11103         (General_options::General_options): Initialize do_demangle_.
11104         (General_options::finalize): Set do_demangle_.  Handle demangling
11105         style.
11106         * options.h (parse_optional_string): Declare.
11107         (struct One_option): Add optional_arg field.  Update constructor.
11108         Update call constructor calls.  Add takes_optional_argument
11109         function.
11110         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11111         (DEFINE_optional_string): Define.
11112         (General_options::demangle): Change from DEFINE_bool to
11113         DEFINE_optional_string.
11114         (General_options::no_demangle): New function.
11115         (General_options::do_demangle): New function.
11116         (General_options::set_do_demangle): New function.
11117         (General_options::execstack_status_): Move definition to end of
11118         class definition.
11119         (General_options::static_): Likewise.
11120         (General_options::do_demangle_): New field.
11121         * object.cc (big_endian>::get_symbol_location_info): Call
11122         Options::do_demangle, not Options::demangle.
11123         * symtab.cc (demangle): Likewise.
11124
11125 2008-03-22  Ian Lance Taylor  <iant@google.com>
11126
11127         * gold.h: Include <cstddef> and <sys/types.h>
11128         * options.h: Include <cstring>.
11129
11130 2008-03-21  Ian Lance Taylor  <iant@google.com>
11131
11132         * Added source code to GNU binutils.