gold: Fix 64-bit sparc GOLD crash in gdb-index code.
[external/binutils.git] / gold / ChangeLog
1 2012-04-16  David S. Miller  <davem@davemloft.net>
2
3         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4         writing out 64-bit part of ranges.
5
6         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
7         -fpic and -fpie respectively.
8         * Makefile.in: Regenerate.
9
10         * sparc.cc (class Target_sparc): Add rela_ifunc_.
11         (Target_sparc::Target_sparc): Initialize new field.
12         (Target_sparc::do_plt_section_for_global): New function.
13         (Target_sparc::do_plt_section_for_local): New function.
14         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
15         (Target_sparc::make_plt_section): New function, broken out of
16         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
17         (Target_sparc::make_plt_entry): Call make_plt_section.
18         (Target_sparc::make_local_ifunc_plt_entry): New function.
19         (Target_sparc::rela_ifunc_section): New function.
20         (Target_sparc::plt_section): Remove const.
21         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
22         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
23         and ifunc_count_ fields.
24         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
25         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
26         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
27         (Output_data_plt_sparc::rela_ifunc): New function.
28         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
29         (Output_data_plt_sparc::has_ifunc_section): New function.
30         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
31         (Output_data_plt_sparc::address_for_global): New function.
32         (Output_data_plt_sparc::address_for_local): New function.
33         (Output_data_plt_sparc::plt_index_to_offset): New function.
34         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
35         and entry_count.
36         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
37         entry_count.
38         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
39         R_SPARC_JMP_IREL to switch.
40         (Target_sparc::Scan::check_non_pic): Likewise.
41         (Target_sparc::Scan::local): Handle IFUNC symbols.
42         (Target_sparc::Scan::local): Likewise.
43         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
44         and plt_address_for_local.
45         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
46         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
47
48         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
49         (class Output_data_reloc): Adjust calls to Output_reloc_type.
50         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
51         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
52         global relocs too.
53         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
54         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
55         calls.
56         * sparc.cc (Target_sparc::Scan::global): Likewise.
57         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
58
59 2012-04-16  Cary Coutant  <ccoutant@google.com>
60
61         * archive.cc (Library_base::should_include_member): Check for
62         --export-dynamic-symbol.
63         * options.h (class General_options): Add --export-dynamic-symbol.
64         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
65         --export-dynamic-symbol.
66         (Symbol_table::gc_mark_undef_symbols): Likewise.
67         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
68
69 2012-04-12  David S. Miller  <davem@davemloft.net>
70
71         * sparc.cc (Reloc::wdisp10): New relocation method.
72         (Reloc::h34): Likewise.
73         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
74         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
75         R_SPARC_WDISP10.
76         (Target_sparc::Scan::local): Likewise.
77         (Target_sparc::Scan::global): Likewise.
78         (Target_sparc::Relocate::relocate): Likewise.
79
80 2012-04-09  Cary Coutant  <ccoutant@google.com>
81
82         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
83         low_pc == 0.
84
85 2012-04-06  Ian Lance Taylor  <iant@google.com>
86
87         * timer.cc: #include <unistd.h>.
88
89 2012-04-06  Roland McGrath  <mcgrathr@google.com>
90
91         * configure.in (AC_CHECK_HEADERS): Add locale.h.
92         * config.in: Regenerate.
93         * configure: Regenerate.
94
95 2012-04-05  Nick Clifton  <nickc@redhat.com>
96
97         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
98         (AM_LC_MESSAGES): Add.
99         * aclocal.m4: Regenerate.
100         * config.in: Regenerate.
101         * configure: Regenerate.
102
103 2012-03-21  Cary Coutant  <ccoutant@google.com>
104
105         * Makefile.am: Add gdb-index.cc, gdb-index.h.
106         * Makefile.in: Regenerate.
107         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
108         (Sized_elf_reloc_mapper::symbol_section): New function.
109         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
110         (make_elf_reloc_mapper): New function.
111         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
112         (Dwarf_abbrev_table::do_read_abbrevs): New function.
113         (Dwarf_abbrev_table::do_get_abbrev): New function.
114         (Dwarf_ranges_table::read_ranges_table): New function.
115         (Dwarf_ranges_table::read_range_list): New function.
116         (Dwarf_pubnames_table::read_section): New function.
117         (Dwarf_pubnames_table::read_header): New function.
118         (Dwarf_pubnames_table::next_name): New function.
119         (Dwarf_die::Dwarf_die): New function.
120         (Dwarf_die::read_attributes): New function.
121         (Dwarf_die::skip_attributes): New function.
122         (Dwarf_die::set_name): New function.
123         (Dwarf_die::set_linkage_name): New function.
124         (Dwarf_die::attribute): New function.
125         (Dwarf_die::string_attribute): New function.
126         (Dwarf_die::int_attribute): New function.
127         (Dwarf_die::uint_attribute): New function.
128         (Dwarf_die::ref_attribute): New function.
129         (Dwarf_die::child_offset): New function.
130         (Dwarf_die::sibling_offset): New function.
131         (Dwarf_info_reader::check_buffer): New function.
132         (Dwarf_info_reader::parse): New function.
133         (Dwarf_info_reader::do_parse): New function.
134         (Dwarf_info_reader::do_read_string_table): New function.
135         (Dwarf_info_reader::lookup_reloc): New function.
136         (Dwarf_info_reader::get_string): New function.
137         (Dwarf_info_reader::visit_compilation_unit): New function.
138         (Dwarf_info_reader::visit_type_unit): New function.
139         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
140         Sized_elf_reloc_mapper.
141         (Sized_dwarf_line_info::symbol_section): Remove function.
142         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
143         (Sized_dwarf_line_info::read_line_mappings): Remove object
144         parameter, adjust callers.
145         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
146         * dwarf_reader.h: Include <sys/types.h>.
147         (class Track_relocs): Remove forward declaration.
148         (class Elf_reloc_mapper): New class.
149         (class Sized_elf_reloc_mapper): New class.
150         (class Dwarf_abbrev_table): New class.
151         (class Dwarf_range_list): New class.
152         (class Dwarf_ranges_table): New class.
153         (class Dwarf_pubnames_table): New class.
154         (class Dwarf_die): New class.
155         (class Dwarf_info_reader): New class.
156         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
157         (Sized_dwarf_line_info::symbol_section): Remove member function.
158         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
159         base class.
160         * gdb-index.cc: New source file.
161         * gdb-index.h: New source file.
162         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
163         and .debug_types sections, call Layout::add_to_gdb_index.
164         (Sized_relobj_incr::do_section_name): Implement.
165         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
166         return type; Implement.
167         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
168         return type.
169         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
170         parameter list and return type.
171         (Sized_incr_dynobj::do_section_contents): Likewise.
172         * layout.cc: Include gdb-index.h.
173         (Layout::Layout): Initialize gdb_index_data_.
174         (Layout::init_fixed_output_section): Check for .gdb_index section.
175         (Layout::add_to_gdb_index): New function. Instantiate.
176         * layout.h: Add forward declaration for class Gdb_index.
177         (Layout::add_to_gdb_index): New member function.
178         (Layout::gdb_index_data_): New data member.
179         * main.cc: Include gdb-index.h.
180         (main): Print statistics for gdb index.
181         * object.cc (Object::section_contents): Move code into
182         do_section_contents.
183         (need_decompressed_section): Check for sections needed when building
184         gdb index.
185         (build_compressed_section_map): Likewise.
186         (Sized_relobj_file::do_read_symbols): Need local symbols when building
187         gdb index.
188         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
189         sections; call Layout::add_to_gdb_index.
190         (Sized_relobj_file::do_decompressed_section_contents): Call
191         do_section_contents directly.
192         * object.h (Object::do_section_contents): Adjust parameter list and
193         return type.
194         (Object::do_decompressed_section_contents): Call do_section_contents
195         directly.
196         (Sized_relobj_file::do_section_contents): Adjust parameter list and
197         return type.
198         * options.h (class General_options): Add --gdb-index option.
199         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
200         list and return type.
201         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
202         * reloc.h (Track_relocs::checkpoint): New function.
203         (Track_relocs::reset): New function.
204
205         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
206         New test cases.
207         * testsuite/Makefile.in: Regenerate.
208         * testsuite/gdb_index_test.cc: New test source file.
209         * testsuite/gdb_index_test_1.sh: New test source file.
210         * testsuite/gdb_index_test_2.sh: New test source file.
211
212 2012-03-19  Doug Kwan  <dougkwan@google.com>
213
214         * arm.cc (Target_arm::do_define_standard_symbols): New method.
215         (Target_arm::do_finalize_sections): Remove code which defines
216         __exidx_start and __exidx_end.  Make symbol table parameter
217         anonymous as it is not used.
218         * gold.cc (queue_middle_tasks): Call target hook to define any
219         target-specific symbols.
220         * target.h (Target::define_standard_symbols): New method.
221         (Target::do_define_standard_symbols): Same.
222         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
223         * testsuite/Makefile.in: Regenerate.
224         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
225         and __exidx_end.
226         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
227         relocations are generated for __exidx_start and __exidx_end.
228
229 2012-03-16  Doug Kwan  <dougkwan@google.com>
230
231         * testsuite/Makefile.am: Disable test initpri3b.
232         * testsuite/Makefile.in: Regenerate.
233
234 2012-03-15  Doug Kwan  <dougkwan@google.com>
235
236         * arm.cc (Target_arm::got_section): Make .got section read-only
237         if -z now is given.
238
239 2012-03-15  Ian Lance Taylor  <iant@google.com>
240
241         PR gold/13850
242         * layout.cc (Layout::make_output_section): Correctly mark
243         SHT_INIT_ARRAY, et. al., as relro.
244
245 2012-03-14  Doug Kwan  <dougkwan@google.com>
246
247         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
248         dynamic relocations for protected symbols in shared objects.
249
250 2012-03-13  Ian Lance Taylor  <iant@google.com>
251
252         * resolve.cc (Symbol_table::resolve): When merging common symbols,
253         keep the larger alignment.
254
255 2012-03-12  Cary Coutant  <ccoutant@google.com>
256
257         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
258         handling of DW_LNE_define_file.
259
260 2012-03-12  Cary Coutant  <ccoutant@google.com>
261
262         * reduced_debug_output.cc
263         (Output_reduced_debug_info_section::get_die_end): Add new FORM
264         codes to switch.
265
266 2012-02-29  Cary Coutant  <ccoutant@google.com>
267
268         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
269
270 2012-02-29  Cary Coutant  <ccoutant@google.com>
271
272         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
273         Call Object::decompressed_section_contents.
274         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
275         New dtor.
276         (Sized_dwarf_line_info::buffer_start_): New data member.
277         * merge.cc (Output_merge_data::do_add_input_section): Call
278         Object::decompressed_section_contents.
279         (Output_merge_string::do_add_input_section): Likewise.
280         * object.cc (need_decompressed_section): New function.
281         (build_compressed_section_map): Decompress sections needed later.
282         (Sized_relobj_file::do_decompressed_section_contents): New function.
283         (Sized_relobj_file::do_discard_decompressed_sections): New function.
284         * object.h (Object::decompressed_section_contents): New function.
285         (Object::discard_decompressed_sections): New function.
286         (Object::do_decompressed_section_contents): New function.
287         (Object::do_discard_decompressed_sections): New function.
288         (Compressed_section_info): New type.
289         (Compressed_section_map): Include decompressed section contents.
290         (Sized_relobj_file::do_decompressed_section_contents): New function.
291         (Sized_relobj_file::do_discard_decompressed_sections): New function.
292
293 2012-02-16  Cary Coutant  <ccoutant@google.com>
294
295         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
296         * testsuite/Makefile.in: Regenerate.
297
298 2012-02-14  Cary Coutant  <ccoutant@google.com>
299
300         * options.cc (General_options::finalize): Disallow -pie and -static.
301
302 2012-02-03  Doug Kwan  <dougkwan@google.com>
303
304         * arm.cc (Arm_relocate_functions::abs8,
305         Arm_relocate_functions::abs16): Use
306         Bits::has_signed_unsigned_overflow32.
307         (Arm_relocate_functions::thm_abs8): Correct range of
308         overflow check.
309         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
310         in assertions.
311
312 2012-02-02  Doug Kwan  <dougkwan@google.com>
313
314         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
315         position independent outputs, not just shared objects.
316
317 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
318
319         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
320         * configure: Regenerated.
321
322 2012-01-27  Ian Lance Taylor  <iant@google.com>
323
324         * reloc.h (Bits): New class with static functions, copied from
325         namespace utils in arm.cc.
326         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
327         instead.
328
329 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
330
331         * incremental.cc (write_info_blocks): Correct relocation offset.
332
333 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
334
335         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
336         (Relocate::tls_gd_to_le): Likewise.
337
338 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
339
340         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
341
342 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
343
344         * configure.ac: Check if -mcmodel=medium works.
345         * configure: Regenerated.
346
347 2012-01-24  Cary Coutant  <ccoutant@google.com>
348
349         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
350         definition and ...
351         (read_unsigned_LEB_128_x): ... this new function.
352         (read_signed_LEB_128): Replaced with inline definition and ...
353         (read_signed_LEB_128_x): ... this new function.
354         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
355         (read_unsigned_LEB_128): Add inline definition.
356         (read_signed_LEB_128_x): New function.
357         (read_signed_LEB_128): Add inline definition.
358         * testsuite/Makefile.am (leb128_unittest): New unit test.
359         * testsuite/Makefile.in: Regenerate.
360         * testsuite/leb128_unittest.cc: New unit test.
361
362 2012-01-23  Ian Lance Taylor  <iant@google.com>
363
364         PR gold/13617
365         * i386.cc (Target_i386::do_code_fill): When using a jmp
366         instruction, pad with nop instructions.
367         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
368
369 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
370
371         * x86_64.cc (gc_process_relocs): Add typename on types used in
372         template.
373         (scan_relocs): Likewise.
374         (relocate_section): Likewise.
375         (apply_relocation): Likewise.
376
377 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
378
379         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
380         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
381         under x32.
382
383 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
384
385         * x86_64.cc: Initial support for x32.
386
387 2012-01-03  Cary Coutant  <ccoutant@google.com>
388
389         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
390         Use abstract base class for GOT.
391         * gold/output.h (class Output_data_got_base): New abstract base class.
392         (class Output_data_got): Derive from new base class, adjust ctors.
393         (Output_data_got::reserve_slot): Make virtual; rename to
394         do_reserve_slot; Adjust callers.
395         * gold/target.h (Sized_target::init_got_plt_for_update): Return
396         pointer to abstract base class.
397         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
398
399 2011-12-18  Ian Lance Taylor  <iant@google.com>
400
401         * object.h (Relobj::local_symbol_value): New function.
402         (Relobj::local_plt_offset): New function.
403         (Relobj::local_has_got_offset): New function.
404         (Relobj::local_got_offset): New function.
405         (Relobj::set_local_got_offset): New function.
406         (Relobj::do_local_symbol_value): New pure virtual function.
407         (Relobj::do_local_plt_offset): Likewise.
408         (Relobj::do_local_has_got_offset): Likewise.
409         (Relobj::do_local_got_offset): Likewise.
410         (Relobj::do_set_local_got_offset): Likewise.
411         (Sized_relobj::do_local_has_got_offset): Rename from
412         local_has_got_offset.
413         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
414         (Sized_relobj::do_set_local_got_offset): Rename from
415         set_local_got_offset.
416         (Sized_relobj_file::do_local_plt_offset): Rename from
417         local_plt_offset.
418         (Sized_relobj_file::do_local_symbol_value): New function.
419         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
420         local_plt_offset.
421         * output.cc (Output_data_got::Got_entry::write): Change object to
422         Relobj.  Use local_symbol_value.
423         (Output_data_got::add_global_with_rel): Change rel_dyn to
424         Output_data_reloc_generic*.  Use add_global_generic.
425         (Output_data_got::add_global_with_rela): Remove.  Change all
426         callers to use add_global_with_rel.
427         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
428         Output_data_reloc_generic*.  Use add_global_generic.
429         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
430         callers to use add_global_pair_with_rel.
431         (Output_data_got::add_local): Change object to Relobj*.
432         (Output_data_got::add_local_plt): Likewise.
433         (Output_data_got::add_local_with_rel): Change object to Relobj*,
434         change rel_dyn to Output_data_reloc_generic*.  Use
435         add_local_generic.
436         (Output_data_got::add_local_with_rela): Remove.  Change all
437         callers to use all_local_with_rel.
438         (Output_data_got::add_local_pair_with_rel): Change object to
439         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
440         add_output_section_generic.
441         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
442         callers to use add_local_pair_with_rel.
443         (Output_data_got::reserve_local): Change object to Relobj*.
444         * output.h: (class Output_data_reloc_generic): Add pure virtual
445         declarations for add_global_generic, add_local_generic,
446         add_output_section_generic.
447         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
448         functions for Output_data_reloc_generic.  Update declarations for
449         changes listed in output.cc.
450         (class Output_data_got): Change template parameter to got_size.
451         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
452         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
453         function.
454         (Sized_relobj_incr::do_local_plt_offset): New function.
455         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
456         add_global_generic.
457
458 2011-12-17  Cary Coutant  <ccoutant@google.com>
459
460         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
461         * resolve.cc (Symbol_table::resolve): Likewise.
462         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
463         arrays.
464         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
465
466 2011-12-16  Ian Lance Taylor  <iant@google.com>
467
468         * output.h (Output_data_reloc_generic::add): Only call
469         add_dynamic_reloc if this is a dynamic reloc section.
470
471 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
472
473         PR gold/13505
474         * target-reloc.h (apply_relocation): Replace <64, false> with
475         <size, big_endian>.
476
477 2011-11-25  Nick Clifton  <nickc@redhat.com>
478
479         * po/it.po: New Italian translation.
480
481 2011-11-17  Sterling Augustine  <saugustine@google.com>
482
483         * script.cc (script_include_directive): Implement.
484         (read_script_file): New local variables name and search_path. Update
485         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
486         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
487         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
488
489 2011-11-11  Sterling Augustine  <saugustine@google.com>
490
491         * yyscript.y (section_cmd): Add support for INCLUDE directive.
492         (file_or_sections_cmd): Likewise.
493
494 2011-11-11  Doug Kwan  <dougkwan@google.com>
495
496         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
497         if --just-symbols is given.
498
499 2011-11-10  Doug Kwan  <dougkwan@google.com>
500
501         PR gold/13362
502         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
503         when processing data relocs.
504         * reloc.h (Relocate_functions::rel_unaligned): New method.
505         (Relocate_functions::pcrel_unaligned): Ditto.
506         (Relocate_functions::rel32_unaligned): Ditto.
507         (Relocate_functions::pcrel32_unaligned): Ditto.
508
509 2011-11-09  Doug Kwan  <dougkwan@google.com>
510
511         PR gold/13362
512         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
513         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
514         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
515         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
516         (Relocate_functions::rel_unaligned): New.
517         (Relocate_functions::rel32_unaligned): New.
518         * target-reloc.h (relocate_for_relocatable): Add code to handle
519         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
520         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
521         arm_unaligned_reloc_r): New targets.
522         * testsuite/Makefile.in: Regenerate.
523         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
524         linking.
525
526 2011-11-02  Ian Lance Taylor  <iant@google.com>
527
528         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
529         NATIVE_LINKER.
530         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
531         * options.cc (General_options::finalize): Use library search path
532         from configure script if specified.  If not native and no sysroot,
533         only search TOOLLIBDIR.
534         * options.h (Search_directory::Search_directory): Change name to
535         const std::string&.
536         (General_options::add_to_library_path_with_sysroot): Change arg to
537         const std::string&.
538         * configure, Makefile.in, config.in: Rebuild.
539
540 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
541
542         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
543         we are working around the ARM1176 Erratum.
544         * options.h (General_options::fix_arm1176): Add option.
545         * testsuite/Makefile.am: Add testcases, and keep current ones
546         working.
547         * testsuite/Makefile.in: Regenerate.
548         * testsuite/arm_fix_1176.s: New file.
549         * testsuite/arm_fix_1176.sh: Likewise.
550
551 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
552
553         * arm.cc (Target_arm::Target_arm): Remove initialisation of
554         may_use_blx_.
555         (Target_arm::may_use_blx): Remove method.
556         (Target_arm::set_may_use_blx): Likewise.
557         (Target_arm::may_use_v4t_interworking): New method.
558         (Target_arm::may_use_v5t_interworking): Likewise.
559         (Target_arm::may_use_blx_): Remove member variable.
560         (Arm_relocate_functions::arm_branch_common): Check for v5T
561         interworking.
562         (Arm_relocate_functions::thumb_branch_common): Likewise.
563         (Reloc_stub::stub_type_for_reloc): Likewise.
564         (Target_arm::do_finalize_sections): Correct interworking checks.
565         * testsuite/Makefile.am: Add new tests.
566         * testsuite/Makefile.in: Regenerate.
567         * testsuite/arm_farcall_arm_arm.s: New test.
568         * testsuite/arm_farcall_arm_arm.sh: Likewise.
569         * testsuite/arm_farcall_arm_thumb.s: Likewise.
570         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
571         * testsuite/arm_farcall_thumb_arm.s: Likewise.
572         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
573         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
574         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
575
576 2011-10-31  Cary Coutant  <ccoutant@google.com>
577
578         PR gold/13023
579         * expression.cc (Expression::eval_with_dot): Add
580         is_section_dot_assignment parameter.
581         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
582         absolute and assigning to dot within a section.
583         * script-sections.cc
584         (Output_section_element_assignment::set_section_addresses): Pass
585         dot_section to set_if_absolute.
586         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
587         as is_section_dot_assignment flag to eval_with_dot.
588         (Output_section_element_dot_assignment::set_section_addresses):
589         Likewise.
590         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
591         parameter.  Also set value if relative to dot_section; set the
592         symbol's output_section.
593         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
594         parameter.  Adjust all callers.
595         (Expression::eval_maybe_dot): Likewise.
596         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
597         Adjust all callers.
598         * testsuite/script_test_2.t: Test assignment of an absolute value
599         to dot within an output section element.
600
601 2011-10-31  Cary Coutant  <ccoutant@google.com>
602
603         * options.h (class General_options): Add --[no-]gnu-unique options.
604         * symtab.cc (Symbol_table::sized_write_globals): Convert
605         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
606
607 2011-10-31  Cary Coutant  <ccoutant@google.com>
608
609         PR gold/13359
610         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
611         unnecessary assertion.
612         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
613
614 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
615
616         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
617         gc_mark_symbol.
618         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
619         gc_mark_symbol.
620         Change to just keep the section associated with symbol.
621         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
622         they are externally visible and --export-dynamic is turned on.
623         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
624
625 2011-10-19  Ian Lance Taylor  <iant@google.com>
626
627         PR gold/13163
628         * script-sections.cc
629         (Output_section_element_dot_assignment::needs_output_section): New
630         function.
631
632 2011-10-19  Ian Lance Taylor  <iant@google.com>
633
634         PR gold/13204
635         * layout.cc (Layout::segment_precedes): Don't assert failure if a
636         --section-start option was seen.
637         * options.h (General_options::any_section_start): New function.
638
639 2011-10-18  David S. Miller  <davem@davemloft.net>
640
641         PR binutils/13301
642         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
643         member to track relocation locations that have moved during TLS
644         reloc optimizations.
645         (Target_sparc::Relocate::Relocate): Initialize to NULL.
646         (Target_sparc::Relocate::relocate): Adjust view down by 4
647         bytes if it matches reloc_adjust_addr_.
648         (Target_sparc::Relocate::relocate_tls): Always move the
649         __tls_get_addr call delay slot instruction forward 4 bytes when
650         performing relaxation.
651
652 2011-10-18  Cary Coutant  <ccoutant@google.com>
653
654         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
655         (Output_file::map_no_anonymous): Check for non-zero
656         return code from posix_fallocate.
657
658 2011-10-17  Cary Coutant  <ccoutant@google.com>
659
660         PR gold/13245
661         * plugin.cc (is_visible_from_outside): Check for symbols
662         referenced from dynamic objects.
663         * resolve.cc (Symbol_table::resolve): Don't count references
664         from dynamic objects as references from real ELF files.
665         * testsuite/plugin_test_2.sh: Adjust expected result.
666
667 2011-10-17  Cary Coutant  <ccoutant@google.com>
668
669         * gold.cc: Include timer.h.
670         (queue_middle_tasks): Stamp time.
671         (queue_final_tasks): Likewise.
672         * main.cc (main): Store timer in parameters.  Print timers
673         for each pass.
674         * parameters.cc (Parameters::Parameters): Initialize timer_.
675         (Parameters::set_timer): New function.
676         (set_parameters_timer): New function.
677         * parameters.h (Parameters::set_timer): New function.
678         (Parameters::timer): New function.
679         (Parameters::timer_): New data member.
680         (set_parameters_timer): New function.
681         * timer.cc (Timer::stamp): New function.
682         (Timer::get_pass_time): New function.
683         * timer.h (Timer::stamp): New function.
684         (Timer::get_pass_time): New function.
685         (Timer::pass_times_): New data member.
686
687 2011-10-17  Cary Coutant  <ccoutant@google.com>
688
689         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
690         task for members of lib groups.
691
692 2011-10-17  Cary Coutant  <ccoutant@google.com>
693
694         PR gold/13288
695         * fileread.cc (File_read::find_view): Add assert.
696         (File_read::make_view): Move bounds check (replace with assert)...
697         (File_read::find_or_make_view): ... to here.
698
699 2011-10-12  Cary Coutant  <ccoutant@google.com>
700
701         * output.cc (Output_file::open_base_file): Handle case where
702         ::read returns less than requested size.
703
704 2011-10-10  Cary Coutant  <ccoutant@google.com>
705
706         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
707         Initialize defined_count_.
708         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
709         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
710         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
711         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
712         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
713         * incremental.h (Sized_relobj_incr::defined_count_): New data
714         member.
715         (Sized_incr_dynobj::defined_count_): New data member.
716         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
717         Return zeroes instead of internal error.
718
719 2011-10-10  Cary Coutant  <ccoutant@google.com>
720
721         PR gold/13249
722         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
723         (Output_reloc::symbol_value): Return PLT offset if flag is set.
724         * output.h (class Output_reloc): Add use_plt_offset flag.
725         (Output_reloc::type_): Adjust size of bit field.
726         (Output_reloc::use_plt_offset_): New bit field.
727         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
728         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
729         flag.  Adjust all callers.
730         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
731         creating RELATIVE relocations.
732
733 2011-10-10  Nick Clifton  <nickc@redhat.com>
734
735         * po/es.po: Updated Spanish translation.
736         * po/fi.po: Updated Finnish translation.
737
738 2011-10-03   Diego Novillo  <dnovillo@google.com>
739
740         * options.cc (parse_uint): Fix dereference of RETVAL.
741
742 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
743
744         * layout.h (section_order_map_): New member.
745         (get_section_order_map): New member function.
746         * output.cc (Output_section::add_input_section): Check for patterns
747         only when --section-ordering-file is specified.
748         * gold.cc (queue_middle_tasks): Delay updating order of sections till
749         output_sections have been formed.
750         * layout.cc (Layout_Layout): Initialize section_order_map_.
751         * plugin.cc (update_section_order): Store order in order_map. Do not
752         update the order.
753         * testsuite/Makefile.am: Add test case for plugin_final_layout.
754         * testsuite/Makefile.in: Regenerate.
755         * testsuite/plugin_section_order.c: New file.
756         * testsuite/plugin_final_layout.cc: New file.
757         * testsuite/plugin_final_layout.sh: New file.
758
759 2011-09-29  Cary Coutant  <ccoutant@google.com>
760
761         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
762         Check for NULL.
763         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
764         symbols during incremental update.
765         (Symbol_table::add_from_dynobj): Likewise.
766
767 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
768             Ian Lance Taylor  <iant@google.com>
769
770         * symtab.cc (Symbol_table::define_special_symbol): Always
771         canonicalize version string.
772
773 2011-09-26  Cary Coutant  <ccoutant@google.com>
774
775         * gold.cc (queue_initial_tasks): Move option checks ...
776         * options.cc (General_options::finalize): ... to here. Disable
777         some options; make others fatal.
778
779 2011-09-26  Cary Coutant  <ccoutant@google.com>
780
781         gcc PR lto/47247
782         * plugin.cc (get_symbols_v2): New function.
783         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
784         (is_referenced_from_outside): New function.
785         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
786         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
787         (get_symbols): Pass version parameter.
788         (get_symbols_v2): New function.
789         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
790         parameter.
791         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
792         (onload): Add LDPT_GET_SYMBOLS_V2.
793         (all_symbols_read_hook): Use get_symbols_v2; check for
794         LDPR_PREVAILING_DEF_IRONLY_EXP.
795         * testsuite/plugin_test_3.sh: Update expected results.
796
797 2011-09-23  Simon Baldwin  <simonb@google.com>
798
799         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
800         configuration options.
801         * configure: Regenerate.
802         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
803         * Makefile.in: Regenerate.
804         * testsuite/Makefile.in: Regenerate.
805
806 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
807
808         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
809
810 2011-09-19  Cary Coutant  <ccoutant@google.com>
811
812         * incremental.cc (can_incremental_update): Fix typo in comment.
813         * incremental.h (can_incremental_update): Likewise.
814
815 2011-09-18  Cary Coutant  <ccoutant@google.com>
816
817         * incremental.cc (can_incremental_update): New function.
818         * incremental.h (can_incremental_update): New function.
819         * layout.cc (Layout::init_fixed_output_section): Call it.
820         (Layout::make_output_section): Don't allow patch space in .eh_frame.
821         * object.cc (Sized_relobj_file::do_layout): Call
822         can_incremental_update.
823
824 2011-09-13  Cary Coutant  <ccoutant@google.com>
825
826         * configure.ac: Check for glibc support for gnu_indirect_function
827         support with static linking, setting automake conditional
828         IFUNC_STATIC.
829         * Makefile.in: Regenerate.
830         * configure: Regenerate.
831
832         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
833         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
834         for IFUNC_STATIC.
835         * testsuite/Makefile.in: Regenerate.
836
837 2011-09-13  Cary Coutant  <ccoutant@google.com>
838
839         * incremental.cc (Sized_relobj_incr::do_layout): Call
840         report_comdat_group for kept comdat sections.
841         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
842         * testsuite/Makefile.in: Regenerate.
843         * testsuite/incr_comdat_test_1.cc: New source file.
844         * testsuite/incr_comdat_test_2_v1.cc: New source file.
845         * testsuite/incr_comdat_test_2_v2.cc: New source file.
846         * testsuite/incr_comdat_test_2_v3.cc: New source file.
847
848 2011-09-13  Ian Lance Taylor  <iant@google.com>
849
850         * object.cc (Sized_relobj_file::do_layout): Remove unused local
851         variable external_symbols_offset.
852
853 2011-09-12  Ian Lance Taylor  <iant@google.com>
854
855         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
856         triggered if object has no symbols.
857
858 2011-09-09  David S. Miller  <davem@davemloft.net>
859
860         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
861         (Output_fill_debug_line::do_write): Likewise.
862
863 2011-08-29  Cary Coutant  <ccoutant@google.com>
864
865         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
866         casts to match formatting specs.
867         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
868
869 2011-08-26  Cary Coutant  <ccoutant@google.com>
870
871         * layout.cc (Free_list::allocate): Provide guarantee of minimum
872         remaining hole size when allocating.
873         (Layout::make_output_section): Set fill methods for debug sections.
874         * layout.h (Free_list::Free_list_node): Move from private to
875         public.
876         (Free_list::set_min_hole_size): New function.
877         (Free_list::begin, Free_list::end): New functions.
878         (Free_list::min_hole_): New data member.
879         * output.cc: Include dwarf.h.
880         (Output_fill_debug_info::do_minimum_hole_size): New function.
881         (Output_fill_debug_info::do_write): New function.
882         (Output_fill_debug_line::do_minimum_hole_size): New function.
883         (Output_fill_debug_line::do_write): New function.
884         (Output_section::Output_section): Initialize new data member.
885         (Output_section::set_final_data_size): Ensure patch space is larger
886         than minimum hole size.
887         (Output_section::do_write): Fill holes in debug sections.
888         * output.h (Output_fill): New class.
889         (Output_fill_debug_info): New class.
890         (Output_fill_debug_line): New class.
891         (Output_section::set_free_space_fill): New function.
892         (Output_section::free_space_fill_): New data member.
893         * testsuite/Makefile.am (incremental_test_3): Add
894         --incremental-patch option.
895         (incremental_test_4): Likewise.
896         (incremental_test_5): Likewise.
897         (incremental_test_6): Likewise.
898         (incremental_copy_test): Likewise.
899         (incremental_common_test_1): Likewise.
900         * testsuite/Makefile.in: Regenerate.
901
902 2011-08-26  Nick Clifton  <nickc@redhat.com>
903
904         * po/es.po: Updated Spanish translation.
905
906 2011-08-01  Cary Coutant  <ccoutant@google.com>
907
908         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
909         * gold/testsuite/Makefile.in: Regenerate.
910         * gold/testsuite/justsyms_exec.c: New source file.
911         * gold/testsuite/justsyms_lib.c: New source file.
912
913 2011-08-01  Cary Coutant  <ccoutant@google.com>
914
915         * layout.cc (Layout::set_segment_offsets): Don't realign text
916         segment if -Ttext was specified.
917         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
918         file type.
919         * object.h (Sized_relobj_file::e_type): New function.
920         (Sized_relobj_file::e_type_): New data member.
921         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
922         base address for ET_EXEC files.
923         * target.cc (Target::do_make_elf_object_implementation): Allow
924         ET_EXEC files with --just-symbols option.
925
926 2011-07-28  Cary Coutant  <ccoutant@google.com>
927
928         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
929         Add thread_number parameter.
930         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
931         * workqueue-threads.cc
932         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
933         current thread if its thread number is greater than desired thread
934         count.
935         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
936         Add thread_number parameter.
937         (Workqueue::should_cancel_thread): Likewise.
938         (Workqueue::find_runnable_or_wait): Pass thread_number to
939         should_cancel_thread.
940         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
941         parameter.
942
943 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
944
945         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
946         only after checking if it cannot be forced local.
947         * symtab.h (is_externally_visible): Check if the symbol is not forced
948         local.
949
950 2011-07-15  Ian Lance Taylor  <iant@google.com>
951
952         * options.h (class General_options): Add --print-output-format.
953         Move -EL next to -EB, for  better --help output.
954         * target-select.cc: Include <cstdio>, "options.h", and
955         "parameters.h".
956         (Target_selector::do_target_bfd_name): New function.
957         (print_output_format): New function.
958         * target-select.h (class Target_selector): Update declarations.
959         (Target_selector::target_bfd_name): New function.
960         (print_output_format): Declare.
961         * main.cc: Include "target-select.h".
962         (main): Handle --print-output-format.
963         * gold.cc: Include "target-select.h".
964         (queue_initial_tasks): Handle --print-output-format when there are
965         no input files.
966         * parameters.cc (parameters_force_valid_target): Give a better
967         error message if -EB/-EL does not match target.
968         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
969         function.
970
971 2011-07-15  Ian Lance Taylor  <iant@google.com>
972
973         * i386.cc (class Output_data_plt_i386): Add layout_ field.
974         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
975         (Output_data_plt_i386::do_write): Write address of .dynamic
976         section to first entry in .got.plt section.
977         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
978         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
979         Initialize layout_.
980         (Output_data_plt_x86_64::do_write): Write address of .dynamic
981         section to first entry in .got.plt section.
982         * layout.h (Layout::dynamic_section): New function.
983
984 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
985
986         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
987         to claim_file call.
988         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
989         input_section_position_, and input_section_glob_.
990         (read_layout_from_file): Call function section_ordering_specified.
991         * layout.h (is_section_ordering_specified): New function.
992         (section_ordering_specified): New function.
993         (section_ordering_specified_): New boolean member.
994         * main.cc(main): Call load_plugins after layout object is defined.
995         * output.cc (Output_section::add_input_section): Use
996         function section_ordering_specified to check if section ordering is
997         needed.
998         * output.cc (Output_section::add_relaxed_input_section): Use
999         function section_ordering_specified to check if section ordering is
1000         needed.
1001         (Output_section::update_section_layout): New function.
1002         (Output_section::sort_attached_input_sections): Check if input section
1003         must be reordered.
1004         * output.h (Output_section::update_section_layout): New function.
1005         * plugin.cc (get_section_count): New function.
1006         (get_section_type): New function.
1007         (get_section_name): New function.
1008         (get_section_contents): New function.
1009         (update_section_order): New function.
1010         (allow_section_ordering): New function.
1011         (Plugin::load): Add the new interfaces to the transfer vector.
1012         (Plugin_manager::load_plugins): New parameter.
1013         (Plugin_manager::all_symbols_read): New parameter.
1014         (Plugin_manager::claim_file): New parameter. Save the elf object for
1015         unclaimed objects.
1016         (Plugin_manager::get_elf_object): New function.
1017         (Plugin_manager::get_view): Change to directly use the bool to check
1018         if get_view is called from claim_file_hook.
1019         * plugin.h (input_objects): New function
1020         (Plugin__manager::load_plugins): New parameter.
1021         (Plugin_manager::claim_file): New parameter.
1022         (Plugin_manager::get_elf_object): New function.
1023         (Plugin_manager::in_claim_file_handler): New function.
1024         (Plugin_manager::in_claim_file_handler_): New member.
1025         (layout): New function.
1026         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1027         handler with an extra parameter. Make the elf object before calling
1028         claim_file handler.
1029         * testsuite/plugin_test.c (get_section_count): New function pointer.
1030         (get_section_type): New function pointer.
1031         (get_section_name): New function pointer.
1032         (get_section_contents): New function pointer.
1033         (update_section_order): New function pointer.
1034         (allow_section_ordering): New function pointer.
1035         (onload): Check if the new interfaces exist.
1036
1037 2011-07-13  Ian Lance Taylor  <iant@google.com>
1038
1039         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1040         relro section.
1041         * x86_64.cc (Target_x86_64::got_section): Likewise.
1042         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1043         (relro_now_test_SOURCES): New variable.
1044         (relro_now_test_DEPENDENCIES): New variable.
1045         (relro_now_test_LDFLAGS): New variable.
1046         (relro_now_test_LDADD): New variable.
1047         (relro_now_test.so): New target.
1048         * testsuite/Makefile.in: Rebuild.
1049
1050 2011-07-12  Ian Lance Taylor  <iant@google.com>
1051
1052         PR gold/12980
1053         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1054         GLOB_DAT relocation rather than a RELATIVE relocation for a
1055         protected symbol when creating a shared library.
1056         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1057         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1058         * testsuite/protected_main_1.cc (main): Test that protected
1059         function has same address.
1060
1061 2011-07-11  Ian Lance Taylor  <iant@google.com>
1062
1063         PR gold/12979
1064         * options.h (class General_options): Add -Bgroup.
1065         * options.cc (General_options::finalize): If -Bgroup is set,
1066         default to --unresolved-symbols=report-all.
1067         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1068         * target-reloc.h (issue_undefined_symbol_error): Handle
1069         --unresolved-symbols=report-all.
1070
1071 2011-07-08  Ian Lance Taylor  <iant@google.com>
1072
1073         PR gold/11985
1074         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1075         if linker script discards key sections.
1076         (Layout::create_dynamic_symtab): Likewise.
1077         (Layout::assign_local_dynsym_offsets): Likewise.
1078         (Layout::sized_create_version_sections): Likewise.
1079         (Layout::create_interp): Likewise.
1080         (Layout::finish_dynamic_section): Likewise.
1081         (Layout::set_dynamic_symbol_size): Likewise.
1082
1083 2011-07-08  Ian Lance Taylor  <iant@google.com>
1084
1085         PR gold/12386
1086         * options.h (class General_options): Add --unresolved-symbols.
1087         * target-reloc.h (issue_undefined_symbol_error): Check
1088         --unresolved-symbols.  Add comments.
1089
1090 2011-07-08  Ian Lance Taylor  <iant@google.com>
1091
1092         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1093         expression more complex.
1094
1095 2011-07-08  Ian Lance Taylor  <iant@google.com>
1096
1097         PR gold/11317
1098         * target-reloc.h (issue_undefined_symbol_error): New inline
1099         function, broken out of relocate_section.
1100         (relocate_section): Call issue_undefined_symbol_error.
1101         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1102         there is no TLS segment if we are about to issue an undefined
1103         symbol error.
1104         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1105
1106 2011-07-08  Ian Lance Taylor  <iant@google.com>
1107
1108         PR gold/12279
1109         * resolve.cc (Symbol_table::should_override): Add fromtype
1110         parameter.  Change all callers.  Give error when linking together
1111         TLS and non-TLS symbol.
1112         (Symbol_table::should_override_with_special): Add fromtype
1113         parameter.  Change all callers.
1114         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1115         there is no TLS segment if we have reported some errors.
1116         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1117
1118 2011-07-08  Ian Lance Taylor  <iant@google.com>
1119
1120         PR gold/12372
1121         * target.h (Target::plt_address_for_global): New function.
1122         (Target::plt_address_for_local): New function.
1123         (Target::plt_section_for_global): Remove.
1124         (Target::plt_section_for_local): Remove.
1125         (Target::do_plt_address_for_global): New virtual function.
1126         (Target::do_plt_address_for_local): New virtual function.
1127         (Target::do_plt_section_for_global): Remove.
1128         (Target::do_plt_section_for_local): Remove.
1129         (Target::register_global_plt_entry): Add Symbol_table and Layout
1130         parameters.
1131         * output.cc (Output_data_got::Got_entry::write): Use
1132         plt_address_for_global and plt_address_for_local.
1133         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1134         address of output section.
1135         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1136         got_irelative_, and irelative_count_ fields.  Update
1137         declarations.
1138         (Output_data_plt_i386::has_irelative_section): New function.
1139         (Output_data_plt_i386::entry_count): Add irelative_count_.
1140         (Output_data_plt_i386::set_final_data_size): Likewise.
1141         (class Target_i386): Add got_irelative_ and rel_irelative_
1142         fields.  Update declarations.
1143         (Target_i386::Target_i386): Initialize new fields.
1144         (Target_i386::do_plt_address_for_global): New function replacing
1145         do_plt_section_for_global.
1146         (Target_i386::do_plt_address_for_local): New function replacing
1147         do_plt_section_for_local.
1148         (Target_i386::got_section): Create got_irelative_.
1149         (Target_i386::rel_irelative_section): New function.
1150         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1151         fields.  Don't define __rel_iplt_{start,end}.
1152         (Output_data_plt_i386::add_entry): Add symtab and layout
1153         parameters.  Change all callers.  Use different PLT and GOT for
1154         IFUNC symbols.
1155         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1156         layout parameters.  Change all callers.  Use different PLT and
1157         GOT.
1158         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1159         (Output_data_plt_i386::rel_irelative): New function.
1160         (Output_data_plt_i386::address_for_global): New function.
1161         (Output_data_plt_i386::address_for_local): New function.
1162         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1163         IRELATIVE GOT when changing IFUNC GOT entries.
1164         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1165         reloc.
1166         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1167         if we didn't create an IRELATIVE GOT.
1168         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1169         plt_address_for_local.
1170         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1171         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1172         got_irelative_, and irelative_count_ fields.  Update
1173         declarations.
1174         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1175         Initialize new fields.  Remove symtab parameter.  Change all
1176         callers.
1177         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1178         irelative_count_.
1179         (Output_data_plt_x86_64::has_irelative_section): New function.
1180         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1181         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1182         fields.  Update declarations.
1183         (Target_x86_64::Target_x86_64): Initialize new fields.
1184         (Target_x86_64::do_plt_address_for_global): New function replacing
1185         do_plt_section_for_global.
1186         (Target_x86_64::do_plt_address_for_local): New function replacing
1187         do_plt_section_for_local.
1188         (Target_x86_64::got_section): Create got_irelative_.
1189         (Target_x86_64::rela_irelative_section): New function.
1190         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1191         all callers.  Don't create __rel_iplt_{start,end}.
1192         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1193         parameters.  Change all callers.  Use different PLT and GOT for
1194         IFUNC symbols.
1195         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1196         layout parameters.  Change all callers.  Use different PLT and
1197         GOT.
1198         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1199         parameters.  Change all callers.  Use different PLT and GOT for
1200         IFUNC symbols.
1201         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1202         (Output_data_plt_x86_64::rela_irelative): New function.
1203         (Output_data_plt_x86_64::address_for_global): New function.
1204         (Output_data_plt_x86_64::address_for_local): New function.
1205         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1206         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1207         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1208         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1209         parameters.
1210         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1211         reloc.
1212         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1213         symbols if we didn't create an IRELATIVE GOT.
1214         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1215         plt_address_for_local.
1216         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1217         * testsuite/ifuncvar1.c: New test file.
1218         * testsuite/ifuncvar2.c: New test file.
1219         * testsuite/ifuncvar3.c: New test file.
1220         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1221         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1222         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1223         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1224         * testsuite/Makefile.in: Rebuild.
1225
1226 2011-07-07  Cary Coutant  <ccoutant@google.com>
1227
1228         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1229         (two_file_test_1_ndebug.o): Likewise.
1230         (two_file_test_1b_ndebug.o): Likewise.
1231         (two_file_test_2_ndebug.o): Likewise.
1232         (two_file_test_main_ndebug.o): Likewise.
1233         (incremental_test_2): Link with no-debug versions.
1234
1235 2011-07-06  Cary Coutant  <ccoutant@google.com>
1236
1237         * gold/incremental.cc
1238         (Output_section_incremental_inputs::write_info_blocks): Check for
1239         hidden and internal symbols.
1240
1241 2011-07-06  Cary Coutant  <ccoutant@google.com>
1242
1243         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1244         Check disposition for startup file.
1245         (Incremental_inputs::report_command_line): Ignore
1246         --incremental-startup-unchanged option.
1247         * options.cc (General_options::parse_incremental_startup_unchanged):
1248         New function.
1249         (General_options::General_options): Initialize new data member.
1250         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1251         (General_options): Add --incremental-startup-unchanged option.
1252         (General_options::incremental_startup_disposition): New function.
1253         (General_options::incremental_startup_disposition_): New data member.
1254
1255 2011-07-06  Cary Coutant  <ccoutant@google.com>
1256
1257         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1258         input file index to Script_info ctor.
1259         (Sized_incremental_binary::do_file_has_changed): Find the
1260         command-line argument for files named in scripts.
1261         * incremental.h (Script_info::Script_info): New ctor
1262         with input file index.
1263         (Script_info::input_file_index): New function.
1264         (Script_info::input_file_index_): New data member.
1265         (Incremental_binary::get_library): Add const.
1266         (Incremental_binary::get_script_info): Add const.
1267         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1268         * testsuite/Makefile.am (incremental_test_5): New test case.
1269         (incremental_test_6): New test case.
1270         * testsuite/Makefile.in: Regenerate.
1271
1272 2011-07-06  Cary Coutant  <ccoutant@google.com>
1273
1274         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1275         debug output when command lines differ.
1276
1277 2011-07-06  Cary Coutant  <ccoutant@google.com>
1278
1279         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1280         --incremental-patch option.
1281         * layout.cc (Free_list::allocate): Extend allocation beyond original
1282         end if enabled.
1283         (Layout::make_output_section): Mark sections that should get
1284         patch space.
1285         * options.cc (parse_percent): New function.
1286         * options.h (parse_percent): New function.
1287         (DEFINE_percent): New macro.
1288         (General_options): Add --incremental-patch option.
1289         * output.cc (Output_section::Output_section): Initialize new data
1290         members.
1291         (Output_section::add_input_section): Print section name when out
1292         of patch space.
1293         (Output_section::add_output_section_data): Likewise.
1294         (Output_section::set_final_data_size): Add patch space when
1295         doing --incremental-full.
1296         (Output_section::do_reset_address_and_file_offset): Remove patch
1297         space.
1298         (Output_segment::set_section_list_addresses): Print debug output
1299         only if --incremental-update.
1300         * output.h (Output_section::set_is_patch_space_allowed): New function.
1301         (Output_section::is_patch_space_allowed_): New data member.
1302         (Output_section::patch_space_): New data member.
1303         * parameters.cc (Parameters::incremental_full): New function.
1304         * parameters.h (Parameters::incremental_full): New function
1305         * testsuite/Makefile.am (incremental_test_2): Add test for
1306         --incremental-patch option.
1307         * testsuite/Makefile.in: Regenerate.
1308         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1309         (t18): Remove function body.
1310
1311 2011-07-05  Doug Kwan  <dougkwan@google.com>
1312
1313         PR gold/12771
1314         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1315         Arm_Address type for relocation result.
1316         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1317         overflow check.
1318         (Arm_relocate_functions::abs32): Use unaligned access.
1319         (Arm_relocate_functions::rel32): Ditto.
1320         (Arm_relocate_functions::prel31): Ditto.
1321         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1322         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1323         static data relocations.
1324         * testsuite/Makefile.in: Regnerate.
1325         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1326
1327 2011-07-05  Ian Lance Taylor  <iant@google.com>
1328
1329         PR gold/12392
1330         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1331         symbols if necessary.
1332         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1333
1334 2011-07-05  Ian Lance Taylor  <iant@google.com>
1335
1336         PR gold/12952
1337         * resolve.cc (Symbol::override_base_with_special): Simply override
1338         version with special symbol version, ignoring previous version.
1339
1340 2011-07-05  Ian Lance Taylor  <iant@google.com>
1341
1342         * object.cc (Sized_relobj_file::include_section_group): Add
1343         information to comment about signature location.
1344
1345 2011-07-02  Ian Lance Taylor  <iant@google.com>
1346
1347         PR gold/12957
1348         * options.h (class General_options): Add -f and -F.
1349         * options.cc (General_options::finalize): Fatal error if -f/-F
1350         are used without -shared.
1351         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1352
1353 2011-07-02  Ian Lance Taylor  <iant@google.com>
1354
1355         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1356
1357 2011-07-01  Ian Lance Taylor  <iant@google.com>
1358
1359         PR gold/12525
1360         PR gold/12952
1361         * resolve.cc (Symbol::override_base_with_special): Don't override
1362         the version if the overriding symbol has a different name.
1363         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1364         all callers.  If we give an error about an undefined version,
1365         define the base version if necessary.
1366         * dynobj.h (class Versions): Update declaration.
1367         * testsuite/weak_alias_test_5.cc: New file.
1368         * testsuite/weak_alias_test.script: New file.
1369         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1370         and versioned_alias have the right value, and call t2.
1371         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1372         weak_alias_test_5.so.
1373         (weak_alias_test_LDADD): Likewise.
1374         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1375         * testsuite/Makefile.in: Rebuild.
1376
1377 2011-07-01  Ian Lance Taylor  <iant@google.com>
1378
1379         PR gold/12525
1380         * options.h (class General_options): Support -z notext.
1381         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1382         -Wl,-z,notext.
1383         (two_file_shared_nonpic.so): Likewise.
1384         (two_file_shared_mixed.so): Likewise.
1385         (two_file_shared_mixed_1.so): Likewise.
1386         (weak_undef_lib_nonpic.so): Likewise.
1387         (alt/weak_undef_lib_nonpic.so): Likewise.
1388         (tls_test_shared_nonpic.so): Likewise.
1389         * testsuite/Makefile.in: Rebuild.
1390
1391 2011-07-01  Ian Lance Taylor  <iant@google.com>
1392
1393         PR gold/12525
1394         * configure.ac: Test whether static linking works, setting
1395         the automake conditional HAVE_STATIC.
1396         * testsuite/Makefile.am: Disable tests using -static if
1397         HAVE_STATIC is not true.
1398         * configure, testsuite/Makefile.in: Rebuild.
1399
1400 2011-07-01  Ian Lance Taylor  <iant@google.com>
1401
1402         PR gold/12525
1403         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1404         Assert if we see DW_EH_PE_indirect.
1405         * target.h (Target::ehframe_datarel_base): New function.
1406         (Target::do_ehframe_datarel_base): New target function.
1407         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1408         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1409         function.
1410
1411 2011-07-01  Ian Lance Taylor  <iant@google.com>
1412
1413         PR gold/12571
1414         * options.h (class General_options): Add
1415         --ld-generated-unwind-info.
1416         * ehframe.cc (Fde::write): Add address parameter.  Change all
1417         callers.  If associated with PLT, fill in address and size.
1418         (Cie::set_output_offset): Only add merge mapping if there is an
1419         object.
1420         (Cie::write): Add address parameter.  Change all callers.
1421         (Eh_frame::add_ehframe_for_plt): New function.
1422         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1423         input_offset_ fields into union u_, with new plt field.
1424         (Fde::Fde): Adjust for new union field.
1425         (Fde::Fde) [Output_data version]: New constructor.
1426         (Fde::add_mapping): Only add merge mapping if there is an object.
1427         (class Cie): Update declarations.
1428         (class Eh_frame): Declare add_ehframe_for_plt.
1429         * layout.cc (Layout::layout_eh_frame): Break out code into
1430         make_eh_frame_section, and call it.
1431         (Layout::make_eh_frame_section): New function.
1432         (Layout::add_eh_frame_for_plt): New function.
1433         * layout.h (class Layout): Update declarations.
1434         * merge.cc (Merge_map::add_mapping): Add assertion.
1435         * i386.cc: Include "dwarf.h".
1436         (class Output_data_plt_i386): Make first_plt_entry,
1437         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1438         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1439         and plt_eh_frame_fde.
1440         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1441         boundary.  Call add_eh_frame_for_plt if appropriate.
1442         * x86_64.cc: Include "dwarf.h".
1443         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1444         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1445         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1446         and plt_eh_frame_fde.
1447         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1448         appropriate.
1449
1450 2011-06-29  Ian Lance Taylor  <iant@google.com>
1451
1452         PR gold/12629
1453         * object.cc (Sized_relobj_file::layout_section): Change shdr
1454         parameter to be const.
1455         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1456         out of do_layout.
1457         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1458         appropriate.  Call layout_eh_frame_section.
1459         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1460         sections.
1461         * object.h (class Sized_relobj_file): Update declarations.
1462
1463 2011-06-29  Ian Lance Taylor  <iant@google.com>
1464
1465         PR gold/12652
1466         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1467         modifier.
1468         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1469
1470 2011-06-29  Ian Lance Taylor  <iant@google.com>
1471
1472         PR gold/12675
1473         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1474         SHT_X86_64_UNWIND.
1475         * layout.cc (Layout::layout_eh_frame): Likewise.
1476
1477 2011-06-29  Ian Lance Taylor  <iant@google.com>
1478
1479         PR gold/12695
1480         * layout.cc (Layout::symtab_section_shndx): New function.
1481         * layout.h (class Layout): Declare symtab_section_shndx.
1482         * output.cc (Output_section::write_header): Call it.
1483
1484 2011-06-29  Ian Lance Taylor  <iant@google.com>
1485
1486         PR gold/12818
1487         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1488         symbols which are not used in a relocation.
1489
1490 2011-06-28  Ian Lance Taylor  <iant@google.com>
1491
1492         PR gold/12898
1493         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1494         script create indistinguishable segments.
1495         (Layout::set_segment_offsets): Use stable_sort when sorting
1496         segments.  Pass this to Compare_segments constructor.
1497         * layout.h (class Layout): Make segment_precedes non-static.
1498         (class Compare_segments): Change from struct to class.  Add
1499         layout_ field.  Add constructor.
1500         * script-sections.cc
1501         (Script_sections::attach_sections_using_phdrs_clause): Rename
1502         local orphan to is_orphan.  Don't report failure to put empty
1503         section in segment.  On attachment failure, report name of
1504         section, and attach to first PT_LOAD segment.
1505
1506 2011-06-28  Ian Lance Taylor  <iant@google.com>
1507
1508         PR gold/12934
1509         * target-select.cc (Target_selector::Target_selector): Add
1510         emulation parameter.  Change all callers.
1511         (select_target_by_bfd_name): Rename from select_target_by_name.
1512         Change all callers.
1513         (select_target_by_emulation): New function.
1514         (supported_emulation_names): New function.
1515         * target-select.h (class Target_selector): Add emulation_ field.
1516         Update declarations.
1517         (Target_selector::recognize_by_bfd_name): Rename from
1518         recognize_by_name.  Change all callers.
1519         (Target_selector::supported_bfd_names): Rename from
1520         supported_names.  Change all callers.
1521         (Target_selector::recognize_by_emulation): New function.
1522         (Target_selector::supported_emulations): New function.
1523         (Target_selector::emulation): New function.
1524         (Target_selector::do_recognize_by_bfd_name): Rename from
1525         do_recognize_by_name.  Change all callers.
1526         (Target_selector::do_supported_bfd_names): Rename from
1527         do_supported_names.  Change all callers.
1528         (Target_selector::do_recognize_by_emulation): New function.
1529         (Target_selector::do_supported_emulations): New function.
1530         (select_target_by_bfd_name): Change name in declaration.
1531         (select_target_by_emulation): Declare.
1532         (supported_emulation_names): Declare.
1533         * parameters.cc (parameters_force_valid_target): Try to find
1534         target based on emulation from -m option.
1535         * options.h (class General_options): Change doc string for -m.
1536         * options.cc (help): Print emulations.
1537         (General_options::parse_V): Likewise.
1538         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1539         Add emulation parameter.  Change all callers.
1540
1541 2011-06-28  Ian Lance Taylor  <iant@google.com>
1542
1543         * target.h (class Target): Add osabi_ field.
1544         (Target::osabi): New function.
1545         (Target::set_osabi): New function.
1546         (Target::Target): Initialize osabi_.
1547         (Target::do_adjust_elf_header): Make pure virtual.
1548         (Sized_target::do_adjust_elf_header): Declare.
1549         * target.cc (Sized_target::do_adjust_elf_header): New function.
1550         (class Sized_target): Instantiate all versions.
1551         * freebsd.h (class Target_freebsd): Remove.
1552         (Target_selector_freebsd::do_recognize): Call set_osabi on
1553         Target.
1554         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1555         (Target_selector_freebsd::set_osabi): Remove.
1556         * i386.cc (class Target_i386): Inherit from Sized_target rather
1557         than Target_freebsd.
1558         * x86_64.cc (class Target_x86_64): Likewise.
1559
1560 2011-06-28  Ian Lance Taylor  <iant@google.com>
1561
1562         * target.h (Target::can_check_for_function_pointers): Rewrite.
1563         Make non-virtual.
1564         (Target::can_icf_inline_merge_sections): Likewise.
1565         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1566         (Target::Target_info): Add can_icf_inline_merge_sections field.
1567         (Target::do_can_check_for_function_pointers): New virtual
1568         function.
1569         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1570         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1571         from can_check_for_function_pointers, move in file.
1572         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1573         section_may_have_icf_unsafe_poineters, move in file.
1574         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1575         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1576         Rename from can_check_for_function_pointers, move in file.
1577         (Target_i386::can_icf_inline_merge_sections): Remove.
1578         (Target_i386::i386_info): Initialize
1579         can_icf_inline_merge_sections.
1580         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1581         Initialize can_icf_inline_merge_sections.
1582         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1583         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1584         Rename from can_check_for_function_pointers, move in file.
1585         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1586         (Target_x86_64::x86_64_info): Initialize
1587         can_icf_inline_merge_sections.
1588         * testsuite/testfile.cc (Target_test::test_target_info):
1589         Likewise.
1590         * icf.cc (get_section_contents): Correct formatting.
1591
1592 2011-06-27  Ian Lance Taylor  <iant@google.com>
1593
1594         * symtab.cc (Symbol::versioned_name): New function.
1595         (Symbol_table::add_to_final_symtab): Use versioned_name when
1596         appropriate.
1597         (Symbol_table::sized_write_symbol): Likewise.
1598         * symtab.h (class Symbol): Declare versioned_name.
1599         * stringpool.h (class Stringpool_template): Add variant of add
1600         which takes a std::basic_string.
1601         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1602         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1603         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1604         (ver_test_12.o): New target.
1605         * testsuite/Makefile.in: Rebuild.
1606
1607 2011-06-27  Doug Kwan  <dougkwan@google.com>
1608
1609         * arm.cc (Arm_relocate_functions::thm_jump8,
1610         Arm_relocate_functions::thm_jump11): Use a wider signed
1611         type to compute offset.
1612         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1613         arm_thm_jump8.
1614         * testsuite/Makefile.in: Regenerate.
1615         * testsuite/arm_branch_in_range.sh: Check test results of
1616         arm_thm_jump11 and arm_thm_jump8.
1617         * testsuite/arm_thm_jump11.s: New test source file.
1618         * testsuite/arm_thm_jump11.t: New linker script.
1619         * testsuite/arm_thm_jump8.s: New test source file.
1620         * testsuite/arm_thm_jump8.t: New linker script.
1621
1622 2011-06-24  Ian Lance Taylor  <iant@google.com>
1623
1624         * layout.cc: Include "object.h".
1625         (ctors_sections_in_init_array): New static variable.
1626         (Layout::is_ctors_in_init_array): New function.
1627         (Layout::layout): Add entry to ctors_sections_in_init_array if
1628         appropriate.
1629         * layout.h (class Layout): Declare is_ctors_in_init_array.
1630         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1631         is_ctors_reverse_view is set.
1632         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1633         all callers.  Set is_ctors_reverse_view field of View_size.
1634         (Sized_relobj_file::reverse_words): New function.
1635         * object.h (Sized_relobj_file::View_size): Add
1636         is_ctors_reverse_view field.
1637         (class Sized_relobj_file): Update declarations.
1638         * testsuite/initpri3.c: New test.
1639         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1640         initpri3b.
1641         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1642         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1643         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1644         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1645         * testsuite/Makefile.in: Rebuild.
1646
1647 2011-06-24  Cary Coutant  <ccoutant@google.com>
1648
1649         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1650         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1651         (debug_msg_cdebug.err): New targets.
1652         * testsuite/Makefile.in: Regenerate.
1653         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1654         Fix checks for link with shared library.
1655
1656 2011-06-24  Doug Kwan  <dougkwan@google.com>
1657
1658         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1659         skip empty text sections.
1660         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1661
1662 2011-06-22  Ian Lance Taylor  <iant@google.com>
1663
1664         PR gold/12910
1665         * options.h (class General_options): Add --ctors-in-init-array.
1666         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1667         friends as SHT_PROGBITS for merging sections.
1668         (Layout::layout): Remove special handling of .init_array and
1669         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1670         and .dtors if ctors_in_init_array.
1671         (Layout::make_output_section): Force correct section types for
1672         .init_array and friends.  Don't sort if doing relocatable link,
1673         Don't sort .ctors and .dtors if ctors_in_init_array.
1674         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1675         (Layout::output_section_name): Add relobj parameter.  Change all
1676         callers.  Handle .ctors. and .dtors. in code rather than table.
1677         Handle .ctors and .dtors if ctors_in_init_array.
1678         (Layout::match_file_name): New function, moved from output.cc.
1679         * layout.h (class Layout): Update declarations.
1680         * output.cc: Include "layout.h".
1681         (Input_section_sort_entry::get_priority): New function.
1682         (Input_section_sort_entry::match_file_name): Just call
1683         Layout::match_file_name.
1684         (Output_section::Input_section_sort_init_fini_compare::operator()):
1685         Handle .ctors and .dtors.  Sort by explicit priority rather than
1686         by name.
1687         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1688         * testsuite/initpri2.c: New test.
1689         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1690         (check_PROGRAMS): Add initpri2.
1691         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1692         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1693         * configure, testsuite/Makefile.in: Rebuild.
1694
1695 2011-06-19  Ian Lance Taylor  <iant@google.com>
1696
1697         PR gold/12880
1698         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1699         .interp section to a PT_INTERP segment even if we have seen a
1700         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1701         clause in a linker script.
1702         (Layout::finalize): Don't create a .interp section if we've
1703         already create a PT_INTERP segment.
1704         (Layout::create_interp): Always call choose_output_section (revert
1705         patch of 2011-06-17).  Don't create PT_INTERP segment.
1706         * script-sections.cc
1707         (Script_sections::create_note_and_tls_segments): Add a .interp
1708         section to a PT_INTERP segment even if we have seen a
1709         --dynamic-linker option.
1710
1711 2011-06-18  Ian Lance Taylor  <iant@google.com>
1712
1713         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1714         merely because a non-PT_LOAD segment has a dynamic reloc.
1715
1716 2011-06-18  Ian Lance Taylor  <iant@google.com>
1717
1718         * layout.cc (Layout::finish_dynamic_section): Don't create
1719         DT_FLAGS entry if not needed.
1720
1721 2011-06-18  Ian Lance Taylor  <iant@google.com>
1722
1723         PR gold/12745
1724         * layout.cc (Layout::layout_eh_frame): Correct handling of
1725         writable .eh_frame section.
1726
1727 2011-06-17  Ian Lance Taylor  <iant@google.com>
1728
1729         PR gold/12893
1730         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1731         symbol is redefined with the exact same object and value.
1732
1733 2011-06-17  Ian Lance Taylor  <iant@google.com>
1734
1735         PR gold/12880
1736         * layout.h (class Layout): Add interp_segment_ field.
1737         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1738         (Layout::attach_allocated_section_to_segment): If making shared
1739         library, put .interp section in PT_INTERP segment.
1740         (Layout::finalize): Also call create_interp if -dynamic-linker
1741         option was used.
1742         (Layout::create_interp): Assert that there is no PT_INTERP
1743         segment.  If not using a SECTIONS clause, use make_output_section.
1744         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1745         * script-sections.cc
1746         (Script_sections::create_note_and_tls_segments): If making shared
1747         library, put .interp section in PT_INTERP segment.
1748
1749 2011-06-17  Ian Lance Taylor  <iant@google.com>
1750
1751         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1752         when making a shared library.
1753
1754 2011-06-17  Ian Lance Taylor  <iant@google.com>
1755
1756         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1757         parameter.  Change all callers.  Don't issue warning about PC32
1758         against locally defined symbol.
1759
1760 2011-06-16  Ian Lance Taylor  <iant@google.com>
1761
1762         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1763         occurs in same object.
1764
1765 2011-06-14  Alan Modra  <amodra@gmail.com>
1766
1767         * po/POTFILES.in: Regenerate.
1768
1769 2011-06-09  Ian Lance Taylor  <iant@google.com>
1770
1771         * script-sections.cc
1772         (Orphan_output_section::set_section_addresses): For a relocatable
1773         link set address to 0.
1774
1775 2011-06-09  Cary Coutant  <ccoutant@google.com>
1776
1777         PR gold/12804
1778         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1779         used with --compress-debug-sections.
1780         * gold/object.cc (Sized_relobj_file::do_layout): Report
1781         uncompressed size of compressed input sections.
1782
1783 2011-06-08  Cary Coutant  <ccoutant@google.com>
1784
1785         PR gold/12804
1786         * testsuite/two_file_test_2_v1.cc: Change initialization of
1787         v2 to keep it in .data.
1788
1789 2011-06-07  Cary Coutant  <ccoutant@google.com>
1790
1791         * common.cc (Symbol_table::do_allocate_commons_list): Call
1792         gold_fallback.
1793         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1794         (Errors::fallback): New function.
1795         (gold_fallback): New function.
1796         * errors.h (Errors::fallback): New function.
1797         * gold.cc (gold_exit): Change status parameter to enum; adjust
1798         all callers.
1799         (queue_initial_tasks): Call gold_fallback.
1800         * gold.h: Include cstdlib.
1801         (Exit_status): New enum type.
1802         (gold_exit): Change status parameter to enum.
1803         (gold_fallback): New function.
1804         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1805         (Layout::create_symtab_sections): Likewise.
1806         (Layout::create_shdrs): Likewise.
1807         * main.cc (main): Adjust call to gold_exit.
1808         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1809         (Output_data_got::add_got_entry_pair): Likewise.
1810         (Output_section::add_input_section): Likewise.
1811         (Output_section::add_output_section_data): Likewise.
1812         (Output_segment::set_section_list_addresses): Likewise.
1813         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1814
1815 2011-06-07  Cary Coutant  <ccoutant@google.com>
1816
1817         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1818         for incremental links.
1819         * output.cc (Output_segment::set_section_list_addresses): Remove
1820         FIXME and test for TLS or BSS.
1821
1822 2011-06-07  Cary Coutant  <ccoutant@google.com>
1823
1824         * testsuite/Makefile.am: Add incremental_copy_test,
1825         incremental_common_test_1.
1826         * testsuite/Makefile.in: Regenerate.
1827         * testsuite/common_test_1_v1.c: New source file.
1828         * testsuite/common_test_1_v2.c: New source file.
1829         * testsuite/copy_test_v1.cc: New source file.
1830
1831 2011-06-07  Cary Coutant  <ccoutant@google.com>
1832
1833         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1834         update, allocate common from bss section's free list.
1835         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1836         linker-defined symbols.
1837         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1838         Skip GOT and PLT entries that are no longer referenced.
1839         (Output_section_incremental_inputs::write_info_blocks): Mark
1840         linker-defined symbols.
1841         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1842         * output.cc (Output_section::allocate): New function.
1843         * output.h (Output_section::allocate): New function.
1844         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1845         linker-defined symbols.
1846         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1847         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1848         (Symbol::init_base_output_data): Likewise.
1849         (Symbol::init_base_output_segment): Likewise.
1850         (Symbol::init_base_constant): Likewise.
1851         (Sized_symbol::init_output_data): Likewise.
1852         (Sized_symbol::init_output_segment): Likewise.
1853         (Sized_symbol::init_constant): Likewise.
1854         (Symbol_table::do_define_in_output_data): Likewise.
1855         (Symbol_table::do_define_in_output_segment): Likewise.
1856         (Symbol_table::do_define_as_constant): Likewise.
1857         * symtab.h (Symbol::is_predefined): New function.
1858         (Symbol::init_base_output_data): Add is_predefined parameter.
1859         (Symbol::init_base_output_segment): Likewise.
1860         (Symbol::init_base_constant): Likewise.
1861         (Symbol::is_predefined_): New data member.
1862         (Sized_symbol::init_output_data): Add is_predefined parameter.
1863         (Sized_symbol::init_output_segment): Likewise.
1864         (Sized_symbol::init_constant): Likewise.
1865         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1866
1867 2011-06-07  Cary Coutant  <ccoutant@google.com>
1868
1869         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1870         instead of emit_copy_reloc.
1871         (Copy_relocs::emit_copy_reloc): Refactor.
1872         (Copy_relocs::make_copy_reloc): New function.
1873         (Copy_relocs::add_copy_reloc): Remove.
1874         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1875         section.
1876         (Copy_relocs::make_copy_reloc): New function.
1877         (Copy_relocs::add_copy_reloc): Remove.
1878         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1879         unchanged input files.
1880         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1881         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1882         Reserve BSS space for COPY relocations.
1883         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1884         (Output_section_incremental_inputs::write_info_blocks): Record
1885         whether a symbol is copied from a shared object.
1886         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1887         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1888         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1889         (Incremental_input_entry_reader::get_output_symbol_index): Add
1890         is_copy parameter.
1891         (Incremental_binary::emit_copy_relocs): New function.
1892         (Incremental_binary::do_emit_copy_relocs): New function.
1893         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1894         new data member.
1895         (Sized_incremental_binary::add_copy_reloc): New function.
1896         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1897         (Sized_incremental_binary::Copy_reloc): New struct.
1898         (Sized_incremental_binary::Copy_relocs): New typedef.
1899         (Sized_incremental_binary::copy_relocs_): New data member.
1900         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1901         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1902         * target.h (Sized_target::emit_copy_reloc): New function.
1903         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1904
1905 2011-06-02  Cary Coutant  <ccoutant@google.com>
1906
1907         PR gold/12163
1908         * gold/archive.cc (Archive::Archive): Initialize new data member.
1909         (Archive::include_all_members): Return if archive has already been
1910         included.
1911         * gold/archive.h (Archive::include_all_members_): New data member.
1912
1913 2011-06-02  Nick Clifton  <nickc@redhat.com>
1914
1915         * dynobj.h: Fix spelling mistake in comment.
1916         * output.cc: Likewise.
1917
1918 2011-05-31  Doug Kwan  <dougkwan@google.com>
1919             Asier Llano
1920
1921         PR gold/12826
1922         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1923         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1924         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1925         redundant arm_exidx_test.so.
1926         * testsuite/Makefile.in: Regenerate.
1927         (check_SCRIPTS): Add pr12826.sh
1928         (check_DATA): Add pr12826.stdout
1929         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1930         * testsuite/pr12826.sh: New file.
1931         * testsuite/pr12826_1.s: Ditto.
1932         * testsuite/pr12826_1.s: Ditto.
1933
1934 2011-05-30  Ian Lance Taylor  <iant@google.com>
1935
1936         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1937         sections.
1938
1939 2011-05-29  Ian Lance Taylor  <iant@google.com>
1940
1941         PR gold/12804
1942         * testsuite/Makefile.am: Use different file name for two_file_test
1943         temporary file for each incremental test.
1944         * testsuite/Makefile.in: Rebuild.
1945
1946 2011-05-29  Ian Lance Taylor  <iant@google.com>
1947
1948         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1949         binary input file is empty.
1950
1951 2011-05-27  Ian Lance Taylor  <iant@google.com>
1952
1953         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1954         (ver_test_9.so): Likewise.
1955         * testsuite/Makefile.in: Rebuild.
1956
1957 2011-05-26 Cary Coutant  <ccoutant@google.com>
1958
1959         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1960         * incremental.cc (Incremental_inputs::report_input_section): Fix
1961         comment, indentation.
1962         (Incremental_inputs::report_comdat_group): New function.
1963         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1964         of data for incremental input file entry.
1965         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1966         group count, COMDAT group signatures.
1967         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1968         an unchanged input file.
1969         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1970         Initialize new data member.
1971         (Incremental_object_entry::add_comdat_group): New function.
1972         (Incremental_object_entry::get_comdat_group_count): New function.
1973         (Incremental_object_entry::get_comdat_signature_key): New function.
1974         (Incremental_object_entry::groups_): New data member.
1975         (Incremental_inputs::report_comdat_group): New function.
1976         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1977         data for incremental input file entry.
1978         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1979         (Incremental_input_entry_reader::get_input_section): Adjust size of
1980         data for incremental input file entry.
1981         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1982         (Incremental_input_entry_reader::get_comdat_group_signature): New
1983         function.
1984         * object.cc (Sized_relobj::include_section_group): Report kept
1985         COMDAT groups for incremental links.
1986
1987 2011-05-24  David Meyer  <pdox@google.com>
1988
1989         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1990         with name parameter.  Add found_name parameter.
1991         * fileread.cc (Input_file::find_file): Adjust code accordingly.
1992         * dirsearch.h (class Dirsearch): Update declaration.
1993
1994 2011-05-24  Ian Lance Taylor  <iant@google.com>
1995
1996         * archive.cc (Library_base::should_include_member): Pull in object
1997         from archive if it defines the entry symbol.
1998         * parameters.cc (Parameters::entry): New function.
1999         * parameters.h (class Parameters): Declare entry.
2000         * output.h (class Output_file_header): Remove entry_ field.
2001         * output.cc (Output_file_header::Output_file_header): Remove entry
2002         parameter.  Change all callers.
2003         (Output_file_header::entry): Use parameters->entry.
2004         * gold.cc (queue_middle_tasks): Likewise.
2005         * plugin.cc (Plugin_hook::run): Likewise.
2006
2007 2011-05-24 Cary Coutant  <ccoutant@google.com>
2008
2009         * gold.cc (queue_initial_tasks): Pass incremental base filename
2010         to Output_file::open_base_file; don't print error message.
2011         * incremental-dump.cc (main): Adjust call to
2012         Output_file::open_for_modification.
2013         * incremental-dump.cc (main): Likewise.
2014         * incremental.cc (Incremental_inputs::report_command_line):
2015         Ignore --incremental-base option when comparing command lines.
2016         Ignore parameter when given as separate argument.
2017         * options.h (class General_options): Add --incremental-base.
2018         * output.cc (Output_file::Output_file):
2019         (Output_file::open_base_file): Add base_name and writable parameters;
2020         read base file into new file; print error message here.
2021         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2022         callers.
2023         * output.h (Output_file::open_for_modification): Rename to...
2024         (Output_file::open_base_file): ...this; add base_name and
2025         writable parameters; adjust all callers.
2026         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2027         callers.
2028         * testsuite/Makefile.am (incremental_test_4): Test
2029         --incremental-base.
2030         * testsuite/Makefile.in: Regenerate.
2031
2032 2011-05-24 Cary Coutant  <ccoutant@google.com>
2033
2034         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2035         incremental_test_4.
2036         * testsuite/Makefile.in: Regenerate.
2037         * testsuite/two_file_test_1_v1.cc: New test source file.
2038         * testsuite/two_file_test_1b_v1.cc: New test source file.
2039         * testsuite/two_file_test_2_v1.cc: New test source file.
2040
2041 2011-05-24 Cary Coutant  <ccoutant@google.com>
2042
2043         * dynobj.h (Dynobj::do_dynobj): New function.
2044         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2045         flag and soname for shared objects.
2046         * incremental.cc (Incremental_inputs::report_object): Make
2047         either Incremental_object_entry or Incremental_dynobj_entry; add
2048         soname to string table.
2049         (Incremental_inputs::report_input_section): Add assertion.
2050         (Output_section_incremental_inputs::set_final_data_size): Adjust
2051         type of input file entry for shared libraries; adjust size of
2052         shared library info entry.
2053         (Output_section_incremental_inputs::write_input_files): Write
2054         as_needed flag for shared libraries.
2055         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2056         of input file entry for shared libraries; write soname.
2057         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2058         soname from incremental info.
2059         * incremental.h (enum Incremental_input_flags): Add
2060         INCREMENTAL_INPUT_AS_NEEDED.
2061         (Incremental_input_entry::Incremental_input_entry): Initialize new
2062         data member.
2063         (Incremental_input_entry::set_as_needed): New function.
2064         (Incremental_input_entry::as_needed): New function.
2065         (Incremental_input_entry::do_dynobj_entry): New function.
2066         (Incremental_input_entry::as_needed_): New data member.
2067         (Incremental_object_entry::Incremental_object_entry): Don't check
2068         for shared library.
2069         (Incremental_object_entry::do_type): Likewise.
2070         (class Incremental_dynobj_entry): New class.
2071         (Incremental_input_entry_reader::as_needed): New function.
2072         (Incremental_input_entry_reader::get_soname): New function.
2073         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2074         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2075         size of shared library info entry.
2076         * layout.cc (Layout::finish_dynamic_section): Don't test for
2077         incremental link when adding DT_NEEDED entries.
2078         * object.h (Object::Object): Initialize new data member.
2079         (Object::dynobj): New function.
2080         (Object::set_as_needed): New function.
2081         (Object::as_needed): New function.
2082         (Object::do_dynobj): New function.
2083         (Object::as_needed_): New data member.
2084
2085 2011-05-24 Cary Coutant  <ccoutant@google.com>
2086
2087         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2088         info; adjust display of GOT entries.
2089         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2090         vector of input objects; remove file_status_.
2091         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2092         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2093         got_plt reader; call target hooks to reserve GOT entries.
2094         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2095         of input file info header and GOT info entry.
2096         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2097         relocation info.
2098         (Got_plt_view_info::got_descriptor): Remove.
2099         (Got_plt_view_info::sym_index): New data member.
2100         (Got_plt_view_info::input_index): New data member.
2101         (Local_got_offset_visitor::visit): Write input file index.
2102         (Global_got_offset_visitor::visit): Write 0 for input file index.
2103         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2104         with sym_index and input_index.
2105         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2106         incremental info GOT entry; replace got_descriptor with input_index.
2107         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2108         map from input file index to object.
2109         (Sized_relobj_incr::do_layout): Replace direct data member reference
2110         with accessor function.
2111         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2112         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2113         Adjust size of input file info header.
2114         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2115         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2116         (Incremental_input_entry_reader::get_input_section): Adjust size of
2117         input file info header.
2118         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2119         of incremental info GOT entry.
2120         (Incremental_got_plt_reader::get_got_desc): Remove.
2121         (Incremental_got_plt_reader::get_got_symndx): New function.
2122         (Incremental_got_plt_reader::get_got_input_index): New function.
2123         (Sized_incremental_binary::Sized_incremental_binary): Remove
2124         file_status_; add input_objects_.
2125         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2126         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2127         (Sized_incremental_binary::file_is_unchanged): Remove.
2128         (Sized_incremental_binary::set_input_object): New function.
2129         (Sized_incremental_binary::input_object): New function.
2130         (Sized_incremental_binary::file_status_): Remove.
2131         (Sized_incremental_binary::input_objects_): New data member.
2132         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2133         references.
2134         (Sized_relobj_incr::invalid_address): Move to base class.
2135         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2136         class.
2137         (Sized_relobj_incr::do_output_section_offset): Likewise.
2138         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2139         (Sized_relobj_incr::section_offsets_): Likewise.
2140         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2141         function.
2142         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2143         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2144         with accessor function.
2145         (Sized_relobj_file::do_layout): Likewise.
2146         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2147         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2148         (Sized_relobj_file::compute_final_local_value): Replace refs to
2149         section_offsets_ with accessor function.
2150         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2151         * object.h (Relobj::Relobj): Initialize new data members.
2152         (Relobj::add_dyn_reloc): New function.
2153         (Relobj::first_dyn_reloc): New function.
2154         (Relobj::dyn_reloc_count): New function.
2155         (Relobj::first_dyn_reloc_): New data member.
2156         (Relobj::dyn_reloc_count_): New data member.
2157         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2158         references.
2159         (Sized_relobj::Address): New typedef.
2160         (Sized_relobj::invalid_address): Move here from child class.
2161         (Sized_relobj::Sized_relobj): Initialize new data members.
2162         (Sized_relobj::sized_relobj): New function.
2163         (Sized_relobj::is_output_section_offset_invalid): Move here from
2164         child class.
2165         (Sized_relobj::get_output_section_offset): Likewise.
2166         (Sized_relobj::local_has_got_offset): Likewise.
2167         (Sized_relobj::local_got_offset): Likewise.
2168         (Sized_relobj::set_local_got_offset): Likewise.
2169         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2170         (Sized_relobj::clear_got_offsets): New function.
2171         (Sized_relobj::section_offsets): Move here from child class.
2172         (Sized_relobj::do_output_section_offset): Likewise.
2173         (Sized_relobj::do_set_section_offset): Likewise.
2174         (Sized_relobj::Local_got_offsets): Likewise.
2175         (Sized_relobj::local_got_offsets_): Likewise.
2176         (Sized_relobj::section_offsets_): Likewise.
2177         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2178         references.
2179         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2180         class.
2181         (Sized_relobj_file::sized_relobj): New function
2182         (Sized_relobj_file::local_has_got_offset): Move to base class.
2183         (Sized_relobj_file::local_got_offset): Likewise.
2184         (Sized_relobj_file::set_local_got_offset): Likewise.
2185         (Sized_relobj_file::get_output_section_offset): Likewise.
2186         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2187         (Sized_relobj_file::do_output_section_offset): Likewise.
2188         (Sized_relobj_file::do_set_section_offset): Likewise.
2189         (Sized_relobj_file::Local_got_offsets): Likewise.
2190         (Sized_relobj_file::local_got_offsets_): Likewise.
2191         (Sized_relobj_file::section_offsets_): Likewise.
2192         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2193         (all constructors).
2194         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2195         (Output_reloc::get_symbol_index): Likewise.
2196         (Output_reloc::local_section_offset): Likewise.
2197         (Output_reloc::get_address): Likewise.
2198         (Output_reloc::symbol_value): Likewise.
2199         (Output_data_got::reserve_slot): Move to class definition.
2200         (Output_data_got::reserve_local): New function.
2201         (Output_data_got::reserve_slot_for_global): Remove.
2202         (Output_data_got::reserve_global): New function.
2203         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2204         (all constructors, two instantiations).
2205         (Output_reloc::get_relobj): New function (two instantiations).
2206         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2207         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2208         (Output_data_reloc::add_global): Adjust type of relobj.
2209         (Output_data_reloc::add_global_relative): Likewise.
2210         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2211         (Output_data_reloc::add_local): Likewise.
2212         (Output_data_reloc::add_local_relative): Likewise.
2213         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2214         (Output_data_reloc::add_local_section): Likewise.
2215         (Output_data_reloc::add_output_section): Likewise.
2216         (Output_data_reloc::add_absolute): Likewise.
2217         (Output_data_reloc::add_target_specific): Likewise.
2218         (Output_data_got::reserve_slot): Move definition here.
2219         (Output_data_got::reserve_local): New function.
2220         (Output_data_got::reserve_global): New function.
2221         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2222         section_offsets_ with accessor function.
2223         (Sized_relobj_file::write_sections): Likewise.
2224         (Sized_relobj_file::do_relocate_sections): Likewise.
2225         * target.h (Sized_target::reserve_local_got_entry): New function.
2226         (Sized_target::reserve_global_got_entry): New function.
2227         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2228         (Target_x86_64::reserve_global_got_entry): New function.
2229         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2230
2231 2011-05-23 Cary Coutant  <ccoutant@google.com>
2232
2233         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2234         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2235         bit when checking got_type.
2236         * incremental.cc (Sized_incremental_binary::setup_readers):
2237         Store symbol table and string table locations; initialize bit vector
2238         of file status flags.
2239         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2240         unchanged files.
2241         (Sized_incremental_binary::do_process_got_plt): New function.
2242         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2243         (Output_section_incremental_inputs::set_final_data_size): Record
2244         file index for each input file.
2245         (Output_section_incremental_inputs::write_got_plt): Store file index
2246         instead of input entry offset for each GOT entry.
2247         * incremental.h
2248         (Incremental_input_entry::Incremental_input_entry): Initialize new
2249         data member.
2250         (Incremental_input_entry::set_offset): Store file index.
2251         (Incremental_input_entry::get_file_index): New function.
2252         (Incremental_input_entry::file_index_): New data member.
2253         (Incremental_binary::process_got_plt): New function.
2254         (Incremental_binary::do_process_got_plt): New function.
2255         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2256         data members.
2257         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2258         (Sized_incremental_binary::set_file_is_unchanged): New function.
2259         (Sized_incremental_binary::file_is_unchanged): New function.
2260         (Sized_incremental_binary::do_process_got_plt): New function.
2261         (Sized_incremental_binary::file_status_): New data member.
2262         (Sized_incremental_binary::main_symtab_loc_): New data member.
2263         (Sized_incremental_binary::main_strtab_loc_): New data member.
2264         * output.cc (Output_data_got::Got_entry::write): Add case
2265         RESERVED_CODE.
2266         (Output_data_got::add_global): Call add_got_entry.
2267         (Output_data_got::add_global_plt): Likewise.
2268         (Output_data_got::add_global_with_rel): Likewise.
2269         (Output_data_got::add_global_with_rela): Likewise.
2270         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2271         (Output_data_got::add_global_pair_with_rela): Likewise.
2272         (Output_data_got::add_local): Call add_got_entry.
2273         (Output_data_got::add_local_plt): Likewise.
2274         (Output_data_got::add_local_with_rel): Likewise.
2275         (Output_data_got::add_local_with_rela): Likewise.
2276         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2277         (Output_data_got::add_local_pair_with_rela): Likewise.
2278         (Output_data_got::reserve_slot): New function.
2279         (Output_data_got::reserve_slot_for_global): New function.
2280         (Output_data_got::add_got_entry): New function.
2281         (Output_data_got::add_got_entry_pair): New function.
2282         (Output_section::add_output_section_data): Edit FIXME.
2283         * output.h
2284         (Output_section_data_build::Output_section_data_build): New
2285         constructor with size parameter.
2286         (Output_data_space::Output_data_space): Likewise.
2287         (Output_data_got::Output_data_got): Initialize new data member; new
2288         constructor with size parameter.
2289         (Output_data_got::add_constant): Call add_got_entry.
2290         (Output_data_got::reserve_slot): New function.
2291         (Output_data_got::reserve_slot_for_global): New function.
2292         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2293         (Output_data_got::add_got_entry): New function.
2294         (Output_data_got::add_got_entry_pair): New function.
2295         (Output_data_got::free_list_): New data member.
2296         * target.h (Sized_target::init_got_plt_for_update): New function.
2297         (Sized_target::register_global_plt_entry): New function.
2298         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2299         Initialize new data member; call init; add constructor with PLT count.
2300         (Output_data_plt_x86_64::init): New function.
2301         (Output_data_plt_x86_64::add_relocation): New function.
2302         (Output_data_plt_x86_64::reserve_slot): New function.
2303         (Output_data_plt_x86_64::free_list_): New data member.
2304         (Target_x86_64::init_got_plt_for_update): New function.
2305         (Target_x86_64::register_global_plt_entry): New function.
2306         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2307         incremental updates.
2308         (Output_data_plt_x86_64::add_relocation): New function.
2309         * testsuite/object_unittest.cc (Object_test): Set default options.
2310
2311 2011-05-16  Ian Lance Taylor  <iant@google.com>
2312
2313         * options.h (class General_options): Make -i a synonym for -r.
2314
2315 2011-05-16  Ian Lance Taylor  <iant@google.com>
2316
2317         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2318
2319 2011-05-10 Cary Coutant  <ccoutant@google.com>
2320
2321         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2322         strip_all (-s).
2323
2324 2011-05-06  Ian Lance Taylor  <iant@google.com>
2325
2326         * layout.cc (Layout::layout): If the output section flags change,
2327         update the ordering.
2328
2329 2011-04-25 Cary Coutant  <ccoutant@google.com>
2330
2331         * incremental-dump.cc (dump_incremental_inputs): Print local
2332         symbol info for each input file.
2333         * incremental.cc
2334         (Output_section_incremental_inputs::set_final_data_size): Add local
2335         symbol info to input file entries in incremental info.
2336         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2337         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2338         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2339         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2340         implementation.
2341         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2342         (Sized_incr_relobj::do_relocate): Write the local symbols.
2343         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2344         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2345         Adjust size of input file header.
2346         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2347         (Incremental_inputs_reader::get_local_symbol_count): New function.
2348         (Incremental_inputs_reader::get_input_section): Adjust size of input
2349         file header.
2350         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2351         (Sized_incr_relobj::This): New typedef.
2352         (Sized_incr_relobj::sym_size): New const data member.
2353         (Sized_incr_relobj::Local_symbol): New struct.
2354         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2355         (Sized_incr_relobj::do_local_symbol_offset): New function.
2356         (Sized_incr_relobj::local_symbol_count_): New data member.
2357         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2358         (Sized_incr_relobj::local_symbol_index_): New data member.
2359         (Sized_incr_relobj::local_symbol_offset_): New data member.
2360         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2361         (Sized_incr_relobj::local_symbols_): New data member.
2362         * object.h (Relobj::output_local_symbol_count): New function.
2363         (Relobj::local_symbol_offset): New function.
2364         (Relobj::do_output_local_symbol_count): New function.
2365         (Relobj::do_local_symbol_offset): New function.
2366         (Sized_relobj::do_output_local_symbol_count): New function.
2367         (Sized_relobj::do_local_symbol_offset): New function.
2368
2369 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2370
2371         * descriptors.cc (set_close_on_exec): New function.
2372         (Descriptors::open): Use set_close_on_exec.
2373         * output.cc (S_ISLNK): Define if not defined.
2374
2375 2011-04-22 Cary Coutant  <ccoutant@google.com>
2376
2377         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2378         global symbol map.
2379         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2380         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2381         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2382         relocations.
2383         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2384         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2385         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2386         * incremental.h
2387         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2388         function.
2389         (Incremental_binary::apply_incremental_relocs): New function.
2390         (Incremental_binary::do_apply_incremental_relocs): New function.
2391         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2392         data member.
2393         (Sized_incremental_binary::add_global_symbol): New function.
2394         (Sized_incremental_binary::global_symbol): New function.
2395         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2396         (Sized_incremental_binary::symbol_map_): New data member.
2397         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2398         * target.h (Sized_target::apply_relocation): New function.
2399         * target-reloc.h (apply_relocation): New function.
2400         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2401
2402 2011-04-22  Doug Kwan  <dougkwan@google.com>
2403
2404         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2405         flag of a SHT_ARM_EXIDX section.
2406         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2407         * testsuite/Makefile.in: Regenerate.
2408         * testsuite/arm_exidx_test.s: New file.
2409         * testsuite/arm_exidx_test.sh: Same.
2410
2411 2011-04-20 Cary Coutant  <ccoutant@google.com>
2412
2413         PR gold/12689
2414         * archive.h (Incremental_archive_entry::Archive_member):
2415         Initialize arg_serial_ (second constructor).
2416
2417 2011-04-17  Ian Lance Taylor  <iant@google.com>
2418
2419         * object.cc (Relocate_info::location): Simplify location string.
2420         * errors.cc (Errors::error_at_location): Don't print program
2421         name.
2422         (Errors::warning_at_location): Likewise.
2423         (Errors::undefined_symbol): Likewise.
2424         * testsuite/debug_msg.sh: Update accordingly.
2425
2426 2011-04-14 Cary Coutant  <ccoutant@google.com>
2427
2428         * gold/layout.cc (Layout::symtab_section_offset): New function.
2429         * gold/layout.h (Layout::symtab_section_offset): New function.
2430         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2431
2432 2011-04-12  Ian Lance Taylor  <iant@google.com>
2433
2434         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2435         with MREMAP_MAYMOVE.
2436         * output.h (class Output_file): Add map_is_allocated_ field.
2437         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2438         not available, provide stubs.  If mremap is not available, #define
2439         it to gold_mremap.
2440         (MREMAP_MAYMOVE): Define if not defined.
2441         (Output_file::Output_file): Initialize map_is_allocated_.
2442         (Output_file::resize): Check map_is_allocated_.
2443         (Output_file::map_anonymous): If mmap fails, use malloc.
2444         (Output_file::unmap): Don't do anything for an anonymous map.
2445         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2446         is not available, provide stubs.
2447         (File_read::View::~View): Use free rather than delete[].
2448         (File_read::make_view): Use malloc rather than new[].  If mmap
2449         fails, use malloc.
2450         (File_read::find_or_make_view): Use malloc rather than new[].
2451         * gold.h: Remove HAVE_REMAP code.
2452         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2453         exists.  Rename mremap to gold_mremap.  If mmap is not available
2454         don't do anything.
2455         * configure, config.in: Rebuild.
2456
2457 2011-04-11  Ian Lance Taylor  <iant@google.com>
2458
2459         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2460         initialize local variable v.
2461
2462 2011-04-11  Cary Coutant  <ccoutant@google.com>
2463
2464         * archive.cc (Archive::include_member): Adjust call to
2465         report_object.
2466         (Add_archive_symbols::run): Track argument serial numbers.
2467         (Lib_group::include_member): Likewise.
2468         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2469         * archive.h (Incremental_archive_entry::Archive_member):
2470         Initialize arg_serial_.
2471         (Archive_member::arg_serial_): New data member.
2472         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2473         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2474         incremental link.
2475         (Sized_dynobj::do_for_all_local_got_entries): New function.
2476         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2477         function.
2478         * fileread.cc (get_mtime): New function.
2479         * fileread.h (get_mtime): New function.
2480         * gold.cc (queue_initial_tasks): Check for incremental update.
2481         (process_incremental_input): New function.
2482         (queue_middle_tasks): Don't force valid target for incremental
2483         update.
2484         * incremental-dump.cc (find_input_containing_global): Adjust
2485         size of symbol info entry.
2486         (dump_incremental_inputs): Dump argument serial number and
2487         in_system_directory flag; bias shndx by 1; print symbol names
2488         when dumping per-file symbol lists; use new symbol info readers.
2489         * incremental.cc
2490         (Output_section_incremental_inputs:update_data_size): New function.
2491         (Sized_incremental_binary::setup_readers): Setup input readers
2492         for each input file; build maps for files added from libraries
2493         and scripts.
2494         (Sized_incremental_binary::check_input_args): New function.
2495         (Sized_incremental_binary::do_check_inputs): Build map of argument
2496         serial numbers to input arguments.
2497         (Sized_incremental_binary::do_file_has_changed): Rename
2498         do_file_is_unchanged to this; compare file modification times.
2499         (Sized_incremental_binary::do_init_layout): New function.
2500         (Sized_incremental_binary::do_reserve_layout): New function.
2501         (Sized_incremental_binary::do_get_input_reader): Remove.
2502         (Sized_incremental_binary::get_symtab_view): New function.
2503         (Incremental_checker::can_incrementally_link_output_file): Remove.
2504         (Incremental_inputs::report_command_line): Exclude --debug options.
2505         (Incremental_inputs::report_archive_begin): Add parameter; track
2506         argument serial numbers; don't put input file entry for archive
2507         before archive members.
2508         (Incremental_inputs::report_archive_end): Put input file entry
2509         for archive after archive members.
2510         (Incremental_inputs::report_object): Add parameter; track argument
2511         serial numbers and in_system_directory flag.
2512         (Incremental_inputs::report_script): Add parameter; track argument
2513         serial numbers.
2514         (Output_section_incremental_inputs::set_final_data_size): Adjust
2515         size of symbol info entry; check for forwarding symbols.
2516         (Output_section_incremental_inputs::write_input_files): Write
2517         in_system_directory flag and argument serial number.
2518         (Output_section_incremental_inputs::write_info_blocks): Map section
2519         indices between incremental info and original input file; store
2520         input section index for each symbol.
2521         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2522         change operator() to visit().
2523         (class Global_got_offset_visitor): Likewise.
2524         (class Global_symbol_visitor_got_plt):
2525         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2526         classes.
2527         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2528         (Sized_incr_relobj::do_read_symbols): New function.
2529         (Sized_incr_relobj::do_layout): New function.
2530         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2531         (Sized_incr_relobj::do_add_symbols): New function.
2532         (Sized_incr_relobj::do_should_include_member): New function.
2533         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2534         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2535         (Sized_incr_relobj::do_section_size): New function.
2536         (Sized_incr_relobj::do_section_name): New function.
2537         (Sized_incr_relobj::do_section_contents): New function.
2538         (Sized_incr_relobj::do_section_flags): New function.
2539         (Sized_incr_relobj::do_section_entsize): New function.
2540         (Sized_incr_relobj::do_section_address): New function.
2541         (Sized_incr_relobj::do_section_type): New function.
2542         (Sized_incr_relobj::do_section_link): New function.
2543         (Sized_incr_relobj::do_section_info): New function.
2544         (Sized_incr_relobj::do_section_addralign): New function.
2545         (Sized_incr_relobj::do_initialize_xindex): New function.
2546         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2547         (Sized_incr_relobj::do_read_relocs): New function.
2548         (Sized_incr_relobj::do_gc_process_relocs): New function.
2549         (Sized_incr_relobj::do_scan_relocs): New function.
2550         (Sized_incr_relobj::do_count_local_symbols): New function.
2551         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2552         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2553         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2554         (Sized_incr_relobj::do_relocate): New function.
2555         (Sized_incr_relobj::do_set_section_offset): New function.
2556         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2557         (Sized_incr_dynobj::do_read_symbols): New function.
2558         (Sized_incr_dynobj::do_layout): New function.
2559         (Sized_incr_dynobj::do_add_symbols): New function.
2560         (Sized_incr_dynobj::do_should_include_member): New function.
2561         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2562         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2563         (Sized_incr_dynobj::do_section_size): New function.
2564         (Sized_incr_dynobj::do_section_name): New function.
2565         (Sized_incr_dynobj::do_section_contents): New function.
2566         (Sized_incr_dynobj::do_section_flags): New function.
2567         (Sized_incr_dynobj::do_section_entsize): New function.
2568         (Sized_incr_dynobj::do_section_address): New function.
2569         (Sized_incr_dynobj::do_section_type): New function.
2570         (Sized_incr_dynobj::do_section_link): New function.
2571         (Sized_incr_dynobj::do_section_info): New function.
2572         (Sized_incr_dynobj::do_section_addralign): New function.
2573         (Sized_incr_dynobj::do_initialize_xindex): New function.
2574         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2575         (make_sized_incremental_object): New function.
2576         (Incremental_library::copy_unused_symbols): New function.
2577         (Incremental_library::do_for_all_unused_symbols): New function.
2578         * incremental.h (enum Incremental_input_flags): New type.
2579         (class Incremental_checker): Remove.
2580         (Incremental_input_entry::Incremental_input_entry): Add argument
2581         serial number.
2582         (Incremental_input_entry::arg_serial): New function.
2583         (Incremental_input_entry::set_is_in_system_directory): New function.
2584         (Incremental_input_entry::is_in_system_directory): New function.
2585         (Incremental_input_entry::arg_serial_): New data member.
2586         (Incremental_input_entry::is_in_system_directory_): New data member.
2587         (class Script_info): Move here from script.h.
2588         (Script_info::Script_info): Add filename parameter.
2589         (Script_info::filename): New function.
2590         (Script_info::filename_): New data member.
2591         (Incremental_script_entry::Incremental_script_entry): Add argument
2592         serial number.
2593         (Incremental_object_entry::Incremental_object_entry): Likewise.
2594         (Incremental_object_entry::add_input_section): Build list of input
2595         sections with map to original shndx.
2596         (Incremental_object_entry::get_input_section_index): New function.
2597         (Incremental_object_entry::shndx_): New data member.
2598         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2599         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2600         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2601         serial number.
2602         (Incremental_inputs::report_archive_begin): Likewise.
2603         (Incremental_inputs::report_object): Likewise.
2604         (Incremental_inputs::report_script): Likewise.
2605         (class Incremental_global_symbol_reader): New class.
2606         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2607         and store flags and input file type.
2608         (Incremental_input_entry_reader::arg_serial): New function.
2609         (Incremental_input_entry_reader::type): Extract type from flags.
2610         (Incremental_input_entry_reader::is_in_system_directory): New function.
2611         (Incremental_input_entry_reader::get_input_section_count): Call
2612         accessor function for type.
2613         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2614         function for type; adjust size of global symbol entry.
2615         (Incremental_input_entry_reader::get_global_symbol_count): Call
2616         accessor function for type.
2617         (Incremental_input_entry_reader::get_object_count): Likewise.
2618         (Incremental_input_entry_reader::get_object_offset): Likewise.
2619         (Incremental_input_entry_reader::get_member_count): Likewise.
2620         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2621         (Incremental_input_entry_reader::get_member_offset): Likewise.
2622         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2623         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2624         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2625         (Incremental_input_entry_reader::get_global_symbol_reader): New
2626         function.
2627         (Incremental_input_entry_reader::get_output_symbol_index): New
2628         function.
2629         (Incremental_input_entry_reader::type_): Remove.
2630         (Incremental_input_entry_reader::flags_): New data member.
2631         (Incremental_inputs_reader::input_file_offset): New function.
2632         (Incremental_inputs_reader::input_file_index): New function.
2633         (Incremental_inputs_reader::input_file): Call input_file_offset.
2634         (Incremental_inputs_reader::input_file_at_offset): New function.
2635         (Incremental_relocs_reader::get_r_type): Reformat.
2636         (Incremental_relocs_reader::get_r_shndx): Reformat.
2637         (Incremental_relocs_reader::get_r_offset): Reformat.
2638         (Incremental_relocs_reader::data): New function.
2639         (Incremental_binary::Incremental_binary): Initialize new data members.
2640         (Incremental_binary::check_inputs): Add cmdline parameter.
2641         (Incremental_binary::file_is_unchanged): Remove.
2642         (Input_reader::arg_serial): New function.
2643         (Input_reader::get_unused_symbol_count): New function.
2644         (Input_reader::get_unused_symbol): New function.
2645         (Input_reader::do_arg_serial): New function.
2646         (Input_reader::do_get_unused_symbol_count): New function.
2647         (Input_reader::do_get_unused_symbol): New function.
2648         (Incremental_binary::input_file_count): New function.
2649         (Incremental_binary::get_input_reader): Change signature to use
2650         index instead of filename.
2651         (Incremental_binary::file_has_changed): New function.
2652         (Incremental_binary::get_input_argument): New function.
2653         (Incremental_binary::get_library): New function.
2654         (Incremental_binary::get_script_info): New function.
2655         (Incremental_binary::init_layout): New function.
2656         (Incremental_binary::reserve_layout): New function.
2657         (Incremental_binary::output_file): New function.
2658         (Incremental_binary::do_check_inputs): New function.
2659         (Incremental_binary::do_file_is_unchanged): Remove.
2660         (Incremental_binary::do_file_has_changed): New function.
2661         (Incremental_binary::do_init_layout): New function.
2662         (Incremental_binary::do_reserve_layout): New function.
2663         (Incremental_binary::do_input_file_count): New function.
2664         (Incremental_binary::do_get_input_reader): Change signature.
2665         (Incremental_binary::input_args_map_): New data member.
2666         (Incremental_binary::library_map_): New data member.
2667         (Incremental_binary::script_map_): New data member.
2668         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2669         new data members.
2670         (Sized_incremental_binary::output_section): New function.
2671         (Sized_incremental_binary::inputs_reader): Add const.
2672         (Sized_incremental_binary::symtab_reader): Add const.
2673         (Sized_incremental_binary::relocs_reader): Add const.
2674         (Sized_incremental_binary::got_plt_reader): Add const.
2675         (Sized_incremental_binary::get_symtab_view): New function.
2676         (Sized_incremental_binary::Inputs_reader): New typedef.
2677         (Sized_incremental_binary::Input_entry_reader): New typedef.
2678         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2679         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2680         (Sized_incremental_binary::do_file_has_changed): New function.
2681         (Sized_incremental_binary::do_init_layout): New function.
2682         (Sized_incremental_binary::do_reserve_layout): New function.
2683         (Sized_input_reader::Inputs_reader): Remove.
2684         (Sized_input_reader::Input_entry_reader): Remove.
2685         (Sized_input_reader::do_arg_serial): New function.
2686         (Sized_input_reader::do_get_unused_symbol_count): New function.
2687         (Sized_input_reader::do_get_unused_symbol): New function.
2688         (Sized_incremental_binary::do_input_file_count): New function.
2689         (Sized_incremental_binary::do_get_input_reader): Change signature;
2690         use index instead of filename.
2691         (Sized_incremental_binary::section_map_): New data member.
2692         (Sized_incremental_binary::input_entry_readers_): New data member.
2693         (class Sized_incr_relobj): New class.
2694         (class Sized_incr_dynobj): New class.
2695         (make_sized_incremental_object): New function.
2696         (class Incremental_library): New class.
2697         * layout.cc (Free_list::num_lists): New static data member.
2698         (Free_list::num_nodes): New static data member.
2699         (Free_list::num_removes): New static data member.
2700         (Free_list::num_remove_visits): New static data member.
2701         (Free_list::num_allocates): New static data member.
2702         (Free_list::num_allocate_visits): New static data member.
2703         (Free_list::init): New function.
2704         (Free_list::remove): New function.
2705         (Free_list::allocate): New function.
2706         (Free_list::dump): New function.
2707         (Free_list::print_stats): New function.
2708         (Layout_task_runner::run): Resize output file for incremental updates.
2709         (Layout::Layout): Initialize new data members.
2710         (Layout::set_incremental_base): New function.
2711         (Layout::init_fixed_output_section): New function.
2712         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2713         incremental updates.
2714         (Layout::create_gold_note): Do not create gold note section for
2715         incremental updates.
2716         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2717         for incremental updates.
2718         (Layout::set_section_offsets): For incremental updates, allocate space
2719         from free list.
2720         (Layout::create_symtab_sections): Layout with offsets relative to
2721         start of section; for incremental updates, allocate space from free
2722         list.
2723         (Layout::create_shdrs): For incremental updates, allocate space from
2724         free list.
2725         (Layout::finish_dynamic_section): For incremental updates, do not
2726         check --as-needed (fixed in subsequent patch).
2727         * layout.h (class Free_list): New class.
2728         (Layout::set_incremental_base): New function.
2729         (Layout::incremental_base): New function.
2730         (Layout::init_fixed_output_section): New function.
2731         (Layout::allocate): New function.
2732         (Layout::incremental_base_): New data member.
2733         (Layout::free_list_): New data member.
2734         * main.cc (main): Print Free_list statistics.
2735         * object.cc (Relobj::finalize_incremental_relocs): Add
2736         clear_counts parameter; clear counts only when clear_counts is set.
2737         (Sized_relobj::Sized_relobj): Initialize new base class.
2738         (Sized_relobj::do_layout): Don't report special sections.
2739         (Sized_relobj::do_for_all_local_got_entries): New function.
2740         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2741         symtab_off to all symbol table offsets.
2742         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2743         * object.h (class Got_offset_list): Move to top of file.
2744         (Object::Object): Allow case where input_file == NULL.
2745         (Object::~Object): Likewise.
2746         (Object::input_file): Assert that input_file != NULL.
2747         (Object::lock): Allow case where input_file == NULL.
2748         (Object::unlock): Likewise.
2749         (Object::is_locked): Likewise.
2750         (Object::token): Likewise.
2751         (Object::release): Likewise.
2752         (Object::is_incremental): New function.
2753         (Object::get_mtime): New function.
2754         (Object::for_all_local_got_entries): New function.
2755         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2756         (Object::set_is_in_system_directory): New function.
2757         (Object::is_in_system_directory): New function.
2758         (Object::do_is_incremental): New function.
2759         (Object::do_get_mtime): New function.
2760         (Object::do_for_all_local_got_entries): New function.
2761         (Object::is_in_system_directory_): New data member.
2762         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2763         (class Sized_relobj_base): New class.
2764         (class Sized_relobj): Derive from Sized_relobj_base.
2765         (class Sized_relobj::Symbols): Redeclare from base class.
2766         (class Sized_relobj::local_got_offset_list): Remove.
2767         (class Sized_relobj::Output_sections): Redeclare from base class.
2768         (class Sized_relobj::do_for_all_local_got_entries): New function.
2769         (class Sized_relobj::write_local_symbols): Add offset parameter.
2770         (class Sized_relobj::local_symbol_offset_): Update comment.
2771         (class Sized_relobj::local_dynsym_offset_): Update comment.
2772         * options.cc (Input_arguments::add_file): Remove const.
2773         * options.h (Input_file_argument::Input_file_argument):
2774         Initialize arg_serial_ (all constructors).
2775         (Input_file_argument::set_arg_serial): New function.
2776         (Input_file_argument::arg_serial): New function.
2777         (Input_file_argument::arg_serial_): New data member.
2778         (Input_arguments::Input_arguments): Initialize file_count_.
2779         (Input_arguments::add_file): Remove const.
2780         (Input_arguments::number_of_input_files): New function.
2781         (Input_arguments::file_count_): New data member.
2782         (Command_line::number_of_input_files): Call
2783         Input_arguments::number_of_input_files.
2784         * output.cc (Output_segment_headers::Output_segment_headers):
2785         Set current size.
2786         (Output_section::Input_section::current_data_size): New function.
2787         (Output_section::Output_section): Initialize new data members.
2788         (Output_section::add_input_section): Don't do merge sections for
2789         an incremental link; allocate space from free list for an
2790         incremental update.
2791         (Output_section::add_output_section_data): Allocate space from
2792         free list for an incremental update.
2793         (Output_section::update_data_size): New function.
2794         (Output_section::set_fixed_layout): New function.
2795         (Output_section::reserve): New function.
2796         (Output_segment::set_section_addresses): Remove const.
2797         (Output_segment::set_section_list_addresses): Remove const; allocate
2798         space from free list for an incremental update.
2799         (Output_segment::set_offset): Adjust size of RELRO segment for an
2800         incremental update.
2801         * output.h (Output_data::current_data_size): Move here from
2802         child classes.
2803         (Output_data::pre_finalize_data_size): New function.
2804         (Output_data::update_data_size): New function.
2805         (Output_section_headers::update_data_size): new function.
2806         (Output_section_data_build::current_data_size): Move to Output_data.
2807         (Output_data_strtab::update_data_size): New function.
2808         (Output_section::current_data_size): Move to Output_data.
2809         (Output_section::set_fixed_layout): New function.
2810         (Output_section::has_fixed_layout): New function.
2811         (Output_section::reserve): New function.
2812         (Output_section::update_data_size): New function.
2813         (Output_section::has_fixed_layout_): New data member.
2814         (Output_section::free_list_): New data member.
2815         (Output_segment::set_section_addresses): Remove const.
2816         (Output_segment::set_section_list_addresses): Remove const.
2817         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2818         New function.
2819         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2820         New function.
2821         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2822         parameter when calling Add_symbols constructor; store argument
2823         serial number for members of a lib group.
2824         (Add_symbols::locks): Allow case where token == NULL.
2825         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2826         (Read_member::~Read_member): New function.
2827         (Read_member::is_runnable): New function.
2828         (Read_member::locks): New function.
2829         (Read_member::run): New function.
2830         (Check_script::~Check_script): New function.
2831         (Check_script::is_runnable): New function.
2832         (Check_script::locks): New function.
2833         (Check_script::run): New function.
2834         (Check_library::~Check_library): New function.
2835         (Check_library::is_runnable): New function.
2836         (Check_library::locks): New function.
2837         (Check_library::run): New function.
2838         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2839         (Add_symbols::library_): New data member.
2840         (class Read_member): New class.
2841         (class Check_script): New class.
2842         (class Check_library): New class.
2843         * reloc.cc (Read_relocs::is_runnable): Allow case where
2844         token == NULL.
2845         (Read_relocs::locks): Likewise.
2846         (Scan_relocs::locks): Likewise.
2847         (Relocate_task::locks): Likewise.
2848         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2849         to clear counters.
2850         (Sized_relobj::incremental_relocs_scan): Fix comment.
2851         (Sized_relobj::do_relocate): Pass output file offset to
2852         write_local_symbols.
2853         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2854         from class declaration.
2855         * script.cc (read_input_script): Allocate Script_info; pass
2856         argument serial number to report_script.
2857         * script.h (class Script_info): Move to incremental.h.
2858         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2859         * symtab.h (Symbol_table::add_from_incrobj): New function.
2860         (Symbol_table::set_file_offset): New function.
2861
2862 2011-04-05  Cary Coutant  <ccoutant@google.com>
2863
2864         * incremental-dump.cc (dump_incremental_inputs): Change signature
2865         to take a Sized_incremental_binary; change caller.  Use readers
2866         in Sized_incremental_binary.
2867         * incremental.cc
2868         (Sized_incremental_binary::find_incremental_inputs_sections):
2869         Rename do_find_incremental_inputs_sections to this.
2870         (Sized_incremental_binary::setup_readers): New function.
2871         (Sized_incremental_binary::do_check_inputs): Check
2872         has_incremental_info_ flag; move setup code to setup_readers;
2873         use input readers.
2874         (Sized_incremental_binary::do_file_is_unchanged): New function.
2875         (Sized_incremental_binary::do_get_input_reader): New function.
2876         * incremental.h (class Incremental_binary): Move to end of file.
2877         (Incremental_binary::file_is_unchanged): New function.
2878         (Incremental_binary::do_file_is_unchanged): New function.
2879         (Incremental_binary::Input_reader): New class.
2880         (Incremental_binary::get_input_reader): New function.
2881         (class Sized_incremental_binary): Move to end of file.
2882         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2883         input section reader classes.
2884         (Sized_incremental_binary::has_incremental_info): New function.
2885         (Sized_incremental_binary::inputs_reader): New function.
2886         (Sized_incremental_binary::symtab_reader): New function.
2887         (Sized_incremental_binary::relocs_reader): New function.
2888         (Sized_incremental_binary::got_plt_reader): New function.
2889         (Sized_incremental_binary::do_file_is_unchanged): New function.
2890         (Sized_incremental_binary::Sized_input_reader): New class.
2891         (Sized_incremental_binary::get_input_reader): New function.
2892         (Sized_incremental_binary::find_incremental_inputs_sections):
2893         Rename do_find_incremental_inputs_sections to this.
2894         (Sized_incremental_binary::setup_readers): New function.
2895         (Sized_incremental_binary::has_incremental_info_): New data member.
2896         (Sized_incremental_binary::inputs_reader_): New data member.
2897         (Sized_incremental_binary::symtab_reader_): New data member.
2898         (Sized_incremental_binary::relocs_reader_): New data member.
2899         (Sized_incremental_binary::got_plt_reader_): New data member.
2900         (Sized_incremental_binary::current_input_file_): New data member.
2901
2902 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2903
2904         PR gold/12640
2905         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2906         violation.
2907
2908 2011-03-30  Cary Coutant  <ccoutant@google.com>
2909
2910         * archive.cc (Archive::include_member): Adjust call to report_object.
2911         (Add_archive_symbols::run): Add script_info to call to
2912         report_archive_begin.
2913         (Lib_group::include_member): Adjust call to report_object.
2914         (Add_lib_group_symbols::run): Adjust call to report_object.
2915         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2916         blocks.  Add object count for script input files.
2917         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2918         script_info parameter; change all callers.
2919         (Incremental_inputs::report_object): Add script_info parameter;
2920         change all callers.
2921         (Incremental_inputs::report_script): Store backpointer to
2922         incremental info entry.
2923         (Output_section_incremental_inputs::set_final_data_size): Record
2924         additional information for scripts.
2925         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2926         * incremental.h (Incremental_script_entry::add_object): New function.
2927         (Incremental_script_entry::get_object_count): New function.
2928         (Incremental_script_entry::get_object): New function.
2929         (Incremental_script_entry::objects_): New data member; adjust
2930         constructor.
2931         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2932         (Incremental_inputs::report_object): Add script_info parameter.
2933         (Incremental_inputs_reader::get_object_count): New function.
2934         (Incremental_inputs_reader::get_object_offset): New function.
2935         * options.cc (Input_arguments::add_file): Return reference to
2936         new input argument.
2937         * options.h (Input_argument::set_script_info): New function.
2938         (Input_argument::script_info): New function.
2939         (Input_argument::script_info_): New data member; adjust all
2940         constructors.
2941         (Input_file_group::add_file): Return reference to new input argument.
2942         (Input_file_lib::add_file): Likewise.
2943         (Input_arguments::add_file): Likewise.
2944         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2945         * script.cc (Parser_closure::Parser_closure): Add script_info
2946         parameter; adjust all callers.
2947         (Parser_closure::script_info): New function.
2948         (Parser_closure::script_info_): New data member.
2949         (read_input_script): Report scripts earlier to incremental info.
2950         (script_add_file): Set script_info in Input_argument.
2951         (script_add_library): Likewise.
2952         * script.h (Script_options::Script_info): Rewrite class.
2953
2954 2011-03-29  Cary Coutant  <ccoutant@google.com>
2955
2956         * archive.cc (Library_base::should_include_member): Move
2957         method here from class Archive.
2958         (Archive::Archive): Initialize base class.
2959         (Archive::should_include_member): Move to base class.
2960         (Archive::do_for_all_unused_symbols): New function.
2961         (Add_archive_symbols::run): Remove redundant access to
2962         incremental_inputs.
2963         (Lib_group::Lib_group): Initialize base class.
2964         (Lib_group::do_filename): New function.
2965         (Lib_group::include_member): Pass pointer to Lib_group to
2966         report_object.
2967         (Lib_group::do_for_all_unused_symbols): New function.
2968         (Add_lib_group_symbols::run): Report archive information for
2969         incremental links.
2970         * archive.h (class Library_base): New base class.
2971         (class Archive): Derive from Library_base.
2972         (Archive::filename): Move to base class.
2973         (Archive::set_incremental_info): Likewise.
2974         (Archive::incremental_info): Likewise.
2975         (Archive::Should_include): Likewise.
2976         (Archive::should_include_member): Likewise.
2977         (Archive::Armap_entry): Remove.
2978         (Archive::Unused_symbol_iterator): Remove.
2979         (Archive::unused_symbols_begin): Remove.
2980         (Archive::unused_symbols_end): Remove.
2981         (Archive::do_filename): New function.
2982         (Archive::do_get_mtime): New function.
2983         (Archive::do_for_all_unused_symbols): New function.
2984         (Archive::task_): Move to base class.
2985         (Archive::incremental_info_): Likewise.
2986         (class Lib_group): Derive from Library_base.
2987         (Lib_group::do_filename): New function.
2988         (Lib_group::do_get_mtime): New function.
2989         (Lib_group::do_for_all_unused_symbols): New function.
2990         (Lib_group::task_): Move to base class.
2991         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2992         function.
2993         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2994         function.
2995         * incremental.cc (Incremental_inputs::report_archive_begin):
2996         Use Library_base; call library's get_mtime; add incremental inputs
2997         entry before members.
2998         (class Unused_symbol_visitor): New class.
2999         (Incremental_inputs::report_archive_end): Use Library_base; use
3000         visitor class to record unused symbols; don't add incremental inputs
3001         entry after members.
3002         (Incremental_inputs::report_object): Use Library_base.
3003         * incremental.h
3004         (Incremental_archive_entry::Incremental_archive_entry): Remove
3005         unused Archive parameter.
3006         (Incremental_inputs::report_archive_begin): Use Library_base.
3007         (Incremental_inputs::report_archive_end): Likewise.
3008         (Incremental_inputs::report_object): Likewise.
3009         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3010         function.
3011         * object.h (Object::for_all_global_symbols): New function.
3012         (Object::do_for_all_global_symbols): New function.
3013         (Sized_relobj::do_for_all_global_symbols): New function.
3014         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3015         function.
3016         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3017         function.
3018
3019 2011-03-27  Ian Lance Taylor  <iant@google.com>
3020
3021         * archive.cc (Archive::interpret_header): Return -1 if something
3022         goes wrong.  Change callers accordingly.
3023
3024 2011-03-25  Cary Coutant  <ccoutant@google.com>
3025
3026         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3027         * testsuite/Makefile.in: Regenerate.
3028
3029 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3030
3031         * plugin.cc (get_view): New.
3032         (Plugin::load): Pass get_view to the plugin.
3033         (Plugin_manager::get_view): New.
3034
3035 2011-03-21  Ian Lance Taylor  <iant@google.com>
3036
3037         * testsuite/final_layout.sh: Rewrite to not use dc.
3038         * testsuite/relro_test.sh: Fail if dc is not present.
3039
3040 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3041
3042         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3043         Change == to -eq.
3044         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3045         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3046         Change == to -eq.
3047         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3048         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3049
3050 2011-03-14  Ian Lance Taylor  <iant@google.com>
3051
3052         * script-sections.cc (Sort_output_sections::script_compare):
3053         Rename from is_before, change return type.
3054         (Sort_output_sections::operator()): Adjust accordingly.
3055
3056 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3057
3058         PR gold/12572
3059         * testsuite/odr_violation2.cc: Add comment to make all error line
3060         numbers double digits.
3061         * testsuite/debug_msg.sh: Adjust expected errors.
3062
3063 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3064
3065         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3066         but mark earlier ones as non-canonical
3067         (offset_to_iterator): Update search target and example
3068         (do_addr2line): Return extra lines in a vector*
3069         (format_file_lineno): Extract from do_addr2line
3070         (one_addr2line): Add vector* out-param
3071         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3072         when a lineno entry appeared last for its instruction
3073         (Dwarf_line_info): Add vector* out-param
3074         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3075         * symtab.cc (Odr_violation_compare): Include the lineno in the
3076         comparison again.
3077         (linenos_from_loc): New. Combine the canonical line for an
3078         address with its other lines.
3079         (True_if_intersect): New. Helper functor to make
3080         std::set_intersection a query.
3081         (detect_odr_violations): Compare sets of lines instead of just
3082         one line for each function. This became less deterministic, but
3083         has fewer false positives.
3084         * symtab.h: Declarations.
3085         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3086         mix an optimized and non-optimized object in the same binary
3087         (odr_violation2.so): Same.
3088         * testsuite/Makefile.in: Regenerate from Makefile.am.
3089         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3090         * testsuite/debug_msg.sh: Update line numbers and add
3091         assertions.
3092         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3093         non-optimized context.
3094         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3095         isn't inlined, and use OdrDerived in an optimized context.
3096         * testsuite/odr_header1.h: Defines OdrDerived, where
3097         optimization will change the
3098         first-instruction-in-the-destructor's file and line number.
3099         * testsuite/odr_header2.h: Defines OdrBase.
3100
3101 2011-03-09  Ian Lance Taylor  <iant@google.com>
3102
3103         * fileread.cc (File_read::clear_views): Don't delete the whole
3104         file view.
3105
3106 2011-03-08  Ian Lance Taylor  <iant@google.com>
3107
3108         PR gold/12525
3109         * fileread.cc: #include <climits>.
3110         (GOLD_IOV_MAX): Define.
3111         (File_read::read_multiple): Limit number of entries by iov_max.
3112         * fileread.h (class File_read): Always set max_readv_entries to
3113         128.
3114
3115 2011-03-07  Ian Lance Taylor  <iant@google.com>
3116
3117         PR gold/12525
3118         * options.h (class General_options): Add -dy and -dn.
3119
3120 2011-03-02  Cary Coutant  <ccoutant@google.com>
3121
3122         * testsuite/script_test_9.t: Add TLS segment.
3123
3124 2011-03-02  Simon Baldwin  <simonb@google.com>
3125
3126         * configure.ac: Add check for gnu_indirect_function support in
3127         the toolchain building binutils.
3128         * configure: Rebuild.
3129
3130 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3131
3132         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3133         plugin only symbols.
3134         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3135         in plugin files as not needed in the symbol table.
3136
3137 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3138
3139         * output.cc (Output_section::add_input_section): Delay fill
3140         generation for section ordering.
3141
3142 2011-02-09  Ian Lance Taylor  <iant@google.com>
3143
3144         PR gold/12316
3145         * object.h (class Sized_relobj): Remove clear_local_symbols.
3146         * reloc.cc (Sized_relobj::do_relocate): Don't call
3147         clear_local_symbols.
3148
3149 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3150
3151         * plugin.cc (is_visible_from_outside): Return true for symbols
3152         in the -u option.
3153
3154 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3155
3156         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3157         filename.
3158
3159 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3160
3161         * icf.h (is_section_foldable_candidate): Change type of parameter
3162         to std::string.
3163         * icf.cc (Icf::find_identical_sections): Change type of local variable
3164         section_name to be std::string.
3165         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3166
3167 2011-01-25  Ian Lance Taylor  <iant@google.com>
3168
3169         * script.cc (script_add_extern): Rewrite to use
3170         add_symbol_reference.
3171
3172 2011-01-25  Doug Kwan  <dougkwan@google.com>
3173
3174         * icf.cc (get_section_contents): Always lock section's object.
3175
3176 2011-01-24  Ian Lance Taylor  <iant@google.com>
3177
3178         * options.h (class General_options): Accept
3179         --no-detect-odr-violations.
3180
3181 2011-01-24  Ian Lance Taylor  <iant@google.com>
3182
3183         * version.cc (version_string): Bump to 1.11.
3184
3185 2011-01-24  Ian Lance Taylor  <iant@google.com>
3186
3187         * plugin.cc (class Plugin_rescan): Define new class.
3188         (Plugin_manager::claim_file): Set any_claimed_.
3189         (Plugin_manager::save_archive): New function.
3190         (Plugin_manager::save_input_group): New function.
3191         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3192         necessary.
3193         (Plugin_manager::new_undefined_symbol): New function.
3194         (Plugin_manager::rescan): New function.
3195         (Plugin_manager::rescannable_defines): New function.
3196         (Plugin_manager::add_input_file): Set any_added_.
3197         * plugin.h (class Plugin_manager): define new fields rescannable_,
3198         undefined_symbols_, any_claimed_, and any_added_.  Declare
3199         Plugin_rescan as friend.  Declare new functions.
3200         (Plugin_manager::Rescannable): Define type.
3201         (Plugin_manager::Rescannable_list): Define type.
3202         (Plugin_manager::Undefined_symbol_list): Define type.
3203         (Plugin_manager::Plugin_manager): Initialize new fields.
3204         * archive.cc (Archive::defines_symbol): New function.
3205         (Add_archive_symbols::run): Pass archive to plugins if any.
3206         * archive.h (class Archive): Declare defines_symbol.
3207         * readsyms.cc (Input_group::~Input_group): New function.
3208         (Finish_group::run): Pass input_group to plugins if any.
3209         * readsyms.h (class Input_group): Declare destructor.
3210         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3211         any.
3212
3213 2011-01-10  Ian Lance Taylor  <iant@google.com>
3214
3215         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3216         section as relro.
3217         (Layout::set_segment_offsets): Reset increase_relro before calling
3218         set_section_addresses a second time.
3219
3220 2011-01-04  Cary Coutant  <ccoutant@google.com>
3221
3222         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3223         sections before NOBITS sections.
3224
3225 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3226
3227         * version.cc (print_version): Update copyright to 2011.
3228
3229 2010-12-23  Cary Coutant  <ccoutant@google.com>
3230
3231         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3232         of OS to this->add.  Add OD parameter to second form of the function.
3233
3234 2010-12-20  Ian Lance Taylor  <iant@google.com>
3235
3236         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3237         second of two consecutive entries with same offset.
3238
3239 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3240
3241         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3242         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3243         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3244         to avoid unneeded links against $(LDADD).
3245         * testsuite/Makefile.in: Regenerate.
3246
3247 2010-12-15  Ian Lance Taylor  <iant@google.com>
3248
3249         PR gold/12324
3250         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3251         for R_X86_64_32 and R_X86_64_PC32.
3252         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3253         ver_matching_def_pic.o.
3254         (ver_matching_def_pic.o): New target.
3255
3256 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3257
3258         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3259         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3260         Move definition before File_read::View member definitions.
3261         (File_read::View::~View): Initialize and hold lock before
3262         updating current_mapped_bytes.
3263
3264 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3265
3266         * dwarf_reader.cc: Remove outdated comment.
3267         * gold-threads.cc: Fix typo in error message.
3268         * archive.cc: Fix typos in comments.
3269         * archive.h: Likewise.
3270         * arm-reloc-property.cc: Likewise.
3271         * arm-reloc-property.h: Likewise.
3272         * arm-reloc.def: Likewise.
3273         * arm.cc: Likewise.
3274         * attributes.h: Likewise.
3275         * cref.cc: Likewise.
3276         * ehframe.cc: Likewise.
3277         * fileread.h: Likewise.
3278         * gold.h: Likewise.
3279         * i386.cc: Likewise.
3280         * icf.cc: Likewise.
3281         * incremental.h: Likewise.
3282         * int_encoding.cc: Likewise.
3283         * layout.h: Likewise.
3284         * main.cc: Likewise.
3285         * merge.h: Likewise.
3286         * object.cc: Likewise.
3287         * object.h: Likewise.
3288         * options.cc: Likewise.
3289         * readsyms.cc: Likewise.
3290         * reduced_debug_output.cc: Likewise.
3291         * reloc.cc: Likewise.
3292         * script-sections.cc: Likewise.
3293         * sparc.cc: Likewise.
3294         * symtab.h: Likewise.
3295         * target-reloc.h: Likewise.
3296         * target.cc: Likewise.
3297         * target.h: Likewise.
3298         * timer.cc: Likewise.
3299         * timer.h: Likewise.
3300         * x86_64.cc: Likewise.
3301
3302 2010-12-09  Cary Coutant  <ccoutant@google.com>
3303
3304         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3305         stack.
3306         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3307         parameter; change all callers.
3308         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3309         * options.h (warn_execstack): New option.
3310
3311 2010-12-07  Doug Kwan  <dougkwan@google.com>
3312
3313         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3314         like function call relocations.
3315
3316 2010-12-07  Ian Lance Taylor  <iant@google.com>
3317
3318         * archive.cc (Archive::get_elf_object_for_member): Permit
3319         punconfigured to be NULL.
3320         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3321         (Archive::include_member): Pass NULL to get_elf_object_for_member
3322         if we searched for the archive and this is the first included
3323         object.
3324
3325 2010-12-01  Ian Lance Taylor  <iant@google.com>
3326
3327         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3328         track_relocs_type_ field.
3329         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3330         Set track_relocs_type_.
3331         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3332         contents when using RELA relocs.
3333         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3334         reloc_map_.
3335         * reloc.cc (Track_relocs::next_addend): New function.
3336         * reloc.h (class Track_relocs): Declare next_addend.
3337
3338 2010-12-01  Ian Lance Taylor  <iant@google.com>
3339
3340         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3341         virtual destructor.
3342
3343 2010-12-01  Ian Lance Taylor  <iant@google.com>
3344
3345         * README: Update compilers known to work and fail.
3346
3347 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3348
3349         * configure.in: For --enable-gold, handle value `default' instead of
3350         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3351         not the default.
3352         * configure: Regenerate.
3353
3354 2010-11-18  Doug Kwan  <dougkwan@google.com>
3355
3356         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3357         and right_alignment to be zero.  Store result alignment only if it is
3358         greater than existing alignment.
3359
3360 2010-11-16  Cary Coutant  <ccoutant@google.com>
3361
3362         PR gold/12220
3363         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3364         Check for ".zdebug_line".
3365
3366 2010-11-16  Doug Kwan  <dougkwan@google.com>
3367             Cary Coutant  <ccoutant@google.com>
3368
3369         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3370         by reference; adjust all callers.
3371         * output.cc (Output_segment::set_section_addresses): Adjust references
3372         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3373         list is empty.
3374         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3375         end at page boundary.
3376
3377 2010-11-16  Cary Coutant  <ccoutant@google.com>
3378
3379         PR gold/12220
3380         * layout.cc (Layout::choose_output_section): Transform names of
3381         compressed sections even when using a script with a SECTIONS clause.
3382         (Layout::output_section_name): Remove code to transform
3383         compressed debug section names.
3384         * output.cc (Output_section::add_input_section): Use uncompressed
3385         section size when tracking input sections.
3386
3387 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3388
3389         * symtab.h (Symbol::NON_PIC_REF): Remove.
3390         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3391         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3392         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3393         (Symbol::use_plt_offset): Take a flags argument and pass it
3394         directly to needs_dynamic_reloc.  Restrict check for undefined
3395         weak symbols to function calls.
3396         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3397         (Target_arm::Scan::global): Use it.
3398         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3399         (Target_arm::Relocate::relocate): Likewise.
3400         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3401         parameter with an r_type parameter.  Use get_reference_flags
3402         to get the flags.
3403         (Target_arm::Relocate::relocate): Update accordingly.
3404         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3405         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3406         (Target_i386::Scan::global): Likewise.
3407         (Target_i386::Relocate::relocate): Likewise.
3408         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3409         parameter with an r_type parameter.  Use get_reference_flags
3410         to get the flags.
3411         (Target_i386::Relocate::relocate): Update accordingly.
3412         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3413         (Target_powerpc::Scan::global): Use it.
3414         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3415         (Target_powerpc::Relocate::relocate): Likewise.
3416         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3417         (Target_sparc::Scan::global): Use it.
3418         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3419         (Target_sparc::Relocate::relocate): Likewise.
3420         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3421         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3422         (Target_x86_64::Scan::global): Likewise.
3423         (Target_x86_64::Relocate::relocate): Likewise.
3424
3425 2010-11-08  Doug Kwan  <dougkwan@google.com>
3426             Cary Coutant  <ccoutant@google.com>
3427
3428         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3429         (Arm_exidx_merge_section::section_contents_): New data member.
3430         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3431         (Arm_input_section::~Arm_input_section): De-allocate memory.
3432         (Arm_input_section::original_contents_): New data member.
3433         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3434         in parameters instead of calling Object::section_contents without
3435         locking.
3436         (Arm_output_section::group_section): New parameter TASK.  Pass it
3437         to callees that need locking objects.
3438         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3439         to lock EXIDX input sections.  Fix a formatting issue.  Call
3440         Arm_exidx_merged_section::build_contents to create merged section
3441         contents.
3442         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3443         to lock object of stub table owner.
3444         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3445         TEXT_SIZE to initialize data member TEXT_SIZE_.
3446         (Arm_exidx_input_section::addralign): Fix typo in comment.
3447         (Arm_exidx_input_section::text_size): New method.
3448         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3449         that require locking objects.  Lock objects before scanning for stubs
3450         and updating local symbols.
3451         (Arm_input_section<big_endian>::init): Copy contents of original
3452         input section.
3453         (Arm_input_section<big_endian>::do_write): Use saved contents of
3454         original input section instead of calling Object::section_contents
3455         without locking.
3456         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3457         size without calling Object::section_size().
3458         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3459         for size.  Allocate a buffer for merged EXIDX entries.
3460         (Arm_exidx_merged_section::build_contents): New method.
3461         (Arm_exidx_merged_section::do_write): Move merge section contents
3462         building code to Arm_exidx_merged_section::build_contetns.  Write
3463         out contetns in buffer instead of building it on the fly.
3464         (Arm_relobj::make_exidx_input_section): Also pass text section size
3465         to Arm_exidx_input_section constructor.
3466         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3467         (Arm_dynobj::do_read_symbols): Fix memory leak.
3468         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3469         * target.h: (class Task): Add forward declaration.
3470         (Target::relax): Add new parameter TASK and pass it to
3471         Target::do_relax().
3472         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3473
3474 2010-11-05  Cary Coutant  <ccoutant@google.com>
3475
3476         PR gold/10708
3477         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3478         object when reading from the file.
3479         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3480         second layout pass.
3481         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3482         when reading section contents.
3483         (get_section_contents): Likewise.
3484         (icf::find_identical_sections): Likewise.
3485         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3486         object when reading from the file.
3487         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3488         the object when doing deferred section layout.
3489
3490 2010-11-03  Nick Clifton  <nickc@redhat.com>
3491
3492         PR gold/12001
3493         * script.h (class Symbol_assignment: name): New member.  Returns
3494         the name of the symbol.
3495         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3496         Returns true if the given symbol name is on the list of
3497         assignments wating to be processed.
3498         * archive.cc (should_incldue_member): If the symbol is undefined,
3499         check to see if it is on the list of symbols pending assignment.
3500
3501 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3502
3503         * script-sections.cc (Script_sections::find_memory_region): Check
3504         for a NULL output section pointer.
3505
3506 2010-10-29  Doug Kwan  <dougkwan@google.com>
3507
3508         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3509         Output_section::add_relaxed_input_section.
3510         * output.cc (Output_section::add_relaxed_input_section): Add new
3511         arguments LAYOUT and NAME.  Set section order index.
3512         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3513         Copy section order index.
3514         * output.h (Output_section::add_relaxed_input_section): Add new
3515         arguments LAYOUT and NAME.
3516
3517 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3518
3519         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3520         NATIVE_OR_CROSS_LINKER.
3521         * testsuite/Makefile.in: Regenerate.
3522
3523 2010-10-20  Doug Kwan  <dougkwan@google.com>
3524
3525         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3526         without SHF_LINK_ORDER flags.
3527         * layout.cc (Layout::choose_output_section): Do not filter
3528         SHF_LINK_ORDER flag in a relocatable link.
3529
3530 2010-10-17  Cary Coutant  <ccoutant@google.com>
3531
3532         * output.h (Output_segment::set_section_addresses): Change function
3533         signature.  Update all callers.
3534         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3535         sections.
3536         (Output_segment::set_section_addresses): Align after last TLS
3537         section.  Add padding before last relro section instead of after.
3538
3539 2010-10-17  Doug Kwan  <dougkwan@google.com>
3540
3541         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3542         GOT output section to be writable.
3543
3544 2010-10-14  Cary Coutant  <ccoutant@google.com>
3545
3546         * debug.h (DEBUG_INCREMENTAL): New flag.
3547         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3548         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3549         mode.
3550         * incremental.cc (report_command_line): Ignore all forms of
3551         --incremental.
3552         * layout.cc (Layout::Layout): Check parameters for incremental link
3553         mode.
3554         * options.cc (General_options::parse_incremental): New function.
3555         (General_options::parse_no_incremental): New function.
3556         (General_options::parse_incremental_full): New function.
3557         (General_options::parse_incremental_update): New function.
3558         (General_options::incremental_mode_): New data member.
3559         (General_options::finalize): Check incremental_mode_.
3560         * options.h (General_options): Update help text for --incremental.
3561         Add --no-incremental, --incremental-full, --incremental-update.
3562         (General_options::Incremental_mode): New enum type.
3563         (General_options::incremental_mode): New function.
3564         (General_options::incremental_mode_): New data member.
3565         * parameters.cc (Parameters::incremental_mode_): New data member.
3566         (Parameters::set_options): Set incremental_mode_.
3567         (Parameters::set_incremental_full): New function.
3568         (Parameters::incremental): New function.
3569         (Parameters::incremental_update): New function.
3570         (set_parameters_incremental_full): New function.
3571         * parameters.h (Parameters::set_incremental_full): New function.
3572         (Parameters::incremental): New function.
3573         (Parameters::incremental_update): New function.
3574         (Parameters::incremental_mode_): New data member.
3575         (set_parameters_incremental_full): New function.
3576         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3577         incremental link mode.
3578         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3579         (Sized_relobj::do_relocate_sections): Likewise.
3580         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3581         option.
3582         * testsuite/Makefile.in: Regenerate.
3583         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3584
3585 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3586
3587         * script-sections.h (class Script_sections): Make
3588         Sections_elements typedef public.
3589         * script-sections.cc (class Sort_output_sections): Add elements_
3590         field.  Add constructor which sets it; change all callers.
3591         (Sort_output_sections::is_before): New function.
3592         (Sort_output_sections::operator()): Call is_before.
3593         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3594         conditional.
3595         * testsuite/script_test_10.sh: New test. Test script section
3596         order.
3597         * testsuite/script_test_10.t: Likewise.
3598         * testsuite/script_test_10.s: Likewise.
3599         * testsuite/Makefile.am: Wrap the cross linker tests and the
3600         common tests into NATIVE_OR_CROSS_LINKER.
3601         (check_SCRIPTS): Add script_test_10.sh.
3602         (check_DATA): Add script_test_10.stdout.
3603         (script_test_10.o, script_test_10): New targets.
3604         (script_test_10.stdout): New target.
3605         * configure, testsuite/Makefile.in: Regenerate.
3606
3607 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3608
3609         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3610         error for the deprecated relocations.
3611         (Target_arm::Scan::global): Likewise.
3612         (Target_arm::Relocate::relocate): Likewise.
3613
3614 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3615
3616         * fileread.cc (Input_file::find_file): Initialize *found_name
3617         and *namep when using the fallback search for case 4.
3618
3619 2010-10-11  Cary Coutant  <ccoutant@google.com>
3620
3621         * options.h (class General_options): Redefine -z lazy as an alias for
3622         the negation of -z now.
3623
3624 2010-10-11  Ian Lance Taylor  <iant@google.com>
3625
3626         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3627         binding.
3628
3629 2010-10-06  Nick Clifton  <nickc@redhat.com>
3630
3631         * script-sections.cc(class Memory_region): Remove
3632         current_lma_offset_ field.  Rename current_vma_offset_ to
3633         current_offset_.  Add last_section_ field.
3634         (Memory_region::get_current_vma_address): Rename to
3635         get_current_address.
3636         (Memory_region::get_current_lma_address): Delete.
3637         (Memory_region::increment_vma_offset): Rename to
3638         increment_offset.
3639         (Memory_region::increment_lma_offset): Delete.
3640         (Memory_region::attributes_compatible): New method.  Returns
3641         true if the provided section is compatible with the region.
3642         (Memory_region::get_last_section): New method.  Returns the last
3643         section to use the region.
3644         (Memory_region::set_last_section): New method.  Stores the last
3645         section to use the region.
3646         (Script_sections::block_in_region): New method.  Returns true if
3647         a block of memory is contained within a region.
3648         (Script_sections::find_memory_region): New method.  Locates a
3649         memory region to be used to set a VMA or LMA address.
3650         (Output_section_definition::set_section_addresses): Add code to
3651         check for addresses set by memory regions.
3652         (Output_segment::set_section_addresses): Remove memory region
3653         walking code.
3654         (Script_sections::create_segment): Add a warning if a header
3655         segment is created outside of any region.
3656         * script-sections.h (class Script_sections): Add prototypes for
3657         find_memory_region and block_in_region methods.
3658         * testsuite/memory_test.s: Use .long instead of .word.
3659         * testsuite/memory_test.t: Add some more output sections.
3660         * testsuite/memory_test.sh: Update expected output.
3661
3662 2010-10-02  Doug Kwan  <dougkwan@google.com>
3663
3664         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3665         defintion to symtab.h
3666         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3667         declaration to defintion.
3668
3669 2010-10-01  Nick Clifton  <nickc@redhat.com>
3670
3671         * expression.cc (eval): Replace dummy argument with NULL.
3672         (eval_maybe_dot): Check for a NULL result section pointer.
3673         (Symbol_expression::value): Likewise.
3674         (Dot_expression::value): Likewise.
3675         (BINARY_EXPRESSION): Likewise.
3676         (Max_expression::value): Likewise.
3677         (Min_expression::value): Likewise.
3678         (Absolute_expression::value): Likewise.
3679         (Addr_expression::value_from_output_section): Likewise.
3680         (Loaddddr_expression::value_from_output_section): Likewise.
3681         (Segment_start_expression::value): Likewise.
3682         * script-sections.cc
3683         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3684         argument with NULL.
3685         (Sections_elememt_dot_assignment::set_section_addresses):
3686         Likewise.
3687         (Output_data_expression::do_write_to_buffer): Likewise.
3688         (Output_section_definition::finalize_symbols): Likewise.
3689         (Output_section_definition::set_section_addresses): Likewise.
3690
3691 2010-09-30  Doug Kwan  <dougkwan@google.com>
3692
3693         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3694
3695 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3696
3697         * target.h (Target::can_icf_inline_merge_sections): New virtual
3698         function.
3699         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3700         virtual function.
3701         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3702         virtual function.
3703         * icf.cc (get_section_contents): Inline merge sections only when
3704         target allows it.
3705
3706 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3707
3708         * configure: Regenerate.
3709
3710 2010-09-17  Ian Lance Taylor  <iant@google.com>
3711
3712         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3713         * testsuite/Makefile.am (memory_test.o): New target.
3714         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3715         memory_test.t.
3716         * testsuite/Makefile.in: Rebuild.
3717
3718 2010-09-17  Doug Kwan  <dougkwan@google.com>
3719
3720         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3721         defintion if relocation uses GOT entries of the symbol.
3722         * testsuite/icf_safe_test.sh: Fix test.
3723         * testsuite/icf_safe_so_test.sh: Fix test.
3724
3725 2010-09-16  Cary Coutant  <ccoutant@google.com>
3726
3727         * script_sections.cc (class Memory_region): Remove "NULL" from
3728         vector initializations.
3729
3730 2010-09-15  Cary Coutant  <ccoutant@google.com>
3731
3732         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3733         Resolve forwarding symbols.
3734
3735 2010-09-15  Doug Kwan  <dougkwan@google.com>
3736
3737         * gold/testsuite/script_test_3.t: Add ARM special sections.
3738         * gold/testsuite/script_test_4.t: Same.
3739         * gold/testsuite/script_test_5.t: Same.
3740         * gold/testsuite/script_test_6.t: Same.
3741         * gold/testsuite/script_test_7.t: Same.
3742         * gold/testsuite/script_test_7.t: Same.
3743         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3744
3745 2010-09-14  Cary Coutant  <ccoutant@google.com>
3746
3747         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3748         (Target_x86_64::Relocate::relocate_tls): Replace check for
3749         saw_tls_block_reloc_ with test for executable section.
3750
3751 2010-09-12  Cary Coutant  <ccoutant@google.com>
3752
3753         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3754         position-independent executables to shared libraries need dynamic
3755         relocations.
3756         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3757         position-independent executables.
3758         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3759         * testsuite/Makefile.in: Regenerate.
3760
3761 2010-09-10  Nick Clifton  <nickc@redhat.com>
3762
3763         PR gold/11997
3764         * testsuite/memory_test.t: Discard any sections that are not
3765         needed.
3766
3767 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3768
3769         PR gold/11996
3770         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3771         "This::" to work around a bug in gcc 4.2.
3772
3773         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3774
3775 2010-09-09  Rafael Espindola  <espindola@google.com>
3776
3777         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3778         sections with different PF_X flags in the same segment.
3779         (Layout::find_first_load_seg): Search all segments to find the first
3780         one.
3781         * options.h (rosegment): New.
3782
3783 2010-09-08  Rafael Espindola  <espindola@google.com>
3784
3785         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3786
3787 2010-09-08  Doug Kwan  <dougkwan@google.com>
3788
3789         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3790         (Arm_relobj::do_relocate_sections): Add new parameter for output
3791         file to match the parent.
3792         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3793         of local symbols instead of input values.  Update code to track
3794         changes in gold::relocate_section.
3795         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3796         (Sized_relobj::compute_final_local_value_internal): New methods.
3797         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3798         body into private version of Sized_relobj::compute_final_local_value.
3799         Call the inline method.
3800         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3801         merged symbol value if there is one.
3802         (Symbol_value::has_output_value): New method defintiion.
3803         (Sized_relobj::Compute_final_local_value_status): New enum type.
3804         (Sized_relobj::compute_final_local_value): New methods.
3805         (Sized_relobj::compute_final_local_value_internal): New methods.
3806         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3807         and arm_cortex_a8.sh.
3808         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3809         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3810         New tests.
3811         * Makefile.in: Regenerate.
3812         * testsuite/arm_bl_out_of_range.s: Update test.
3813         * testsuite/thumb_bl_out_of_range.s: Ditto.
3814         * testsuite/thumb_blx_out_of_range.s: Ditto.
3815         * testsuite/arm_branch_out_of_range.sh: New file.
3816         * testsuite/arm_cortex_a8.sh: Ditto.
3817         * testsuite/arm_cortex_a8_b.s: Ditto.
3818         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3819         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3820         * testsuite/arm_cortex_a8_bl.s: Ditto.
3821         * testsuite/arm_cortex_a8_blx.s: Ditto.
3822         * testsuite/arm_cortex_a8_local.s: Ditto.
3823         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3824         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3825
3826 2010-09-08  Rafael Espindola  <espindola@google.com>
3827
3828         * Makefile.am (memory_test.stdout): Run readelf with -W.
3829         * Makefile.in: Regenerate.
3830         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3831         64 bit output.
3832
3833 2010-09-08  Rafael Espindola  <espindola@google.com>
3834
3835         * script-sections.cc (Script_sections::add_memory_region): Convert
3836         field precision to int.
3837         * script.cc (script_set_section_region, script_set_section_region):
3838         Convert field precision to int.
3839
3840 2010-09-08  Rafael Espindola  <espindola@google.com>
3841
3842         * arm.cc (do_finalize_sections): Create the __exidx_start and
3843         __exdix_end symbols even when the section is missing.
3844
3845 2010-09-08  Nick Clifton  <nickc@redhat.com>
3846
3847         * README: Remove claim that MEMORY is not supported.
3848         * expression.cc (script_exp_function_origin)
3849         (script_exp_function_length): Move from here to ...
3850         * script.cc: ... here.
3851         (script_set_section_region, script_add_memory)
3852         (script_parse_memory_attr, script_include_directive): New
3853         functions.
3854         * script-sections.cc
3855         (class Memory_region): New class.
3856         (class Output_section_definition): Add set_memory_region,
3857         set_section_vma, set_section_lma and get_section_name methods.
3858         (class Script_Sections): Add add_memory_region,
3859         find_memory_region, find_memory_region_origin,
3860         find_memory_region_length and set_memory_region methods.
3861         Have set_section_addresses method walk the list of set memory
3862         regions.
3863         Extend the print methos to display memory regions.
3864         * script-sections.h: Add prototypes for new methods.
3865         Add enum for MEMORY region attributes.
3866         * yyscript.y: Add support for parsing MEMORY regions.
3867         * script-c.h: Add prototypes for new functions.
3868         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3869         * testsuite/Makefile.in: Regenerate.
3870         * testsuite/memory_test.sh: New script.
3871         * testsuite/memory_test.s: New assembler source file.
3872         * testsuite/memory_test.t: New linker script.
3873
3874 2010-08-27  Doug Kwan  <dougkwan@google.com>
3875
3876         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3877         reference override an existing dynamic weak reference.
3878         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3879         * testsuite/Makefile.in: Regenerate.
3880         * testsuite/dyn_weak_ref.sh: New file.
3881         * testsuite/dyn_weak_ref_1.c: Ditto.
3882         * testsuite/dyn_weak_ref_2.c: Ditto.
3883
3884 2010-08-27  Ian Lance Taylor  <iant@google.com>
3885
3886         * incremental.h (class Incremental_input_entry): Add virtual
3887         destructor.
3888
3889 2010-08-27  Ian Lance Taylor  <iant@google.com>
3890
3891         * testsuite/start_lib_test_3.c: Mark t3 as used.
3892
3893 2010-08-27  Nick Clifton  <nickc@redhat.com>
3894
3895         * options.cc (version_script): Fix small typo in previous
3896         whitespace tidyup.
3897
3898 2010-08-25  Nick Clifton  <nickc@redhat.com>
3899
3900         * archive.cc: Formatting fixes: Remove whitespace between
3901         typename and following asterisk.  Remove whitespace between
3902         function name and opening parenthesis.
3903         * archive.h: Likewise.
3904         * arm.cc: Likewise.
3905         * attributes.cc: Likewise.
3906         * attributes.h: Likewise.
3907         * common.cc: Likewise.
3908         * copy-relocs.cc: Likewise.
3909         * dirsearch.h: Likewise.
3910         * dynobj.cc: Likewise.
3911         * ehframe.cc: Likewise.
3912         * ehframe.h: Likewise.
3913         * expression.cc: Likewise.
3914         * fileread.cc: Likewise.
3915         * fileread.h: Likewise.
3916         * gc.h: Likewise.
3917         * gold-threads.cc: Likewise.
3918         * gold.cc: Likewise.
3919         * i386.cc: Likewise.
3920         * icf.h: Likewise.
3921         * incremental-dump.cc: Likewise.
3922         * incremental.cc: Likewise.
3923         * layout.cc: Likewise.
3924         * layout.h: Likewise.
3925         * main.cc: Likewise.
3926         * merge.cc: Likewise.
3927         * merge.h: Likewise.
3928         * object.cc: Likewise.
3929         * object.h: Likewise.
3930         * options.cc: Likewise.
3931         * options.h: Likewise.
3932         * output.cc: Likewise.
3933         * output.h: Likewise.
3934         * plugin.cc: Likewise.
3935         * plugin.h: Likewise.
3936         * powerpc.cc: Likewise.
3937         * reloc.cc: Likewise.
3938         * script-c.h: Likewise.
3939         * script-sections.cc: Likewise.
3940         * script.cc: Likewise.
3941         * stringpool.cc: Likewise.
3942         * symtab.cc: Likewise.
3943         * symtab.h: Likewise.
3944         * target.cc: Likewise.
3945         * timer.cc: Likewise.
3946         * timer.h: Likewise.
3947         * version.cc: Likewise.
3948         * x86_64.cc: Likewise.
3949
3950 2010-08-24  Nick Clifton  <nickc@redhat.com>
3951
3952         PR 11899
3953         * layout.cc (segment_precedes): Sort segments by their physical
3954         addresses, if they have been set.
3955
3956 2010-08-23  Cary Coutant  <ccoutant@google.com>
3957
3958         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3959         symbols data.
3960         (Lib_group::include_member): Unlock object after deleting its
3961         symbols data.
3962         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3963         the bug fixed here.
3964
3965 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3966             Cary Coutant  <ccoutant@google.com>
3967
3968         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3969         constructor, and set_blocker.
3970         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3971         readsyms_blocker_.
3972         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3973         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3974         * testsuite/Makefile.am (start_lib_test): New test case.
3975         * testsuite/Makefile.in: Regenerate.
3976         * testsuite/start_lib_test_main.c: New file.
3977         * testsuite/start_lib_test_1.c: New file.
3978         * testsuite/start_lib_test_2.c: New file.
3979         * testsuite/start_lib_test_3.c: New file.
3980
3981 2010-08-19  Ian Lance Taylor  <iant@google.com>
3982
3983         * Makefile.in: Rebuild with automake 1.11.1.
3984         * aclocal.m4: Likewise.
3985         * testsuite/Makefile.in: Likewise.
3986
3987 2010-08-19  Ian Lance Taylor  <iant@google.com>
3988
3989         PR 10893
3990         * i386.cc (class Output_data_plt_i386): Update declarations.
3991         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
3992         local_ifuncs_ fields.
3993         (Target_i386::do_plt_section_for_global): New function.
3994         (Target_i386::do_plt_section_for_local): New function.
3995         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3996         parameter; change all callers.  Initialize global_ifuncs_ and
3997         local_ifuncs_.  If doing a static link define __rel_iplt_start and
3998         __rel_iplt_end.
3999         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4000         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4001         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4002         symbols.
4003         (Target_i386::make_plt_section): New function, broken out of
4004         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4005         (Target_i386::make_plt_entry): Call make_plt_section.
4006         (Target_i386::make_local_ifunc_plt_entry): New function.
4007         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4008         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4009         R_386_IRELATIVE to switch.
4010         (Target_i386::Scan::global): Likewise.
4011         (Target_i386::Relocate::relocate): Likewise.
4012         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4013         switch.
4014         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4015         (Target_x86_64::do_plt_section_for_global): New function.
4016         (Target_x86_64::do_plt_section_for_local): New function.
4017         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4018         parameter; change all callers.  If doing a static link define
4019         __rela_iplt_start and __rela_iplt_end.
4020         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4021         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4022         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4023         to point to .plt.
4024         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4025         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4026         switch.
4027         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4028         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4029         R_X86_64_IRELATIVE to switch.
4030         (Target_x86_64::Scan::global): Likewise.
4031         (Target_x86_64::Relocate::relocate): Likewise.
4032         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4033         switch.
4034         * target.h (class Target): Add plt_section_for_global and
4035         plt_section_for_local functions.  Add do_plt_section_for_global
4036         and do_plt_section_for_local virtual functions.
4037         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4038         clarifying comments.
4039         (Symbol::use_plt_offset): Handle IFUNC symbol.
4040         * object.cc (Sized_relobj::Sized_relobj): Initialize
4041         local_plt_offsets_.
4042         (Sized_relobj::local_has_plt_offset): New function.
4043         (Sized_relobj::local_plt_offset): New function.
4044         (Sized_relobj::set_local_plt_offset): New function.
4045         (Sized_relobj::do_count): Handle IFUNC symbol.
4046         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4047         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4048         is_ifunc_symbol functions.
4049         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4050         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4051         local_plt_offsets_ field.
4052         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4053         * output.h (class Output_section_data): Add non-const
4054         output_section function.
4055         (class Output_data_got): Update declarations.
4056         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4057         Add use_plt_offset parameter to global and local constructors.
4058         Change all callers.  Change local_sym_index_ field to 31 bits.
4059         Change GSYM_CODE and CONSTANT_CODE accordingly.
4060         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4061         doing a static link don't set sh_link field.
4062         (Output_data_got::Got_entry::write): Use PLT offset if
4063         appropriate.
4064         (Output_data_got::add_global_plt): New function.
4065         (Output_data_got::add_local_plt): New function.
4066         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4067         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4068         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4069         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4070         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4071         IFUNC conditional.
4072         * testsuite/ifunc-sel.h: New file.
4073         * testsuite/ifuncmain1.c: New file.
4074         * testsuite/ifuncmain1vis.c: New file.
4075         * testsuite/ifuncmod1.c: New file.
4076         * testsuite/ifuncdep2.c: New file.
4077         * testsuite/ifuncmain2.c: New file.
4078         * testsuite/ifuncmain3.c: New file.
4079         * testsuite/ifuncmod3.c: New file.
4080         * testsuite/ifuncmain4.c: New file.
4081         * testsuite/ifuncmain5.c: New file.
4082         * testsuite/ifuncmod5.c: New file.
4083         * testsuite/ifuncmain6pie.c: New file.
4084         * testsuite/ifuncmod6.c: New file.
4085         * testsuite/ifuncmain7.c: New file.
4086         * configure, testsuite/Makefile.in: Rebuild.
4087
4088 2010-08-18  Ian Lance Taylor  <iant@google.com>
4089
4090         * incremental.cc
4091         (Output_section_incremental_inputs::write_input_files): Add cast
4092         to avoid signed/unsigned comparison warning.
4093         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4094
4095 2010-08-12  Cary Coutant  <ccoutant@google.com>
4096
4097         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4098
4099 2010-08-13  Ian Lance Taylor  <iant@google.com>
4100
4101         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4102
4103 2010-08-12  Cary Coutant  <ccoutant@google.com>
4104             Doug Kwan  <dougkwan@google.com>
4105
4106         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4107         defintion overrides non-weak undef, remember that the original undef
4108         is not weak.
4109         * symtab.cc (Symbol_table::sized_write_global): For undef without
4110         an original weak binding, set binding to global in output.
4111         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4112         * testsuite/Makefile.in: Regenerate.
4113         * testsuite/strong_ref_weak_def.sh: New file.
4114         * testsuite/strong_ref_weak_def_1.c: Ditto.
4115         * testsuite/strong_ref_weak_def_2.c: Ditto.
4116
4117 2010-08-12  Cary Coutant  <ccoutant@google.com>
4118
4119         * testsuite/incremental_test.sh: Rewrite.
4120         * testsuite/incremental_test_1.c: Rewrite.
4121         * testsuite/incremental_test_2.c: Rewrite.
4122
4123 2010-08-12  Cary Coutant  <ccoutant@google.com>
4124
4125         * arm.cc (Target_arm::got_size): Add const.
4126         (Target_arm::got_entry_count): New function.
4127         (Target_arm::plt_entry_count): New function.
4128         (Target_arm::first_plt_entry_offset): New function.
4129         (Target_arm::plt_entry_size): New function.
4130         (Output_data_plt_arm::entry_count): New function.
4131         (Output_data_plt_arm::first_plt_entry_offset): New function.
4132         (Output_data_plt_arm::get_plt_entry_size): New function.
4133         * i386.cc (Target_i386::got_size): Add const.
4134         (Target_i386::got_entry_count): New function.
4135         (Target_i386::plt_entry_count): New function.
4136         (Target_i386::first_plt_entry_offset): New function.
4137         (Target_i386::plt_entry_size): New function.
4138         (Output_data_plt_i386::entry_count): New function.
4139         (Output_data_plt_i386::first_plt_entry_offset): New function.
4140         (Output_data_plt_i386::get_plt_entry_size): New function.
4141         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4142         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4143         * incremental.cc: Include target.h.
4144         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4145         parameter.  Adjust all callers.  Find incremental_got_plt section.
4146         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4147         section.
4148         (Output_section_incremental_inputs::set_final_data_size): Calculate
4149         size of incremental_got_plt section.
4150         (Output_section_incremental_inputs::do_write): Write the
4151         incremental_got_plt section.
4152         (Got_plt_view_info): New struct.
4153         (Local_got_offset_visitor): New class.
4154         (Global_got_offset_visitor): New class.
4155         (Global_symbol_visitor_got_plt): New class.
4156         (Output_section_incremental_inputs::write_got_plt): New function.
4157         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4158         Add parameter.  Adjust all callers.
4159         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4160         (Incremental_inputs::got_plt_section): New function.
4161         (Incremental_inputs::got_plt_section_): New data member.
4162         (Incremental_got_plt_reader): New class.
4163         * layout.cc (Layout::create_incremental_info_sections): Add the
4164         incremental_got_plt section.
4165         * object.h (Got_offset_list::get_list): New function.
4166         (Got offset_list::for_all_got_offsets): New function.
4167         (Sized_relobj::local_got_offset_list): New function.
4168         * powerpc.cc (Target_powerpc::got_size): Add const.
4169         (Target_powerpc::got_entry_count): New function.
4170         (Target_powerpc::plt_entry_count): New function.
4171         (Target_powerpc::first_plt_entry_offset): New function.
4172         (Target_powerpc::plt_entry_size): New function.
4173         (Output_data_plt_powerpc::entry_count): New function.
4174         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4175         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4176         * sparc.cc (Target_sparc::got_size): Add const.
4177         (Target_sparc::got_entry_count): New function.
4178         (Target_sparc::plt_entry_count): New function.
4179         (Target_sparc::first_plt_entry_offset): New function.
4180         (Target_sparc::plt_entry_size): New function.
4181         (Output_data_plt_sparc::entry_count): New function.
4182         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4183         (Output_data_plt_sparc::get_plt_entry_size): New function.
4184         * symtab.h (Symbol::got_offset_list): New function.
4185         (Symbol_table::for_all_symbols): New function.
4186         * target.h (Sized_target::got_entry_count): New function.
4187         (Sized_target::plt_entry_count): New function.
4188         (Sized_target::plt_entry_size): New function.
4189         * x86_64.cc (Target_x86_64::got_size): Add const.
4190         (Target_x86_64::got_entry_count): New function.
4191         (Target_x86_64::plt_entry_count): New function.
4192         (Target_x86_64::first_plt_entry_offset): New function.
4193         (Target_x86_64::plt_entry_size): New function.
4194         (Output_data_plt_x86_64::entry_count): New function.
4195         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4196         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4197
4198 2010-08-12  Cary Coutant  <ccoutant@google.com>
4199
4200         * archive.cc: Include incremental.h.
4201         (Archive::Archive): Initialize incremental_info_.
4202         (Archive::include_member): Record archive members in incremental info.
4203         (Add_archive_symbols::run): Record begin and end of an archive in
4204         incremental info.
4205         (Lib_group::include_member): Record objects in incremental info.
4206         * archive.h (Incremental_archive_entry): Forward declaration.
4207         (Archive::set_incremental_info): New member function.
4208         (Archive::incremental_info): New member function.
4209         (Archive::Unused_symbol_iterator): New class.
4210         (Archive::unused_symbols_begin): New member function.
4211         (Archive::unused_symbols_end): New member function.
4212         (Archive::incremental_info_): New data member.
4213         * incremental-dump.cc (find_input_containing_global): New function.
4214         (dump_incremental_inputs): Dump new incremental info sections.
4215         * incremental.cc: Include symtab.h.
4216         (Output_section_incremental_inputs): New class.
4217         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4218         new incremental info sections.
4219         (Sized_incremental_binary::do_check_inputs): Likewise.
4220         (Incremental_inputs::report_archive): Remove.
4221         (Incremental_inputs::report_archive_begin): New function.
4222         (Incremental_inputs::report_archive_end): New function.
4223         (Incremental_inputs::report_object): New function.
4224         (Incremental_inputs::finalize_inputs): Remove.
4225         (Incremental_inputs::report_input_section): New function.
4226         (Incremental_inputs::report_script): Rewrite.
4227         (Incremental_inputs::finalize): Do nothing but finalize string table.
4228         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4229         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4230         (Incremental_inputs::create_data_sections): New function.
4231         (Incremental_inputs::relocs_entsize): New function.
4232         (Output_section_incremental_inputs::set_final_data_size): New function.
4233         (Output_section_incremental_inputs::do_write): New function.
4234         (Output_section_incremental_inputs::write_header): New function.
4235         (Output_section_incremental_inputs::write_input_files): New function.
4236         (Output_section_incremental_inputs::write_info_blocks): New function.
4237         (Output_section_incremental_inputs::write_symtab): New function.
4238         * incremental.h (Incremental_script_entry): Forward declaration.
4239         (Incremental_object_entry): Forward declaration.
4240         (Incremental_archive_entry): Forward declaration.
4241         (Incremental_inputs): Forward declaration.
4242         (Incremental_inputs_header_data): Remove.
4243         (Incremental_inputs_header): Remove.
4244         (Incremental_inputs_header_write): Remove.
4245         (Incremental_inputs_entry_data): Remove.
4246         (Incremental_inputs_entry): Remove.
4247         (Incremental_inputs_entry_write): Remove.
4248         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4249         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4250         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4251         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4252         Likewise.
4253         (Incremental_input_entry): New class.
4254         (Incremental_script_entry): New class.
4255         (Incremental_object_entry): New class.
4256         (Incremental_archive_entry): New class.
4257         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4258         (Incremental_inputs::report_inputs): Remove.
4259         (Incremental_inputs::report_archive): Remove.
4260         (Incremental_inputs::report_archive_begin): New function.
4261         (Incremental_inputs::report_archive_end): New function.
4262         (Incremental_inputs::report_object): Change prototype.
4263         (Incremental_inputs::report_input_section): New function.
4264         (Incremental_inputs::report_script): Change prototype.
4265         (Incremental_inputs::get_reloc_count): New function.
4266         (Incremental_inputs::set_reloc_count): New function.
4267         (Incremental_inputs::create_data_sections): New function.
4268         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4269         (Incremental_inputs::inputs_section): New function.
4270         (Incremental_inputs::symtab_section): New function.
4271         (Incremental_inputs::relocs_section): New function.
4272         (Incremental_inputs::get_stringpool): Add const.
4273         (Incremental_inputs::command_line): Add const.
4274         (Incremental_inputs::inputs): Remove.
4275         (Incremental_inputs::command_line_key): New function.
4276         (Incremental_inputs::input_file_count): New function.
4277         (Incremental_inputs::input_files): New function.
4278         (Incremental_inputs::relocs_entsize): New function.
4279         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4280         (Incremental_inputs::finalize_inputs): Remove.
4281         (Incremental_inputs::Input_info): Remove.
4282         (Incremental_inputs::lock_): Remove.
4283         (Incremental_inputs::inputs_): Change type.
4284         (Incremental_inputs::inputs_map_): Remove.
4285         (Incremental_inputs::current_object_entry_): New data member.
4286         (Incremental_inputs::inputs_section_): New data member.
4287         (Incremental_inputs::symtab_section_): New data member.
4288         (Incremental_inputs::relocs_section_): New data member.
4289         (Incremental_inputs::reloc_count_): New data member.
4290         (Incremental_inputs_reader): New class.
4291         (Incremental_symtab_reader): New class.
4292         (Incremental_relocs_reader): New class.
4293         * layout.cc (Layout::finalize): Move finalization of incremental info
4294         and creation of incremental info sections to follow finalization of
4295         symbol table.  Set offsets for postprocessing sections.
4296         (Layout::create_incremental_info_sections): Call
4297         Incremental_inputs::create_data_sections.  Add incremental symtab
4298         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4299         sections to layout after input sections.
4300         * layout.h (struct Timespec): Forward declaration.
4301         (Layout::incremental_inputs): Add const.
4302         (Layout::create_incremental_info_sections): Add parameter.
4303         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4304         * object.cc: Include incremental.h.
4305         (Relobj::finalize_incremental_relocs): New function.
4306         (Sized_relobj::do_layout): Record input sections in incremental info.
4307         * object.h (Object::output_section): New function.
4308         (Object::output_section_offset): Moved from Relobj.
4309         (Object::get_incremental_reloc_base): New function.
4310         (Object::get_incremental_reloc_count): New function.
4311         (Object::do_output_section): New function.
4312         (Object::do_output_section_offset): Moved from Relobj.
4313         (Object::do_get_incremental_reloc_base): New function.
4314         (Object::do_get_incremental_reloc_count): New function.
4315         (Object::Object): Initialize new data members.
4316         (Relobj::output_section): Renamed do_output_section and moved to
4317         protected.
4318         (Relobj::output_section_offset): Moved to Object.
4319         (Relobj::do_get_incremental_reloc_base): New function.
4320         (Relobj::do_get_incremental_reloc_count): New function.
4321         (Relobj::allocate_incremental_reloc_counts): New function.
4322         (Relobj::count_incremental_reloc): New function.
4323         (Relobj::finalize_incremental_relocs): New function.
4324         (Relobj::next_incremental_reloc_index): New function.
4325         (Relobj::reloc_counts_): New data member.
4326         (Relobj::reloc_bases_): New data member.
4327         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4328         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4329         (Sized_relobj::incremental_relocs_scan): New function.
4330         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4331         (Sized_relobj::incremental_relocs_write): New function.
4332         (Sized_relobj::incremental_relocs_write_reltype): New function.
4333         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4334         incremental link.
4335         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4336         archives and object files elsewhere.
4337         (Add_symbols::run): Report object files here.
4338         (Finish_group::run): Report end of archive at end of group.
4339         * reloc.cc: Include layout.h, incremental.h.
4340         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4341         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4342         (Sized_relobj::incremental_relocs_scan): New function.
4343         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4344         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4345         (Sized_relobj::incremental_relocs_write): New function.
4346         (Sized_relobj::incremental_relocs_write_reltype): New function.
4347         * script.cc (read_input_script): Rewrite test for incremental link.
4348         Change call to Incremental_inputs::report_script.
4349         * symtab.h (Symbol_table::first_global_index): New function.
4350         (Symbol_table::output_count): New function.
4351
4352 2010-08-12  Doug Kwan  <dougkwan@google.com>
4353
4354         * arm.cc (Target_arm::merge_object_attributes): Check command line
4355         options --no-wchar-size-warning and --no-enum-size-warning.
4356         * options.h (General_options): Add ld-compatible options
4357         --no-enum-size-warning and --no-wchar-size-warning.
4358
4359 2010-08-04  Ian Lance Taylor  <iant@google.com>
4360
4361         * x86_64.cc (Target_x86_64::Scan::local): Use
4362         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4363         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4364         (Target_x86_64::Scan::global): Likewise.
4365         (Target_x86_64::Relocate::relocate): Likewise.
4366         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4367         Likewise.
4368
4369 2010-08-03  Cary Coutant  <ccoutant@google.com>
4370
4371         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4372         to reserve space in merged_strings vector. Keep total input size
4373         for stats.
4374         (Output_merge_string::do_print_merge_stats): Print total input size.
4375         * merge.h (Output_merge_string): Add input_size_ field.
4376         * stringpool.cc (Stringpool_template::string_length): Move
4377         implementations out of Stringpool_template class and place in
4378         stringpool.h.
4379         * stringpool.h (string_length): Move out of Stringpool_template.
4380
4381 2010-08-03  Ian Lance Taylor  <iant@google.com>
4382
4383         PR 11712
4384         * layout.cc (relaxation_loop_body): If address of load segment is
4385         set, adjust address to include headers if possible.
4386
4387 2010-08-03  Ian Lance Taylor  <iant@google.com>
4388
4389         * version.cc (version_string): Bump to 1.10.
4390
4391 2010-08-03  Ian Lance Taylor  <iant@google.com>
4392
4393         PR 11805
4394         * layout.h (enum Output_section_order): Define.
4395         (class Layout): Update declarations.
4396         * layout.cc (Layout::get_output_section): Add order parameter.
4397         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4398         is_first_non_relro parameters.  Change all callers.
4399         (Layout::choose_output_section): Likewise.
4400         (Layout::add_output_section_data): Likewise.
4401         (Layout::make_output_section): Likewise.  Set order.
4402         (Layout::default_section_order): New function.
4403         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4404         * output.cc (Output_section::Output_section): Initialize order_.
4405         Don't initialize deleted fields.
4406         (Output_segment::Output_segment): Don't initialize deleted
4407         fields.
4408         (Output_segment::add_output_section_to_load): New function
4409         replacing add_output_section.  Change all callers to call this or
4410         add_output_section_to_nonload.
4411         (Output_segment::add_output_section_to_nonload): New function.
4412         (Output_segment::remove_output_section): Rewrite.
4413         (Output_segment::add_initial_output_data): Likewise.
4414         (Output_segment::has_any_data_sections): Likewise.
4415         (Output_segment::is_first_section_relro): Likewise.
4416         (Output_segment::maximum_alignment): Likewise.
4417         (Output_segment::has_dynamic_reloc): New function replacing
4418         dynamic_reloc_count.  Change all callers.
4419         (Output_segment::has_dynamic_reloc_list): New function replacing
4420         dynamic_reloc_count_list.  Change all callers.
4421         (Output_segment::set_section_addresses): Rewrite.
4422         (Output_segment::set_offset): Rewrite.
4423         (Output_segment::find_first_and_last_list): Remove.
4424         (Output_segment::set_tls_offsets): Rewrite.
4425         (Output_segment::first_section_load_address): Likewise.
4426         (Output_segment::output_section_count): Likewise.
4427         (Output_segment::section_with_lowest_load_address): Likewise.
4428         (Output_segment::write_section_headers): Likewise.
4429         (Output_segment::print_sections_to_map): Likewise.
4430         * output.h (class Output_data): Remove dynamic_reloc_count_
4431         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4432         (Output_data::add_dynamic_reloc): Rewrite.
4433         (Output_data::has_dynamic_reloc): New function.
4434         (Output_data::dynamic_reloc_count): Remove.
4435         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4436         is_last_relro_, is_first_non_relro_, is_interp_,
4437         is_dynamic_linker_section_ fields.  Add order and set_order
4438         functions.  Remove is_relro_local, set_is_relro_local,
4439         is_last_relro, set_is_last_relro, is_first_non_relro,
4440         set_is_first_non_relro functions, is_interp, set_is_interp,
4441         is_dynamic_linker_section, and set_is_dynamic_linker_section
4442         functions.
4443         (class Output_segment): Change Output_data_list from std::list to
4444         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4445         output_bss_ fields.  Update declarations.
4446
4447 2010-08-02  Ian Lance Taylor  <iant@google.com>
4448
4449         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4450         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4451         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4452
4453 2010-08-02  Ian Lance Taylor  <iant@google.com>
4454
4455         PR 11855
4456         * script.cc (Script_options::Script_options): Initialize
4457         symbol_definitions_ and symbol_references_.
4458         (Script_options::add_symbol_assignment): Update
4459         symbol_definitions_ and symbol_references_.
4460         (Script_options::add_symbol_reference): New function.
4461         (script_symbol): New function.
4462         * script.h (class Script_options): Add symbol_definitions_ and
4463         symbol_references_ fields.
4464         (Script_options::referenced_const_iterator): New type.
4465         (Script_options::referenced_begin): New function.
4466         (Script_options::referenced_end): New function.
4467         (Script_options::is_referenced): New function.
4468         (Script_options::any_unreferenced): New function.
4469         * script-c.h (script_symbol): Declare.
4470         * yyscript.y (exp): Call script_symbol.
4471         * symtab.cc: Include "script.h".
4472         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4473         Change all callers.  Check symbols referenced by scripts.
4474         (Symbol_table::add_undefined_symbols_from_command_line): Add
4475         layout parameter.  Change all callers.
4476         (Symbol_table::do_add_undefined_symbols_from_command_line):
4477         Likewise.  Break out loop body.  Check symbols referenced by
4478         scripts.
4479         (Symbol_table::add_undefined_symbol_from_command_line): New
4480         function broken out of
4481         do_add_undefined_symbols_from_command_line.
4482         * symtab.h (class Symbol_table): Update declarations.
4483         * archive.cc: Include "layout.h".
4484         (Archive::should_include_member): Add layout parameter.  Change
4485         all callers.  Check for symbol mentioned in expression.
4486         * archive.h (class Archive): Update declaration.
4487         * object.cc (Sized_relobj::do_should_include_member): Add layout
4488         parameter.
4489         * object.h (Object::should_include_member): Add layout parameter.
4490         Change all callers.
4491         (Object::do_should_include_member): Add layout parameter.
4492         (class Sized_relobj): Update declaration.
4493         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4494         parameter.
4495         * dynobj.h (class Sized_dynobj): Update declaration.
4496         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4497         layout parameter.
4498         * plugin.h (class Sized_pluginobj): Update declaration.
4499
4500 2010-08-02  Ian Lance Taylor  <iant@google.com>
4501
4502         PR 11866
4503         * output.cc (Output_segment::set_offset): Search for the first and
4504         last sections rather than assuming that the list is in order.
4505         (Output_segment::find_first_and_last_list): New function.
4506         * output.h (class Output_segment): Update declarations.
4507         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4508         (relro_strip_test_SOURCES): New variable.
4509         (relro_strip_test_DEPENDENCIES): New variable.
4510         (relro_strip_test_LDFLAGS): New variable.
4511         (relro_strip_test_LDADD): New variable.
4512         (relro_strip_test.so): New target.
4513
4514 2010-08-02  Ian Lance Taylor  <iant@google.com>
4515
4516         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4517         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4518         (Target_i386::got_tlsdesc_section): New function.
4519         (Target_i386::got_section): Create space for GOT entries for
4520         TLSDESC relocations.
4521         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4522         R_386_TLS_GOTDESC.
4523         (Target_i386::Scan::global): Likewise.
4524         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4525         using TLSDESC GOT.
4526         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4527         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4528         (Target_x86_64::got_tlsdesc_section): New function.
4529         (Target_x86_64::got_section): Create space for GOT entries for
4530         TLSDESC relocations.
4531         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4532         R_386_TLS_GOTDESC.
4533         (Target_x86_64::Scan::global): Likewise.
4534         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4535         using TLSDESC GOT.
4536
4537 2010-08-02  Ian Lance Taylor  <iant@google.com>
4538
4539         * testsuite/final_layout.sh: Use dc to convert from hex to
4540         decimal.
4541
4542 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4543
4544         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4545         paramter to the call to gold::gc_process_relocs.
4546         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4547         paramter to the call to gold::gc_process_relocs.
4548         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4549         parameter to the call to gold::gc_process_relocs.
4550         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4551         template parameter to the call to gold::gc_process_relocs.
4552         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4553         paramter to the call to gold::gc_process_relocs.
4554         * gc.h (get_embedded_addend_size): New function.
4555         (gc_process_relocs): Save the size of the reloc for use by ICF.
4556         * icf.cc (get_section_contents): Get the addend from the text section
4557         for SHT_REL relocation sections.
4558         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4559         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4560         * int_encoding.h (read_from_pointer): New overloaded function.
4561         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4562         * testsuite/icf_sht_rel_addend_test.sh: New file.
4563         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4564         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4565
4566 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4567
4568         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4569         * Makefile.in: Regenerate.
4570         * testsuite/Makefile.in: Regenerate.
4571
4572 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4573
4574         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4575         * gold/testsuite/debug_msg.cc: Likewise.
4576         * gold/testsuite/odr_violation1.cc
4577         * gold/testsuite/odr_violation2.cc
4578
4579 2010-07-21  Cary Coutant  <ccoutant@google.com>
4580
4581         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4582         string, and length fields.
4583         (Output_merge_string::Merged_strings_list): New type.
4584         (Output_merge_string::Merged_strings_lists): New typedef.
4585         (Output_merge_string): Replace merged_strings_ with
4586         merged_strings_lists_.
4587         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4588         Merged_strings_list per input object and section.  Don't store pointer
4589         to the string.  Don't store length with each merged string entry.
4590         (Output_merge_string::finalize_merged_data): Loop over list of merged
4591         strings lists.  Recompute length of each merged string.
4592
4593 2010-07-15  Cary Coutant  <ccoutant@google.com>
4594
4595         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4596         here.
4597
4598 2010-07-14  Ian Lance Taylor  <iant@google.com>
4599
4600         * descriptors.cc (Descriptors::open): Report correct name in error
4601         message.
4602
4603 2010-07-13  Doug Kwan  <dougkwan@google.com>
4604
4605         * arm.cc (Arm_input_section::Arm_input_section): For a
4606         SHT_ARM_EXIDX section, always keeps the input sections.
4607         (Arm_input_section::set_exidx_section_link): New method.
4608         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4609         has_errors_ to false.
4610         (Arm_exidx_input_section::has_errors,
4611         Arm_exidx_input_section::set_has_errors): New methods.
4612         (Arm_exidx_input_section::has_errors_): New data member.
4613         (Arm_relobj::get_exidx_shndx_list): New method.
4614         (Arm_output_section::append_text_sections_to_list): Do not skip
4615         section without SHF_EXECINSTR.
4616         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4617         errors.
4618         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4619         section header.  Make error messages more verbose.  Check for
4620         a non-executable section linked to an EXIDX section.
4621         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4622         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4623         check that there is no deferred EXIDX section if we exit early.
4624         Instead of not making an EXIDX section in case of an error, make one
4625         and set the has_errors flag of it.
4626         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4627         in a relocatable link.
4628         (Target_arm::do_relax): Look for the EXIDX output section instead of
4629         assuming that it is called .ARM.exidx.
4630         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4631         section list.  Do not check for SHF_EXECINSTR section flags but
4632         skip any input section with errors.
4633         * output.cc (Output_section::Output_section): Initialize
4634         always_keeps_input_sections_ to false.
4635         (Output_section::add_input_section): Check for
4636         always_keeps_input_sections_.
4637         *  output.h (Output_section::always_keeps_input_sections,
4638         Output_section::set_always_keeps_input_sections): New methods.
4639         (Output_section::always_keeps_input_sections): New data member.
4640
4641 2010-07-13  Rafael Espindola  <espindola@google.com>
4642
4643         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4644         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4645
4646 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4647             Ian Lance Taylor  <iant@google.com>
4648
4649         * output.h (Output_section_lookup_maps::add_merge_section):
4650         Correct check of whether value was inserted.
4651         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4652         (Output_section_lookup_maps::add_relaxed_input_section):
4653         Likewise.
4654         * arm.cc (Target_arm::got_section): Remove used local os.
4655         * i386.cc (Target_i386::got_section): Likewise.
4656         * x86_64.cc (Target_x86_64::got_section): Likewise.
4657         * sparc.cc (Target_sparc::got_section): Likewise.
4658         (Target_sparc::relocate): Remove unused local have_got_offset.
4659         * powerpc.cc (Target_powerpc::relocate): Likewise.
4660
4661 2010-07-13  Ian Lance Taylor  <iant@google.com>
4662
4663         * compressed_output.cc (zlib_decompress): Fix signature in
4664         !HAVE_ZLIB_H case.
4665
4666         * archive.cc (Archive::include_member): Unlock an external member
4667         of a thin archive.  Don't bother to delete an object we know is
4668         NULL.
4669
4670 2010-07-12  Cary Coutant  <ccoutant@google.com>
4671
4672         * compressed_output.cc (zlib_decompress): New function.
4673         (get_uncompressed_size): New function.
4674         (decompress_input_section): New function.
4675         * compressed_output.h (get_uncompressed_size): New function.
4676         (decompress_input_section): New function.
4677         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4678         Handle compressed debug sections.
4679         * layout.cc (is_compressed_debug_section): New function.
4680         (Layout::output_section_name): Map compressed section names to
4681         canonical names.
4682         * layout.h (is_compressed_debug_section): New function.
4683         (is_debug_info_section): Recognize compressed debug sections.
4684         * merge.cc: Include compressed_output.h.
4685         (Output_merge_data::do_add_input_section): Handle compressed
4686         debug sections.
4687         (Output_merge_string::do_add_input_section): Handle compressed
4688         debug sections.
4689         * object.cc: Include compressed_output.h.
4690         (Sized_relobj::Sized_relobj): Initialize new data members.
4691         (build_compressed_section_map): New function.
4692         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4693         * object.h (Object::section_is_compressed): New method.
4694         (Object::do_section_is_compressed): New method.
4695         (Sized_relobj::Compressed_section_map): New type.
4696         (Sized_relobj::do_section_is_compressed): New method.
4697         (Sized_relobj::compressed_sections_): New data member.
4698         * output.cc (Output_section::add_input_section): Handle compressed
4699         debug sections.
4700         * reloc.cc: Include compressed_output.h.
4701         (Sized_relobj::write_sections): Handle compressed debug sections.
4702
4703 2010-07-08  Cary Coutant  <ccoutant@google.com>
4704
4705         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4706         weak when resolving to a dynamic def.
4707         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4708         for weak undef/dynamic def cases. Adjust callers.
4709         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4710         undef_binding_weak_.
4711         (Symbol_table::sized_write_globals): Adjust symbol binding.
4712         (Symbol_table::sized_write_symbol): Add binding parameter.
4713         * symtab.h (Symbol::set_undef_binding): New method.
4714         (Symbol::is_undef_binding_weak): New method.
4715         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4716         (Symbol_table::should_override): Add new parameter.
4717         (Symbol_table::sized_write_symbol): Add new parameter.
4718
4719         * testsuite/weak_undef_file1.cc: Add new test case.
4720         * testsuite/weak_undef_file2.cc: Fix header comment.
4721         * testsuite/weak_undef_test.cc: Add new test case.
4722
4723 2010-06-29  Doug Kwan  <dougkwan@google.com>
4724
4725         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4726         Initialize USE_SYMBOL_.
4727         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4728         definition.
4729         (Arm_reloc_property::uses_symbol_): New data member declaration.
4730         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4731         uses symbol value and symbol is undefined but not weakly undefined.
4732
4733 2010-06-28  Rafael Espindola  <espindola@google.com>
4734
4735         * plugin.cc (Plugin::load): Use dlerror.
4736
4737 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4738
4739         * symtab.cc (detect_odr_violations): When reporting an ODR
4740         violation, report an object where the symbol is defined.
4741
4742 2010-06-25  Doug Kwan  <dougkwan@google.com>
4743
4744         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4745         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4746         definition.
4747         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4748         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4749         target hook to detect function points.
4750         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4751         * icf.h (Icf::check_section_for_function_pointers): Change type of
4752         parameter SECTION_NAME to const reference to std::string.  Use
4753         target hook to determine if section may have unsafe pointers.
4754         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4755         method definition.
4756
4757 2010-06-21  Rafael Espindola  <espindola@google.com>
4758
4759         * fileread.cc (Input_file::find_fie): New
4760         (Input_file::open): Use Input_file::find_fie.
4761         * fileread.h (Input_file::find_fie): New
4762         * plugin.cc (set_extra_library_path): New.
4763         (Plugin::load): Add set_extra_library_path to the transfer vector.
4764         (Plugin_manager::set_extra_library_path): New.
4765         (Plugin_manager::add_input_file): Use the extra search path if set.
4766         (set_extra_library_path(): New.
4767         * plugin.h (Plugin_manager): Add set_extra_library_path and
4768         extra_search_path_.
4769
4770 2010-06-19  Cary Coutant  <ccoutant@google.com>
4771
4772         * layout.cc (gdb_sections): Add .debug_types.
4773         (lines_only_debug_sections): Likewise.
4774
4775 2010-06-18  Rafael Espindola  <espindola@google.com>
4776
4777         * plugin.cc (add_input_file,add_input_library)
4778         (Plugin_manager::add_input_file): Make filename arguments const.
4779         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4780         const.
4781
4782 2010-06-16  Doug Kwan  <dougkwan@google.com>
4783
4784         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4785         .ARM.attributes section if we have not merged any input
4786         attributes sections.
4787
4788 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4789
4790         * arm.cc: Allow combining objects with no EABI version
4791         information.
4792
4793 2010-06-15  Rafael Espindola  <espindola@google.com>
4794
4795         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4796
4797 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4798
4799         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4800         (struct iovec): Correct !HAVE_READV definition.
4801
4802 2010-06-10  Cary Coutant  <ccoutant@google.com>
4803
4804         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4805         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4806         reloc sections.
4807         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4808
4809         PR 11683
4810         * symtab.h (Symbol::is_placeholder): New member function.
4811         * target-reloc.h (relocate_section): Check for placeholder symbols.
4812
4813         * testsuite/Makefile.am (plugin_test_8): New test.
4814         (plugin_test_9): New test.
4815         * testsuite/Makefile.in: Regenerate.
4816
4817 2010-06-09  Nick Clifton  <nickc@redhat.com>
4818
4819         * yyscript.y (input_list_element): Allow strings prefixed with
4820         the '-' character.  Treat these as libraries.
4821         * script.cc (script_add_library): New function.  Adds a library
4822         specified by "-l<name>" found in an input script.
4823         * script-c.h: Add prototype for script_add_library.
4824
4825 2010-06-07  Doug Kwan  <dougkwan@google.com>
4826
4827         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4828         Restrict stub-group size to be within long conditional branch
4829         range when working around cortex-A8 erratum.
4830
4831 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4832
4833         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4834         #ifdef typo.
4835
4836 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4837
4838         PR gold/11658
4839         * output.cc
4840         (Output_section::Input_section_sort_entry::compare_section_ordering):
4841         Change to return non-zero correctly.
4842         (Output_section::Input_section_sort_section_order_index_compare
4843         ::operator()): Change to fix ambiguity in comparisons.
4844
4845 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4846
4847         * gold.h (is_wildcard_string): New function.
4848         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4849         (Layout::layout_eh_frame): Ditto.
4850         (Layout::find_section_order_index): New method.
4851         (Layout::read_layout_from_file): New method.
4852         * layout.h (Layout::find_section_order_index): New method.
4853         (Layout::read_layout_from_file): New method.
4854         (Layout::input_section_position_): New private member.
4855         (Layout::input_section_glob_): New private member.
4856         * main.cc (main): Call read_layout_from_file here.
4857         * options.h (--section-ordering-file): New option.
4858         * output.cc (Output_section::input_section_order_specified_): New
4859         member.
4860         (Output_section::Output_section): Initialize new member.
4861         (Output_section::add_input_section): Add new parameter.
4862         Keep input sections when --section-ordering-file is used.
4863         (Output_section::set_final_data_size): Sort input sections when
4864         section ordering file is specified.
4865         (Output_section::Input_section_sort_entry): Add new parameter.
4866         Check sorting type.
4867         (Output_section::Input_section_sort_entry::compare_section_ordering):
4868         New method.
4869         (Output_section::Input_section_sort_compare::operator()): Change to
4870         consider section_order_index.
4871         (Output_section::Input_section_sort_init_fini_compare::operator()):
4872         Change to consider section_order_index.
4873         (Output_section::Input_section_sort_section_order_index_compare
4874         ::operator()): New method.
4875         (Output_section::sort_attached_input_sections): Change to sort
4876         according to section order when specified.
4877         (Output_section::add_input_section<32, true>): Add new parameter.
4878         (Output_section::add_input_section<64, true>): Add new parameter.
4879         (Output_section::add_input_section<32, false>): Add new parameter.
4880         (Output_section::add_input_section<64, false>): Add new parameter.
4881         * output.h (Output_section::add_input_section): Add new parameter.
4882         (Output_section::input_section_order_specified): New
4883         method.
4884         (Output_section::set_input_section_order_specified): New method.
4885         (Input_section::Input_section): Initialize section_order_index_.
4886         (Input_section::section_order_index): New method.
4887         (Input_section::set_section_order_index): New method.
4888         (Input_section::section_order_index_): New member.
4889         (Input_section::Input_section_sort_section_order_index_compare): New
4890         struct.
4891         (Output_section::input_section_order_specified_): New member.
4892         * script-sections.cc (is_wildcard_string): Delete and move modified
4893         method to gold.h.
4894         (Output_section_element_input::Output_section_element_input): Modify
4895         call to is_wildcard_string.
4896         (Output_section_element_input::Input_section_pattern
4897         ::Input_section_pattern): Ditto.
4898         (Output_section_element_input::Output_section_element_input): Ditto.
4899         * testsuite/Makefile.am (final_layout): New test case.
4900         * testsuite/Makefile.in: Regenerate.
4901         * testsuite/final_layout.cc: New file.
4902         * testsuite/final_layout.sh: New file.
4903
4904 2010-06-01  Rafael Espindola  <espindola@google.com>
4905
4906         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4907
4908 2010-06-01  Rafael Espindola  <espindola@google.com>
4909
4910         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4911         visibility of symbols.
4912
4913 2010-05-27  Doug Kwan  <dougkwan@google.com>
4914
4915         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4916         from start of output section instead of address for a local symbol
4917         in a merged or relaxed section when doing a relocatable link.
4918
4919 2010-05-26  Rafael Espindola  <espindola@google.com>
4920
4921        PR 11604
4922         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4923         adding sections the garbage collector removed.
4924         * gold/testsuite/Makefile.am: Add test.
4925         * gold/testsuite/Makefile.in: Regenerate.
4926         * gold/testsuite/plugin_test_7.sh: New.
4927         * gold/testsuite/plugin_test_7_1.c: New.
4928         * gold/testsuite/plugin_test_7_2.c: New.
4929
4930 2010-05-26  Rafael Espindola  <espindola@google.com>
4931
4932         * script-sections.cc (Output_section_definition::set_section_addresses):
4933         Check for --section-start.
4934
4935 2010-05-26  Doug Kwan  <dougkwan@google.com>
4936
4937         * arm.cc (Arm_scan_relocatable_relocs): New class.
4938         (Target_arm::relocate_special_relocatable): New method.
4939         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4940         (Arm_relocate_functions::thumb_branch_common): Same.
4941         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4942         instead of Default_scan_relocatable_relocs.
4943         * target-reloc.h (relocate_for_relocatable): Let target handle
4944         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4945         * target.h (Sized_target::relocate_special_relocatable): New method.
4946
4947 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4948
4949         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4950
4951 2010-05-23  Doug Kwan  <dougkwan@google.com>
4952
4953         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4954         instead of a cast.
4955         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4956         with a direct branch, not a conditional branch, to a stub.
4957         * merge.cc (Output_merge_base::record_input_section): New method
4958         defintion.
4959         (Output_merge_data::do_add_input_section): Record input section if
4960         keeps-input-sections flag is set.
4961         (Output_merge_string::do_add_input_section): Ditto.
4962         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4963         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4964         INPUT_SECTIONS_.
4965         (Output_merge_base::keeps_input_sections,
4966         Output_merge_base::set_keeps_input_sections,
4967         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4968         method definitions.
4969         (Output_merge_base::Input_sections): New type declaration.
4970         (Output_merge_base::input_sections_begin,
4971         Output_merge_base::input_sections_end,
4972         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4973         (Output_merge_base::bool keeps_input_sections_,
4974         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4975         Output_merge_base::input_sections_): New data members.
4976         (Output_merge_data::do_set_keeps_input_sections): New method
4977         defintion.
4978         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4979         * output.cc (Output_section::Input_section::relobj): Move method
4980         defintion from class declaration to here and handle merge sections.
4981         (Output_section::Input_section::shndx): Ditto.
4982         (Output_section::Output_section): Remove initializations of removed
4983         data members and initialize new data member LOOKUP_MAPS_.
4984         (Output_section::add_input_section): Set keeps-input-sections flag
4985         for a newly created merge output section as appropriate.  Adjust code
4986         to use Output_section_lookup_maps class.
4987         (Output_section::add_relaxed_input_section): Adjst code for lookup
4988         maps code refactoring.
4989         (Output_section::add_merge_input_section): Add a new parameter
4990         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
4991         class.  If adding input section to a newly created merge output
4992         section fails, remove the new merge section.
4993         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4994         Adjust code for use of the Output_section_lookup_maps class.
4995         (Output_section::find_merge_section): Ditto.
4996         (Output_section::build_lookup_maps): New method defintion.
4997         (Output_section::find_relaxed_input_section): Adjust code to use
4998         Output_section_lookup_maps class.
4999         (Output_section::get_input_sections): Export merge sections.  Adjust
5000         code to use Output_section_lookup_maps class.
5001         (Output_section:::add_script_input_section): Adjust code to use
5002         Output_section_lookup_maps class.  Update lookup maps for merge
5003         sections also.
5004         (Output_section::discard_states): Use Output_section_lookup_maps.
5005         (Output_section::restore_states): Same.
5006         * output.h (Merge_section_properties): Move class defintion out of
5007         Output_section.
5008         (Output_section_lookup_maps): New class.
5009         (Output_section::Input_section::is_merge_section): New method
5010         defintion.
5011         (Output_section::Input_section::relobj): Move defintion out of class
5012         defintion.  Declare method only.
5013         (Output_section::Input_section::shndx): Ditto.
5014         (Output_section::Input_section::output_merge_base): New method defintion.
5015         (Output_section::Input_section::u2_.pomb): New union field.
5016         (Output_section::Merge_section_by_properties_map,
5017         Output_section::Output_section_data_by_input_section_map,
5018         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5019         Remove types.
5020         (Output_section::add_merge_input_section): Add new parameter
5021         KEEPS_INPUT_SECTIONS.
5022         (Output_section::build_lookup_maps): New method declaration.
5023         (Output_section::merge_section_map_,
5024         Output_section::merge_section_by_properties_map_,
5025         Output_section::relaxed_input_section_map_,
5026         Output_section::is_relaxed_input_section_map_valid_): Remove data
5027         members.
5028         (Output_section::lookup_maps_): New data member.
5029
5030 2010-05-21  Doug Kwan  <dougkwan@google.com>
5031
5032         PR gold/11619
5033         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5034         avoid a compilation error.
5035
5036 2010-05-19  Rafael Espindola  <espindola@google.com>
5037
5038         * script-sections.cc (Output_section_definition::allocate_to_segment):
5039         Update the phdrs_list even when the output section is NULL.
5040         * testsuite/Makefile.am: Add test.
5041         * testsuite/Makefile.in: Regenerate.
5042         * testsuite/script_test_9.cc: New.
5043         * testsuite/script_test_9.sh: New.
5044         * testsuite/script_test_9.t: New.
5045
5046 2010-05-19  Doug Kwan  <dougkwan@google.com>
5047
5048         * arm.cc (Arm_input_section::original_size): New method.
5049         (Arm_input_section::do_addralign): Add a cast.
5050         (Arm_input_section::do_output_offset): Remove static cast.
5051         (Arm_input_section::original_addralign,
5052          Arm_input_section::original_size_): Change type to uint32_t.
5053         (Arm_input_section::init): Add safe casts for section alignment
5054         and size.
5055         (Arm_input_section::set_final_data_size): Do not set address and
5056         offset of stub table.
5057         (Arm_output_section::fix_exidx_coverage): Change use of of
5058         Output_section::Simple_input_section to that of
5059         Output_section::Input_section.
5060         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5061         except for the first pass.
5062         * output.cc (Output_section::get_input_sections): Change type of
5063         input_sections to std::list<Input_section>.
5064         (Output_section::add_script_input_section): Rename from
5065         Output_section::add_simple_input_section.  Change type of SIS
5066         parameter from Simple_input_section to Input_section.
5067         * output.h (Output_section::Simple_input_section): Remove class.
5068         (Output_section::Input_section): Change class visibility to public.
5069         (Output_section::Input_section::addralign): Use stored alignments
5070         for special input sections if set.
5071         (Output_section::Input_section::set_addralign): New method.
5072         (Output_section::get_input_sections): Change parameter type from
5073         list of Simple_input_section to list of Input_section.
5074         (Output_section::add_script_input_section): Rename from
5075         Output_section::add_simple_input_section. Change first parameter's
5076         type from Simple_input_section to Input_section and remove the
5077         second and third parameters.
5078         * script-sections.cc (Input_section::Input_section_list): Change
5079         type to list of Output_section::Input_section/
5080         (Input_section_info::Input_section_info): Change parameter type of
5081         INPUT_SECTION to Output_section::Input_section.
5082         (Input_section_info::input_section): Change return type.
5083         (Input_section_info::input_section_): Change type to
5084         Output_section::Input_section.
5085         (Output_section_element_input::set_section_addresses): Adjust code
5086         to use Output_section::Input_section instead of
5087         Output_section::Simple_input_section.  Adjust code for renaming
5088         of Output_section::add_simple_input_section.
5089         (Orphan_output_section::set_section_addresses): Ditto.
5090
5091 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5092
5093         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5094         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5095
5096 2010-05-18  Rafael Espindola  <espindola@google.com>
5097
5098         * options.cc (General_options::finalize): Handle -nostdlib.
5099         * options.h (nostdlib): New option.
5100         * script.cc (script_add_search_dir): Handle -nostdlib.
5101
5102 2010-05-12  Doug Kwan  <dougkwan@google.com>
5103
5104         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5105         attributes section only if there no attributes section after merging.
5106         (Target_arm::merge_object_attributes): Move value of
5107         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5108         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5109         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5110         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5111         and arm_attr_merge_7.stdout.
5112         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5113         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5114         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5115         arm_attr_merge_7b.o): New rules.
5116         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5117         arm_attr_merge_7
5118         * testsuite/Makefile.in: Regenerate.
5119         * testsuite/arm_attr_merge.sh: New file.
5120         * testsuite/arm_attr_merge_[67][ab].s: Same.
5121
5122 2010-05-05  Nick Clifton  <nickc@redhat.com>
5123
5124         * po/es.po: Updated Spanish translation.
5125
5126 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5127
5128         * Makefile.am (install-exec-local): Properly install gold as
5129         default cross linker.
5130         * Makefile.in: Regenerated.
5131
5132 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5133             Nick Clifton  <nickc@redhat.com>
5134
5135         * configure.ac (install_as_default): Define and set to false
5136         unless --enable-gold or --enable-gold=both/gold has been
5137         specified.
5138         * configure: Regenerate.
5139
5140         * Makefile.am (install-exec-local): Install the executable as
5141         'ld.gold'.  If install_as_default is true then also install it as
5142         'ld'.
5143         * Makefile.in: Regenerated.
5144
5145 2010-04-24  Ian Lance Taylor  <iant@google.com>
5146
5147         * layout.cc (Layout::layout_reloc): In relocatable link don't
5148         combine reloc sections for grouped sections.
5149
5150 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5151
5152         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5153         sections that are not ordinary to icf.
5154         * icf.cc (get_section_contents): Handle relocation pointing to section
5155         with no object or shndx information.
5156         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5157         * testsuite/Makefile.in: Regenerate.
5158         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5159         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5160
5161 2010-04-22  Ian Lance Taylor  <iant@google.com>
5162
5163         * expression.cc (Expression::Expression_eval_info): Add
5164         result_alignment_pointer field.
5165         (Expression::eval_with_dot): Add result_alignment_pointer
5166         parameter.  Change all callers.
5167         (Expression::eval_maybe_dot): Likewise.
5168         (class Binary_expression): Add alignment_pointer parameter to
5169         left_value and right_value.  Change all callers.
5170         (BINARY_EXPRESSION): Set result alignment.
5171         (class Trinary_expression): Add alignment_pointer parameter to
5172         arg2_value and arg3_value.  Change all callers.
5173         (Trinary_cond::value): Set result alignment.
5174         (Max_expression::value, Min_expression::value): Likewise.
5175         (Align_expression::value): Likewise.
5176         * script-sections.cc (class Sections_element): Add dot_alignment
5177         parameter to set_section_addresses virtual function.  Update
5178         instantiations.
5179         (class Output_section_element): Likewise.
5180         (Script_sections::create_segments): Add dot_alignment parameter.
5181         Change all callers.
5182         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5183         (Script_sections::set_phdrs_clause_addresses): Likewise.
5184         * script-sections.h: Update declarations.
5185         * script.h: Update declarations.
5186         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5187         min_p_align.
5188         * testsuite/script_test_3.t: Set large alignment.
5189         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5190         segment has expected alignment.
5191
5192 2010-04-22  Nick Clifton  <nickc@redhat.com>
5193
5194         * po/gold.pot: Updated by the Translation project.
5195         * po/vi.po: Updated Vietnamese translation.
5196
5197 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5198
5199         * testsuite/Makefile.am (check_PROGRAMS): Add
5200         icf_virtual_function_folding_test.
5201         * testsuite/Makefile.in: Regenerated.
5202
5203 2010-04-15  Andrew Haley  <aph@redhat.com>
5204
5205         * options.h (merge_exidx_entries): New option.
5206         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5207         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5208         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5209         (Target_arm::merge_exidx_entries): New function.
5210         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5211         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5212         to Arm_exidx_fixup constructor.
5213         Add new arg, merge_exidx_entries.
5214         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5215         Arm_output_section::fix_exidx_coverage.
5216
5217 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5218
5219         * icf.cc (get_section_contents): Check for preemptible functions.
5220         Ignore addend when appropriate.
5221         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5222         section folded.
5223         (add_from_relobj): Check for section folded.
5224         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5225         * symtab.h (should_add_dynsym_entry): Add new parameter.
5226         * target-reloc.h (scan_relocs): Check for section folded.
5227         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5228         Check reloc types for function pointers in shared objects.
5229         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5230         case.
5231         (icf_preemptible_functions_test): New test case.
5232         (icf_string_merge_test): New test case.
5233         * testsuite.Makefile.in: Regenerate.
5234         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5235         bar_glob.  Refactor code.
5236         * testsuite/icf_preemptible_functions_test.cc: New file.
5237         * testsuite/icf_preemptible_functions_test.sh: New file.
5238         * testsuite/icf_string_merge_test.cc: New file.
5239         * testsuite/icf_string_merge_test.sh: New file.
5240         * testsuite/icf_virtual_function_folding_test.cc: New file.
5241         * testsuite/icf_virtual_function_folding_test.sh: New file.
5242
5243 2010-04-14  Doug Kwan  <dougkwan@google.com>
5244
5245         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5246         for local symbol recounting if we remove a section due to ICF.
5247         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5248         there are no regular objects in input.
5249
5250 2010-04-13  Doug Kwan  <dougkwan@google.com>
5251
5252         * arm.cc (Arm_input_section::set_final_data_size): Compute
5253         accurate final data size instead of using current data size.
5254
5255 2010-04-09  Doug Kwan  <dougkwan@google.com>
5256
5257         * layout.cc (Layout::choose_output_section): Handle script section
5258         types.
5259         (Layout::make_output_section_for_script): Add section type parameter.
5260         Handle script section types.
5261         * layout.h (Layout::make_output_section_for_script): Add section
5262         type parameter.
5263         * output.cc (Output_section::Output_section): Initialize data member
5264         is_noload_.
5265         (Output_section::do_reset_address_and_file_offset): Do not set address
5266         to 0 if section is a NOLOAD section.
5267         * output.h (Output_section::is_noload): New method.
5268         (Output_section::set_is_noload): Ditto.
5269         (Output_section::is_noload_): New data member.
5270         * script-c.h (Script_section_type): New enum type.
5271         (struct Parser_output_section_header): Add new file section_type.
5272         * script-sections.cc (Sections_element::output_section_name): Add
5273         parameter for returning script section type.
5274         (Output_section_definition::output_section_name): Ditto.
5275         (Output_section_definition::section_type)P; New method.
5276         (Output_section_definiton::script_section_type_name): Ditto.
5277         (Output_section_definition::script_section_type_): New data member.
5278         (Output_section_definition::Output_section_definition): Initialize
5279         data member Output_section_definition::script_section_type_.
5280         (Output_section_definition::create_sections): Pass script section type
5281         to Layout::make_output_section_for_script.
5282         (Output_section_definition::output_section_name): Return script
5283         section type to caller.
5284         (Output_section_definition::set_section_address): Do not advance
5285         dot value and load address if section type is NOLOAD.  Set address
5286         of NOLOAD sections regardless of section flags.
5287         (Output_section_definition::print): Print section type if it is
5288         not SCRIPT_SECTION_TYPE_NONE.
5289         (Output_section_definition::section_type): New method.
5290         (Output_section_definition::script_section_type_name): Ditto.
5291         (Script_sections::output_section_name): Add new parameter
5292         PSECTION_TYPE for returning script section type.  Pass it to
5293         section elements.  Handle discard sections.
5294         (Sort_output_sections::operator()): Handle NOLOAD sections.
5295         * script-sections.h (Script_sections::Section_type): New enum type.
5296         (Script_sections::output_section_name): Add a new parameter for
5297         returning script section type.
5298         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5299         INFO and NOLOAD.
5300         * yyscript.y (union): Add new field SECTION_TYPE.
5301         (COPY, DSECT, INFO, NOLOAD): New tokens.
5302         (opt_address_and_section_type): Change type to output_section_header.
5303         (section_type): New non-terminal
5304         (section_header): Handle section type.
5305         (opt_address_and_section_type): Return section type value.
5306
5307 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5308
5309         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5310         * testsuite/plugin_common_test_2.c (foo): Likewise.
5311
5312 2010-04-08  Doug Kwan  <dougkwan@google.com>
5313
5314         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5315         Output_merge_data.
5316         * output.cc (Output_section::add_merge_input_section): Simplify
5317         code and return status of Output_merge_base::add_input_section.
5318         Update merge section map only if Output_merge_base::add_input_section
5319         returns true.
5320
5321 2010-04-07  Doug Kwan  <dougkwan@google.com>
5322
5323         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5324         if section is marked as containing instructions but has no mapping
5325         symbols.
5326         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5327         correct section index.
5328         (Arm_relobj::find_linked_text_section): Ditto.
5329
5330 2010-04-07  Cary Coutant  <ccoutant@google.com>
5331
5332         * archive.cc (include_member): Destroy Read_symbols_data object before
5333         releasing file.
5334         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5335         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5336         (Read_symbols_data::~Read_symbols_data) New destructor.
5337         (Section_relocs::Section_relocs) New constructor.
5338         (Section_relocs::~Section_relocs) New destructor.
5339         (Read_relocs_data::Read_relocs_data) New constructor.
5340         (Read_relocs_data::~Read_relocs_data) New destructor.
5341         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5342         pointers to NULL after deleting.
5343
5344 2010-04-07  Doug Kwan  <dougkwan@google.com>
5345
5346         * arm.cc: Replace "endianity" with "endianness" in comments.
5347         (Arm_exidx_cantunwind): Ditto.
5348         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5349         (Arm_relobj::merge_flags_and_attributes): New method.
5350         (Arm_relobj::merge_flags_and_attributes_): New data member.
5351         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5352         (Arm_relobj::scan_sections_for_stubs): Ditto.
5353         (Arm_relobj::do_read_symbols): Check to see if we really want to
5354         merge processor-specific flags and attributes.  Exit early if
5355         an object is empty except for section names and the undefined symbol.
5356         (Target_arm::do_finalize_sections): Move check for ELF format to
5357         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5358         attributes from a regular object only when we have determined that
5359         it is aapropriate.  Do not create an .ARM.attributes section in
5360         output if there is no regular input object.
5361         (Target_arm::merge_processor_specific_flags): Check
5362         --warn-mismatch before printing any error.
5363         (Target_arm::merge_object_attributes): Ditto.
5364         * gold.cc (queue_middle_tasks): Handle the case in which there is
5365         no regular object in input.
5366         * options.cc (General_options::parse_EB): New method.
5367         (General_options::parse_EL): Same.
5368         (General_options::General_options): Initialize endianness_.
5369         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5370         New options.
5371         (General_options::Endianness): New enum.
5372         (General_options::endianness): New method.
5373         (General_options::endianness_): New data member.
5374         * parameters.cc (Parameters::set_options): Check target endianness.
5375         (Parameters::set_target_once): Ditto.
5376         (Parameters::check_target_endianness): New method.
5377         (parameters_force_valid_target): If either -EL or -EB is specified,
5378         use it to define endianness of default target.
5379         * parameters.h (Parameters::check_target_endianness): New method
5380         declaration.
5381         * target.h (class Target): Change "endianity" to "endianness"
5382         in comments.
5383
5384 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5385
5386         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5387         * configure: Regenerate.
5388         * Makefile.in: Regenerate.
5389         * testsuite/Makefile.in: Regenerate.
5390
5391 2010-04-06  Cary Coutant  <ccoutant@google.com>
5392
5393         gcc PR lto/42757
5394         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5395         prevailing definitions of common symbols.
5396         * testsuite/plugin_test_6.sh: New test case.
5397         * testsuite/plugin_common_test_1.c: New test case.
5398         * testsuite/plugin_common_test_2.c: New test case.
5399         * testsuite/Makefile.am (plugin_test_6): New test case.
5400         * testsuite/Makefile.in: Regenerate.
5401
5402 2010-04-06  Nick Clifton  <nickc@redhat.com>
5403
5404         * po/vi.po: New Vietnamese translation.
5405
5406 2010-03-30  Doug Kwan  <dougkwan@google.com>
5407
5408         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5409
5410 2010-03-25  Doug Kwan  <dougkwan@google.com>
5411
5412         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5413         to avoid a conversion warning on a 32-bit host.
5414
5415 2010-03-24  Ian Lance Taylor  <iant@google.com>
5416
5417         * testsuite/script_test_3.t: Add a TLS segment.
5418         * testsuite/Makefile.am (check_PROGRAMS): Add
5419         tls_phdrs_script_test.
5420         (tls_phdrs_script_test_SOURCES): Define.
5421         (tls_phdrs_script_test_DEPENDENCIES): Define.
5422         (tls_phdrs_script_test_LDFLAGS): Define.
5423         (tls_phdrs_script_test_LDADD): Define.
5424         * testsuite/Makefile.in: Rebuild.
5425
5426 2010-03-23  Cary Coutant  <ccoutant@google.com>
5427
5428         * fileread.cc (find_or_make_view): Fix comment.
5429
5430 2010-03-23  Ian Lance Taylor  <iant@google.com>
5431
5432         * script-sections.cc (class Orphan_section_placement): Define
5433         PLACE_TLS and PLACE_TLS_BSS.
5434         (Orphan_section_placement::Orphan_section_placement): Initialize
5435         new places.
5436         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5437         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5438         (tls_script_test_SOURCES): Define.
5439         (tls_script_test_DEPENDENCIES): Define.
5440         (tls_script_test_LDFLAGS): Define.
5441         (tls_script_test_LDADD): Define.
5442         * testsuite/Makefile.in: Rebuild.
5443
5444 2010-03-22  Doug Kwan  <dougkwan@google.com>
5445
5446         * arm.cc (Arm_relocate_functions::abs8,
5447         Arm_relocate_functions::abs16): Use correct check for overflow
5448         specified in the ARM ELF specs.
5449         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5450         target of a BLX instruction specially.
5451         (Reloc_stub::stub_type_for_reloc): Ditto.
5452         (Relocate::relocate): Use symbolic names instead of numeric relocation
5453         codes to report error.
5454         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5455         workaround.
5456         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5457         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5458         thumb2_blx_out_of_range.stdout
5459         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5460         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5461         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5462         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5463         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5464         thumb2_blx_in_range, thumb2_blx_in_range.o,
5465         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5466         thumb2_blx_out_of_range.o): New rules.
5467         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5468         thumb2_blx_in_range and thumb2_blx_out_of_range.
5469         * testsuite/Makefile.in: Regenerate.
5470         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5471         * testsuite/thumb_blx_in_range.s: New file.
5472         * testsuite/thumb_blx_out_of_range.s: New file.
5473
5474 2010-03-22  Rafael Espindola  <espindola@google.com>
5475
5476         * archive.cc (Should_include): Move to archive.h.
5477         (should_include_member): Make it a member of Archive.
5478         (Lib_group): New.
5479         (Add_lib_group_symbols): New.
5480         * archive.h: Include options.h.
5481         (Archive_member): Moved from Archive.
5482         (Should_include): Moved from archive.cc.
5483         (Lib_group): New.
5484         (Add_lib_group_symbols): New.
5485         * dynobj.cc (do_should_include_member): New.
5486         * dynobj.h (do_should_include_member): New.
5487         * gold.cc (queue_initial_tasks): Update call to queue.
5488         * main.cc (main): Print lib group stats.
5489         * object.cc (do_should_include_member): New.
5490         * object.h: Include archive.h.
5491         (Object::should_include_member): New.
5492         (Object::do_should_include_member): New.
5493         (Sized_relobj::do_should_include_member): New.
5494         * options.cc (General_options::parse_start_lib): New.
5495         (General_options::parse_end_lib): New.
5496         (Input_arguments::add_file): Handle lib groups.
5497         (Input_arguments::start_group): Check we are not in a lib.
5498         (Input_arguments::start_lib): New.
5499         (Input_arguments::end_lib): New.
5500         * options.h (General_options): Add start_lib and end_lib.
5501         (Input_argument::lib_): New.
5502         (Input_argument::lib): New.
5503         (Input_argument::is_lib): New.
5504         (Input_file_lib): New.
5505         (Input_arguments::in_lib_): New.
5506         (Input_arguments::in_lib): New.
5507         (Input_arguments::start_lib): New.
5508         (Input_arguments::end_lib_): New.
5509         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5510         in unused members as preempted.
5511         (Sized_pluginobj::do_should_include_member): New.
5512         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5513         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5514         return the blocker.
5515         (Read_symbols::do_whole_lib_group): New.
5516         (Read_symbols::do_lib_group): New.
5517         (Read_symbols::do_read_symbols): Handle lib groups.
5518         (Read_symbols::get_name): Handle lib groups.
5519         * readsyms.h (Read_symbols): Add an archive member pointer.
5520         (Read_symbols::do_whole_lib_group): New.
5521         (Read_symbols::do_lib_group): New.
5522         (Read_symbols::member_): New.
5523         * script.cc (read_input_script): Update call to queue_soon.
5524
5525 2010-03-19  Doug Kwan  <dougkwan@google.com>
5526
5527         * arm.cc (Stub_table::Stub_table): Initialize new data members
5528         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5529         (Stub_table::add_reloc_stub): Assign stub offset and update
5530         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5531         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5532         New data members.
5533         (Stub_table::update_data_size_and_addralign): Use
5534         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5535         instead of going over all reloc stubs.
5536         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5537         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5538         Stringpool_template::offset_ to size of Stringpool_char.
5539         (Stringpool_template::new_key_offset): Remove code to initialize
5540         Stringpool_template::offset_.
5541         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5542         Stringpool_template::offset_ to zero.
5543
5544 2010-03-15  Doug Kwan  <dougkwan@google.com>
5545
5546         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5547         offset_.
5548         (Stringpool_template::new_key_offset): New method.
5549         (Stringpool_template::add_string): Assign offsets when adding new
5550         strings.
5551         (Stringpool_template::set_string_offsets): Do not set string offsets
5552         when not optimizing.
5553         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5554         member size_.
5555         (Chunked_vector::clear): Clear size_.
5556         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5557         (Chunked_vector::size): Return size_.
5558         (Chunked_vector::push_back): Use size_ to find insert position.
5559         (Chunked_vector::size_): New data member.
5560         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5561         (Stringpool_template::new_key_offset): New method declaration.
5562         (Stringpool_template::offset_): New data member.
5563
5564 2010-03-15   Rafael Espindola  <espindola@google.com>
5565
5566         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5567         Add_symbols' constructor.
5568         * readsyms.h (Add_symbols): Remove the input_group member.
5569
5570 2010-03-10  Ian Lance Taylor  <iant@google.com>
5571
5572         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5573         target to ask whether a reference to a symbol requires a stack
5574         split.
5575         * target.h (Target::is_call_to_non_split): New function.
5576         (Target::do_is_call_to_non_split): Declare virtual function.
5577         * target.cc: Include "symtab.h".
5578         (Target::do_is_call_to_non_split): New function.
5579         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5580
5581 2010-03-10  Cary Coutant  <ccoutant@google.com>
5582
5583         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5584         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5585         (File_read::open[2]): Add whole_file_view_ to list of views.
5586         (File_read::make_view): Remove test of whole_file_view_.
5587         (File_read::find_or_make_view): Create whole_file_view_ if
5588         necessary.
5589         (File_read::clear_views): Replace bool parameter with enum;
5590         adjust all callers.  Don't delete views with permanent data;
5591         do delete cached views and views from archives if
5592         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5593         if clearing the corresponding view.
5594         * fileread.h (File_read::Clear_views_mode): New enum.
5595         (File_read::View::is_permanent_view): New method.
5596         (File_read::clear_views): Replace bool parameter
5597         with enum; adjust all callers.
5598         * options.h (General_options): Change keep_files_mapped option;
5599         add map_whole_files.
5600         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5601         releasing the file.
5602         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5603         the file.
5604
5605 2010-03-10  David S. Miller  <davem@davemloft.net>
5606
5607         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5608
5609 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5610
5611         * icf.cc (get_section_contents): Add '@' marker after processing the
5612         merge reloc.
5613
5614 2010-03-08  Doug Kwan  <dougkwan@google.com>
5615
5616         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5617         due to a conversion warning.
5618         (Arm_relobj::update_output_local_symbol_count): Check for local
5619         symbol with unset output index.
5620
5621 2010-03-05  Ian Lance Taylor  <iant@google.com>
5622
5623         * options.h (class General_options): Add --spare-dynamic-tags.
5624         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5625         --spare-dynamic-tags.
5626
5627 2010-03-05  Ian Lance Taylor  <iant@google.com>
5628
5629         * incremental.cc: Include "libiberty.h".
5630
5631 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5632
5633         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5634         function, is_info_ member.
5635         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5636         (Versions::Versions): Update caller.
5637         (Versions::define_base_version): Likewise.
5638         (Versions::add_def): Likewise.
5639
5640 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5641
5642         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5643         (Scan::possible_function_pointer_reloc): New function.
5644         (Scan::local_reloc_may_be_function_pointer): Change to call
5645         possible_function_pointer_reloc.
5646         (Scan::global_reloc_may_be_function_pointer): Ditto.
5647         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5648         relocations in ".data.rel.ro._ZTV" section.
5649         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5650         * testsuite/icf_safe_so_test.cc: Ditto.
5651         * testsuite/icf_safe_test.cc: Ditto.
5652         * testsuite/icf_safe_test.sh: Ditto.
5653
5654 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5655             Ian Lance Taylor  <iant@google.com>
5656
5657         * target-reloc.h (relocate_section): Check the symbol table index
5658         for -1U before setting the local symbol index.
5659         (scan_relocatable_relocs): If copying the relocation, record that
5660         the local symbol is required.
5661         * object.h (Symbol_value::is_output_symtab_index_set): New
5662         function.
5663         (Symbol_value::may_be_discarded_from_output_symtab): New
5664         function.
5665         (Symbol_value::has_output_symtab_entry): New function.
5666         (Symbol_value::needs_output_symtab_entry): Remove.
5667         (Symbol_value::output_symtab_index): Make sure the symbol index is
5668         set.
5669         (Symbol_value::set_output_symtab_index): Make sure the symbol
5670         index is not set.  Make sure the new index is valid.
5671         (Symbol_value::set_must_have_output_symtab_entry): New function.
5672         (Symbol_value::has_output_dynsym_entry): New function.
5673         (Symbol_value::set_output_dynsym_index): Make sure the new index
5674         is valid.
5675         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5676         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5677         local symbol if permitted.
5678         (Sized_relobj::do_finalize_local_symbols): Call
5679         is_output_symtab_index_set rather than needs_output_symtab_entry.
5680         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5681         rather than needs_output_symtab_entry.  Call
5682         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5683         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5684         is_output_symtab_index_set rather than needs_output_symtab_entry.
5685         * testsuite/discard_locals_relocatable_test.c: New file.
5686         * testsuite/discard_locals_test.sh: Test -r.
5687         * testsuite/Makefile.am (check_DATA): Add
5688         discard_locals_relocatable_test1.syms,
5689         discard_local_relocatable_test2.syms.
5690         (MOSTLYCLEANFILES): Likewise.  Also add
5691         discard_locals_relocatable_test1.lout and
5692         discard_locals_relocatable_test2.out.
5693         (discard_locals_relocatable_test1.syms): New target.
5694         (discard_locals_relocatable_test.o): New target.
5695         (discard_locals_relocatable_test1.out): New target.
5696         (discard_locals_relocatable_test2.syms): New target.
5697         (discard_locals_relocatable_test2.out): New target.
5698         (various): Add missing ../ld-new dependencies.
5699         * testsuite/Makefile.in: Rebuild.
5700
5701 2010-03-03  Nick Clifton  <nickc@redhat.com>
5702
5703         * po/fi.po: New Finnish translation.
5704
5705 2010-03-01  Doug Kwan  <dougkwan@google.com>
5706
5707         * layout.cc (Layout::Layout): Force section types of .init_array*,
5708         .preinit_array* and .fini_array* sections.
5709         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5710         Fix check of return value of std::string::find.().
5711         (Output_section::Input_section_sort_compare::operator()): Remove
5712         comment about .init_array.
5713         (Output_section::Input_section_sort_init_fini_compare::operator()):
5714         New method.
5715         (Output_section::sort_attached_input_sections): Handle .init_array
5716         and .fini_array specially.
5717         * output.h (Output_section::Inut_section_sort_compare): Update
5718         comment.
5719         (Output_section::Input_section_sort_init_fini_compare): New struct.
5720
5721 2010-02-26  Doug Kwan  <dougkwan@google.com>
5722
5723         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5724         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5725         * testsuite/debug_msg.sh: Avoid matching source line number for
5726         use of global variable undef_int.
5727
5728 2010-02-26  Doug Kwan  <dougkwan@google.com>
5729
5730         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5731         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5732         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5733         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5734         * options.cc (General_options::General_options): Initialize member
5735         fix_v4bx_.
5736         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5737         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5738         and rm_no_fix_v4bx.stdout
5739         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5740         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5741         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5742         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5743         and arm_no_fix_v4bx.
5744         * Makefile.in: Regenerate.
5745         * testsuite/arm_fix_v4bx.s: New file.
5746         * testsuite/arm_fix_v4bx.sh: Ditto.
5747
5748 2010-02-24  Doug Kwan  <dougkwan@google.com>
5749
5750         * arm.cc (Target_arm::got_section): Make the .got section the first
5751         non RELRO section in the data segment.
5752         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5753         suffixes of section names.
5754
5755 2010-02-24  Doug Kwan  <dougkwan@google.com>
5756
5757         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5758         flags and attributes merging if an input file is a binary file.
5759         * fileread.cc (Input_file::open): Record format of original file.
5760         * fileread.h (Input_file::Format): New enum type.
5761         (Input_file::Input_file): Initialize data member format_.
5762         (Input_file::format): New method definition.
5763         (Input_file::format_):: New data member.
5764
5765 2010-02-24  Doug Kwan  <dougkwan@google.com>
5766
5767         * arm.cc (Arm_output_data_got): New class.
5768         (ARM_TCB_SIZE): New constant
5769         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5770         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5771         If user uses a script with a SECTIONS clause, issue only a warning
5772         for a misplaced EXIDX input section.  Otherwise, issue an error.
5773         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5774         garbage collection.
5775         (Target_arm::got_mode_index_entry): Handle static linking.
5776         (Target_arm::Scan::local): Ditto.
5777         (Target_arm::Scan::global): Ditto.
5778         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5779         all incorrectly implemented relocations.
5780         (Target_arm::fix_exidx_coverage): Pass layout to
5781         Arm_output_section::fix_exidx_coverage.
5782         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5783         from ".ARM.exidx." and ".ARM.extab.".
5784
5785 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5786
5787         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5788         section if it does not already exist.
5789         * attributes.cc (Attributes_section_data::Attributes_section_data):
5790         Don't crash if size is zero.
5791
5792 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5793             Ian Lance Taylor  <iant@google.com>
5794
5795         * gold.cc (queue_middle_tasks): If no input files were opened,
5796         exit.
5797         * workqueue.h (Task_function::Task_function): Assert that there is
5798         a blocker.
5799
5800 2010-02-22  Doug Kwan  <dougkwan@google.com>
5801
5802         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5803         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5804         types to avoid warnings due to different uint64_t implementations
5805         on different hosts.
5806
5807 2010-02-21  Doug Kwan  <dougkwan@google.com>
5808
5809         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5810         handling of the maximum backward branch offset.
5811         (Arm_relocate_functions::thumb_branch_common): Ditto.
5812         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5813         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5814         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5815         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5816         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5817         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5818         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5819         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5820         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5821         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5822         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5823         thumb2_bl_out_of_range.o): New rules.
5824         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5825         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5826         thumb2_bl_out_of_range
5827         * testsuite/Makefile.in: Regenerate.
5828         * testsuite/arm_bl_in_range.s: New file.
5829         * testsuite/arm_bl_out_of_range.s: Ditto.
5830         * testsuite/arm_branch_in_range.sh: Ditto.
5831         * testsuite/arm_branch_range.t: Ditto.
5832         * testsuite/thumb2_branch_range.t: Ditto.
5833         * testsuite/thumb_bl_in_range.s: Ditto.
5834         * testsuite/thumb_bl_out_of_range.s: Ditto.
5835         * testsuite/thumb_branch_range.t: Ditto.
5836
5837 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5838
5839         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5840         Add reloc offset information.
5841         * icf.cc (get_section_contents): Change iterators to point to the new
5842         vectors. Add reloc offset information to the contents.
5843         * icf.h (Icf::Sections_reachable_info): New typedef.
5844         (Icf::Sections_reachable_list): New typedef.
5845         (Icf::Offset_info): New typedef.
5846         (Icf::Reloc_info): New struct typedef.
5847         (Icf::Reloc_info_list): New typedef.
5848         (Icf::symbol_reloc_list): Delete method.
5849         (Icf::addend_reloc_list): Delete method.
5850         (Icf::section_reloc_list): Delete method.
5851         (Icf::reloc_info_list): New method.
5852         (Icf::reloc_info_list_): New member.
5853
5854 2010-02-19  Doug Kwan  <dougkwan@google.com>
5855
5856         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5857         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5858         * arm.cc (Arm_relocation_functions): New forward declaration.
5859         (Target_arm::Target_arm): Initialize new data members
5860         got_mod_index_offset_ and tls_base_symbol_defined_.
5861         (Target_arm::Relocate::relocate_tls): New method.
5862         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5863          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5864         New methods.
5865         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5866         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5867         (Target_arm::got_mod_index_offset_,
5868         Target_arm::tls_base_symbol_defined_): New data members.
5869         (Target_arm::Scan::local, Target::Scan::global,
5870         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5871         relocations.
5872
5873 2010-02-18  Doug Kwan  <dougkwan@google.com>
5874
5875         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5876         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5877         text section as a parameter becuase some broken tools may not set
5878         the link in section header.
5879         (Target_arm::has_got_section): New method.
5880         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5881         without any mapping symbol as data only.  Remove warning.
5882         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5883         link in its section header, try to discover the link by inspecting the
5884         REL31 relocation at the beginning of the section.
5885         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5886         in error message.
5887         (Target_arm::Scan::global): Treat any reference to the symbol
5888         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5889
5890 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5891
5892         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5893         (Scan::global_reloc_may_be_function_pointer): New function.
5894         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5895         (Scan::global_reloc_may_be_function_pointer): New function.
5896         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5897         (Scan::global_reloc_may_be_function_pointer): New function.
5898         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5899         (Scan::global_reloc_may_be_function_pointer): New function.
5900         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5901         (Scan::global_reloc_may_be_function_pointer): New function.
5902         (Scan::possible_function_pointer_reloc): New function.
5903         (Target_x86_64::can_check_for_function_pointers): New function.
5904         * gc.h (gc_process_relocs): Scan relocation types to determine if
5905         function pointers were taken for targets that support it.
5906         * icf.cc (Icf::find_identical_sections): Include functions for
5907         folding in safe ICF whose pointer is not taken.
5908         * icf.h (Secn_fptr_taken_set): New typedef.
5909         (fptr_section_id_): New member.
5910         (section_has_function_pointers): New function.
5911         (set_section_has_function_pointers): New function.
5912         (check_section_for_function_pointers): New function.
5913         * options.h: Fix comment for safe ICF option.
5914         * target.h (can_check_for_function_pointers): New function.
5915         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5916         Modify icf_safe_test for X86-64.
5917         * testsuite/Makefile.in: Regenerate.
5918         * testsuite/icf_safe_so_test.cc: New file.
5919         * testsuite/icf_safe_so_test.sh: New file.
5920         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5921         (main): Change to take pointer to function kept_func_3.
5922         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5923         folding is done correctly for X86-64.
5924
5925 2010-02-12  David S. Miller  <davem@davemloft.net>
5926
5927         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5928         is_symbolless parameter.
5929         (Output_reloc<SHT_REL>::is_symbolless): New.
5930         (Output_reloc<SHT_REL>::is_symbolless_): New.
5931         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5932         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5933         (Output_reloc<SHT_RELA>::is_symbolless): New.
5934         (Output_data_reloc::add_global): Handle is_symbolless.
5935         (Output_data_reloc::add_global_relative): Likewise.
5936         (Output_data_reloc::add_local): Likewise.
5937         (Output_data_reloc::add_local_relative): Likewise.
5938         (Output_data_reloc::add_symbolless_global_addend): New.
5939         (Output_data_reloc::add_symbolless_local_addend): New.
5940         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5941         is_symbolless.
5942         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5943         instead of ->is_relative_
5944         (Output_reloc::write): Likewise.
5945         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5946         (Output_reloc::write_rel): Simplify.
5947
5948         * sparc.cc (Target_sparc::Scan::local): Use
5949         ->add_symbolless_local_addend as needed.
5950         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5951         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5952         based upon relocation offset.
5953
5954 2010-02-11  Doug Kwan  <dougkwan@google.com>
5955
5956         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5957         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5958         beginning of function.
5959         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5960         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5961         parameter is_32bit in calls to should_apply_static_reloc.
5962         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5963         (check_DATA): Add arm_abs_global.stdout.
5964         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5965         arm_abs_global.stdout): New rules.
5966         (MOSTLLYCLEANFILES): Add arm_abs_global
5967         * Makefile.in: Regenerate.
5968         * testsuite/arm_abs_global.s: New file.
5969         * testsuite/arm_abs_global.sh: Ditto.
5970         * testsuite/arm_abs_lib.s: Ditto.
5971
5972 2010-02-11  Ian Lance Taylor  <iant@google.com>
5973
5974         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5975         Read_relocs task.
5976         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5977         Allocate_commons_task first.
5978         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5979         task, rather than symtab_lock_.
5980         (Gc_process_relocs::~Gc_process_relocs): New function.
5981         (Gc_process_relocs::is_runnable): Check this_blocker_.
5982         (Gc_process_relocs::locks): Use next_blocker_ rather than
5983         blocker_.
5984         (Scan_relocs::~Scan_relocs): New function.
5985         (Scan_relocs::is_runnable): Check this_blocker_ rather than
5986         symtab_lock_.
5987         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
5988         next_blocker_.
5989         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5990         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
5991         constructor accordingly.
5992         (class Gc_process_relocs): Likewise.
5993         (class Scan_relocs): Likewise.
5994         * common.h (class Allocate_commons_task): Remove symtab_lock_
5995         field, and corresponding constructor parameter.
5996         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5997         symtab_lock_.
5998         (Allocate_commons_task::locks): Likewise.
5999
6000 2010-02-11  Ian Lance Taylor  <iant@google.com>
6001
6002         * gold-threads.h (class Once): Define.
6003         (class Initialize_lock): Rewrite as child of Once.
6004         * gold-threads.cc (class Once_initialize): Define.
6005         (once_pointer_control): New static variable.
6006         (once_pointer, once_arg): New static variables.
6007         (c_run_once): New static function.
6008         (Once::Once, Once::run_once, Once::internal_run): New functions.
6009         (class Initialize_lock_once): Remove.
6010         (initialize_lock_control): Remove.
6011         (initialize_lock_pointer): Remove.
6012         (initialize_lock_once): Remove.
6013         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6014         (Initialize_lock::initialize): Rewrite.
6015         (Initialize_lock::do_run_once): New function.
6016         * archive.cc (Archive::interpret_header): Only clear name if it is
6017         not already empty.
6018         * fileread.cc: Include "gold-threads.h"
6019         (file_counts_lock): New static variable.
6020         (file_counts_initialize_lock): Likewise.
6021         (File_read::release): Only increment counts when using --stats.
6022         Use a lock around the increment.
6023         * parameters.cc (class Set_parameters_target_once): Define.
6024         (set_parameters_target_once): New static variable.
6025         (Parameters::Parameters): Move here from parameters.h.
6026         (Parameters::set_target): Rewrite.
6027         (Parameters::set_target_once): New function.
6028         (Parameters::clear_target): Move here and rewrite.
6029         * parameters.h (class Parameters): Update declarations.  Add
6030         set_parameters_target_once_ field.
6031         (Parameters::Parameters): Move to parameters.cc.
6032         (Parameters::clear_target): Likewise.
6033         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6034         task.
6035         (Start_group::~Start_group): New function.
6036         (Start_group::is_runnable): New function.
6037         (Start_group::locks, Start_group::run): New functions.
6038         (Finish_group::run): Change saw_undefined to size_t.
6039         * readsyms.h (class Start_group): Define.
6040         (class Finish_group): Change saw_undefined_ field to size_t.
6041         (Finish_group::Finish_group): Remove saw_undefined and
6042         this_blocker parameters.  Change all callers.
6043         (Finish_group::set_saw_undefined): New function.
6044         (Finish_group::set_blocker): New function.
6045         * symtab.h (class Symbol_table): Change saw_undefined to return
6046         size_t.  Change saw_undefined_ field to size_t.
6047         * target-select.cc (Set_target_once::do_run_once): New function.
6048         (Target_selector::Target_selector): Initialize set_target_once_
6049         field.  Don't initialize lock_ and initialize_lock_ fields.
6050         (Target_selector::instantiate_target): Rewrite.
6051         (Target_selector::set_target): New function.
6052         * target-select.h (class Set_target_once): Define.
6053         (class Target_selector): Update declarations.  Make
6054         Set_target_once a friend.  Remove lock_ and initialize_lock_
6055         fields.  Add set_target_once_ field.
6056
6057 2010-02-10  Ian Lance Taylor  <iant@google.com>
6058
6059         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6060         queueing any tasks.
6061         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6062         (queue_middle_tasks): Add all blockers before queueing any tasks.
6063         (queue_final_tasks): Likewise.
6064         * token.h (Task_token::add_blockers): New function.
6065         * object.h (Input_objects::number_of_relobjs): New function.
6066
6067 2010-02-10  Ian Lance Taylor  <iant@google.com>
6068
6069         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6070         shared, not if not position independent.
6071         * x86_64.cc (Relocate::relocate_tls): Likewise.
6072         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6073         (tls_pie_pic_test): New target.
6074         * testsuite/Makefile.in: Rebuild.
6075
6076         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6077         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6078         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6079         * testsuite/Makefile.in: Rebuild.
6080
6081 2010-02-09  David S. Miller  <davem@davemloft.net>
6082
6083         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6084         R_SPARC_RELATIVE using ->add_local_relative().
6085         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6086
6087         * output.h (Output_data_dynamic::add_section_size): New method
6088         that takes two Output_data objects.
6089         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6090         entry param.  Handle it in initializers.
6091         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6092         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6093         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6094         arg.
6095         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6096         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6097         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6098         for dynrel_includes_plt.
6099         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6100         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6101         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6102         before .rela.plt
6103         (Target_sparc::do_finalize_sections): Update to pass true for
6104         dynrel_includes_plt.
6105         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6106         output before .rela.plt
6107         (Target_powerpc::do_finalize_sections): Update to pass true for
6108         dynrel_includes_plt when 32-bit.
6109
6110 2010-02-08  Doug Kwan  <dougkwan@google.com>
6111
6112         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6113         method.
6114         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6115         Arm_relobj::scan_section_for_cortex_a8_stubs,
6116         Arm_relobj::do_relocation_section): Instead of calling
6117         Output_section::output_address, use faster
6118         Arm_relobj::simple_input_section_output_address.
6119
6120 2010-02-08  David S. Miller  <davem@davemloft.net>
6121
6122         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6123         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6124         relocation helper function.
6125
6126         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6127         just like R_SPARC_GOT{10,13,22}.
6128         (Target_sparc::Scan::local): Likewise.
6129         (Target_sparc::Relocate:relocate): Likewise.
6130
6131 2010-02-06  Ian Lance Taylor  <iant@google.com>
6132
6133         * configure.ac: Rewrite targetobjs duplicate removal code to use
6134         only shell constructs.
6135         * configure: Rebuild.
6136
6137 2010-02-05  Doug Kwan  <dougkwan@google.com>
6138
6139         PR 11247
6140         * arm.cc (Arm_relobj::section_is_scannable): New method.
6141         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6142         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6143
6144 2010-02-04  Doug Kwan  <dougkwan@google.com>
6145
6146         PR 11247
6147         * arm-reloc-property.cc (cstdio): Include.
6148         * configure.ac (targetobjs): Remove duplicates.
6149         * configure: Regenerate.
6150         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6151         big and little endian version for a given address size.
6152
6153 2010-02-03  Doug Kwan  <dougkwan@google.com>
6154
6155         * arm-reloc-property.cc
6156         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6157         definition.
6158         * arm-reloc-property.h
6159         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6160         New method definition.
6161         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6162         declaration.
6163         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6164         overflow to N.
6165         (GOT_PREL): Change implemented to Y.
6166         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6167         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6168         (Arm_relocate_functions::movw_abs_nc): Remove method.
6169         (Arm_relocate_functions::movt_abs): Ditto.
6170         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6171         (Arm_relocate_functions::thm_movt_abs): Ditto.
6172         (Arm_relocate_functions::movw_rel_nc): Ditto.
6173         (Arm_relocate_functions::movw_rel): Ditto.
6174         (Arm_relocate_functions::movt_rel): Ditto.
6175         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6176         (Arm_relocate_functions:thm_movw_rel): Ditto.
6177         (Arm_relocate_functions:thm_movt_rel): Ditto.
6178         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6179         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6180         New method definitions.
6181         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6182         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6183         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6184         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6185         (Target_arm::Relocate::relocate): Check for non-static or
6186         unimplemented relocation code and exit early.  Change calls to
6187         Target_arm::reloc_uses_thumb_bit and
6188         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6189         instead.  Refactor code to handle similar relocations to increase
6190         code sharing.  Remove check for unsupported relocation code in switch
6191         statement.
6192         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6193         relocation property table to find out size.  Change error message to
6194         print out the name of a relocation code instead of the numeric value.
6195         (Target_arm::scan_reloc_for_stub): Use relocation property table
6196         instead of calling Target_arm::reloc_uses_thumb_bit().
6197
6198 2010-02-02  Doug Kwan  <dougkwan@google.com>
6199
6200         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6201         types of relaxed input section.
6202
6203 2010-02-02  Doug Kwan  <dougkwan@google.com>
6204
6205         * Makefile.am (HFILES): Add arm-reloc-property.h.
6206         (DEFFILES): New.
6207         (TARGETSOURCES): Add arm-reloc-property.cc
6208         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6209         (libgold_a_SOURCES): $(DEFFILES)
6210         * Makefile.in: Regenerate.
6211         * arm-reloc-property.cc: New file.
6212         * arm-reloc-property.h: New file.
6213         * arm-reloc.def: New file.
6214         * arm.cc: Update comments.
6215         (arm-reloc-property.h): New included header.
6216         (arm_reloc_property_table): New global variable.
6217         (Target_arm::do_select_as_default_target): New method definition.
6218         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6219         arm-reloc-property to targ_extra_obj.
6220         * parameters.cc (set_parameters_target): Call
6221         Target::select_as_default_target().
6222         * target.h (Target::select_as_default_target): New method definition.
6223         (Target::do_select_as_default_target): Same.
6224
6225 2010-02-01  Doug Kwan  <dougkwan@google.com>
6226
6227         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6228         first_output_text_section_.
6229         (Arm_exidx_fixup::first_output_text_section): New method definition.
6230         (Arm_exidx_fixup::first_output_text_section_): New data member.
6231         (Arm_exidx_fixup::process_exidx_section): Record the first text
6232         output section seen.
6233         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6234         and entsize in output section header.
6235
6236 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6237
6238         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6239         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6240         (Arm_relocate_functions::thm_alu11): New Method.
6241         (Arm_relocate_functions::thm_pc8): New Method.
6242         (Arm_relocate_functions::thm_pc12): New Method.
6243         (Target_arm::Scan::local): Handle the relocations.
6244         (Target_arm::Scan::global): Likewise.
6245         (Target_arm::Relocate::relocate): Likewise.
6246         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6247
6248 2010-01-29  Doug Kwan  <dougkwan@google.com>
6249
6250         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6251         of relocation types as ld.
6252
6253 2010-01-29  Doug Kwan  <dougkwan@google.com>
6254
6255         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6256         to public.
6257         (Arm_relocate_functions::thumb_branch_common): Ditto.
6258         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6259         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6260         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6261         Arm_relocate_functions::jump24): Remove.
6262         (Target_arm::Relocate::relocate): Adjust code to call
6263         Arm_relocation_functions::arm_branch_common and
6264         Arm_relocation_functions::thumb_branch_common instead of their removed
6265         wrappers.  Merge switch-cases together to reduce source code size.
6266
6267 2010-01-29  Doug Kwan  <dougkwan@google.com>
6268
6269         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6270         output_local_symbol_count_needs_update_.
6271         (Arm_relobj::output_local_symbol_count_needs_update,
6272          Arm_relobj::set_output_local_symbol_count_needs_update,
6273          Arm_relobj::update_output_local_symbol_count): New methods.
6274         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6275         member.
6276         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6277         of pointed function as in a R_ARM_PREL31 relocation.
6278         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6279         for output local symbol count updating.
6280         (Target_arm::do_relax): Update output local symbol counts in objects
6281         if necessary.
6282         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6283
6284 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6285
6286         * arm.cc: Added support for the ARM relocations:
6287         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6288         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6289         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6290         movw_prel_nc).
6291         (Arm_relocate_functions::movw_rel): New method.
6292         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6293         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6294         thm_movw_prel_nc).
6295         (Arm_relocate_functions::thm_movw_rel): New method.
6296         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6297         thm_movt_prel).
6298         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6299         relocations.
6300         (Target_arm::Scan::global): Likewise.
6301         (Target_arm::Relocate::relocate): Likewise.
6302         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6303         Likewise.
6304
6305 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6306
6307         * arm.cc: Added support for ARM group relocations.
6308         (Target_arm::reloc_needs_sym_origin): New method.
6309         (Arm_relocate_functions::calc_grp_kn): New method.
6310         (Arm_relocate_functions::calc_grp_residual): New method.
6311         (Arm_relocate_functions::calc_grp_gn): New method.
6312         (Arm_relocate_functions::arm_grp_alu): New Method.
6313         (Arm_relocate_functions::arm_grp_ldr): New Method.
6314         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6315         (Arm_relocate_functions::arm_grp_ldc): New Method.
6316         (Target_arm::Scan::local): Handle the ARM group relocations.
6317         (Target_arm::Scan::global): Likewise.
6318         (Target_arm::Relocate::relocate): Likewise.
6319         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6320         Likewise.
6321
6322 2010-01-26  Doug Kwan  <dougkwan@google.com>
6323
6324         * arm.cc (set): Include.
6325         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6326         pointer type.
6327         (Arm_output_section::Text_section_list): New type.
6328         (Arm_output_section::append_text_sections_to_list): New method.
6329         (Arm_output_section::fix_exidx_coverage): Ditto.
6330         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6331         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6332         Relobj::set_section_offset() instead of
6333         Sized_relobj::invalidate_section_offset().
6334         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6335         parameter for section headers. Ignore relocation sections for
6336         unallocated sections and EXIDX sections.
6337         (Target_arm::fix_exidx_coverage): New method.
6338         (Target_arm::output_section_address_less_than): New type.
6339         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6340         linked text section instead of the EXIDX section.
6341         (Arm_output_section::create_stub_group): Add an assertion to check
6342         that this is not an EXIDX output section.
6343         (Arm_output_section::append_text_sections_to_list): New method.
6344         (Arm_output_section::fix_exidx_coverage): Ditto.
6345         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6346         Arm_relobj::section_needs_reloc_stub_scanning.
6347         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6348         first pass.
6349         (Target_arm::fix_exidx_coverage): New method.
6350         * object.h (Relobj::set_output_section): New method.
6351         (Sized_relobj::invalidate_section_offset): Remove method.
6352         (Sized_relobj::do_invalidate_section_offset): Remove method.
6353         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6354
6355 2010-01-25  Doug Kwan  <dougkwan@google.com>
6356
6357         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6358         Fix warning due to signed and unsigned comparison on a 32-bit host.
6359
6360 2010-01-22  Doug Kwan  <dougkwan@google.com>
6361
6362         * arm.cc (Target_arm::do_relax): Record an output section for section
6363         offset adjustment it contains any stub table that has changed.
6364         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6365         offsets in an output section if necessary.
6366         * output.cc (Output_section::Output_section): Initialize
6367         section_offsets_need_adjustments_.
6368         (Output_section::add_input_section_for_script): Renamed to
6369         Output_section::add_simple_input_section.
6370         (Output_section::save_states): Add a comment.
6371         (Output_section::discard_states): New method defintion.
6372         (Output_section::adjust_section_offsets): Same.
6373         * output.h (Output_section::add_input_section_for_script): Renamed to
6374         Output_section::add_simple_input_section.
6375         (Output_section::discard_states): New method declaration.
6376         (Output_section::adjust_section_offsets): Same.
6377         (Output_section::section_offsets_need_adjustment,
6378         Output_section::set_section_offsets_need_adjustment): New method
6379         definitions.
6380         (Output_section::section_offsets_need_adjustment_): New data member.
6381         * script-sections.cc
6382         (Output_section_element_input::set_section_address): Adjust code for
6383         renaming of Output_section::add_input_section_for_script.
6384         (Orphan_output_section::set_section_address): Same.
6385
6386 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6387
6388         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6389         Fix_v4bx enum values .
6390         * gold/options.h (General_options): New option definitions.
6391         (General_options::fix_v4bx): New method.
6392         (General_options::Fix_v4bx): New enum.
6393         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6394         (General_options::parse_fix_v4bx_interworking): New method.
6395
6396 2010-01-22  Doug Kwan  <dougkwan@google.com>
6397
6398         * arm.cc (Arm_exidx_fixup): New class.
6399
6400 2010-01-21  Doug Kwan  <dougkwan@google.com>
6401
6402         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6403         classes.
6404         (Arm_exidx_section_offset_map): New type.
6405
6406 2010-01-21  Doug Kwan  <dougkwan@google.com>
6407
6408         * arm.cc (Arm_exidx_input_section): New class.
6409         (Arm_relobj::exidx_input_section_by_link,
6410         Arm_relobj::exidx_input_section_by_shndx,
6411         Arm_relobj::make_exidx_input_section): New methods.
6412         (read_arm_attributes_section): Remove.
6413         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6414         information about them.
6415         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6416         to here.
6417
6418 2010-01-20  Doug Kwan  <dougkwan@google.com>
6419
6420         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6421         Input_section_specifier to Section_id.
6422         (Target_arm::new_arm_input_section: Adjust code for change of key
6423         type.
6424         (Target_arm::find_arm_input_section): Ditto.
6425         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6426         (Section_id): Remove.
6427         (Garbage_collection::Section_id_hash): Remove.
6428         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6429         (Section_id): Remove.
6430         (Icf::Section_id_hash): Remove.
6431         * object.h (Section_id, Const_section_id, Section_id_hash,
6432         Const_section_id_hash): New type definitions.
6433         * output.cc (Output_section::add_relaxed_input_section): Change to
6434         use Const_section_id instead of Input_section_specifier as key type.
6435         (Output_section::add_merge_input_section): Ditto.
6436         (Output_section::build_relaxation_map): Change to use Section_id
6437         instead of Input_section_specifier as key type.
6438         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6439         Ditto.
6440         (Output_section::convert_input_sections_to_relaxed_sections): Change
6441         to use Const_section_id instead of Input_section_specifier as key type.
6442         (Output_section::find_merge_section): Ditto.
6443         (Output_section::find_relaxed_input_section): Ditto.
6444         * output.h (Input_section_specifier): Remove class.
6445         (Output_section::Output_section_data_by_input_section_map): Change
6446         key type to Const_section_id.
6447         (Output_section::Output_relaxed_input_section_by_input_section_map):
6448         Ditto.
6449         (Output_section::Relaxation_map): Change key type to Section_id.
6450
6451 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6452
6453         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6454         (class Arm_v4bx_stub): New class.
6455         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6456         (Stub_factory::make_arm_v4bx_stub): New method.
6457         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6458         (Stub_table::empty): Handle v4bx stubs.
6459         (Stub_table::add_arm_v4bx_stub): New method.
6460         (Stub_table::find_arm_v4bx_stub): New method.
6461         (Arm_relocate_functions::v4bx): New method.
6462         (Target_arm::fix_v4bx): New method.
6463         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6464         (Stub_table::relocate_stubs): Likewise.
6465         (Stub_table::do_write): Likewise.
6466         (Stub_table::update_data_size_and_addralign): Likewise.
6467         (Stub_table::finalize_stubs):  Likewise.
6468         (Target_arm::Scan::local): Likewise.
6469         (Target_arm::Scan::global): Likewise.
6470         (Target_arm::do_finalize_sections): Likewise.
6471         (Target_arm::Relocate::relocate): Likewise.
6472         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6473         Likewise.
6474         (Target_arm::scan_reloc_for_stub): Likewise.
6475         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6476
6477 2010-01-19  Ian Lance Taylor  <iant@google.com>
6478
6479         * output.cc (Output_section_headers::do_sized_write): Write large
6480         segment count to sh_info field.
6481         (Output_file_header::do_sized_write): For large segment count,
6482         write PN_XNUM to e_phnum field.
6483
6484 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6485
6486         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6487         (Arm_relocate_functions::thm_jump8): New function.
6488         (Arm_relocate_functions::thm_jump11): New function.
6489         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6490         R_ARM_THM_JUMP11.
6491         (Target_arm::Scan::global): Likewise.
6492         (Target_arm::Relocate::relocate): Likewise.
6493         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6494         Likewise.
6495
6496 2010-01-14  Doug Kwan  <dougkwan@google.com>
6497
6498         * arm.cc (map, utility): Include headers.
6499         (Target_arm::apply_cortex_a8_workaround): New method.
6500         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6501         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6502         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6503         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6504         the --[no-]fix-cortex-a8 command line options.
6505         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6506         (Target_arm::relocate_stub): Use addend in instruction template.
6507         * options.h (DEFINE_bool): Set the user-set flag.
6508         (General_options): Add --[no-]-fix-cortex options.
6509         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6510         : Update fast look-up map after conversion.
6511
6512 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6513
6514         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6515         in the first pass of do_layout.
6516
6517 2010-01-13  Doug Kwan  <dougkwan@google.com>
6518
6519         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6520         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6521         apparent compiler problem of not folding static constant integral
6522         data members of elfcpp::Elf_sizes<32>.
6523
6524 2010-01-13  Doug Kwan  <dougkwan@google.com>
6525
6526         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6527         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6528         Arm_relobj::scan_section_for_cortex_a8_erratum,
6529         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6530         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6531         sections to scan for relocation stubs into a new method
6532         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6533         relocation and Cortex-A8 stub scanning.
6534         (Target_arm::do_relax): Force stubs to be after stubbed sections
6535         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6536         the beginning of a new relaxation pass.  Update a comment.
6537         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6538
6539 2010-01-12  Ian Lance Taylor  <iant@google.com>
6540
6541         * target-reloc.h (visibility_error): New inline function.
6542         (relocate_section): Call visibility_error.
6543         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6544         (MOSTLYCLEANFILES): Likewise.
6545         (protected_4_pic.o, protected_3.err): New targets.
6546         * testsuite/protected_4.cc: New file.
6547
6548 2010-01-12  Doug Kwan  <dougkwan@google.com>
6549
6550         * arm.cc (Cortex_a8_reloc): New class.
6551         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6552         and cortex_a8_relocs_info_.
6553         (Target_arm::fix_cortex_a8): New method definition.
6554         (Target_arm::Cortex_a8_relocs_info): New type.
6555         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6556         New data member declarations.
6557         (Target_arm::scan_reloc_for_stub): Record information about
6558         relocations for THUMB branches that might be exempted from the
6559         Cortex-A8 workaround.
6560         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6561         at the beginning of a relaxation pass.
6562
6563 2010-01-12  Doug Kwan  <dougkwan@google.com>
6564
6565         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6566         (Arm_relobj::Mapping_symbol_position,
6567          Arm_reloj::Mapping_symbol_position_less,
6568          Arm_relobj::Mapping_symbols_info): New types.
6569         (Target_arm::is_mapping_symbol_name): New method definition.
6570         (Arm_relobj::do_count_local_symbols): Save information about mapping
6571         symbols.
6572
6573 2010-01-11  Doug Kwan  <dougkwan@google.com>
6574
6575         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6576         Arm_relocate_functions::thumb32_branch_upper,
6577         Arm_relocate_functions::thumb32_branch_lower,
6578         Arm_relocate_functions::thumb32_cond_branch_offset,
6579         Arm_relocate_functions::thumb32_cond_branch_upper,
6580         Arm_relocate_functions::thumb32_cond_branch_lower,
6581         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6582         branch offset encoding.
6583         (Arm_relocate_functions::thumb_branch_common): Use new branch
6584         offset encoding methods to avoid code duplication.
6585         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6586         (Stub_addend_reader::operator()): Use new branch encoding method
6587         to avoid code duplication.
6588
6589 2010-01-11  Doug Kwan  <dougkwan@google.com>
6590
6591         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6592         (Target_arm::do_finalize_sections): Define special EXIDX section
6593         symbols only if referenced.
6594         * gc.h (Garbage_collection::add_reference): New method.
6595         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6596         code duplication.
6597
6598 2010-01-11  Ian Lance Taylor  <iant@google.com>
6599
6600         * script.cc (Version_script_info::build_expression_list_lookup):
6601         Change complaing about duplicate wildcard match from error to
6602         warning.
6603
6604         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6605         of 2009-12-30.
6606         (Version_script_info::Version_script_info): Initialize globs_,
6607         default_version_, default_is_global_, and exact_.  Don't
6608         initialize globals_ or locals_.
6609         (Version_script_info::build_lookup_tables): Build local symbols
6610         first.
6611         (Version_script_info::unquote): New function.
6612         (Version_script_info::add_exact_match): New function.
6613         (Version_script_info::build_expression_list_lookup): Remove lookup
6614         parameter.  Add is_global parameter.  Change all callers.  Handle
6615         wildcard pattern specially.  Unquote pattern.  Call
6616         add_exact_match.
6617         (Version_script_info::get_name_to_match): New function.
6618         (Version_script_info::get_symbol_version): New function.
6619         (Version_script_info::get_symbol_version_helper): Remove.
6620         (Version_script_info::check_unmatched_names): Call unquote.
6621         * script.h (class Version_script_info): Change get_symbol_version
6622         to be non-inline and add is_global parameter; change all callers.
6623         Rewrite symbol_is_local.  Update declarations.  Define struct
6624         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6625         Remove globals_ and locals_ members.  Add exact_, globs_,
6626         default_version_, is_global_.
6627         (Version_script_info::Glob): Remove pattern, add expression and
6628         is_global.  Update constructor.  Change all callers.
6629         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6630         default version.
6631         (Versions::symbol_section_contents): If a symbol is undefined, or
6632         defined in a dynamic object, set the version index to
6633         VER_NDX_LOCAL.
6634         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6635         symbol_is_local.
6636         (Symbol_table::add_from_pluginobj): Likewise.
6637         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6638
6639 2010-01-11  Doug Kwan  <dougkwan@google.com>
6640
6641         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6642         (incremental_dump_LDADD): Add linking option for libintl.
6643         * Makefile.in: Regenerate.
6644
6645 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6646
6647         PR gold/11144
6648         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6649         instead of -Ds.
6650         * testsuite/Makefile.in: Regenerated.
6651
6652 2010-01-10  Doug Kwan  <dougkwan@google.com>
6653
6654         * options.h (DEFINE_var): Use parentheses around argument varname__
6655         in macro body to avoid any unintended subsequent substitutions.
6656
6657 2010-01-10  Ian Lance Taylor  <iant@google.com>
6658
6659         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6660         candidates before doing symbol resolution.
6661
6662         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6663         ODR candidates if only one is weak.
6664
6665 2010-01-08  Ian Lance Taylor  <iant@google.com>
6666
6667         * script.cc (Version_script_info::build_expression_list_lookup):
6668         Don't warn about ambiguous version, just record the ambiguity.
6669         (Version_script_info::get_symbol_version_helper): Give error if
6670         version is ambiguous.
6671
6672 2010-01-08  Doug Kwan  <dougkwan@google.com>
6673
6674         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6675           prev_data_size_ and prev_addralign_.  Remove initializer for
6676           deleted data member has_been_changed_.
6677           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6678           to determine if the table is empty.
6679           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6680           Remove.
6681           (Stub_table::add_reloc_stub): Define method in class definition
6682           instead of just declaring it there.
6683           (Stub_table::add_cortex_a8_stub): New method definition.
6684           (Stub_table::update_data_size_and_addralign): Ditto.
6685           (Stub_table::finalize_stubs): Ditto.
6686           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6687           (Stub_table::do_addralign_): Return address alignment in the
6688           (Stub_table::do_reset_address_and_file_offset): Define method in
6689           class definition instead of declaring it there.  Set current data
6690           size to be the data size of the previous pass.
6691           (Stub_table::set_final_data_size): Use current data size as the
6692           final data size.
6693           (Stub_table::relocate_stub): Change parameter type of stub from
6694           Reloc_stub pointer to Stub pointer.
6695           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6696           (Stub_table::Cortex_a8_stub_list): New typedef.
6697           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6698            Stub_table::prev_addralign_): New data member.
6699           (Arm_relobj::Arm_relobj): Initialize data member
6700           section_has_cortex_a8_workaround_.
6701           (Arm_relobj::section_has_cortex_a8_workaround,
6702            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6703            definitions.
6704           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6705           declarations.
6706           (Target_arm::relocate_stub): Change parameter type of stub from
6707           Reloc_stub pointer to Stub pointer.
6708           (Insn_template::size, Insn_template::alignment): Handle
6709           THUMB16_SPECIAL_TYPE.
6710           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6711            Stub_table::update_data_size_and_addralign,
6712            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6713           definitions.
6714           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6715           (Stub_table::do_write): Ditto.
6716           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6717
6718 2010-01-08  Ian Lance Taylor  <iant@google.com>
6719
6720         PR 11108
6721         * symtab.h (class Symbol): Remove fields is_target_special_ and
6722         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6723         (Symbol::is_defined_in_discarded_section): New function.
6724         (Symbol::set_is_defined_in_discarded_section): New function.
6725         (Symbol::has_plt_offset): Rewrite.
6726         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6727         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6728         Don't initialize is_target_special_ or has_plt_offset_.
6729         Initialize is_defined_in_discarded_section_.
6730         (Symbol_table::add_from_relobj): If appropriate, set
6731         is_defined_in_discarded_section.
6732         * resolve.cc (Symbol::override_base_with_special): Don't test
6733         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6734         * target-reloc.h (relocate_section): Do special handling for
6735         symbols defined in discarded sections for global symbols as well
6736         as local symbols.
6737
6738 2010-01-08  Ian Lance Taylor  <iant@google.com>
6739
6740         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6741         the SHT_SYMTAB case.
6742
6743 2010-01-08  Ian Lance Taylor  <iant@google.com>
6744
6745         * object.cc (Sized_relobj::do_layout): Don't get confused if
6746         layout_eh_frame returns NULL.
6747
6748 2010-01-08  Ian Lance Taylor  <iant@google.com>
6749
6750         PR 11084
6751         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6752         dynamic symbol table, use the normal symbol table.
6753         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6754         symbol table.
6755
6756 2010-01-08  Ian Lance Taylor  <iant@google.com>
6757
6758         PR 11072
6759         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6760         sections.
6761
6762 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6763
6764         * version.cc (print_version): Change to "Copyright 2010".
6765
6766 2010-01-08  Ian Lance Taylor  <iant@google.com>
6767
6768         PR 10287
6769         PR 11063
6770         * i386.cc (class Target_i386): Change return type of plt_section
6771         to be non-const.
6772         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6773         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6774         tls_desc_rel_ field.
6775         (Output_data_plt_i386::rel_tls_desc): New function.
6776         (Target_i386::rel_tls_desc_section): New function.
6777         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6778         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6779         R_386_TLS_DESC reloc in rel_tls_desc_section.
6780         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6781         Define struct Tlsdesc_info.
6782         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6783         (Target_x86_64::do_reloc_symbol_index): New function.
6784         (Target_x86_64::add_tlsdesc_info): New function.
6785         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6786         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6787         tlsdesc_rel_ field.
6788         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6789         all callers.
6790         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6791         (Target_x86_64::rela_tlsdesc_section): New function.
6792         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6793         handling.
6794         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6795         (Target_x86_64::do_reloc_addend): New function.
6796         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6797         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6798         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6799         (Output_reloc::type): New function.
6800         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6801         (Output_reloc::is_target_specific): New function.
6802         (Output_reloc::target_arg): New function.
6803         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6804         absolute relocs and target specific relocs.
6805         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6806         add_target_specific.
6807         (class Output_data_reloc) [SHT_RELA]: Likewise.
6808         * output.cc (Output_reloc::Output_reloc): Add four new versions
6809         for absolute relocs and target specific relocs.
6810         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6811         (Output_reloc::get_symbol_index): Likewise.
6812         (Output_reloc::local_section_offset): Check that local_sym_index_
6813         is not TARGET_CODE or 0.
6814         (Output_reloc::symbol_value): Likewise.
6815         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6816         reloc.
6817         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6818         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6819         functions.
6820         * layout.cc (add_target_dynamic_tags): Use output section for
6821         DT_PLTRELSZ and DT_JMPREL.
6822
6823 2010-01-07  Ian Lance Taylor  <iant@google.com>
6824
6825         PR 11061
6826         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6827         function.
6828         (class Output_data_reloc_generic): Define.
6829         (class Output_data_reloc_base): Change base class to
6830         Output_data_reloc_generic.  Change add() method to call
6831         bump_relative_reloc_count for a relative reloc.  Remove
6832         sort_relocs_ field.
6833         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6834         to sort_relocs().
6835         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6836         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6837         appropriate.
6838         * layout.h (class Layout): Update declaration.
6839
6840 2010-01-07  Ian Lance Taylor  <iant@google.com>
6841
6842         * output.h (class Output_data): Add const version of
6843         output_section and do_output_section.
6844         (class Output_section_data): Add const version of
6845         do_output_section.
6846         (class Output_section): Likewise.
6847         * layout.cc (Layout::add_target_dynamic_tags): New function.
6848         * layout.h (class Layout): Update declarations.
6849         * arm.cc (Target_arm::do_finalize_sections): Use
6850         add_target_dynamic_tags.
6851         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6852         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6853         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6854         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6855
6856 2010-01-07  Ian Lance Taylor  <iant@google.com>
6857
6858         PR 11042
6859         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6860         object as needed.
6861
6862 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6863             Ian Lance Taylor  <iant@google.com>
6864
6865         PR 11019
6866         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6867         Xindex::read_symtab_xindex.
6868
6869 2010-01-07  Doug Kwan  <dougkwan@google.com>
6870
6871         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6872         (Insn_template::thumb16_bcond_insn): New method declaration.
6873         (Insn_template): Fix spelling.
6874         (Stub::thumb16_special): New method declaration.
6875         (Stub::do_write): Define virtual method which was previously pure
6876         virtual.
6877         (Stub::do_thumb16_special): New method declaration.
6878         (Stub::do_fixed_endian_write): New template member.
6879         (Reloc_stub::do_write): Remove.
6880         (Reloc_stub::do_fixed_endian_write): Remove.
6881         (Cortex_a8_stub): New class definition.
6882         (Stub_factory::make_cortex_a8_stub): New method definition.
6883         (Stub_factory::Stub_factory): Add missing static storage class
6884         qualifier for elf32_arm_stub_a8_veneer_blx.
6885
6886 2010-01-07  Ian Lance Taylor  <iant@google.com>
6887
6888         PR 10980
6889         * options.h (class General_options): Add --warn-unresolved-symbols
6890         and --error-unresolved-symbols.
6891         * errors.cc (Errors::undefined_symbol): Implement
6892         --warn-unresolved-symbols.
6893
6894         * options.h (class General_options): Add -z text and -z textoff.
6895         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6896
6897 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6898
6899         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6900         (Garbage_collection::cident_sections): New function.
6901         (Garbage_collection::add_cident_section): New function.
6902         (Garbage_collection::cident_sections_): New member.
6903         (gc_process_relocs): Add references to sections whose names are C
6904         identifiers.
6905         * gold.h (cident_section_start_prefix): New constant.
6906         (cident_section_stop_prefix): New constant.
6907         (is_cident): New function.
6908         * layout.cc (Layout::define_section_symbols): Replace string constants
6909         with the newly defined constants.
6910         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6911         C identifiers.
6912         * testsuite/Makefile.am: Add gc_orphan_section_test.
6913         * testsuite/Makefile.in: Regenerate.
6914         * testsuite/gc_orphan_section_test.cc: New file.
6915         * testsuite/gc_orphan_section_test.sh: New file.
6916
6917 2010-01-06  Ian Lance Taylor  <iant@google.com>
6918
6919         PR 10980
6920         * options.h (class General_options): Add --warn-shared-textrel.
6921         * layout.cc (Layout::finish_dynamic_section): Implement
6922         --warn-shared-textrel.
6923
6924         PR 10980
6925         * options.h (class General_options): Add --warn-multiple-gp.
6926
6927 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6928
6929         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6930         $(THREADSLIB) and $(LIBDL).
6931         * Makefile.in: Rebuild.
6932
6933 2010-01-06  Ian Lance Taylor  <iant@google.com>
6934
6935         PR 10980
6936         * options.cc (General_options::parse_section_start): New function.
6937         (General_options::section_start): New function.
6938         (General_options::General_options): Initialize all members.
6939         * options.h: Include <map>
6940         (class General_options): Add --section-start.  Add section_starts_
6941         member.
6942         * layout.cc (Layout::attach_allocated_section_to_segment): If
6943         --section-start was used, set the address of the segment.  Remove
6944         local sort_sections.
6945         (Layout::relaxation_loop_body): If the address of the load segment
6946         has been set by --section-start, don't use it.
6947         * output.h (Output_segment::update_flags_for_output_section): New
6948         function.
6949         * output.cc (Output_segment::add_output_section): Call
6950         update_flags_for_output_section.
6951
6952 2010-01-05  Ian Lance Taylor  <iant@google.com>
6953
6954         PR 10980
6955         * options.h (class General_options): Add --undefined-version.
6956         * script.cc (struct Version_expression): Add was_matched_by_symbol
6957         field.
6958         (Version_script_info::matched_symbol): New function.
6959         (Version_script_info::get_symbol_version_helper): Call
6960         matched_symbol.
6961         (Version_script_info::check_unmatched_names): New function.
6962         * script.h (class Version_script_info): Update declarations.
6963         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6964
6965         * options.h (class General_options): Use DEFINE_bool_alias for
6966         allow_multiple_definition.
6967         * resolve.cc (Symbol_table::should_override): Don't test
6968         allow_multiple_definition.
6969
6970         PR 10980
6971         * options.h (class General_options): Add --cref.
6972         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6973         until after printing cref table.
6974         * cref.cc: Include "symtab.h".
6975         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6976         (Cref_table_compare::operator()): New function.
6977         (Cref_inputs::gather_cref): New function.
6978         (filecol): New static const.
6979         (Cref_inputs::print_cref): New function.
6980         (Cref::print_cref): New function.
6981         * cref.h: Include <cstdio>.
6982         (class Cref): Update declarations.
6983         * mapfile.h (Mapfile::file): New function.
6984         * object.h (class Object): Define Symbols.  Declare virtual
6985         do_get_global_symbols.
6986         (Object::get_global_symbols): New function.
6987         * object.cc (Input_objects::add_object): Pass object to cref_ if
6988         --cref.
6989         (Input_objects::archive_start): Likewise.
6990         (Input_objects::archive_stop): Likewise.
6991         (Input_objects::print_cref): New function.
6992         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6993         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6994         --cref.
6995         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6996         function.
6997         * plugin.h (class Sized_pluginobj): Update declarations.
6998
6999 2010-01-05  Ian Lance Taylor  <iant@google.com>
7000
7001         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7002         to is_default_version.  Rename insdef to insdefault.
7003         (Symbol_table::add_from_relobj): Rename def to is_default_version
7004         and local to is_forced_local.
7005         (Symbol_table::add_from_pluginobj): Likewise.
7006         (Symbol_table::add_from_dynobj): Likewise.
7007         (Symbol_table::define_special_symbol): Rename insdef to
7008         insdefault.
7009
7010 2010-01-04  Ian Lance Taylor  <iant@google.com>
7011
7012         PR 10980
7013         * options.h (class General_options): Add
7014         --allow-multiple-definition and -z muldefs.
7015         * resolve.cc (Symbol_table::should_override): Don't warn about a
7016         multiple symbol definition if --allow-multiple-definition or -z
7017         muldefs.
7018
7019         PR 10980
7020         * options.h (class General_options): Add --add-needed and
7021         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7022         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7023         error if --copy-dt-needed-entries aka --add-needed is used and
7024         would cause a change in behaviour.
7025
7026         PR 10980
7027         * options.h (class General_options): Add -G as a short version of
7028         --shared.  Add no-op options -assert, -g, and -i.
7029
7030 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7031
7032         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7033         check for .text or .gnu.linkonce.t sections.
7034         * icf.cc (Icf::find_identical_sections): Ditto.
7035         Change the detection for mangled function name within the section
7036         name.
7037         * icf.h (is_section_foldable_candidate): New function.
7038
7039 2009-12-30  Ian Lance Taylor  <iant@google.com>
7040
7041         PR 10980
7042         * options.h (class General_options): Permit two dashes with
7043         --retain-symbols-file.
7044
7045 2009-12-30  Ian Lance Taylor  <iant@google.com>
7046
7047         PR 10979
7048         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7049         don't put the file header and segment headers in the text
7050         segment.
7051
7052         PR 10979
7053         * common.cc (Sort_commons::operator()): Stabilize sort when both
7054         entries are NULL.
7055         (Symbol_table::do_allocate_commons_list): When allocating common
7056         symbols, skip a symbol which is no longer common.
7057         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7058         an object before checking its type.
7059         * testsuite/common_test_2.c: New file.
7060         * testsuite/common_test_3.c: New file.
7061         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7062         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7063         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7064         (common_test_2_pic.o, common_test_2.so): New targets.
7065         (common_test_3_pic.o, common_test_3.so): New targets.
7066         * testsuite/Makefile.in: Rebuild.
7067
7068         PR 10979
7069         * script.cc (read_input_script): If we see a new SECTIONS clause,
7070         and we have added an input section, give an error.
7071         * layout.h (class Layout): Add have_added_input_section function.
7072         Add have_added_input_section_ field.
7073         * layout.cc (Layout::Layout): Initialize
7074         have_added_input_section_.
7075         (Layout::layout): Set have_added_input_section_.
7076         (Layout::layout_eh_frame): Likewise.
7077
7078 2009-12-30  Ian Lance Taylor  <iant@google.com>
7079
7080         PR 10931
7081         * options.h (class General_options): Add --sort-common option.
7082         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7083         * common.cc (Sort_common): Add sort_order parameter to
7084         constructor.  Add sort_order_ field.
7085         (Sort_commons::operator): Check sort_order_.
7086         (Symbol_table::allocate_commons): Determine the sort order.
7087         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7088         Change all callers.
7089         (Symbol_table::do_allocate_commons_list): Likewise.
7090
7091 2009-12-30  Ian Lance Taylor  <iant@google.com>
7092
7093         PR 10916
7094         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7095         symbols from this object, don't change the visibility of an
7096         undefined symbol.
7097         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7098
7099 2009-12-30  Ian Lance Taylor  <iant@google.com>
7100
7101         PR 10861
7102         * script.h (class Version_script_info): Define Language enum.
7103         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7104         new fields globals_, locals_, and is_finalized_.
7105         * script.cc: Various formatting fixes.
7106         (class Parser_closure): Change language_stack_ from a vector of
7107         std::string to one of Version_script_info::Language.  Adjust all
7108         uses accordingly.
7109         (class Lazy_demangler): Remove.
7110         (struct Version_expression): Change language from std::string to
7111         Version_script_info::Language.
7112         (Version_script_info::Version_script_info): New function.
7113         (Version_script_info::~Version_script_info): Don't call clear.
7114         (Version_script_info::finalize): New function.
7115         (Version_script_info::build_lookup_tables): New function.
7116         (Version_script_info::build_expression_list_lookup): New
7117         function.
7118         (Version_script_info::get_symbol_version_helper): Rewrite to use
7119         lookup tables.
7120         (Version_script_info::print_expression_list): Adjust to use
7121         Version_script_info::Language.
7122         (script_push_lex_into_version_mode): Check that the version script
7123         has not been finalized.
7124         (version_script_push_lang): Change language string to
7125         Version_script_info::Language.
7126         * options.cc (Command_line::version_script): New function.
7127         * options.h (class General_options): Add finalize_dynamic_list
7128         function.  Change version_script from declaration to definition.
7129         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7130         * testsuite/version_script.map: Remove duplicate def of foo.
7131         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7132         version_script.map.
7133         * testsuite/Makefile.in: Rebuild.
7134
7135 2009-12-30  Ian Lance Taylor  <iant@google.com>
7136
7137         PR 10843
7138         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7139         if the input symbol index is 0, make the output symbol index 0.
7140
7141 2009-12-30  Ian Lance Taylor  <iant@google.com>
7142
7143         PR 10670
7144         * options.h (class General_options): Add -x/--discard-all.
7145         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7146         --discard-all.  If the local symbol needs a dynamic entry, check
7147         that before handling --discard-locals.
7148
7149 2009-12-30  Ian Lance Taylor  <iant@google.com>
7150
7151         PR 10450
7152         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7153         flags to PF_R.
7154         (Output_segment::add_output_section): Don't change the flags if
7155         the type is PT_TLS.
7156
7157         PR 10450
7158         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7159         GNU hash table if they need a dynamic value.  Otherwise, don't add
7160         them if they are defined in a dynamic object or are forced local.
7161
7162 2009-12-29  Ian Lance Taylor  <iant@google.com>
7163
7164         PR 10450
7165         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7166         .gnu.hash table for a 32-bit target.
7167
7168         PR 10450
7169         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7170         regular and a dynamic object only needs a dynamic symbol table
7171         entry if it is externally visible.
7172
7173         PR 10450
7174         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7175         constructor.  Add global_offset_table_ field.
7176         (Target_i386::got_section): Set global_offset_table_.
7177         (Target_i386::do_finalize_sections): Set global_offset_table_
7178         size.
7179         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7180         in constructor.  Add global_offset_table_ field.
7181         (Target_x86_64::got_section): Set global_offset_table_.
7182         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7183         size.
7184
7185         * layout.cc (Layout::Layout): Initialize increase_relro_.
7186         (Layout::get_output_section): Add is_relro, is_last_relro, and
7187         is_first_non_relro parameters.  Change all callers.
7188         (Layout::choose_output_section): Likewise.
7189         (Layout::add_output_section_data): Likewise.
7190         (Layout::make_output_section): Likewise.
7191         (Layout::set_segment_offsets): Clear increase_relro when using a
7192         linker script.
7193         * layout.h (class Layout): Add increase_relro method.  Add
7194         increase_relro_ field.  Update declarations.
7195         * output.cc (Output_section::Output_section): Initialize
7196         is_last_relro_ and is_first_non_relro_.
7197         (Output_segment::add_output_section): Group relro sections is
7198         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7199         (Output_segment::maximum_alignment): Remove relro handling.
7200         (Output_segment::set_section_addresses): Add increase_relro
7201         parameter.  Change all callers.  Add initial alignment to align
7202         relro sections on separate page.  Remove old relro handling.
7203         (Output_segment::set_section_list_addresses): Remove in_relro
7204         parameter.  Change all callers.
7205         (Output_segment::set_offset): Add increase parameter.  Change all
7206         callers.  Remove old relro handling.
7207         * output.h (class Output_section): Add new methods: is_last_relro,
7208         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7209         Add is_last_relro_ and is_first_non_relro_ fields.
7210         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7211         Create separate .got.plt section.  Call increase_relro.
7212         * x86_64.cc (Target_x86_64::got_section): Likewise.
7213         * testsuite/relro_script_test.t: Add .got.plt.
7214
7215         PR 10450
7216         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7217         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7218         (Layout::finalize): Call set_dynamic_symbol_size.
7219         (Layout::set_dynamic_symbol_size): New function.
7220         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7221         set_dynamic_symbol_size.
7222
7223         PR 10450
7224         * output.h (class Output_section): Add is_entsize_zero_ field.
7225         * output.cc (Output_section::Output_section): Initialize
7226         is_entsize_zero_.
7227         (Output_section::set_entsize): If two different entsizes are
7228         requested, force it to zero.
7229         (Output_section::add_input_section): Set flags for .debug_str
7230         before updating section flags.  Set entsize.
7231         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7232         and SHF_STRING if all input sections have those flags.
7233
7234 2009-12-29   Rafael Espindola  <espindola@google.com>
7235
7236         * main.cc (main): Fix the sys time reporting.
7237         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7238         reporting.
7239
7240 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7241
7242         * options.cc (General_options::parse_version): Allow -v to exit
7243         without an error if there is nothing to link.
7244
7245 2009-12-29  Ian Lance Taylor  <iant@google.com>
7246
7247         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7248         using a version of gcc before 4.1.
7249         * configure: Rebuild.
7250
7251 2009-12-28  Chris Demetriou  <cgd@google.com>
7252
7253         * attributes.cc (Output_attributes_section_data::do_write): Use
7254         std::vector::front rather than std::vector::data.
7255
7256 2009-12-28  Ian Lance Taylor  <iant@google.com>
7257
7258         * symtab.h (class Symbol_table): Add enum Defined.
7259         * resolve.cc (Symbol_table::should_override): Add defined
7260         parameter.  Change all callers.  Test whether object is NULL
7261         before calling a method on it.
7262         (Symbol_table::report_resolve_problem): Add defined parameter.
7263         Change all callers.
7264         (Symbol_table::should_override_with_special): Likewise.
7265         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7266         parameter.  Change all callers.
7267         (Symbol_table::do_define_in_output_data): Likewise.
7268         (Symbol_table::define_in_output_segment): Likewise.
7269         (Symbol_table::do_define_in_output_segment): Likewise.
7270         (Symbol_table::define_as_constant): Likewise.
7271         (Symbol_table::do_define_as_constant): Likewise.
7272         * script.h (class Symbol_assignment): Add is_defsym parameter to
7273         constructor; change all callers.
7274         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7275         parameter.  Change all callers.  Add is_defsym_ field.
7276         (class Parser_closure): Add parsing_defsym parameter to
7277         constructor; change all callers.  Add parsing_defsym accessor
7278         function.  Add parsing_defsym_ field.
7279
7280 2009-12-28  Ian Lance Taylor  <iant@google.com>
7281
7282         * gold.cc (queue_middle_tasks): Fix formatting.
7283         * object.cc (Relobj::is_section_name_included): Likewise.
7284
7285 2009-12-23  Ian Lance Taylor  <iant@google.com>
7286
7287         * i386.cc (Target_i386::do_calls_non_split): Recognize
7288         -fsplit-stack prologue for a function with a static chain.
7289         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7290         -fsplit-stack prologue when using %r11.
7291
7292 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7293
7294         * options.cc (General_options::parse_version): Make -v continue and do
7295         the link like GNU ld does.
7296
7297 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7298
7299         * Makefile.am (CCFILES): Add timer.cc.
7300         (HFILES): Add timer.h.
7301         * configure.ac: Check for sysconf and times.
7302         * main.cc: include timer.h.
7303         (main): Use Timer instead of get_run_time.
7304         * timer.cc: New.
7305         * timer.h: New.
7306         * workqueue.cc: include timer.h.
7307         (Workqueue::find_and_run_task):
7308         Report user, sys and wall time.
7309         * Makefile.in: Regenerate.
7310         * config.in: Regenerate.
7311         * configure: Regenerate.
7312
7313 2009-12-16  Doug Kwan  <dougkwan@google.com>
7314
7315         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7316         sections.
7317         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7318         relaxed input sections.
7319         * output.cc (Output_section::find_relaxed_input_section): Change
7320         return type to Output_relaxed_input_section pointer.  Adjust code
7321         for new type of relaxed_input_section_map_.
7322         * output.h (Output_section::find_relaxed_input_section): Change
7323         return type to Output_relaxed_input_section pointer.
7324         (Output_section::Output_relaxed_input_section_by_input_section_map):
7325         New type.
7326         (Output_section::relaxed_input_section_map_): Change type to
7327         Output_section::Output_relaxed_input_section_by_input_section_map.
7328         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7329         input section.
7330
7331 2009-12-15  Ian Lance Taylor  <iant@google.com>
7332
7333         * layout.cc (Layout::create_shstrtab): Only write out after input
7334         sections if we are compressing debug sections.
7335
7336 2009-12-15  Ian Lance Taylor  <iant@google.com>
7337
7338         * archive.cc (Archive::add_symbols): Only look up a symbol without
7339         a version if there is, in fact, a version.
7340
7341 2009-12-14  Ian Lance Taylor  <iant@google.com>
7342
7343         Revert -Wshadow changes, all changes from:
7344         2009-12-11  Doug Kwan  <dougkwan@google.com>
7345         2009-12-11  Nick Clifton  <nickc@redhat.com>
7346         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7347
7348 2009-12-11  Doug Kwan  <dougkwan@google.com>
7349
7350         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7351         due to -Wshadow.
7352         * attributes.cc (Object_attribute::size): Ditto.
7353         (Attributes_section_data::size): Ditto.
7354         (Attributes_section_data::Attributes_section_data): Ditto.
7355         (Output_attributes_section_data::do_write): Ditto.
7356         * attributes.h (Object_attribute::set_type): Ditto.
7357         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7358
7359 2009-12-11  Nick Clifton  <nickc@redhat.com>
7360
7361         * archive.cc: Fix shadowed variable warnings.
7362         * arm.cc: Likewise.
7363         * compressed_output.cc: Likewise.
7364         * compressed_output.h: Likewise.
7365         * configure: Likewise.
7366         * dwarf_reader.cc: Likewise.
7367         * dynobj.cc: Likewise.
7368         * dynobj.h: Likewise.
7369         * ehframe.cc: Likewise.
7370         * ehframe.h: Likewise.
7371         * errors.cc: Likewise.
7372         * expression.cc: Likewise.
7373         * fileread.cc: Likewise.
7374         * fileread.h: Likewise.
7375         * freebsd.h: Likewise.
7376         * i386.cc: Likewise.
7377         * icf.cc: Likewise.
7378         * incremental.h: Likewise.
7379         * layout.cc: Likewise.
7380         * layout.h: Likewise.
7381         * mapfile.cc: Likewise.
7382         * merge.cc: Likewise.
7383         * merge.h: Likewise.
7384         * object.cc: Likewise.
7385         * object.h: Likewise.
7386         * options.h: Likewise.
7387         * output.cc: Likewise.
7388         * output.h: Likewise.
7389         * parameters.cc: Likewise.
7390         * plugin.cc: Likewise.
7391         * powerpc.cc: Likewise.
7392         * reduced_debug_output.cc: Likewise.
7393         * reduced_debug_output.h: Likewise.
7394         * reloc.cc: Likewise.
7395         * reloc.h: Likewise.
7396         * resolve.cc: Likewise.
7397         * script-sections.cc: Likewise.
7398         * script.cc: Likewise.
7399         * script.h: Likewise.
7400         * sparc.cc: Likewise.
7401         * symtab.cc: Likewise.
7402         * symtab.h: Likewise.
7403         * target-select.cc: Likewise.
7404         * target-select.h: Likewise.
7405         * token.h: Likewise.
7406         * workqueue.cc: Likewise.
7407         * workqueue.h: Likewise.
7408         * x86_64.cc: Likewise.
7409
7410 2009-12-10  Doug Kwan  <dougkwan@google.com>
7411
7412         * arm.cc (attributes.h): New include.
7413         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7414         (Arm_relobj::~Arm_relobj): Delete object pointed by
7415         attributes_section_data_.
7416         (Arm_relobj::attributes_section_data): New method definition.
7417         (Arm_relobj::attributes_section_data_): New data member declaration.
7418         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7419         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7420         attributes_section_data_.
7421         (Arm_dynobj::attributes_section_data): New method definition.
7422         (Arm_dynobj::attributes_section_data_): New data member declaration.
7423         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7424         initialization value of may_use_blx_ to false.
7425         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7426         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7427         object attributes to compute results instead of hard-coding.
7428         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7429         Target_arm::get_secondary_compatible_arch,
7430         Target_arm::set_secondary_compatible_arch
7431         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7432         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7433         New method declarations.
7434         (Target_arm::get_aeabi_object_attribute): New method definition.
7435         (Target_arm::attributes_section_data_): New data member declaration.
7436         (read_arm_attributes_section): New template definition.
7437         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7438         (Arm_dynobj::do_read_symbols): Ditto.
7439         (Target_arm::do_finalize_sections): Merge attributes sections from
7440         input.  Check for BLX use after attributes section merging.
7441         Fix __exidx_start and __exidx_end visibility.  Create an
7442         .ARM.attributes section if necessary.
7443         (Target_arm::get_secondary_compatible_arch,
7444         Target_arm::set_secondary_compatible_arch,
7445         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7446         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7447         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7448         New method definitions.
7449
7450 2009-12-09  Ian Lance Taylor  <iant@google.com>
7451
7452         * plugin.cc (Plugin::load): Don't cast from void* to a function
7453         pointer.
7454
7455 2009-12-09  Ian Lance Taylor  <iant@google.com>
7456
7457         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7458         information fields.
7459
7460 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7461
7462         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7463         Replace two_file_shared_1.so with two_file_shared_2.so.
7464         * testsuite/Makefile.in: Regenerated.
7465
7466 2009-12-08  Doug Kwan  <dougkwan@google.com>
7467
7468         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7469         (HFILES): Add attributes.h and int_encoding.h.
7470         * Makefile.in: Regenerate.
7471         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7472         function definitions to int_encoding.cc
7473         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7474         prototypes to int_encoding.h
7475         * reduced_debug_output.cc (int_encoding.h): New include.
7476         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7477         function definitions to int_encoding.cc
7478         (insert_into_vector, read_from_pointer): Move template definitions to
7479         int_encoding.h
7480         * attributes.cc: New file.
7481         * attributes.h: New file.
7482         * int_encoding.cc: New file.
7483         * int_encoding.h: New file.
7484
7485 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7486
7487         PR gold/11055
7488         * incremental-dump.cc (dump_incremental_inputs): New.
7489         (main): Use dump_incremental_inputs.
7490
7491 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7492
7493         PR gold/10893
7494         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7495         checking elfcpp::STT_FUNC.
7496         (Target_i386::Relocate::relocate): Likewise.
7497         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7498
7499         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7500         symbols from shared libraries into normal FUNC symbols.
7501
7502         * symtab.h (Symbol): Add is_func and use it.
7503
7504 2009-12-05  Doug Kwan  <dougkwan@google.com>
7505
7506         * arm.cc (Target_arm::arm_info): Initialize new fields
7507         attributes_section and attributes_vendor.
7508         * i386.cc (Target_i386::i386_info): Same.
7509         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7510         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7511         fields attributes_section and attributes_vendor.
7512         * sparc.cc (Target_sparc::sparc_info): Same.
7513         * target.h (Target::attributes_section, Target::attributes_vendor,
7514         Target::is_attributes_section, Target::attribute_arg_type,
7515         Target::attributes_order): New method definitions.
7516         (Target::Target_info::attributes_section,
7517         Target::Target_info::attributes_vendor): New fields.
7518         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7519         virtual method definitions.
7520         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7521         attributes_section and attributes_vendor.
7522         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7523
7524 2009-12-05  Doug Kwan  <dougkwan@google.com>
7525
7526         * arm.cc: Update comments about interworking and stub generation.
7527         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7528         considered as non-PIC.
7529         (Arm_relocate_functions::base_abs): Fix formatting.
7530         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7531         of function to use GOT entry address instead of offset.
7532         (Target_arm::Scan::global): Issue an error if a symbol would need a
7533         PLT does not get one because it is untyped.  Remove code to create
7534         dynamic symbols for relative branches.
7535         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7536         takes unsigned integer instead of boolean.
7537
7538 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7539
7540         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7541         (two_file_test_LDADD): Likewise.
7542         (common_test_1_LDADD): Likewise.
7543         (exception_test_LDADD) Likewise.
7544         (weak_test_LDADD): Likewise.
7545         (many_sections_test_LDADD): Likewise.
7546         (initpri1_LDADD): Likewise.
7547         (script_test_1_LDADD): Likewise.
7548         (script_test_2_LDADD): Likewise.
7549         (justsyms_LDADD): Likewise.
7550         (binary_test_LDADD): Likewise.
7551         (large_LDADD): Likewise.
7552         * testsuite/Makefile.in: Regenerated.
7553
7554 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7555
7556         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7557         (Symbol_table::override_with_special): Likewise.
7558         (Symbol_table::add_from_object): Likewise.
7559
7560 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7561
7562         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7563         Don't set the data_offset twice.
7564
7565 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7566
7567         * testsuite/Makefile.in: Regenerate.
7568
7569 2009-12-03  Doug Kwan  <dougkwan@google.com>
7570
7571         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7572         (Target_arm::do_finalize_sections): Add parameter for symbol table
7573         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7574         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7575         parameter for symbol table pointer.
7576         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7577         an additional parameter for a pointer to symbol table.
7578         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7579         parameter for a symbol table pointer.
7580         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7581         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7582         Ditto.
7583         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7584         parameter for a symbol table pointer.
7585
7586 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7587
7588         * incremental.cc (Incremental_inputs_header)
7589         (Incremental_inputs_header_write, Incremental_inputs_entry)
7590         (Incremental_inputs_entry_write): Move ...
7591         * incremental.h (Incremental_inputs_header)
7592         (Incremental_inputs_header_write, Incremental_inputs_entry)
7593         (Incremental_inputs_entry_write): here.
7594
7595 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7596
7597         * incremental.cc (make_sized_incremental_binary): Set the target.
7598         Error if it is incompatible.
7599         * output.h (Output_file): Add filename method.
7600
7601 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7602
7603         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7604         from the get_* methods.
7605
7606 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7607
7608         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7609         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7610         Write 0 for the data_offset of scripts.
7611
7612 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7613
7614         * testsuite/Makefile.am: Add the incremental_test.sh test.
7615         * testsuite/incremental_test.sh: New.
7616         * testsuite/incremental_test_1.c: New.
7617         * testsuite/incremental_test_2.c: New.
7618
7619 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7620
7621        * incremental-dump.cc (main): Fix typos.
7622
7623 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7624
7625         PR gold/11025
7626         * incremental-dump.cc (main): Use llu to print 64 bit values.
7627
7628 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7629             H.J. Lu  <hongjiu.lu@intel.com>
7630
7631         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7632         $(LIBDL).
7633         (incremental_dump_LDADD): Likewise.
7634         * Makefile.in: Regenerated.
7635
7636 2009-11-25  Doug Kwan  <dougkwan@google.com>
7637
7638         Revert:
7639
7640         2009-11-25  Doug Kwan  <dougkwan@google.com>
7641
7642                 * arm.cc (Target_arm::Target_arm): Move method definition
7643                 outside of class definition.  Add code to handle
7644                 --target1-rel, --target1-abs and --target2= options.
7645                 (Target_arm::get_reloc_reloc_type): Change method to be
7646                 non-static and const.
7647                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7648                 New data member declaration.
7649                 (Target_arm::Scan::local, Target_arm::Scan::global,
7650                 Target_arm::Relocate::relocate,
7651                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7652                 Adjust call to Target_arm::get_real_reloc_type.
7653                 (Target_arm::get_real_reloc_type): Use command line options
7654                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7655                 * options.h (--target1-rel, --target1-abs, --target2): New
7656                 ARM-only options.
7657
7658 2009-11-25  Doug Kwan  <dougkwan@google.com>
7659
7660         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7661         class definition.  Add code to handle --target1-rel, --target1-abs
7662         and --target2= options.
7663         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7664         and const.
7665         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7666         member declaration.
7667         (Target_arm::Scan::local, Target_arm::Scan::global,
7668         Target_arm::Relocate::relocate,
7669         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7670         call to Target_arm::get_real_reloc_type.
7671         (Target_arm::get_real_reloc_type): Use command line options to
7672         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7673         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7674         options.
7675
7676 2009-11-25  Doug Kwan  <dougkwan@google.com>
7677
7678         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7679         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7680         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7681         formatting.
7682         (Arm_relocate_functions::thm_call): Replace body with a call to
7683         Arm_relocate_functions::thumb_branch_common.
7684         (Arm_relocate_functions::thm_jump24,
7685         Arm_relocate_functions::thm_xpc22): New method definitions.
7686         (Arm_relocate_functions::thumb_branch_common): New method definition.
7687         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7688         operator.
7689         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7690         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7691
7692 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7693
7694         * Makefile.am: Build incremental-dump
7695         * Makefile.in: Regenerate.
7696         * incremental-dump.cc: New.
7697         * incremental.cc (Incremental_inputs_header_data,
7698         Incremental_inputs_entry_data): Move to incremental.h
7699         * incremental.h: (Incremental_inputs_header_data,
7700         Incremental_inputs_entry_data): Move from incremental.cc
7701
7702 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7703
7704         * incremental.cc (Incremental_inputs_header,
7705         Incremental_inputs_header_write, Incremental_inputs_entry,
7706         Incremental_inputs_entry_write): Add a typedef with the data type.
7707
7708 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7709
7710         * incremental.cc (Incremental_inputs_header,
7711         Incremental_inputs_header_write, Incremental_inputs_entry,
7712         Incremental_inputs_entry_write): Update comment about which
7713         type has the filed descriptions.
7714
7715 2009-11-15  Doug Kwan  <dougkwan@google.com>
7716
7717         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7718         (Arm_relocate_functions::arm_branch_common): Change method defintion
7719         in class definition to a method declaration and update list of formal
7720         parameters.
7721         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7722         Arm_relocation_functions::jump24): Adjust call to
7723         Arm_relocate_functions::arm_branch_common.  Update list of formal
7724         parameters.
7725         (Arm_relocate_functions::xpc25): New method definition.
7726         (Arm_relocate_functions::arm_branch_common): Move method defintion
7727         out from class definition.  Use stubs for mode-switching and extending
7728         branch ranges.
7729         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7730         specially.  Change code to enable use of stubs in ARM branches.
7731
7732 2009-11-10  Doug Kwan  <dougkwan@google.com>
7733
7734         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7735         in method declaration.
7736         (Target_arm::relocate_stub): New method declaration.
7737         (Target_arm::default_target): Change to return a pointer instead of
7738         a const reference.
7739         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7740         Target_arm::default_target.
7741         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7742         method definition.
7743         (Target_arm::relocate_section): Adjust view.
7744         (Target_arm::relocate_stub): New method definition.
7745
7746 2009-11-10  Doug Kwan  <dougkwan@google.com>
7747
7748         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7749         a format warning.
7750         * incremental.cc (open_incremental_binary): Initialized local
7751         variables to avoid warnings.
7752         * object.cc (make_elf_object): Ditto.
7753         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7754         a format warning.
7755
7756 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7757
7758         PR gold/10930
7759         * testsuite/plugin_test.c: Include "config.h".
7760
7761 2009-11-09  Doug Kwan  <dougkwan@google.com>
7762
7763         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7764         (arm_symbol_value): Remove.
7765         (Arm_relocate_functions::arm_branch_common,
7766         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7767         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7768         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7769         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7770         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7771         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7772         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7773         Arm_relocate_functions::thm_mobw_abs_nc,
7774         Arm_relocate_functions::thm_mov_abs,
7775         Arm_relocate_functions::movw_prel_nc,
7776         Arm_relocate_functions::thm_movt_abs,
7777         Arm_relocate_functions::movt_prel,
7778         Arm_relocate_functions::thm_movw_prel_nc,
7779         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7780         (Target_arm::Relocate::relocate): Only decompose address into two
7781         parts if relocation type uses the thumb-bit and pass the actual
7782         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7783         calls to methods in Arm_relocate_functions for this change.
7784
7785 2009-11-08  Ian Lance Taylor  <iant@google.com>
7786
7787         PR 10925
7788         * reloc.cc: Instantiate
7789         Sized_relobj::initialize_input_to_output_maps and
7790         Sized_relobj:free_input_to_output_maps.
7791
7792 2009-11-06  Ian Lance Taylor  <iant@google.com>
7793
7794         PR 10876
7795         * defstd.cc (in_segment): Set only_if_ref true for "end".
7796
7797 2009-11-06  Doug Kwan  <dougkwan@google.com>
7798
7799         * arm.cc (class Reloc_stub): Correct a comment.
7800         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7801         (Target_arm::scan_section_for_stubs): New method declaration.
7802         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7803         Change methods from private to protected.
7804         (Target_arm::do_may_relax): New method definition.
7805         (Target_arm::do_relax, Target_arm::group_sections,
7806         Target_arm::scan_reloc_for_stub,
7807         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7808         (Target_arm::arm_input_section_map_): New data member declaration.
7809         (Target_arm::scan_reloc_for_stub,
7810         Target_arm::scan_reloc_section_for_stubs,
7811         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7812         Target_arm::do_relax): New method definitions.
7813
7814 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7815
7816         * configure.ac: Check for (struct stat)::st_mtim
7817         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7818         * config.in: Regenerate.
7819         * configure: Regenerate.
7820
7821 2009-11-05  Ian Lance Taylor  <iant@google.com>
7822
7823         PR 10910
7824         * output.cc (Output_segment::add_output_section): Add missing
7825         return statement.
7826
7827 2009-11-04  Ian Lance Taylor  <iant@google.com>
7828
7829         PR 10880
7830         * object.h (class Object): Add is_needed and set_is_needed
7831         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7832         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7833         defined in a dynamic object and referenced by a regular object,
7834         set is_needed for the dynamic object.
7835         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7836         if the file is marked with as_needed and it is not needed.
7837
7838 2009-11-04  Ian Lance Taylor  <iant@google.com>
7839
7840         PR 10887
7841         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7842         tags if data is discarded by linker script.
7843         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7844         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7845         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7846         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7847
7848 2009-11-04  Ian Lance Taylor  <iant@google.com>
7849
7850         * layout.cc (Layout::get_output_section): Add is_interp and
7851         is_dynamic_linker_section parameters.  Change all callers.
7852         (Layout::choose_output_section): Likewise.
7853         (Layout::make_output_section): Likewise.
7854         (Layout::add_output_section_data): Add is_dynamic_linker_section
7855         parameter.  Change all callers.
7856         * layout.h (class Layout): Update declarations.
7857         * output.h (class Output_section): Add is_interp, set_is_interp,
7858         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7859         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7860         generate_code_fills_at_write_ to a bitfield.
7861         * output.cc (Output_section::Output_sections): Initialize new
7862         fields.
7863         (Output_segment::add_output_section): Add do_sort parameter.
7864         Change all callers.
7865
7866 2009-11-03  Ian Lance Taylor  <iant@google.com>
7867
7868         PR 10860
7869         * options.h (class General_options): Add --warn-common.
7870         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7871         merging two common symbols.
7872         (Symbol_table::should_override): Handle --warn-common when merging
7873         a common symbol with a defined symbol.  Use report_resolve_problem
7874         for multiple definitions.
7875         (Symbol_table::report_resolve_problem): New function.
7876         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7877
7878 2009-11-03  Doug Kwan  <dougkwan@google.com>
7879
7880         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7881         stub_factory_.
7882         (Target_arm::stub_factory): New method definition.
7883         (Target_arm::new_arm_input_section,
7884         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7885         Target_arm::reloc_uses_thumb_bit): New method declarations.
7886         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7887         New type definitions.
7888         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7889         member declarations.
7890         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7891         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7892         New method definitions.
7893
7894 2009-11-03  Ian Lance Taylor  <iant@google.com>
7895
7896         * options.h (class General_options): Add --warn_constructors.
7897
7898 2009-11-03  Ian Lance Taylor  <iant@google.com>
7899
7900         PR 10893
7901         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7902         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7903
7904 2009-11-03  Ian Lance Taylor  <iant@google.com>
7905
7906         PR 10895
7907         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7908         --msgid-bugs-address.
7909         (install-pdf): New target.
7910         (install-data_yes): Look up one directory to find mkinstalldirs.
7911
7912 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7913
7914         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7915         tree.
7916
7917 2009-10-30  Doug Kwan  <dougkwan@google.com>
7918
7919         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7920
7921 2009-10-30  Doug Kwan  <dougkwan@google.com>
7922
7923         * arm.cc (Stub_addend_reader): New struct template definition
7924         and partial specializations.
7925         (Stub_addend_reader::operator()): New method definition for a
7926         partially specialized template.
7927
7928 2009-10-30  Doug Kwan  <dougkwan@google.com>
7929
7930         * arm.cc (Arm_relobj::processor_specific_flags): New method
7931         definition.
7932         (Arm_relobj::do_read_symbols): New method declaration.
7933         (Arm_relobj::processor_specific_flags_): New data member declaration.
7934         (Arm_dynobj): New class definition.
7935         (Target_arm::do_finalize_sections): Add input_objects parameter.
7936         (Target_arm::do_adjust_elf_header): New method declaration.
7937         (Target_arm::are_eabi_versions_compatible,
7938         (Target_arm::merge_processor_specific_flags): New method declaration.
7939         (Target_arm::do_make_elf_object): New overloaded method definitions
7940         and declaration.
7941         (Arm_relobj::do_read_symbols): New method definition.
7942         (Arm_dynobj::do_read_symbols): Ditto.
7943         (Target_arm::do_finalize_sections): Add input_objects parameters.
7944         Merge processor-specific flags from all input objects.
7945         (Target_arm::are_eabi_versions_compatible,
7946         Target_arm::merge_processor_specific_flags,
7947         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7948         New method definitions.
7949         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7950         Input_objects pointer type parameter.
7951         * layout.cc (Layout::finalize): Pass input objects to target's.
7952         finalize_sections function.
7953         * output.cc (Output_file_header::do_sized_write): Set ELF file
7954         header's processor-specific flags.
7955         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7956         Input_objects pointer type parameter.
7957         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7958         * target.h (Input_objects): New forward class declaration.
7959         (Target::processor_specific_flags,
7960         Target::are_processor_specific_flags_sect): New method definitions.
7961         (Target::finalize_sections): Add input_objects parameter.
7962         (Target::Target): Initialize processor_specific_flags_ and
7963         are_processor_specific_flags_set_.
7964         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7965         parameter.
7966         (Target::set_processor_specific_flags): New method definition.
7967         (Target::processor_specific_flags_,
7968         Target::are_processor_specific_flags_set_): New data member
7969         declarations.
7970         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7971         Input_objects pointer type parameter.
7972
7973 2009-10-30  Doug Kwan  <dougkwan@google.com>
7974
7975         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7976
7977 2009-10-28  Ian Lance Taylor  <iant@google.com>
7978
7979         * object.h (class Relobj): Drop options parameter from
7980         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7981         do_scan_relocs, do_relocate.  Change all callers.
7982         (class Sized_relobj): Drop options parameters from
7983         do_gc_process_relocs, do_scan_relocs, do_relocate,
7984         do_relocate_sections, relocate_sections, emit_relocs_scan,
7985         emit_relocs_scan_reltype.  Change all callers.
7986         (struct Relocate_info): Remove options field and all references to
7987         it.
7988         * reloc.h (class Read_relocs): Remove options constructor
7989         parameter and options_ field.  Change all callers.
7990         (class Gc_process_relocs, class Scan_relocs): Likewise.
7991         (class Relocate_task): Likewise.
7992         * target-reloc.h (scan_relocs): Remove options parameter.  Change
7993         all callers.
7994         (scan_relocatable_relocs): Likewise.
7995         * target.h (class Sized_target): Remove options parameter from
7996         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
7997         all callers.
7998         * gc.h (gc_process_relocs): Remove options parameter.  Change all
7999         callers.
8000         * arm.cc: Update functions to remove options parameters.
8001         * i386.cc: Likewise.
8002         * powerpc.cc: Likewise.
8003         * sparc.cc: Likewise.
8004         * x86_64.cc: Likewise.
8005         * testsuite/testfile.cc: Likewise.
8006
8007 2009-10-28  Doug Kwan  <dougkwan@google.com>
8008
8009         * arm.cc (Arm_relobj): New class definition.
8010         (Arm_relobj::scan_sections_for_stubs,
8011         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8012         New method definitions.
8013
8014 2009-10-28  Cary Coutant  <ccoutant@google.com>
8015
8016         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8017         (Plugin::cleanup_done_): New member.
8018         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8019         (Plugin_manager::cleanup_done_): Remove.
8020         (Plugin_manager::add_input_file): Edit error message.
8021         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8022         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8023
8024 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8025
8026         * fileread.cc: (File_read::View::~View): Use the new
8027         data_ownership_ filed.
8028         (File_read::~File_read): Dispose the new whole_file_view_.
8029         (File_read::open): Mmap the whole file if needed.
8030         (File_read::open): Use whole_file_view_ instead of contents_.
8031         (File_read::find_view): Use whole_file_view_ if applicable.
8032         (File_read::do_read): Use whole_file_view_ instead of contents_.
8033         (File_read::make_view): Use whole_file_view_ instead of contents_,
8034         update File_read::View::View call.
8035         (File_read::find_or_make_view): Update File_read::View::View
8036         call.
8037         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8038         remove contents_
8039         (File_read::View::Data_ownership): New enum.
8040         (File_read::View::View): Replace bool mapped_ with Data_ownership
8041         argument.
8042         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8043         (File_read::View::data_ownership_): New field.
8044         (File_read::contents_): Remove (replaced by whole_file_view_).
8045         (File_read::whole_file_view_): New field.
8046         * options.h (class General_options): Add --keep-files-mapped.
8047
8048 2009-10-27  Cary Coutant  <ccoutant@google.com>
8049
8050         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8051         * testsuite/Makefile.am (plugin_test_5): New test case.
8052         * testsuite/Makefile.in: Regenerate.
8053
8054 2009-10-25  Doug Kwan  <dougkwan@google.com>
8055
8056         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8057         from private to protected to allow access by child class.
8058         (Sized_relobj::do_relocate_sections): New method declaration.
8059         (Sized_relobj::relocate_sections): Virtualize.
8060         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8061         Sized_relobj::relocate_sections.  Instantiate template explicitly
8062         for different target sizes and endianity.
8063
8064 2009-10-24  Doug Kwan  <dougkwan@google.com>
8065
8066         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8067         (Arm_input_section::as_arm_input_section): New method.
8068         (Arm_output_section): New class definition.
8069         (Arm_output_section::create_stub_group,
8070         Arm_output_section::group_sections): New method definitions.
8071
8072 2009-10-22  Doug Kwan  <dougkwan@google.com>
8073
8074         * arm.cc (Arm_input_section): New class definition.
8075         (Arm_input_section::init, Arm_input_section:do_write,
8076         Arm_input_section::set_final_data_size,
8077         Arm_input_section::do_reset_address_and_file_offset): New method
8078         definitions.
8079
8080 2009-10-21  Doug Kwan  <dougkwan@google.com>
8081
8082         * arm.cc (Stub_table, Arm_input_section): New forward class
8083         declarations.
8084         (Stub_table): New class defintion.
8085         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8086         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8087         New method definition.
8088
8089 2009-10-21  Doug Kwan  <dougkwan@google.com>
8090
8091         * arm.cc: Update copyright comments.
8092         (Target_arm): New forward class template declaration.
8093         (Arm_address): New type.
8094         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8095         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8096         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8097         constants.
8098         (Insn_template): Same.
8099         (DEF_STUBS): New macro.
8100         (Stub_type): New enum type.
8101         (Stub_template): New class definition.
8102         (Stub): Same.
8103         (Reloc_stub): Same.
8104         (Stub_factory): Same.
8105         (Target_arm::Target_arm): Initialize may_use_blx_ and
8106         should_force_pic_veneer_.
8107         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8108         Target_arm::should_force_pic_veneer,
8109         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8110         Target_arm::using_thumb_only, Target_arm:;default_target): New
8111         method defintions.
8112         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8113         New data member declarations.
8114         (Insn_template::size, Insn_template::alignment): New method defintions.
8115         (Stub_template::Stub_template): New method definition.
8116         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8117         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8118         (Stub_factory::Stub_factory): New method definition.
8119         * gold.h (string_hash): New template.
8120         * output.h (Input_section_specifier::hash_value): Use
8121         gold::string_hash.
8122         (Input_section_specifier::string_hash): Remove.
8123         * stringpool.cc (Stringpool_template::string_hash): Use
8124         gold::string_hash.
8125
8126 2009-10-20  Doug Kwan  <dougkwan@google.com>
8127
8128         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8129         symbols of relaxed input sections.
8130         * output.h (Output_section::find_relaxed_input_section): Make
8131         method public.
8132
8133 2009-10-16  Doug Kwan  <dougkwan@google.com>
8134
8135         * dynobj.cc (Versions::Versions): Initialize version_script_.
8136         Only insert base version symbol definition for a shared object
8137         if version script defines any version versions.
8138         (Versions::define_base_version): New method definition.
8139         (Versions::add_def): Check that base version is not needed.
8140         (Versions::add_need): Define base version lazily.
8141         * dynobj.h (Versions::define_base_version): New method declaration.
8142         (Versions::needs_base_version_): New data member declaration.
8143         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8144         (check_DATA): Add no_version_test.stdout.
8145         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8146         New make rules.
8147         * testsuite/Makefile.in: Regenerate.
8148         * testsuite/no_version_test.c: New file.
8149         * testsuite/no_version_test.sh: Ditto.
8150
8151 2009-10-16  Doug Kwan  <dougkwan@google.com>
8152
8153         * expression.cc (class Segment_start_expression): New class definition.
8154         (Segment_start_expression::value): New method definition.
8155         (script_exp_function_segment_start): Return a new
8156         Segment_start_expression.
8157         * gold/script-c.h (script_saw_segment_start_expression): New function
8158         prototype.
8159         * script-sections.cc (Script_sections::Script_sections): Initialize
8160         SAW_SEGMENT_START_EXPRESSION_ to false.
8161         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8162         and -Tbbs options to specify section addresses if given in
8163         command line and no SEGMENT_START expression is seen in a script.
8164         * script-sections.h (Script_sections::saw_segment_start_expression,
8165         Script_sections::set_saw_segment_start_expression): New method
8166         definition.
8167         (Script_sections::saw_segment_start_expression_): New data member
8168         declaration.
8169         * script.cc (script_saw_segment_start_expression): New function.
8170         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8171         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8172         script_test_7.sh and script_test_8.sh.
8173         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8174         script_test_8.stdout.
8175         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8176         (script_test_6, script_test_6.stdout, script_test_7,
8177         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8178         * Makefile.in: Regenerate.
8179         * testsuite/script_test_6.sh: New file.
8180         * testsuite/script_test_6.t: Same.
8181         * testsuite/script_test_7.sh: Same.
8182         * testsuite/script_test_7.t: Same.
8183         * testsuite/script_test_8.sh: Same.
8184
8185 2009-10-16  Doug Kwan  <dougkwan@google.com>
8186
8187         * output.cc (Output_segment::set_section_list_address): Cast
8188         expressions to unsigned long long type to avoid format warnings.
8189
8190 2009-10-15  Ian Lance Taylor  <iant@google.com>
8191
8192         * script.cc (Script_options::add_symbol_assignment): Always add a
8193         dot assignment to script_sections_.
8194         * script-sections.cc (Script_sections::add_dot_assignment):
8195         Initialize if necessary.
8196
8197         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8198         program headers with no load segment if there is a linker script.
8199
8200         * layout.cc (Layout::set_segment_offsets): Align the file offset
8201         to the segment aligment for -N or -n with no load segment.
8202         * output.cc (Output_segment::add_output_section): Don't crash if
8203         the first section is a TLS section.
8204         (Output_segment::set_section_list_addresses): Print an error
8205         message if the address moves backward in a linker script.
8206         * script-sections.cc
8207         (Output_section_element_input::set_section_addresses): Don't
8208         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8209         (Orphan_output_section::set_section_addresses): Likewise.
8210
8211 2009-10-15  Doug Kwan  <dougkwan@google.com>
8212
8213         * layout.cc (Layout::finish_dynamic_section): Generate tags
8214         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8215         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8216         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8217
8218 2009-10-14  Ian Lance Taylor  <iant@google.com>
8219
8220         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8221         fields.
8222         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8223         data_shdr fields of relinfo.
8224         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8225         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8226         R_386_TLS_LDO_32, adjust based on section flags.
8227         (Target_i386::Relocate::fix_up_ldo): Remove.
8228
8229 2009-10-13  Ian Lance Taylor  <iant@google.com>
8230
8231         Add support for -pie.
8232         * options.h (class General_options): Add -pie and
8233         --pic-executable.
8234         (General_options::output_is_position_independent): Test -pie.
8235         (General_options::output_is_executable): Return true if not shared
8236         and not relocatable.
8237         (General_options::output_is_pie): Remove.
8238         * options.cc (General_options::finalize): Reject incompatible uses
8239         of -pie.
8240         * gold.cc (queue_middle_tasks): A -pie link is not static.
8241         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8242         * symtab.cc (Symbol::final_value_is_known): Return false if
8243         output_is_position_independent.
8244         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8245         output_is_position_independent.
8246         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8247         output_is_position_independent.
8248         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8249         output_is_position_independent.
8250         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8251         two_file_pie_test.
8252         (basic_pie_test.o, basic_pie_test): New targets.
8253         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8254         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8255         (two_file_pie_test): New target.
8256         * testsuite/Makefile.in: Rebuild.
8257         * README: Remove note saying that -pie is not supported.
8258
8259 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8260
8261         * options.h (class General_options): Add -init and -fini.
8262         * layout.cc (Layout::finish_dynamic_section): Emit
8263         given init and fini functions.
8264
8265 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8266
8267         * gc.h (gc_process_relocs): Check if icf is enabled using new
8268         function.
8269         * gold.cc (queue_initial_tasks): Likewise.
8270         (queue_middle_tasks): Likewise.
8271         * object.cc (do_layout): Likewise.
8272         * symtab.cc (is_section_folded): Likewise.
8273         * main.cc (main): Likewise.
8274         * reloc.cc (Read_relocs::run): Likewise.
8275         (Sized_relobj::do_scan_relocs): Likewise.
8276         * icf.cc (is_function_ctor_or_dtor): New function.
8277         (Icf::find_identical_sections): Check if function is ctor or dtor when
8278         safe icf is chosen.
8279         * options.h (General_options::icf): Change option to be an enum.
8280         (Icf_status): New enum.
8281         (icf_enabled): New method.
8282         (icf_safe_folding): New method.
8283         (set_icf_status): New method.
8284         (icf_status_): New variable.
8285         * (options.cc) (General_options::finalize): Set icf_status_.
8286         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8287         icf_test and icf_keep_unique_test to use the --icf enum flag.
8288         * testsuite/icf_safe_test.sh: New file.
8289         * testsuite/icf_safe_test.cc: New file.
8290
8291 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8292
8293         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8294         includes to gc.h and icf.h.
8295         * arm.cc: Include gc.h.
8296         * gold.cc: Likewise.
8297         * i386.cc: Likewise.
8298         * powerpc.cc: Likewise.
8299         * sparc.cc: Likewise.
8300         * x86_64.cc: Likewise.
8301         * gc.h: Include icf.h.
8302
8303 2009-10-11  Ian Lance Taylor  <iant@google.com>
8304
8305         * plugin.cc: Include "gold.h" before other header files.
8306
8307 2009-10-10  Chris Demetriou  <cgd@google.com>
8308
8309         * options.h (Input_file_argument::Input_file_type): New enum.
8310         (Input_file_argument::is_lib_): Replace with...
8311         (Input_file_argument::type_): New member.
8312         (Input_file_argument::Input_file_argument): Take Input_file_type
8313         'type' rather than boolean 'is_lib' as second argument.
8314         (Input_file_argument::is_lib): Use type_.
8315         (Input_file_argument::is_searched_file): New function.
8316         (Input_file_argument::may_need_search): Handle is_searched_file.
8317         * options.cc (General_options::parse_library): Support -l:filename.
8318         (General_options::parse_just_symbols): Update for Input_file_argument
8319         changes.
8320         (Command_line::process): Likewise.
8321         * archive.cc (Archive::get_file_and_offset): Likewise.
8322         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8323         * script.cc (read_script_file, script_add_file): Likewise.
8324         * fileread.cc (Input_file::Input_file): Likewise.
8325         (Input_file::will_search_for): Handle is_searched_file.
8326         (Input_file::open): Likewise.
8327         * readsyms.cc (Read_symbols::get_name): Likewise.
8328         * testsuite/Makefile.am (searched_file_test): New test.
8329         * testsuite/Makefile.in: Regenerate.
8330         * testsuite/searched_file_test.cc: New file.
8331         * testsuite/searched_file_test_lib.cc: New file.
8332
8333 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8334             Ian Lance Taylor  <iant@google.com>
8335
8336         * descriptor.cc: Include <cstdio> and "binary-io.h".
8337         (Descriptors::open): Open the files in binary mode always.
8338         * script.cc (Lex::get_token): Treat \r as whitespace.
8339
8340 2009-10-09  Ian Lance Taylor  <iant@google.com>
8341
8342         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8343
8344 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8345             Ian Lance Taylor  <iant@google.com>
8346
8347         * configure.ac: Check for readv function also.
8348         * fileread.cc (readv): Define if not HAVE_READV.
8349         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8350         does not exist.
8351         * config.in: Regenerate.
8352         * configure: Regenerate.
8353
8354 2009-10-09  Doug Kwan  <dougkwan@google.com>
8355
8356         * layout.cc (Layout::make_output_section): Call target hook to make
8357         ordinary output section.
8358         (Layout::finalize): Adjust parameter list of call the
8359         Target::may_relax().
8360         * layout.h (class Layout::section_list): New method.
8361         * merge.h (Output_merge_base::entsize): Change visibility to public.
8362         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8363         New methods.
8364         (Output_merge_string::do_is_string): New method.
8365         * object.cc (Sized_relobj::do_setup): renamed from
8366         Sized_relobj::set_up.
8367         * object.h (Sized_relobj::adjust_shndx,
8368         Sized_relobj::initializ_input_to_output_maps,
8369         Sized_relobj::free_input_to_output_maps): Change visibilities to
8370         protected.
8371         (Sized_relobj::setup): Virtualize.
8372         (Sized_relobj::do_setup): New method declaration.
8373         (Sized_relobj::invalidate_section_offset,
8374         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8375         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8376         * options.cc (parse_int): New function.
8377         * options.h (parse_int): New declaration.
8378         (DEFINE_int): New macro.
8379         (stub_group_size): New option.
8380         * output.cc (Output_section::Output_section): Initialize memebers
8381         merge_section_map_, merge_section_by_properties_map_,
8382         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8383         (Output_section::add_input_section): Handled deferred code-fill
8384         generation and remove an old comment.
8385         (Output_section::add_relaxed_input_section): New method definition.
8386         (Output_section::add_merge_input_section): Use merge section by
8387         properties map to speed to search.  Update merge section maps
8388         as appropriate.
8389         (Output_section::build_relaxation_map): New method definition.
8390         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8391         Same.
8392         (Output_section::relax_input_section): Renamed to
8393         Output_section::convert_input_sections_to_relaxed_sections and change
8394         interface to take a vector of pointers to relaxed sections.
8395         (Output_section::find_merge_section,
8396         Output_section::find_relaxed_input_section): New method definitions.
8397         (Output_section::is_input_address_mapped,
8398         Output_section::output_offset, Output_section::output_address):
8399         Use output section data maps to speed up searching.
8400         (Output_section::find_starting_output_address): Add comments.
8401         (Output_section::do_write,
8402         Output_section::write_to_postprocessing_buffer): Do code-fill
8403         generation as appropriate.
8404         (Output_section::get_input_sections): Invalidate relaxed input section
8405         map.
8406         (Output_section::restore_states): Adjust type of checkpoint .
8407         Invalidate relaxed input section map.
8408         * output.h (Output_merge_base): New class declaration.
8409         (Input_section_specifier): New class defintion.
8410         (class Output_relaxed_input_section) Change base class to
8411         Output_section_data_build.
8412         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8413         base class initializer.
8414         (Output_section::add_relaxed_input_section): New method declaration.
8415         (Output_section::Input_section): Change visibility to protected.
8416         (Output_section::Input_section::relobj,
8417         Output_section::Input_section::shndx): Handle relaxed input sections.
8418         Output_section::input_sections) Change visibility to protected.  Also
8419         define overload to return a non-const pointer.
8420         (Output_section::Merge_section_properties): New class defintion.
8421         (Output_section::Merge_section_by_properties_map,
8422         Output_section::Output_section_data_by_input_section_map,
8423         Output_section::Relaxation_map): New types.
8424         (Output_section::relax_input_section): Rename method to
8425         Output_section::convert_input_sections_to_relaxed_sections and change
8426         interface to take a vector of relaxed section pointers.
8427         (Output_section::find_merge_section,
8428         Output_section::find_relaxed_input_section,
8429         Output_section::build_relaxation_map,
8430         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8431         New method declarations.
8432         (Output_section::merge_section_map_
8433         Output_section::merge_section_by_properties_map_,
8434         Output_section::relaxed_input_section_map_,
8435         Output_section::is_relaxed_input_section_map_valid_,
8436         Output_section::generate_code_fills_at_write_): New data members.
8437         * script-sections.cc
8438         (Output_section_element_input::set_section_addresses): Call
8439         current_data_size and addralign methods of relaxed input sections.
8440         (Orphan_output_section::set_section_addresses): Call current_data_size
8441         and addralign methods of relaxed input sections.
8442         * symtab.cc (Symbol_table::compute_final_value): Extract template
8443         from the body of Symbol_table::sized_finalize_symbol.
8444         (Symbol_table::sized_finalized_symbol): Call
8445         Symbol_table::compute_final_value.
8446         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8447         (Symbol_table::compute_final_value): New templated method declaration.
8448         * target.cc (Target::do_make_output_section): New method defintion.
8449         * target.h (Target::make_output_section): New method declaration.
8450         (Target::relax): Add more parameters for input objects, symbol table
8451         and layout.  Adjust call to do_relax.
8452         (Target::do_make_output_section): New method declaration.
8453         (Target::do_relax): Add parameters for input objects, symbol table
8454         and layout.
8455
8456 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8457
8458         * pread.c: Include stdio.h.
8459
8460 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8461
8462         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8463         defined.
8464
8465 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8466
8467         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8468         Change read_shndx type to unsigned int.
8469         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8470         int.
8471         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8472         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8473         Change read_shndx type to unsigned int.
8474         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8475         int.
8476         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8477         * layout.cc (Layout::create_symtab_sections): Cast the result of
8478         local_symcount * symsize to off_t in the gold_assert.
8479
8480 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8481
8482         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8483         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8484         R_ARM_BASE_ABS.
8485         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8486         (Arm_relocate_functions::thm_abs5): New function.
8487         (Arm_relocate_functions::abs12): New function.
8488         (Arm_relocate_functions::abs16): New function.
8489         (Arm_relocate_functions::base_abs): New function.
8490         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8491         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8492         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8493         R_ARM_BASE_ABS.
8494         (Scan::global): Likewise.
8495         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8496         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8497         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8498         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8499         R_ARM_BASE_ABS.
8500
8501 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8502
8503         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8504         (Arm_relocate_functions::movt_prel): New function.
8505         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8506         (Arm_relocate_functions::thm_movt_prel): New function.
8507         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8508         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8509         (Scan::global, Relocate::relocate): Likewise.
8510         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8511
8512 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8513
8514         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8515         Incremental_checker.
8516         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8517         unsigned int.
8518         (class Incremental_inputs_header): New class.
8519         (Incremental_inputs_header_writer): Edit comment.
8520         (Incremental_inputs_entry): New class.
8521         (Incremental_inputs_entry_writer): Edit comment.
8522         (Sized_incremental_binary::do_find_incremental_inputs_section):
8523         Add *strtab_shndx parameter, fill it.
8524         (Sized_incremental_binary::do_check_inputs): New method.
8525         (Incremental_checker::can_incrementally_link_output_file): Use
8526         Sized_incremental_binary::check_inputs.
8527         (Incremental_inputs::report_command_line): Save command line in
8528         command_line_.
8529         * incremental.h:
8530         (Incremental_binary::find_incremental_inputs_section): New
8531         method.
8532         (Incremental_binary::do_find_incremental_inputs_section): Add
8533         strtab_shndx parameter.
8534         (Incremental_binary::do_check_inputs): New pure virtual method.
8535         (Sized_incremental_binary::do_check_inputs): Declare.
8536         (Incremental_checker::Incremental_checker): Add incremental_inputs
8537         parameter, use it to initialize incremental_inputs_.
8538         (Incremental_checker::incremental_inputs_): New field.
8539         (Incremental_checker::command_line): New method.
8540         (Incremental_checker::inputs): New method.
8541         (Incremental_checker::command_line_): New field.
8542
8543 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8544
8545         * incremental.cc: Include <cstdarg> and "target-select.h".
8546         (vexplain_no_incremental): New function.
8547         (explain_no_incremental): New function.
8548         (Incremental_binary::error): New method.
8549         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8550         method.
8551         (make_sized_incremental_binary): New function.
8552         (open_incremental_binary): New function.
8553         (can_incrementally_link_file): Add checks if output is ELF and has
8554         inputs section.
8555         * incremental.h: Include "elfcpp_file.h" and "output.h".
8556         (Incremental_binary): New class.
8557         (Sized_incremental_binary): New class.
8558         (open_incremental_binary): Declare.
8559         * object.cc (is_elf_object): Use
8560         elfcpp::Elf_recognizer::is_elf_file.
8561         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8562         * output.h (Output_file::filesize): New method.
8563
8564 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8565
8566         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8567         New function.
8568         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8569         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8570         function.
8571         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8572         function.
8573         (Arm_relocate_functions::movw_abs_nc): New function.
8574         (Arm_relocate_functions::movt_abs): New function.
8575         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8576         (Arm_relocate_functions::thm_movt_abs): New function.
8577         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8578         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8579         (Scan::global): Likewise.
8580         (Relocate::relocate): Likewise.
8581         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8582
8583 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8584
8585         * arm.cc (Arm_relocate_functions::got_prel) New function.
8586         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8587         (Relocate::relocate): Likewise.
8588         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8589
8590 2009-10-06  Ian Lance Taylor  <iant@google.com>
8591
8592         * options.h (class General_options): Define
8593         split_stack_adjust_size parameter.
8594         * object.h (class Object): Add uses_split_stack_ and
8595         has_no_split_stack_ fields.  Add uses_split_stack and
8596         has_no_split_stack accessor functions.  Declare
8597         handle_split_stack_section.
8598         (class Reloc_symbol_changes): Define.
8599         (class Sized_relobj): Define Function_offsets.  Declare
8600         split_stack_adjust, split_stack_adjust_reltype, and
8601         find_functions.
8602         * object.cc (Object::handle_split_stack_section): New function.
8603         (Sized_relobj::do_layout): Call handle_split_stack_section.
8604         * dynobj.cc (Sized_dynobj::do_layout): Call
8605         handle_split_stack_section.
8606         * reloc.cc (Sized_relobj::relocate_sections): Call
8607         split_stack_adjust for executable sections in split_stack
8608         objects.  Pass reloc_map to relocate_section.
8609         (Sized_relobj::split_stack_adjust): New function.
8610         (Sized_relobj::split_stack_adjust_reltype): New function.
8611         (Sized_relobj::find_functions): New function.
8612         * target-reloc.h: Include "object.h".
8613         (relocate_section): Add reloc_symbol_changes parameter.  Change
8614         all callers.
8615         * target.h (class Target): Add calls_non_split method.  Declare
8616         do_calls_non_split virtual method.  Declare match_view and
8617         set_view_to_nop.
8618         * target.cc: Include "elfcpp.h".
8619         (Target::do_calls_non_split): New function.
8620         (Target::match_view): New function.
8621         (Target::set_view_to_nop): New function.
8622         * gold.cc (queue_middle_tasks): Give an error if mixing
8623         split-stack and non-split-stack objects with -r.
8624         * i386.cc (Target_i386::relocate_section): Add
8625         reloc_symbol_changes parameter.
8626         (Target_i386::do_calls_non_split): New function.
8627         * x86_64.cc (Target_x86_64::relocate_section): Add
8628         reloc_symbol_changes parameter.
8629         (Target_x86_64::do_calls_non_split): New function.
8630         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8631         parameter.
8632         * powerpc.cc (Target_powerpc::relocate_section): Add
8633         reloc_symbol_changes parameter.
8634         * sparc.cc (Target_sparc::relocate_section): Add
8635         reloc_symbol_changes parameter.
8636         * configure.ac: Call AM_CONDITIONAL for the default target.
8637         * configure: Rebuild.
8638         * testsuite/Makefile.am (TEST_AS): New variable.
8639         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8640         (check_DATA): Add split_i386 and split_x86_64 files.
8641         (SPLIT_DEFSYMS): Define.
8642         (split_i386_[1234n].o): New targets.
8643         (split_i386_[124]): New targets.
8644         (split_i386_[1234r].stdout): New targets.
8645         (split_x86_64_[1234n].o): New targets.
8646         (split_x86_64_[124]): New targets.
8647         (split_x86_64_[1234r].stdout): New targets.
8648         (MOSTLYCLEANFILES): Add new executables.
8649         * testsuite/split_i386.sh: New file.
8650         * testsuite/split_x86_64.sh: New file.
8651         * testsuite/split_i386_1.s: New file.
8652         * testsuite/split_i386_2.s: New file.
8653         * testsuite/split_i386_3.s: New file.
8654         * testsuite/split_i386_4.s: New file.
8655         * testsuite/split_i386_n.s: New file.
8656         * testsuite/split_x86_64_1.s: New file.
8657         * testsuite/split_x86_64_2.s: New file.
8658         * testsuite/split_x86_64_3.s: New file.
8659         * testsuite/split_x86_64_4.s: New file.
8660         * testsuite/split_x86_64_n.s: New file.
8661         * testsuite/testfile.cc (Target_test): Update relocation_section
8662         function.
8663         * testsuite/Makefile.in: Rebuild.
8664
8665 2009-10-06  Ian Lance Taylor  <iant@google.com>
8666
8667         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8668         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8669         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8670         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8671         the address on ldo_addrs_.
8672         (Target_i386::Relocate::fix_up_ldo): New function.
8673
8674 2009-10-06   Rafael Espindola  <espindola@google.com>
8675
8676         * plugin.cc (add_input_library): New.
8677         (Plugin::load): Add add_input_library to tv.
8678         (Plugin_manager::add_input_file): Add the is_lib argument.
8679         (add_input_file): Update call to Plugin_manager::add_input_file.
8680         (add_input_library): New.
8681         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8682
8683 2009-09-30  Doug Kwan  <dougkwan@google.com>
8684
8685         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8686         symbol and call Symbol::may_need_copy_reloc to determine if
8687         a copy reloc is needed.
8688         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8689         nocopyreloc is given in command line.
8690         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8691         given in command line.
8692         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8693         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8694         of the removed Target_i386::may_need_copy_reloc.
8695         * options.h (copyreloc): New option with default value false.
8696         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8697         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8698         instead of the removed Target_powerpc::may_need_copy_reloc.
8699         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8700         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8701         instead of the removed Target_sparc::may_need_copy_reloc.
8702         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8703         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8704         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8705         instead of the removed Target_x86_64::may_need_copy_reloc.
8706
8707 2009-09-30  Ian Lance Taylor  <iant@google.com>
8708
8709         * object.h (class Object): Remove target_ field, and target,
8710         sized_target, and set_target methods.
8711         (Object::sized_target): Remove.
8712         (class Sized_relobj): Update declarations.  Remove sized_target.
8713         * object.cc (Sized_relobj::setup): Remove target parameter.
8714         Change all callers.
8715         (Input_objects::add_object): Don't do anything with the target.
8716         (make_elf_sized_object): Add punconfigured parameter.  Change all
8717         callers.  Set or test parameter target.
8718         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8719         Change all callers.
8720         * parameters.cc (Parameters::set_target): Change parameter type to
8721         be non-const.
8722         (Parameters::default_target): Remove.
8723         (set_parameters_target): Change parameter type to be non-const.
8724         (parameters_force_valid_target): New function.
8725         (parameters_clear_target): New function.
8726         * parameters.h (class Parameters): Update declarations.  Remove
8727         default_target method.  Add sized_target and clear_target
8728         methods.  Change target_ to be non-const.
8729         (set_parameters_target): Update declaration.
8730         (parameters_force_valid_target): Declare.
8731         (parameters_clear_target): Declare.
8732         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8733         as NULL if we aren't searching.
8734         (Add_symbols::run): Don't check for compatible target.
8735         * fileread.cc (Input_file::open_binary): Call
8736         parameters_force_valid_target.
8737         * gold.cc (queue_middle_tasks): Likewise.
8738         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8739         set_target on object.
8740         * dynobj.h (class Sized_dynobj): Update declarations.
8741         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8742         make_elf_object returns NULL.
8743         (Archive::include_member): Don't check whether object target is
8744         compatible.
8745         * output.cc (Output_section::add_input_section): Get target from
8746         parameters.
8747         (Output_section::relax_input_section): Likewise.
8748         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8749         parameters.
8750         (Sized_relobj::do_scan_relocs): Likewise.
8751         (Sized_relobj::relocate_sections): Likewise.
8752         * resolve.cc (Symbol_table::resolve): Likewise.
8753         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8754         parameter.  Change all callers.
8755         (Symbol_table::add_from_object): Get target from parameters.
8756         (Symbol_table::add_from_relobj): Don't check object target.
8757         (Symbol_table::add_from_dynobj): Likewise.
8758         (Symbol_table::define_special_symbol): Get target from
8759         parameters.
8760         * symtab.h (class Symbol_table): Update declaration.
8761         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8762         parameter.  Change all callers.  Clear parameter target.
8763         (Binary_test): Test target here.
8764         * testsuite/object_unittest.cc (gold_testsuite): Remove
8765         target_test_pointer parameter.  Change all callers.
8766         (Object_test): Test target here.
8767
8768 2009-09-26  Ian Lance Taylor  <iant@google.com>
8769
8770         * testsuite/initpri1.c: Don't try to use constructor priorities if
8771         compiling with gcc before 4.3.
8772
8773 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8774
8775         * testsuite/retain_symbols_file_test.sh (check_present): Change
8776         output file name to retain_symbols_file_test.stdout.
8777         (check_absent): Likewise.
8778
8779 2009-09-18  Craig Silverstein  <csilvers@google.com>
8780
8781         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8782         * options.cc: Include <cerrno> and <fstream>.
8783         (General_options::finalize): Parse -retain-symbols-file tag.
8784         * options.h: New flag.
8785         (General_options): New method should_retain_symbol, new
8786         variable symbols_to_retain.
8787         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8788         should_retain_symbol map.
8789         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8790         * testsuite/Makefile.in: Regenerate.
8791         * testsuite/retain_symbols_file_test.sh: New file.
8792
8793 2009-09-18  Nick Clifton  <nickc@redhat.com>
8794
8795         * po/es.po: Updated Spanish translation.
8796
8797 2009-09-17  Doug Kwan  <dougkwan@google.com>
8798
8799         * debug.h (DEBUG_RELAXATION): New constant.
8800         (DEBUG_ALL): Add DEBUG_RELAXATION.
8801         (debug_string_to_enum): Add relaxation debug option.
8802         * layout.cc
8803         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8804         Layout::Relaxation_debug_check::read_sections,
8805         Layout::Relaxation_debug_check::read_sections): New method definitions.
8806         (Layout::Layout): Initialize data members
8807         record_output_section_data_from_scrips_,
8808         script_output_section_data_list_ and relaxation_debug_check_.
8809         (Layout::save_segments, Layout::restore_segments,
8810         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8811         Layout::relaxation_loop_body): New method definitions.
8812         (Layout::finalize): Support relaxation.  Move section layout code to
8813         Layout::relaxation_loop_body.
8814         (Layout::set_asection_address_from_script): Move code for orphan
8815         section placement out.
8816         (Layout::place_orphan_sections_in_script): New method definition.
8817         * layout.h (Output_segment_headers, Output_file_header):
8818         New forward class declarations.
8819         (Layout::~Layout): Define.
8820         (Layout::new_output_section_data_from_script): New method definition.
8821         (Layout::place_orphan_sections_in_script): New method declaration.
8822         (Layout::Segment_states): New type declaration.
8823         (Layout::save_segments, Layout::restore_segments,
8824         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8825         Layout::relaxation_loop_body): New method declarations.
8826         (Layout::Output_section_data_list): New type declaration.
8827         (Layout::Relaxation_debug_check): New class definition.
8828         (Layout::record_output_section_data_from_script_,
8829         Layout::script_output_section_data_list_, Layout::segment_states_,
8830         Layout::relaxation_debug_check_): New data members.
8831         * output.cc: (Output_section_headers::do_size): New method definition.
8832         (Output_section_headers::Output_section_headers): Move size
8833         computation to Output_section_headers::do_size.
8834         (Output_segment_headers::do_size): New method definition.
8835         (Output_file_header::Output_file_header): Move size computation to
8836         Output_file_header::do_size and call it.
8837         (Output_file_header::do_size): New method definition.
8838         (Output_data_group::Output_data_group): Adjust call to
8839         Output_section_data.
8840         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8841         (Output_symtab_xindex::do_write): Add array bound check.
8842         (Output_section::Input_section::print_to_mapfile): Handle
8843         RELAXED_INPUT_SECTION_CODE.
8844         (Output_section::Output_section): Initialize data member checkpoint_.
8845         (Output_section::~Output_section): Delete checkpoint object pointed
8846         by checkpoint_.
8847         (Output_section::add_input_section): Always add an Input_section if
8848         relaxing.
8849         (Output_section::add_merge_input_section): Add assert.
8850         (Output_section::relax_input_section): New method definition.
8851         (Output_section::set_final_data_size): Set load address to zero for
8852         an unallocated section.
8853         (Output_section::do_address_and_file_offset_have_reset_values):
8854         New method definition.
8855         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8856         Handle relaxed input section.
8857         (Output_section::sort_attached_input_sections): Checkpoint input
8858         section list lazily.
8859         (Output_section::get_input_sections): Change type of input_sections to
8860         list of Simple_input_section pointers.  Checkpoint input section list
8861         lazily.  Also handle relaxed input sections.
8862         (Output_section::add_input_section_for_script): Take a reference to
8863         a Simple_input_section object instead of Relobj pointer and section
8864         index as parameter.  Handle relaxed input sections.
8865         (Output_section::save_states, Output_section::restore_states): New
8866         method definitions.
8867         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8868         (Output_data::is_data_size_fixed): New method definition.
8869         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8870         if it is fixed.
8871         (Output_data::address_and_file_offset_have_reset_values): New method
8872         definition.
8873         (Output_data::do_address_and_file_offset_have_reset_values): New method
8874         definition.
8875         (Output_data::set_data_size): Check that data size is not fixed.
8876         (Output_data::fix_data_size): New method definition.
8877         (Output_data::is_data_size_fixed_): New data member.
8878         (Output_section_headers::set_final_data_size): New method definition.
8879         (Output_section_headers::do_size): New method declaration.
8880         (Output_segment_headers::set_final_data_size): New method definition.
8881         (Output_segment_headers::do_size): New method declaration.
8882         (Output_file_header::set_final_data_size)::New method definition.
8883         (Output_file_header::do_size)::New method declaration.
8884         (Output_section_data::Output_section_data): Add new parameter
8885         is_data_size_fixed and use it to fix data size.
8886         (Output_data_const::Output_data_const): Adjust call to base class
8887         constructor and fix data size.
8888         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8889         base class constructor and fix data size.
8890         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8891         base class constructor and fix data size.
8892         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8893         class constructor and fix data size.
8894         (Output_data_group::set_final_data_size): New method definition.
8895         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8896         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8897         class constructor and fix data size.
8898         (Output_relaxed_input_section): New class definition.
8899         (Output_section::Simple_input_section): New class definition.
8900         (Output_section::get_input_sections): Adjust parameter list.
8901         (Output_section::add_input_section_for_script): Same.
8902         (Output_section::save_states, Output_section::restore_states,
8903         Output_section::do_address_and_file_offset_have_reset_values,
8904         (Output_section::Input_section::Input_section): Handle
8905         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8906         Output_relaxed_input_section.
8907         (Output_section::Input_section::is_input_section,
8908         Output_section::Input_section::set_output_section): Handle relaxed
8909         input section.
8910         (Output_section::Input_section::is_relaxed_input_section,
8911         Output_section::Input_section::output_section_data,
8912         Output_section::Input_section::relaxed_input_section): New method
8913         definitions.
8914         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8915         value.
8916         (Output_section::Input_section::u1_): Update comments.
8917         (Output_section::Input_section::u2_): Add new union member poris.
8918         (Output_section::Checkpoint_output_section): New classs definition.
8919         (Output_section::relax_input_section): New method declaration.
8920         (Output_section::checkpoint_): New data member.
8921         (Output_segment): Update comments.
8922         (Output_segment::Output_segment): Un-privatize copy constructor.
8923         (Output_segment::operator=): Un-privatize.
8924         * script-sections.cc (Output_section_element::Input_section_list):
8925         Change element type to Output_section::Simple_input_section.
8926         (Output_section_element_dot_assignment::set_section_addresses):
8927         Register output section data for relaxation clean up.
8928         (Output_data_exression::Output_data_expression): Adjust call to base
8929         constructor to fix data size.
8930         (Output_section_element_data::set_section_addresses): Register
8931         Output_data_expression object for relaxation clean up.
8932         (struct Input_section_info): Replace Relobj pointer and section index
8933         pair with Output_section::Simple_input_section and Convert struct to a
8934         class.
8935         (Input_section_sorter::operator()): Adjust access to
8936         Input_section_info data member to use accessors.
8937         (Output_section_element_input::set_section_addresses): Use layout
8938         parameter.  Adjust code to use Output_section::Simple_input_section
8939         and Input_secction_info classes.  Register filler for relaxation
8940         clean up.
8941         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8942         and section index pair with Output_section::Simple_input_section
8943         class.  Adjust code accordingly.
8944         (Phdrs_element::release_segment): New method definition.
8945         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8946         segment list.
8947         (Script_sections::release_segments): New method definition.
8948         * gold/script-sections.h (Script_sections::release_segments): New
8949         method declaration.
8950         * gold/target.h (Target::may_relax, Target::relax,
8951         Target::do_may_relax, Target::do_relax): New method definitions.
8952
8953 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8954
8955         * arm.cc (has_signed_unsigned_overflow): New function.
8956         (Arm_relocate_functions::abs8): New function.
8957         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8958         (Target_arm::Scan::global): Likewise.
8959         (Target_arm::relocate::relocate): Likewise.
8960         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8961         Likewise.
8962
8963 2009-09-16  Cary Coutant  <ccoutant@google.com>
8964
8965         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8966         * testsuite/Makefile.in: Regenerate.
8967
8968 2009-09-11  Nick Clifton  <nickc@redhat.com>
8969
8970         * po/gold.pot: Updated by the Translation project.
8971
8972 2009-09-08  Cary Coutant  <ccoutant@google.com>
8973
8974         * output.cc (Output_file::open): Add execute permission to empty file.
8975         * testsuite/Makefile.am (permission_test): New test.
8976         * testsuite/Makefile.in: Regenerate.
8977
8978 2009-09-02  Ian Lance Taylor  <iant@google.com>
8979
8980         * output.cc (Output_file::resize): Call map_no_anonymous rather
8981         than map.
8982
8983 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
8984
8985         * gold.cc: Include "incremental.h".
8986         (queue_initial_tasks): Call Incremental_checker methods.
8987         * incremental.cc: Include "output.h".
8988         (Incremental_checker::can_incrementally_link_output_file): New
8989         method.
8990         * incremental.h (Incremental_checker): New class.
8991
8992         * output.cc (Output_file::open_for_modification): New method.
8993         (Output_file::map_anonymous): Changed return type to bool.  Record
8994         map in base_ field.
8995         (Output_file::map_no_anonymous): New method, broken out of map.
8996         (Output_file::map): Use map_no_anonymous and map_anonymous.
8997         * output.h (class Output_file): Update declarations.
8998
8999 2009-08-24  Cary Coutant  <ccoutant@google.com>
9000
9001         * options.h (Command_line::Pre_options): New class.
9002         (Command_line::pre_options): New member.
9003         * options.cc (gold::options::ready_to_register): New variable.
9004         (One_option::register_option): Do nothing if not registering options.
9005         Assert if same short option registered twice.
9006         (General_options::General_options): Turn off option registration when
9007         done constructing.
9008         (Command_line::Pre_options::Pre_options): New constructor.
9009
9010 2009-08-24  Cary Coutant  <ccoutant@google.com>
9011
9012         * options.h (General_options::no_keep_memory): Remove incorrect
9013         short option.
9014
9015 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9016
9017         * Makefile.am (am__skiplex, am__skipyacc): New.
9018         * Makefile.in: Regenerate.
9019
9020 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9021
9022         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9023         (INCLUDES): ... this.
9024         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9025         (AM_CPPFLAGS): Renamed from ...
9026         (INCLUDE): ... this.
9027         * Makefile.in, testsuite/Makefile.in: Regenerate.
9028
9029         * Makefile.in: Regenerate.
9030         * aclocal.m4: Likewise.
9031         * config.in: Likewise.
9032         * configure: Likewise.
9033         * testsuite/Makefile.in: Likewise.
9034
9035         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9036         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9037         * Makefile.in: Regenerate.
9038         * testsuite/Makefile.in: Regenerate.
9039
9040 2009-08-19  Cary Coutant  <ccoutant@google.com>
9041
9042         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9043         symbols in shared libraries overridden by hidden or internal symbols
9044         in the main program.
9045
9046 2009-08-19  Chris Demetriou  <cgd@google.com>
9047
9048         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9049         checking source file names in error messages.
9050
9051 2009-08-18  Doug Kwan  <dougkwan@google.com>
9052
9053         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9054         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9055         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9056         an elfcpp::Ehdr as parameter.
9057         * object.cc (Object::set_target): Remove the version that looks up
9058         a target and sets it.
9059         (Sized_relobj::setup): Take a Target object instead of
9060         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9061         (make_elf_sized_object): Find target and ask target to
9062         make an ELF object.
9063         * object.h: (Object::set_target): Remove the version that looks up
9064         a target and sets it.
9065         (Sized_relobj::setup): Take a Target object instead of
9066         an elfcpp:Ehdr as parameter.
9067         * target.cc: Include dynobj.h.
9068         (Target::do_make_elf_object_implementation): New.
9069         (Target::do_make_elf_object): New.
9070         * target.h (Target::make_elf_object): New template declaration.
9071         (Target::do_make_elf_object): New method declarations.
9072         (Target::do_make_elf_object_implementation): New template declaration.
9073
9074 2009-08-14  Ian Lance Taylor  <iant@google.com>
9075
9076         * gold.h (FUNCTION_NAME): Define.
9077         (gold_unreachable): Use FUNCTION_NAME.
9078
9079 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9080
9081         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9082         symbol in the --keep-unique list is not found.
9083
9084 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9085
9086         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9087         been maked as --keep-unique.
9088         (Icf::unfold_section): New function.
9089         * icf.h (Icf::unfold_section): New function.
9090         * options.h (General_options::keep_unique): New option.
9091         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9092         * testsuite/Makefile.in: Regenerate.
9093         * testsuite/icf_keep_unique_test.sh: New file.
9094         * testsuite/icf_keep_unique_test.cc: New file.
9095
9096 2009-08-12  Cary Coutant  <ccoutant@google.com>
9097
9098         PR 10471
9099         * resolve.cc (Symbol_table::resolve): Check for references from
9100         dynamic objects to hidden and internal symbols.
9101         * testsuite/Makefile.am (hidden_test.sh): New test.
9102         * testsuite/Makefile.in: Regenerate.
9103         * testsuite/hidden_test.sh: New script.
9104         * testsuite/hidden_test_1.c: New test source.
9105         * testsuite/hidden_test_main.c: New test source.
9106
9107 2009-08-11  Doug Kwan  <dougkwan@google.com>
9108
9109         * arm.cc: Update comments.
9110         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9111         segment to locate the .ARM.exidx section if present.
9112
9113 2009-08-09  Doug Kwan  <dougkwan@google.com>
9114
9115         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9116         patch.
9117
9118 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9119         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9120         compiler warnings.
9121
9122 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9123
9124         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9125         valid tls_segment only for non-debug-section relocations.
9126         * testsuite/Makefile.am: Add gc_tls_test.
9127         * testsuite/Makefile.in: Regenerate.
9128         * testsuite/gc_tls_test.cc: New file.
9129         * testsuite/gc_tls_test.sh: New file.
9130
9131 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9132
9133         * icf.cc: New file.
9134         * icf.h: New file.
9135         * Makefile.am (CCFILES): Add icf.cc.
9136         (HFILES): Add icf.h
9137         * Makefile.in: Regenerate.
9138         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9139         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9140         section, symbol and addend information for the relocs.
9141         * gold.cc (queue_middle_tasks): Call identical code folding.
9142         * gold.h: Add defines for multimap.
9143         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9144         to the call of finalize_local_symbols.
9145         * main.cc (main): Create object of class Icf.
9146         * object.cc (Sized_relobj::do_layout): Allow this function to be
9147         called twice during icf.
9148         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9149         to sections marked as identical by icf.
9150         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9151         when available.
9152         (Sized_relobj::do_section_entsize): New function.
9153         * object.h (Object::section_entsize): New function.
9154         (Object::do_section_entsize): New pure virtual function.
9155         (Relobj::finalize_local_symbols): Add new parameter.
9156         (Relobj::do_section_entsize): New function.
9157         * options.h (General_options::icf): New option.
9158         (General_options::icf_iterations): New option.
9159         (General_options::print_icf_sections): New option.
9160         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9161         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9162         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9163         icf.
9164         * symtab.cc (Symbol_table::is_section_folded): New function.
9165         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9166         to sections marked as identical by icf.
9167         * symtab.h (Symbol_table::set_icf): New function.
9168         (Symbol_table::icf): New function.
9169         (Symbol_table::is_section_folded): New function.
9170         (Symbol_table::icf_): New data member.
9171         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9172         * testsuite/Makefile.am: Add commands to build icf_test.
9173         * testsuite/Makefile.in: Regenerate.
9174         * testsuite/icf_test.sh: New file.
9175         * testsuite/icf_test.cc: New file.
9176
9177 2009-07-24  Chris Demetriou  <cgd@google.com>
9178
9179         * layout.cc (is_compressible_debug_section): Fix incorrect
9180         comment about compressed section names.
9181
9182 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9183
9184         PR 10419
9185         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9186
9187 2009-07-16  Ian Lance Taylor  <iant@google.com>
9188
9189         PR 10400
9190         * layout.h: #include <map>.
9191         (class Kept_section): Change from struct to class.  Add accessors
9192         and setters.  Add section size to Comdat_group mapping.  Change
9193         Comdat_group to std::map.  Add is_comdat_ field.  Add
9194         linkonce_size field in union.
9195         (class Layout): Update declaration of find_or_add_kept_section.
9196         Don't declare find_kept_object.
9197         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9198         parameter.  Add object, shndx, is_comdat, and is_group_name
9199         parameters.  Change all callers.  Adjust for new Kept_section.
9200         (Layout::find_kept_object): Remove.
9201         * object.cc (Sized_relobj::include_section_group): Update use of
9202         Kept_section.  Rename secnum to shndx.  Only record
9203         Kept_comdat_section if sections are the same size.
9204         (Sized_relobj::include_linkonce_section): Update use of
9205         Kept_section.  Only record Kept_comdat_section if sections are the
9206         same size.  Set size of linkonce section.
9207         (Sized_relobj::map_to_kept_section): Update call to
9208         get_kept_comdat_section.
9209         * object.h (class Sized_relobj): Rename fields in
9210         Kept_comdat_section to drop trailing underscores; change object
9211         field to Relobj*.  Change Kept_comdat_section_table to store
9212         struct rather than pointer.
9213         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9214         Add kept_object and kept_shndx parameters.  Change all callers.
9215         (Sized_relobj::get_kept_comdat_section): Change return type to
9216         bool.  Add kept_object and kept_shndx parameters.  Change all
9217         callers.
9218         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9219         Layout::find_or_add_kept_section.
9220
9221 2009-07-09  Ian Lance Taylor  <iant@google.com>
9222
9223         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9224         Reserve space in the hash table.
9225
9226 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9227
9228         * fileread.cc (File_read::get_mtime): New method.
9229         * fileread.h (Timespec): New structure.
9230         (File_read::get_mtime): New method.
9231         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9232         Renamed from timestamp_nsec.
9233         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9234         Elf_Xword.
9235         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9236         timestamp_nsec.
9237         (Incremental_inputs::report_archive): Save mtime; style fix.
9238         (Incremental_inputs::report_obejct): Save mtime; style fix.
9239         (Incremental_inputs::report_script): Save mtime; style fix.
9240         (Incremental_inputs::finalize_inputs): Style fix.
9241         (Incremental_inputs::finalize): Style fix.
9242         (Incremental_inputs::create_input_section_data): Store inputs
9243         mtime.
9244         * incremental.h (Incremental_inputs::report_script): Add mtime
9245         argument.
9246         (Incremental_inputs::Input_info::Input_info): Intialize only one
9247         union member.
9248         (Incremental_inputs::Input_info::archive): Move to nameless
9249         union.
9250         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9251         (Incremental_inputs::Input_info::script): Move to nameless union.
9252         (Incremental_inputs::mtime): New field.
9253         * script.cc (read_input_script): Pass file mtime to
9254         Incremental_input.
9255         * script.h (Script_info::inputs): Style fix.
9256
9257 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9258
9259         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9260         instead of 32.
9261
9262 2009-06-24  Ian Lance Taylor  <iant@google.com>
9263
9264         PR 10156
9265         * layout.cc (Layout::choose_output_section): If we find an
9266         existing section, update the flags.
9267         (Layout::create_notes): New function, broken out of
9268         Layout::finalize.
9269         (Layout::finalize): Don't create note sections.
9270         (Layout::create_note): Don't crash if linker script discards
9271         section.
9272         (Layout::create_gold_note): Likewise.
9273         (Layout::create_build_id): Likewise.  Don't set
9274         after_input_sections on the section.
9275         (Layout::create_executable_stack_info): Remove target parameter.
9276         Change caller.
9277         * layout.h (class Layout): Declare create_notes.  Update
9278         declaration of create_executable_stack_info.
9279         * gold.cc (queue_middle_tasks): Call create_notes.
9280         * output.cc (Output_section::update_flags_for_input_section): Move
9281         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9282         invalid.
9283         * output.h (Output_data::mark_address_invalid): New function.
9284         (class Output_section): Only declare, not define,
9285         update_flags_for_input_section.  Remove set_flags.
9286
9287 2009-06-24  Ian Lance Taylor  <iant@google.com>
9288
9289         * script-sections.cc (Output_section_definition::
9290         set_section_addresses): Rename shadowing local load_address to
9291         laddr.
9292
9293 2009-06-24  Ian Lance Taylor  <iant@google.com>
9294
9295         PR 10244
9296         * reloc.cc (relocate_sections): Skip empty relocation sections.
9297
9298 2009-06-23  Ian Lance Taylor  <iant@google.com>
9299
9300         PR 10156
9301         * layout.cc (Layout::create_note): Use choose_output_section
9302         rather than make_output_section.
9303
9304 2009-06-23  Ian Lance Taylor  <iant@google.com>
9305
9306         PR 10237
9307         * options.cc (General_options::parse_V): Set printed_version_.
9308         (General_options::General_options): Initialize printed_version_.
9309         * options.h (class General_options): Add printed_version_ field.
9310         * gold.cc (queue_initial_tasks): If there are no input files,
9311         don't give a fatal error if we printed the version information.
9312         (queue_middle_tasks): If using -r with a shared object, give a
9313         fatal error rather than an ordinary error.
9314
9315 2009-06-23  Ian Lance Taylor  <iant@google.com>
9316
9317         PR 10219
9318         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9319         (Layout::make_output_section): Set have_stabstr_section_ if we see
9320         a .stab*str section.
9321         (Layout::finalize): Call link_stabs_sections.
9322         (Layout::link_stabs_sections): New file.
9323         * layout.h (class Layout): Add have_stabstr_section_ field.
9324         Declare link_stabs_sections.
9325
9326 2009-06-23  Doug Kwan  <dougkwan@google.com>
9327
9328         * Makefile.am (libgold_a_LIBADD): New.
9329         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9330         * Makefile.in: Regenerate.
9331         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9332         * configure: Regenerate.
9333         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9334         * fileread.cc: Include sys/state.h
9335         * gold.h: Declare memmem and strndup if found missing.
9336         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9337
9338 2009-06-23  Ian Lance Taylor  <iant@google.com>
9339
9340         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9341         * configure: Rebuild.
9342
9343 2009-06-23  Ian Lance Taylor  <iant@google.com>
9344
9345         PR 10147
9346         * object.cc (Object::section_contents): Don't try to get a view if
9347         the section has length zero.
9348         (Object::handle_gnu_warning_section): If the section is empty, use
9349         the name of the section as the warning.
9350
9351 2009-06-23  Ian Lance Taylor  <iant@google.com>
9352
9353         PR 10133
9354         * stringpool.h (class Stringpool_template): Add optimize_ field.
9355         (Stringpool_template::set_optimize): New function.
9356         * stringpool.cc (Stringpool_template::Stringpool_template):
9357         Initialize optimize_ field.
9358         (Stringpool_template::set_string_offsets): Test local optimize
9359         fild rather than parameter.
9360         * layout.cc (Layout::Layout): Call set_optimize on the section
9361         name stringpool.
9362
9363 2009-06-22  Ian Lance Taylor  <iant@google.com>
9364
9365         PR 10030
9366         * yyscript.y: Parse TARGET.
9367         * script.cc (script_set_target): New function.
9368         * script-c.h (script_set_target): Declare.
9369         * options.cc (General_options::string_to_object_format): Rename
9370         from string_to_object_format in anonymous namespace.  Change
9371         callers.
9372         * options.h (class General_options): Declare
9373         string_to_object_format.
9374
9375 2009-06-22  Ian Lance Taylor  <iant@google.com>
9376
9377         * script-sections.cc (Script_sections::create_segments): Don't put
9378         program headers in a PT_LOAD segment if -n or -N.
9379
9380 2009-06-22  Ian Lance Taylor  <iant@google.com>
9381
9382         PR 10141
9383         * options.h (class General_options): Add -z lazy and -z now.  Sort
9384         -z options into alphabetical order.
9385         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9386
9387 2009-06-21  Ian Lance Taylor  <iant@google.com>
9388
9389         * layout.cc (Layout::make_output_section): Call
9390         Target::new_output_section.
9391         (Layout::attach_allocated_section_to_segment): Put large section
9392         sections in a separate load segment with the large segment flag
9393         set.
9394         (Layout::segment_precedes): Sort large data segments after other
9395         load segments.
9396         (align_file_offset): New static function.
9397         (Layout::set_segment_offsets): Use align_file_offset.
9398         * output.h (class Output_section): Add is_small_section_ and
9399         is_large_section_ fields.
9400         (Output_section::is_small_section): New function.
9401         (Output_section::set_is_small_section):  New function.
9402         (Output_section::is_large_section): New function.
9403         (Output_section::set_is_large_section): New function.
9404         (Output_section::is_large_data_section): New function.
9405         (class Output_segment): Add is_large_data_segment_ field.
9406         (Output_segment::is_large_data_segment): New function.
9407         (Output_segment::set_is_large_data_segment): New function.
9408         * output.cc (Output_section::Output_section): Initialize new
9409         fields.
9410         (Output_segment::Output_segment): Likewise.
9411         (Output_segment::add_output_section): Add assertion that large
9412         data sections always go in large data segments.  Force small data
9413         sections to the end of the list of data sections.  Force small BSS
9414         sections to the start of the list of BSS sections.  For large BSS
9415         sections to the end of the list of BSS sections.
9416         * symtab.h (class Symbol): Declare is_common_shndx.
9417         (Symbol::is_defined): Check Symbol::is_common_shndx.
9418         (Symbol::is_common): Likewise.
9419         (class Symbol_table): Define enum Commons_section_type.  Update
9420         declarations.  Add small_commons_ and large_commons_ fields.
9421         * symtab.cc (Symbol::is_common_shndx): New function.
9422         (Symbol_table::Symbol_table): Initialize new fields.
9423         (Symbol_table::add_from_object): Put small and large common
9424         symbols in the right list.
9425         (Symbol_table::sized_finalized_symbol): Check
9426         Symbol::is_common_shndx.
9427         (Symbol_table::sized_write_globals): Likewise.
9428         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9429         common symbol lists.  Don't call do_allocate_commons_list if the
9430         list is empty.
9431         (Symbol_table::do_allocate_commons_list): Remove is_tls
9432         parameter.  Add comons_section_type parameter.  Change all
9433         callers.  Handle small and large common symbols.
9434         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9435         Symbol::is_common_shndx.
9436         * resolve.cc (symbol_to_bits): Likewise.
9437         * target.h (Target::small_common_shndx): New function.
9438         (Target::small_common_section_flags): New function.
9439         (Target::large_common_shndx): New function.
9440         (Target::large_common_section_flags): New function.
9441         (Target::new_output_section): New function.
9442         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9443         small_common_section_flags, and large_common_section_flags
9444         fields.
9445         (Target::do_new_output_section): New virtual function.
9446         * arm.cc (Target_arm::arm_info): Initialize new fields.
9447         * i386.cc (Target_i386::i386_info): Likewise.
9448         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9449         Likewise.
9450         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9451         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9452         (Target_x86_64::do_new_output_section): New function.
9453         * configure.ac: Define conditional MCMODEL_MEDIUM.
9454         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9455         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9456         (large_LDFLAGS): Define.
9457         * testsuite/large.c: New file.
9458         * testsuite/testfile.cc (Target_test::test_target_info):
9459         Initialize new fields.
9460         * configure, testsuite/Makefile.in: Rebuild.
9461
9462 2009-06-05  Doug Kwan  <dougkwan@google.com>
9463
9464         * Makefile.am (CCFILES): Add target.cc.
9465         * Makefile.in: Regenerate.
9466         * i386.cc (class Target_i386): Define new virtual method to
9467         override do_is_local_label_name in parent.
9468         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9469         local symbols if --discard-locals or -X is given.
9470         * options.h (class General_options): Declare new options
9471         '--discard-locals' and '-X' for discarding locals.
9472         * target.h (class Target): Define new methods is_local_label_name.
9473         Declare new virtual method do_is_local_label_name.
9474         * target.cc: New file.
9475         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9476         (check_SCRIPTS): Add discard_locals_test.sh.
9477         (check_DATA): Add discard_local_tests.syms.
9478         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9479         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9480         * testsuite/Makefile.in: Regenerate.
9481         * testsuite/discard_locals_test.c: New file.
9482         * testsuite/discard_locals_test.sh: Same.
9483
9484 2009-06-05  Doug Kwan  <dougkwan@google.com>
9485
9486         * object.cc (Sized_relobj::Sized_relobj): Initialize
9487         discarded_eh_frame_shndx_ to -1U.
9488         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9489         section.
9490         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9491         a discarded .eh_frame section.
9492         (Sized_relobj::do_finalize_local_symbols): Ditto.
9493         * object.h (class Sized_relobj): Declare new member
9494         discarded_eh_frame_shndx_.
9495         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9496         (local_labels_test.o, local_labels_test): New rules.
9497         * testsuite/Makefile.in: Regenerate.
9498
9499 2009-06-04  Doug Kwan  <dougkwan@google.com>
9500
9501         * layout.cc (Layout::section_name_mapping): Add mapping for
9502         special ARM sections.
9503
9504 2009-06-03  Doug Kwan  <dougkwan@google.com>
9505
9506         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9507         (utils::has_overflow): Same.
9508
9509 2009-06-03  Ian Lance Taylor  <iant@google.com>
9510
9511         * layout.cc (Layout::section_name_mapping): New array, replacing
9512         Layout::linkonce_mapping.
9513         (Layout::section_name_mapping_count): New variable, replacing
9514         Layout::linkonce_mapping_count.
9515         (Layout::linkonce_output_name): Remove.
9516         (Layout::output_section_name): Rewrite.
9517         * layout.h (class Layout): Rename Linkonce_mapping to
9518         Section_name_mapping, linkonce_mapping to section_name_mapping,
9519         linkonce_mapping_count to section_name_mapping_count.  Don't
9520         declare linkonce_output_name.
9521
9522 2009-06-03  Doug Kwan  <dougkwan@google.com>
9523
9524         * gold/arm.cc (namespace utils): New.
9525         (Target_arm::reloc_is_non_pic): Define new method.
9526         (class Arm_relocate_functions): New.
9527         (Target_arm::Relocate::relocate): Handle relocation types used by
9528         Android.
9529
9530 2009-06-03  Ian Lance Taylor  <iant@google.com>
9531
9532         * arm.cc (Target_arm::scan::global): Use || instead of |.
9533
9534 2009-06-02  Doug Kwan  <dougkwan@google.com>
9535
9536         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9537         issued_non_pic_error_.
9538         (class Target_arm::Scan): Declare new method check_non_pic.
9539         Define new method symbol_needs_plt_entry.
9540         Declare new data member issued_non_pic_error_.
9541         (class Target_arm::Relocate): Declare new method
9542         should_apply_static_reloc.
9543         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9544         (Target_arm::Scan::check_non_pic): Define new method.
9545         (Target_arm::Scan::local): Handle a small subset of reloc types used
9546         by Android.
9547         (Target_arm::Scan::local): Same.
9548         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9549
9550 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9551
9552         * incremental.cc (Incremental_inputs::report_command_line): Filter
9553         out --incremental-* options.
9554
9555 2009-05-29  Doug Kwan  <dougkwan@google.com>
9556
9557         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9558         template class.
9559         (class Target_arm): Update comment.
9560         (Target_arm::Target_arm): Initialize new data members GOT_,
9561         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9562         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9563         and Target_arm::rel_dyn_section.
9564         Declare new_enum Target_arm::Got_type.
9565         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9566         and DYNBSS_.
9567         Update commments for member do_dynsym_value.
9568         (Target_arm::got_size, Target_arm::plt_section,
9569         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9570         new methods inside class defintion.
9571         (Target_arm::got_section): Define new method.
9572         (Target_arm::rel_dyn_section): Same.
9573         (Output_data_plt_arm): New template class.
9574         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9575         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9576         (Output_data_plt_arm::add_entry): Same.
9577         (Output_data_plt_arm::first_plt_entry): Define new
9578         static data member for PLT instruction template.
9579         (Output_data_plt_arm::plt_entry): Same.
9580         (Output_data_plt_arm::do_write): Define new method.
9581         (Target_arm::make_plt_entry): Same.
9582         (Target_arm::do_finalize_sections): Same.
9583         (Target_arm::do_dynsym_value): Same.
9584
9585 2009-05-28  Doug Kwan  <dougkwan@google.com>
9586
9587         * Makefile.am (TARGETSOURCES): Add arm.cc.
9588         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9589         * Makefile.in: Regenerate.
9590         * arm.cc: New file.
9591         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9592
9593 2009-05-26  Doug Kwan  <dougkwan@google.com>
9594
9595         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9596         (General_options::check_excluded_libs): Strip off directories in
9597         archive name before matching like GNU ld does.
9598         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9599         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9600         (exclude_libs_test_LDFLAGS): Add linker option
9601         -Wl,--exclude-libs,libexclude_libs_test_3
9602         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9603         an explicit archive without using -l.
9604         (alt/libexclude_libs_test_3.a): New make rule.
9605         * testsuite/Makefile.in: Regenerate.
9606         * testsuite/exclude_libs_test.c : Declare lib3_default().
9607         (main): Call it.
9608         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9609         * exclude_libs_test_3.c: New file.
9610
9611 2009-05-26  Nick Clifton  <nickc@redhat.com>
9612
9613         * po/id.po: New Indonesian translation.
9614         * po/gold.pot: Updated template file.
9615
9616 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9617
9618         * testsuite/Makefile.am: Add -ffunction-sections to compile
9619         gc_comdat_test files.  Add -Wl,--gc-sections to build
9620         gc_comdat_test.
9621         * testsuite/Makefile.in: Regenerate.
9622         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9623
9624 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9625
9626         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9627         kept comdat section was garbage collected.
9628         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9629         * testsuite/Makefile.in: Regenerate.
9630         * testsuite/gc_comdat_test.sh: New file.
9631         * testsuite/gc_comdat_test_1.cc: New file.
9632         * testsuite/gc_comdat_test_2.cc: New file.
9633
9634 2009-05-19  Doug Kwan  <dougkwan@google.com>
9635
9636         * archive.cc (Archive::Archive): Move constructor from archive.h
9637         to here.  Initialize no_export_.
9638         (Archive::get_elf_object_for_member): Set no_export flag of object.
9639         * archive.h (Archive::Archive): Move constructor body to
9640         archive.cc.
9641         (Archive::no_export): New method.
9642         (Archive::no_export_): New field.
9643         * object.h (Object::Object): Initialize no_export_ to false.
9644         (Object::no_export, Object::set_no_export): New methods.
9645         (Object::no_export_): New field.
9646         * options.cc (General_options::parse_exclude_libs): New method.
9647         (General_options::check_excluded_libs) Same.
9648         * options.h (exclude_libs): New option.
9649         (General_options::check_excluded_libs): New method declaration.
9650         (General_options::excluded_libs_): New field.
9651         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9652         default or protected visibility if an object has no-export flag set.
9653         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9654         (check_SCRIPTS): Add exclude_libs_test.sh.
9655         (check_DATA): Add exclude_libs_test.syms.
9656         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9657         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9658         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9659         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9660         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9661         libexclude_libs_test_2.a): New rules.
9662         * testsuite/Makefile.in: Regenerate.
9663         * testsuite/exclude_libs_test.c: New file.
9664         * testsuite/exclude_libs_test.sh: Ditto.
9665         * testsuite/exclude_libs_test_1.c: Ditto.
9666         * testsuite/exclude_libs_test_2.c: Ditto.
9667
9668 2009-05-15  Ian Lance Taylor  <iant@google.com>
9669
9670         * configure.ac: Check for declarations for cases where libiberty.h
9671         checks HAVE_DECL_xxx.
9672         * configure, config.in: Rebuild.
9673
9674 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9675
9676         * gold.h (Incremental_argument_list): Remove (invalid) forward
9677         declaration.
9678         * incremental.cc (Incremental_inputs::report_achive): New method.
9679         (Incremental_inputs::report_object): New method.
9680         (Incremental_inputs::report_script): New method.
9681         (Incremental_inputs::finalize_inputs): New method.
9682         (Incremental_inputs::finalize): Call finalize_inputs().
9683         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9684         Create inputs entries.
9685         * incremental.h (Incremental_input_type): New enum.
9686         (Incremental_inputs::Incremental_input): Initialize new fields.
9687         (Incremental_inputs::report_inputs): New method.
9688         (Incremental_inputs::report_achive): New method.
9689         (Incremental_inputs::report_object): New method.
9690         (Incremental_inputs::report_script): New method.
9691         (Incremental_inputs::finalize_inputs): New method.
9692         (Incremental_inputs::Input_info): New struct.
9693         (Incremental_inputs::Input_info_map): New typedef.
9694         (Incremental_inputs::lock_): New field.
9695         (Incremental_inputs::Inputs_): New field.
9696         (Incremental_inputs::Inputs_map): New field.
9697         * main.cc (main): Call Incremental_input::report_inputs.
9698         * options.h (Input_argument_list): Typedef moved from
9699         Input_arguments.
9700         (Input_file_group::Files): Remove, use ::Input_argument_list.
9701         (Input_file_group::Input_argument_list): Remove, use
9702         ::Input_argument_list.
9703         * plugin.cc (Plugin_manager::add_input_file): Add error in
9704         incremental build.
9705         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9706         functions.
9707         * script.cc (read_input_script): Call
9708         Incremental_input::report_script.
9709         * script.h (Script_info): New class.
9710
9711 2009-04-27  Ian Lance Taylor  <iant@google.com>
9712
9713         * x86_64.cc (do_adjust_output_section): Set entsize to
9714         plt_entry_size.
9715
9716 2009-04-23  Elliott Hughes  <enh@google.com>
9717
9718         * output.cc (Output_file::close): After short writes, continue
9719         writing from the correct offset in the buffer being written.
9720
9721 2009-04-23  Chris Demetriou  <cgd@google.com>
9722
9723         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9724         * configure: Regenerate.
9725         * config.in: Regenerate.
9726         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9727         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9728
9729 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9730
9731         * incremental.cc (Incremental_inputs_header_data): Renamed from
9732         Incremental_input_header_data.
9733         (Incremental_inputs_header_data::data_size): New field.
9734         (Incremental_inputs_header_data::put_input_file_count): Renamed
9735         from input_file_count.
9736         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9737         from command_line_offset.
9738         (Incremental_inputs_header_data::put_reserved): Renamed from
9739         put_reserved.
9740         (Incremental_inputs_entry_data): Renamed from
9741         Incremental_input_entry_data.
9742         (Incremental_inputs_entry_data::data_size): New field.
9743         (Incremental_inputs::report_command_line): New method.
9744         (Incremental_inputs::finalize): New method.
9745         (Incremental_inputs::create_incremental_inputs_data): New method.
9746         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9747         * incremental.h: New file.
9748         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9749        (Layout::finalize): Create incremental inputs section in
9750         incremental builds.
9751        (Layout::create_incremental_info_sections): New method.
9752         * layout.h (Layout::incremental_inputs): New method.
9753        (Layout::create_incremental_info_sections): New method.
9754        (Layout::incremental_inputs_): New field.
9755         * main.cc (main): Notify Incremental_input of the command line.
9756
9757 2009-04-01  Ian Lance Taylor  <iant@google.com>
9758             Mikolaj Zalewski  <mikolajz@google.com>
9759
9760         * gold.h (reserve_unordered_map): Define, three versions, one for
9761         each version of Unordered_map.
9762         * layout.cc (Layout::Layout): Remove options parameter.  Add
9763         number_of_input_files parameter.  Don't initialize options_.
9764         Initialize number_of_input_files_ and resized_signatures_.  Move
9765         sections_are_attached_.
9766         (Layout::layout_group): Reserve space for group_signatures_.
9767         (Layout::find_or_add_kept_section): Change name parameter to be a
9768         reference.  Resize signatures_ map when it gets large enough.
9769         (Layout::layout_eh_frame): Use parameters->options() instead of
9770         this->options_.
9771         (Layout::make_output_section): Likewise.
9772         (Layout::attach_allocated_section_to_segment): Likewise.
9773         (Layout::finalize, Layout::create_executable_stack): Likewise.
9774         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9775         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9776         * layout.h (class Layout): Update declarations.  Remove options_
9777         field.  Add number_of_input_files_ and resized_signatures_
9778         fields.  Move sections_are_attached_ field.
9779         * main.cc (main): Pass number of input files to Layout
9780         constructor.  Don't pass options.
9781
9782 2009-03-30  Ian Lance Taylor  <iant@google.com>
9783
9784         * ffsll.c (ffsll): Correct implementation.
9785
9786 2009-03-27  Ian Lance Taylor  <iant@google.com>
9787
9788         * ffsll.c: New file.
9789         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9790         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9791         * ftruncate.c (ftruncate): Declare before definition.
9792         * mremap.c (mremap): Likewise.
9793         * pread.c (pread): Likewise.
9794         * configure, Makefile.in, config.in: Rebuild.
9795
9796         * mremap.c: New file.
9797         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9798         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9799         (mremap): Declare if HAVE_MREMAP is not defined.
9800         * configure, Makefile.in, config.in: Rebuild.
9801
9802 2009-03-27  Cary Coutant  <ccoutant@google.com>
9803
9804         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9805         position independent.
9806         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9807         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9808
9809 2009-03-24  Cary Coutant  <ccoutant@google.com>
9810
9811         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9812         an executable.
9813         (needs_dynamic_reloc): Likewise.
9814
9815 2009-03-24  Ian Lance Taylor  <iant@google.com>
9816
9817         * yyscript.y (file_cmd): Recognize EXTERN.
9818         (extern_name_list, extern_name_list_body): New nonterminals.
9819         * script.cc (script_add_extern): Define.
9820         * script-c.h (script_add_extern): Declare.
9821
9822 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9823
9824         * object.cc (is_elf_object): Define.
9825         * object.h (is_elf_object): Declare.
9826         * archive.cc (Archive::get_elf_object_for_member): Call
9827         is_elf_object.
9828         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9829
9830 2009-03-24  Elliott Hughes  <enh@google.com>
9831
9832         * output.cc (Output_file::map_anonymous): Define.
9833         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9834         try an anonymous one.  Report the size if the mmap fails.
9835         * output.h (class Output_file): Declare map_anonymous.
9836
9837 2009-03-24  Ian Lance Taylor  <iant@google.com>
9838
9839         * target-select.cc (instantiate_target): Don't acquire the lock if
9840         the instantiated_target_ field has already been set.
9841
9842 2009-03-23  Ian Lance Taylor  <iant@google.com>
9843
9844         * gold-threads.h (class Initialize_lock): Define.
9845         * gold-threads.cc (class Initialize_lock_once): Define.
9846         (initialize_lock_control): New static variable.
9847         (initialize_lock_pointer): New static variable.
9848         (initialize_lock_once): New static function.
9849         (Initialize_lock::Initialize_lock): Define.
9850         (Initialize_lock::initialize): Define.
9851         * target-select.h: Include "gold-threads.h".
9852         (class Target_selector): Add lock_ and initialize_lock_ fields.
9853         Don't define instantiate_target, just declare it.
9854         * target-select.cc (Target_selector::Target_selector): Initialize
9855         new fields.
9856         (Target_selector::instantiate_target): Define.
9857         * descriptors.h: Include "gold-threads.h".
9858         (class Descriptors): Add initialize_lock_ field.
9859         * descriptors.cc (Descriptors::Descriptors): Initialize new
9860         field.
9861         (Descriptors::open): Use initialize_lock_ field
9862         * errors.h (class Errors): Add initialize_lock_ field.
9863         * errors.cc (Errors::Errors): Initialize new field.
9864         (Errors::initialize_lock): Use initialize_lock_ field.
9865         * powerpc.cc (class Target_selector_powerpc): Remove
9866         instantiated_target_ field.  In do_recognize call
9867         instantiate_target rather than do_instantiate_target.  In
9868         do_instantiate_target just allocate a new target.
9869         * sparc.cc (class Target_selector_sparc): Likewise.
9870
9871         * freebsd.h: New file.
9872         * i386.cc: Include "freebsd.h".
9873         (Target_i386): Derive from Target_freebsd rather than
9874         Sized_target.
9875         (Target_selector_i386): Derive from Target_selector_freebsd rather
9876         than Target_selector.
9877         * x86_64.cc: Include "freebsd.h".
9878         (Target_x86_64): Derive from Target_freebsd rather than
9879         Sized_target.
9880         (Target_selector_x86_64): Derive from Target_selector_freebsd
9881         rather than Target_selector.
9882         * target.h (class Target): Add adjust_elf_header and
9883         do_adjust_elf_header.
9884         * output.cc (Output_file_header:: do_sized_write): Call target
9885         adjust_elf_header routine.
9886         * configure.tgt: Set targ_osabi.
9887         * configure.ac: Define GOLD_DEFAULT_OSABI.
9888         * parameters.cc (Parameters::default_target): Pass
9889         GOLD_DEFAULT_OSABI to select_target.
9890         * target-select.h (class Target_selector): Make instantiate_target
9891         protected rather than private.
9892         * Makefile.am (HFILES): Add freebsd.h.
9893         * configure, Makefile.in, config.in: Rebuild.
9894
9895         * merge.cc (do_add_input_section): Correct pend value.  Change
9896         message about last entry not being null terminated from error to
9897         warning.
9898
9899 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9900
9901         * incremental.cc: New file.
9902         * Makefile.am (CCFILES): Add incremental.cc.
9903         * Makefile.in: Rebuild.
9904
9905 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9906
9907         * layout.cc (Layout::output_section_name): Preserve names
9908         of '.note.' sections.
9909
9910 2009-03-19  Ian Lance Taylor  <iant@google.com>
9911
9912         * descriptors.cc (Descriptors::open): Check that the options are
9913         valid before using them.
9914
9915 2009-03-18  Ian Lance Taylor  <iant@google.com>
9916
9917         * script-sections.h: Include <list>.
9918         (class Script_sections): Change Sections_elements from std::vector
9919         to std::list.  Typedef public Elements_iterator.  Add
9920         orphan_section_placement_, data_segment_align_start_, and
9921         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9922         field.
9923         * script-sections.cc (class Orphan_section_placement): New class.
9924         (class Sections_element): Add virtual functions is_relro and
9925         orphan_section_init.  Remove virtual function place_orphan_here.
9926         (class Output_section_definition): Add is_relro and
9927         orphan_section_init.  Remove place_orphan_here.
9928         (class Orphan_output_section): Likewise.
9929         (Script_sections::Script_sections): Update for field changes.
9930         (Script_sections::data_segment_align): Set saw_data_segment_align_
9931         and data_segment_align_start_, not data_segment_align_index.
9932         (Script_sections::data_segment_relro_end): Check
9933         saw_data_segment_align_.  Use data_segment_align_start_ rather
9934         than data_segment_align_index_.
9935         (Script_sections::place_orphan): Rewrite to use
9936         Orphan_section_placement.
9937
9938 2009-03-17  Ian Lance Taylor  <iant@google.com>
9939
9940         * archive.cc (Archive::add_symbols): Check for a version attached
9941         to the symbol name in the archive map.
9942         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9943         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9944         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9945         (ver_test_11.a): New target.
9946         * testsuite/Makefile.in: Rebuild.
9947
9948         * configure.ac: Check for chsize and posix_fallocate.  Replace
9949         ftruncate.
9950         * ftruncate.c: New file, from gnulib.
9951         * output.cc (posix_fallocate): Define dummy version if not
9952         HAVE_POSIX_FALLOCATE.
9953         (Output_file::map): Call posix_fallocate rather than lseek and
9954         write.
9955         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9956         * configure, Makefile.in, config.in: Rebuild.
9957
9958 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9959
9960         * layout.h (Layout::create_note): Add section_name parameter.
9961         * layout.cc (Layout::create_note): Likewise.
9962         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9963
9964 2009-03-17  Ian Lance Taylor  <iant@google.com>
9965
9966         * descriptors.cc: Include "options.h".
9967         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9968         (Descriptors::open): Always use O_CLOEXEC when opening a new
9969         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9970         then set FD_CLOEXEC.
9971
9972         * sparc.cc (class Target_sparc): Add has_got_section.
9973         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9974         make sure we have a GOT section.
9975
9976         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9977         (Target_sparc::Scan::local): Likewise.
9978         (Target_sparc::Scan::global): Likewise.
9979         (Target_sparc::Relocate::relocate): Likewise.
9980         (Target_sparc::Relocate::relocate_tls): Likewise.
9981
9982         * symtab.cc (Symbol_table::define_default_version): New function,
9983         broken out of add_from_object.
9984         (Symbol_table::add_from_object): Call define_default_version.
9985         (Symbol_table::define_special_symbol): Add resolve_oldsym
9986         parameter.  Change all callers.  If the version for a symbol comes
9987         from a version script, resolve it with the symbol with the same
9988         name with no version.  Also add the symbol without a version if
9989         appropriate.
9990         (do_define_in_output_data): If resolving with oldsym, don't delete
9991         sym.
9992         (do_define_in_output_segment): Likewise.
9993         (do_define_as_constant): Likewise.
9994         * symtab.h (class Symbol_table): Update declarations.
9995
9996 2009-03-13  Ian Lance Taylor  <iant@google.com>
9997
9998         * readsyms.cc (Read_symbols::incompatible_warning): New function.
9999         (Read_symbols::requeue): New function.
10000         (Read_symbols::do_read_symbols): If make_elf_object fails because
10001         the target type is not configured, and the file was searched for,
10002         issue a warning and retry with the next directory.
10003         (Add_symbols::run): If the file has an incompatible format, and
10004         it was searched for, requeue the Read_symbols task.  On error,
10005         release the object.
10006         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10007         dirindex parameter to constructor.  Change all callers.  Declare
10008         incompatible_warning and requeue.
10009         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10010         input_argument_ and input_group_ fields.  Add them to
10011         constructor.  Change all callers.
10012         (class Read_script): Add dirindex_ field.  Add it to constructor.
10013         Change all callers.
10014         * archive.cc (Archive::setup): Remove input_objects parameter.
10015         Change all callers.
10016         (Archive::get_file_and_offset): Likewise.
10017         (Archive::read_all_symbols): Likewise.
10018         (Archive::read_symbols): Likewise.
10019         (Archive::get_elf_object_for_member): Remove input_objects
10020         parameter.  Add punconfigured parameter.  Change all callers.
10021         (Archive::add_symbols): Change return type to bool.  Check return
10022         value of include_member.
10023         (Archive::include_all_members): Likewise.
10024         (Archive::include_member): Change return type to bool.  Return
10025         false if first included object has incompatible target.  Set
10026         included_member_ field.
10027         (Add_archive_symbols::run): If add_symbols returns false, requeue
10028         Read_symbols task.
10029         * archive.h (class Archive): Add included_member_ field.
10030         Initialize it in constructor.  Add input_file and searched_for
10031         methods.  Update declarations.
10032         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10033         input_argument_ fields.  Add them to constructor.  Change all
10034         callers.
10035         * script.cc: Include "target-select.h".
10036         (class Parser_closure): Add skip_on_incompatible_target_ and
10037         found_incompatible_target_ fields.  Add
10038         skip_on_incompatible_target parameter to constructor.  Change all
10039         callers.  Add methods skip_on_incompatible_target,
10040         clear_skip_on_incompatible_target, found_incompatible_target, and
10041         set_found_incompatible_target.
10042         (read_input_script): Add dirindex parameter.  Change all callers.
10043         If parser finds an incompatible target, requeue Read_symbols
10044         task.
10045         (script_set_symbol): Clear skip_on_incompatible_target in
10046         closure.
10047         (script_add_assertion, script_parse_option): Likewise.
10048         (script_start_sections, script_add_phdr): Likewise.
10049         (script_check_output_format): New function.
10050         * script.h (read_input_script): Update declaration.
10051         * script-c.h (script_check_output_format): Declare.
10052         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10053         (ignore_cmd): Remove OUTPUT_FORMAT.
10054         * fileread.cc (Input_file::Input_file): Add explicit this.
10055         (Input_file::will_search_for): New function.
10056         (Input_file::open): Add pindex parameter.  Change all callers.
10057         * fileread.h (class Input_file): Add input_file_argument method.
10058         Declare will_search_for.  Update declarations.
10059         * object.cc (make_elf_object): Add punconfigured parameter.
10060         Change all callers.
10061         * object.h (class Object): Make input_file public.  Add
10062         searched_for method.
10063         (make_elf_object): Update declaration.
10064         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10065         restart search.
10066         * dirsearch.h (class Dirsearch): Update declaration.
10067         * options.h (class General_options): Add --warn-search-mismatch.
10068         * parameters.cc (Parameters::is_compatible_target): New function.
10069         * parameters.h (class Parameters): Declare is_compatible_target.
10070         * workqueue.cc (Workqueue::add_blocker): New function.
10071         * workqueue.h (class Workqueue): Declare add_blocker.
10072
10073         * fileread.cc (Input_file::open): Remove options parameter.
10074         Change all callers.
10075         (Input_file::open_binary): Likewise.
10076         * script.cc (read_input_script): Likewise.
10077         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10078         options parameter from constructor.  Change all callers.
10079         (class Read_script): Likewise.
10080         * fileread.h (class Input_file): Update declarations.
10081         * script.h (read_input_script): Update declaration.
10082
10083 2009-03-10  Nick Clifton  <nickc@redhat.com>
10084
10085         * po/es.po: New Spanish translation.
10086
10087 2009-03-06  Cary Coutant  <ccoutant@google.com>
10088
10089         * options.cc (parse_short_option): Keep dash_z from registering itself.
10090
10091 2009-03-03  Ian Lance Taylor  <iant@google.com>
10092
10093         PR 9918
10094         * target-reloc.h (relocate_section): Pass output_section to
10095         relocate.
10096         * i386.cc (Target_i386::should_apply_static_reloc): Add
10097         output_section parameter.  Change all callers.
10098         (Target_i386::Relocate::relocate): Add output_section parameter.
10099         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10100         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10101         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10102         * testsuite/two_file_shared.sh: New script.
10103         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10104         (check_DATA): Add two_file_shared.dbg.
10105         (two_file_shared.dbg): New target.
10106         * testsuite/Makefile.in: Rebuild.
10107
10108 2009-03-01  Ian Lance Taylor  <iant@google.com>
10109
10110         * configure.ac: Check for byteswap.h.
10111         * configure: Rebuild.
10112         * config.in: Rebuild.
10113
10114 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10115
10116         * layout.cc (Layout::find_or_add_kept_section): New function.
10117         (Layout::add_comdat): Removed.
10118         * layout.h (struct Kept_section): Move out of class Layout.
10119         Remove trailing underscores from field names.  Add group_sections
10120         field.  Rename group_ field to is_group.  Change all uses.
10121         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10122         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10123         comdat_groups_ field.
10124         (Sized_relobj::include_section_group): Use
10125         find_or_add_kept_section and Kept_section::group_sections.
10126         (Sized_relobj::include_linkonce_section): Likewise.
10127         * object.cc (class Sized_relobj): Don't define Comdat_group or
10128         Comdat_group_table.  Remove find_comdat_group and
10129         add_comdat_group.  Remove comdat_groups_ field.
10130         * plugin.cc (include_comdat_group): Use
10131         Layout::find_or_add_kept_section.
10132
10133 2009-02-28  Ian Lance Taylor  <iant@google.com>
10134
10135         * README: --gc-sections and map files are now supported.  Document
10136         some build requirements.
10137
10138         PR 6992
10139         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10140         relocatable link set the value of the section symbol to zero.
10141         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10142         relocatable link don't include the section address in the local
10143         symbol value.
10144
10145 2009-02-27  Ian Lance Taylor  <iant@google.com>
10146
10147         PR 6811
10148         * options.h (class Search_directory): Add is_system_directory.
10149         (class General_options): Declare is_in_system_directory.
10150         * options.cc (get_relative_sysroot): Make static.
10151         (get_default_sysroot): Make static.
10152         (General_optoins::is_in_system_directory): New function.
10153         * fileread.cc (Input_file::is_in_system_directory): New function.
10154         * fileread.h (class Input_file): Declare is_in_system_directory.
10155         * object.h (class Object): Add is_in_system_directory.
10156         (class Input_objects): Remove system_library_directory_ field.
10157         * object.cc (Input_objects::add_object): Don't set
10158         system_library_directory_.
10159         (input_objects::found_in_system_library_directory): Remove.
10160         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10161         parameter.  Change all callers.
10162         (Symbol_table::sized_write_globals): Likewise.
10163         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10164         Call Object::is_in_system_directory.
10165         * symtab.h (class Symbol_table): Update declarations.
10166
10167         PR 5990
10168         * descriptors.h (Open_descriptor): Add is_on_stack field.
10169         * descriptors.cc (Descriptors::open): If the descriptor is on the
10170         top of the stack, remove it.  Initialize is_on_stack field.
10171         (Descriptors::release): Only add pod to stack if it is not on the
10172         stack already.
10173         (Descriptors::close_some_descriptor): Clear stack_next and
10174         is_on_stack fields.
10175
10176         PR 7091
10177         * output.cc (Output_section::find_starting_output_address): Rename
10178         from starting_output_address; add PADDR parameter; change return
10179         type.
10180         * output.h (class Output_section): Declare
10181         find_starting_output_address instead of starting_output_address.
10182         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10183         section symbol for which we can't find a merge section.
10184
10185         PR 9836
10186         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10187         hidden or internal, force the symbol to be local.
10188         * resolve.cc (Symbol::override_visibility): Define.
10189         (Symbol::override_base): Use override_visibility.
10190         (Symbol_table::resolve): Likewise.
10191         (Symbol::override_base_with_special): Likewise.
10192         (Symbol_table::override_with_special): If the visibility is hidden
10193         or internal, force the symbol to be local.
10194         * symtab.h (class Symbol): Add set_visibility and
10195         override_visibility.
10196         * testsuite/ver_test_1.sh: New file.
10197         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10198         (check_DATA): Add ver_test_1.syms.
10199         (ver_test_1.syms): New target.
10200         * testsuite/Makefile.in: Rebuild.
10201
10202 2009-02-25  Cary Coutant  <ccoutant@google.com>
10203
10204         * layout.cc (Layout::choose_output_section): Don't rename sections
10205         when using a linker script that has a SECTIONS clause.
10206         * Makefile.in: Regenerate.
10207
10208         * testsuite/Makefile.am (script_test_5.sh): New test case.
10209         * testsuite/Makefile.in: Regenerate.
10210         * testsuite/script_test_5.cc: New file.
10211         * testsuite/script_test_5.sh: New file.
10212         * testsuite/script_test_5.t: New file.
10213
10214 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10215
10216         * archive.cc (Archive::include_member): Update calls to add_symbols.
10217         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10218         the Layout argument.
10219         * dynobj.h (do_add_symbols): Add the Layout argument.
10220         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10221         Layout argument.
10222         * object.h (Object::add_symbols): Add the Layout argument.
10223         (Object::do_add_symbols): Add the Layout argument.
10224         (Sized_relobj::do_add_symbols): Add the Layout argument.
10225         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10226         Unify the two versions.
10227         (Add_plugin_symbols): Remove.
10228         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10229         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10230         (Add_plugin_symbols): Remove.
10231         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10232         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10233         (Add_symbols::run): Make it work with Pulginobj.
10234
10235 2009-02-06  Ian Lance Taylor  <iant@google.com>
10236
10237         * object.cc (Sized_relobj::do_layout): Make info message start
10238         with lower case letter.
10239
10240 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10241
10242         * binary.cc: Fix file comment.
10243
10244         * options.h (enum Incremental_disposition): Define.
10245         (class General_options): Add new options: --incremental,
10246         --incremental_changed, --incremental_unchanged,
10247         --incremental_unknown.  Add incremental_disposition_ and
10248         implicit_incremental_ fields.
10249         (General_options::incremental_disposition): New function.
10250         (class Position_dependent_options): Add incremental_disposition
10251         option.
10252         (Position_dependent_options::copy_from_options): Set incremental
10253         dispositions.
10254         * options.cc (General_options::parse_incremental_changed): New
10255         function.
10256         (General_options::parse_incremental_unchanged): New function.
10257         (General_options::parse_incremental_unknown): New function.
10258         (General_options::General_options): Initialize new fields
10259         incremental_disposition_ and implicit_incremental_.
10260         (General_options::finalize): Check for uasge of --incremental-*
10261         without --incremental.
10262
10263 2009-02-06  Chris Demetriou  <cgd@google.com>
10264
10265         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10266         pointer and to report location as the file name associated with
10267         the symbol.
10268         (gold_undefined_symbol_at_location): New function to replace the
10269         old gold_undefined_symbol functionality.
10270         * target-reloc.h (relocate_section): Update to use
10271         gold_undefined_symbol_at_location.
10272         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10273         Call gold_undefined_symbol function rather than gold_error.
10274         * errors.h (Errors::undefined_symbol): Take location as a
10275         string, rather than calculating it from a relocation.
10276         * errors.cc (Errors::fatal): Print "fatal error:" before the
10277         formatted message.
10278         (Errors::error, Errors::error_at_location): Print "error: "
10279         before the formatted message.
10280         (Errors::undefined_symbol): Take location as a string, rather
10281         than calculating it from a relocation.
10282         (gold_undefined_symbol_at_location): New function akin to
10283         old gold_undefined_symbol, calculates location from relocation.
10284         (gold_undefined_symbol): Change to take only a Symbol pointer
10285         and to report location as the file name associated with the symbol.
10286         * testsuite/debug_msg.sh: Update for changed error messages.
10287         * testsuite/undef_symbol.sh: Likewise.
10288
10289 2009-02-04  Duncan Sands  <baldrick@free.fr>
10290
10291         PR 9812
10292         * reduced_debug_output.h
10293         (Output_reduced_debug_abbrev_section::failed): Use format for
10294         gold_warning.
10295         (Output_reduced_debug_info_section::faild): Likewise.
10296
10297 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10298
10299         * script.cc (Lazy_demangler): New class.
10300         (Version_script_info::get_symbol_version_helper): Demangle a
10301         symbol only once.
10302
10303 2009-01-29  Cary Coutant  <ccoutant@google.com>
10304
10305         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10306         to __tls_get_addr.
10307         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10308
10309 2009-01-28  Ian Lance Taylor  <iant@google.com>
10310
10311         * version.cc (version_string): Bump to 1.9.
10312
10313         * gold.h: Include <cstring> and <stdint.h>.
10314         * version.cc: Include <cstdio>.
10315         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10316         warning.
10317         * reduced_debug_output.cc (insert_into_vector): Rename from
10318         Insert_into_vector; change all callers.  Use Swap_unaligned to
10319         avoid aliasing issue; remove union since it is unnecessary.
10320
10321 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10322
10323         * Makefile.am (CCFILES): Add gc.cc.
10324         (HFILES): Add gc.h.
10325         * Makefile.in: Regenerate.
10326         * gold.cc (Gc_runner): New class.
10327         (queue_initial_tasks): Call garbage collection related tasks
10328         when corresponding options are invoked.
10329         (queue_middle_gc_tasks): New function.
10330         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10331         processed early before laying out sections during garbage collection.
10332         * gold.h (queue_middle_gc_tasks): New function.
10333         (is_prefix_of): Move from "layout.cc".
10334         * i386.cc (Target_i386::gc_process_relocs): New function.
10335         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10336         * main.cc (main): Create object of class "Garbage_collection".
10337         * object.cc (Relobj::copy_symbols_data): New function.
10338         (Relobj::is_section_name_included): New function.
10339         (Sized_relobj::do_layout): Allow this function to be called twice
10340         during garbage collection and defer layout of section during the
10341         first call.
10342         * object.h (Relobj::get_symbols_data): New function.
10343         (Relobj::is_section_name_included): New function.
10344         (Relobj::copy_symbols_data): New function.
10345         (Relobj::set_symbols_data): New function.
10346         (Relobj::get_relocs_data): New function.
10347         (Relobj::set_relocs_data): New function.
10348         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10349         (Relobj::gc_process_relocs): New function.
10350         (Relobj::do_gc_process_relocs): New pure virtual function.
10351         (Relobj::sd_): New data member.
10352         (Sized_relobj::is_output_section_offset_invalid): New function.
10353         (Sized_relobj::do_gc_process_relocs): New function.
10354         * options.h (General_options::gc_sections): Modify to not be a no-op.
10355         (General_options::print_gc_sections): New option.
10356         * plugin.cc (Plugin_finish::run): Remove function call to
10357         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10358         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10359         * reloc.cc (Read_relocs::run): Add task to process relocs and
10360         determine unreferenced sections when doing garbage collection.
10361         (Gc_process_relocs): New class.
10362         (Sized_relobj::do_gc_process_relocs): New function.
10363         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10364         sections that are garbage collected.
10365         * reloc.h (Gc_process_relocs): New class.
10366         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10367         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10368         symbols whose corresponding sections are garbage collected.
10369         (Symbol_table::Symbol_table): Add new parameter for the garbage
10370         collection object.
10371         (Symbol_table::gc_mark_undef_symbols): New function.
10372         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10373         (Symbol_table::gc_mark_dyn_syms): New function.
10374         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10375         as garbage.
10376         (Symbol_table::add_from_object): Likewise.
10377         (Symbol_table::add_from_relobj): When building shared objects, do not
10378         treat externally visible symbols as garbage.
10379         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10380         table information for static and relocatable links.
10381         * symtab.h (Symbol_table::set_gc): New function.
10382         (Symbol_table::gc): New function.
10383         (Symbol_table::gc_mark_undef_symbols): New function.
10384         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10385         (Symbol_table::gc_mark_dyn_syms): New function.
10386         (Symbol_table::gc_): New data member.
10387         * target.h (Sized_target::gc_process_relocs): New pure virtual
10388         function.
10389         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10390         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10391
10392 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10393
10394         * options.h (General_options::gc_sections): Define as a no-op for now.
10395         (General_options::no_keep_memory): Ditto.
10396         (General_options::Bshareable): Define.
10397         * options.cc (General_options::finalize): Honor -Bshareable.
10398
10399 2009-01-20  Andreas Schwab  <schwab@suse.de>
10400
10401         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10402         read the value in the contents, since we don't use it.  Use the
10403         template endianness when writing.
10404         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10405
10406 2009-01-19  Andreas Schwab  <schwab@suse.de>
10407
10408         * configure.tgt (powerpc64-*): Fix targ_obj.
10409
10410 2009-01-15  Ian Lance Taylor  <iant@google.com>
10411
10412         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10413         local symbols when stripping all symbols.
10414
10415 2009-01-14  Cary Coutant  <ccoutant@google.com>
10416
10417         * output.cc (Output_reloc): Add explicit instantiations.
10418
10419 2009-01-14  Cary Coutant  <ccoutant@google.com>
10420
10421         * archive.cc (Archive::get_elf_object_for_member): Remove call
10422         to File_read::claim_for_plugin.
10423         * descriptors.cc (Descriptors::open): Remove reference to
10424         is_claimed.
10425         (Descriptors::claim_for_plugin): Remove.
10426         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10427         (Descriptors::is_claimed): Remove.
10428         (claim_descriptor_for_plugin): Remove.
10429         * fileread.cc (File_read::claim_for_plugin): Remove.
10430         * fileread.h (File_read::claim_for_plugin): Remove.
10431         (File_read::descriptor): Reopen descriptor if necessary.
10432         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10433         (Plugin_manager::all_symbols_read): Add task parameter. Change
10434         all callers.
10435         (Plugin_manager::get_input_file): New function.
10436         (Plugin_manager::release_input_file): New function.
10437         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10438         corresponding data member.
10439         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10440         and pass to base constructor. Change all callers.
10441         (get_input_file, release_input_file): New functions.
10442         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10443         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10444         (Plugin_manager::all_symbols_read): Add task parameter.
10445         (Plugin_manager::get_input_file): New function.
10446         (Plugin_manager::release_input_file): New function.
10447         (Plugin_manager::task_): New data member.
10448         (Pluginobj::Pluginobj): Add filesize parameter.
10449         (Pluginobj::filename): New function.
10450         (Pluginobj::descriptor): New function.
10451         (Pluginobj::filesize): New function.
10452         (Pluginobj::filesize_): New data member.
10453         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10454         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10455         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10456
10457         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10458         with archive libraries.
10459         * testsuite/Makefile.in: Regenerate.
10460         * testsuite/plugin_test.c (struct sym_info): New type.
10461         (get_input_file, release_input_file): New static variables.
10462         (onload): Capture new transfer vector entries.
10463         (claim_file_hook): Stop reading at end of file according to filesize.
10464         Factor out parsing of readelf output into separate function.
10465         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10466         APIs and get the source file name from the symbol table.  Convert
10467         source file name to corresponding object file name.  Print info
10468         message when adding new input files.
10469         (parse_readelf_line): New function.
10470         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10471         * testsuite/plugin_test_2.sh: Likewise.
10472         * testsuite/plugin_test_3.sh: Likewise.
10473         * testsuite/plugin_test_4.sh: New test case.
10474
10475 2009-01-07  Ian Lance Taylor  <iant@google.com>
10476
10477         * version.cc (version_string): Bump to 1.8.
10478
10479 2008-12-23  Cary Coutant  <ccoutant@google.com>
10480
10481         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10482         * plugin.cc (Plugin_manager::finish): Rename as
10483         layout_deferred_objects.  Move cleanup to separate function.
10484         (Plugin_manager::cleanup): New function.
10485         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10486         separately.
10487         * plugin.h (Plugin_manager::finish): Rename as
10488         layout_deferred_objects.
10489         (Plugin_manager::cleanup): New function.
10490         (Plugin_manager::cleanup_done): New field.
10491
10492 2008-12-23  Cary Coutant  <ccoutant@google.com>
10493
10494         * plugin.cc (is_visible_from_outside): New function.
10495         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10496         so we don't return "IR only" status for exported symbols or -r links.
10497
10498         * testsuite/Makefile.am (plugin_test_3): New test case.
10499         * testsuite/Makefile.in: Regenerate.
10500         * testsuite/plugin_test_3.sh: New file.
10501
10502 2008-12-22  Cary Coutant  <ccoutant@google.com>
10503
10504         * object.cc (Sized_relobj::layout_section): New function.
10505         (Sized_relobj::do_layout): Defer layout of input sections until after
10506         plugin has provided replacement files.
10507         (Sized_relobj::do_layout_deferred_sections): New function.
10508         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10509         (Relobj::layout_deferred_sections): New function.
10510         (Relobj::do_layout_deferred_sections): New function.
10511         (Sized_relobj::do_layout_deferred_sections): New function.
10512         (Sized_relobj::layout_section): New function.
10513         (Sized_relobj::Deferred_layout): New structure.
10514         (Sized_relobj::deferred_layout_): New field.
10515         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10516         Change all callers.  Layout deferred sections.
10517         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10518         references.
10519         (Plugin_hook::run): Move code from do_plugin_hook inline.
10520         (Plugin_hook::do_plugin_hook): Remove.
10521         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10522         (Plugin_manager::finish): Renamed, was cleanup.
10523         (Plugin_manager::should_defer_layout): New function.
10524         (Plugin_manager::add_deferred_layout_object): New function.
10525         (Plugin_manager::Deferred_layout_list): New type.
10526         (Plugin_manager::deferred_layout_objects_): New field.
10527         (Plugin_hook::do_plugin_hook): Remove.
10528
10529 2008-12-17  Ian Lance Taylor  <iant@google.com>
10530
10531         * options.h (class General_options): Add --no case for
10532         --export-dynamic.
10533
10534 2008-12-16  Cary Coutant  <ccoutant@google.com>
10535
10536         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10537         vector.
10538         (Plugin_manager::claim_file): Create plugin object even if
10539         plugin did not call the add_symbols callback.
10540         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10541         asking for more symbols than were added.
10542         * testsuite/Makefile.am (plugin_test_1): Add test case with
10543         no global symbols.
10544         (empty.syms): New target.
10545         * testsuite/Makefile.in: Regenerate.
10546         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10547         message. Don't call add_symbols if no globals.
10548         (all_symbols_read_hook): Don't provide replacement for empty
10549         claimed file.
10550
10551 2008-12-12  Ian Lance Taylor  <iant@google.com>
10552
10553         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10554         r_type == 0 for a local symbol with r_sym == 0.
10555         (scan_relocatable_relocs): Pass r_sym to
10556         local_non_section_strategy.
10557         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10558         r_sym parameter.
10559
10560         * configure.ac: Update test for TLS descriptors: they are
10561         supported as of glibc 2.9.
10562         * configure: Rebuild.
10563
10564 2008-12-11  Ian Lance Taylor  <iant@google.com>
10565
10566         PR 7091
10567         * target-reloc.h (Default_scan_relocatable_relocs): For each
10568         function, map r_type == 0 to RELOC_DISCARD.
10569
10570 2008-12-10  Cary Coutant  <ccoutant@google.com>
10571
10572         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10573         object to override a kept COMDAT group from a plugin object.
10574
10575 2008-12-09  Ian Lance Taylor  <iant@google.com>
10576
10577         PR 7088
10578         * yyscript.y (file_cmd): Handle INPUT.
10579
10580         * testsuite/initpri1.c: Change all declarations to be full
10581         prototypes by adding void, to avoid compiler warnings.
10582
10583 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10584
10585         * options.cc (General_options::parse_plugin_opt): New.
10586         (General_options::add_plugin): The argument now is just the filename.
10587         (General_options::add_plugin_option): New.
10588         * options.h (plugin_opt): New.
10589         (add_plugin): Change argument name.
10590         (add_plugin_option): New.
10591         * plugin.cc (Plugin::load): Don't parse the plugin option.
10592         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10593         (Plugin::add_option): New.
10594         (Plugin::args_): Change type.
10595         (Plugin::filename_): New.
10596         (Plugin_manager::add_plugin_option): New.
10597         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10598         * testsuite/Makefile.in: Regenerate.
10599
10600 2008-12-05  Cary Coutant  <ccoutant@google.com>
10601
10602         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10603         Handle --strip-lto-sections option.
10604         * options.h (strip_lto_sections): New option.
10605
10606 2008-12-01  Cary Coutant  <ccoutant@google.com>
10607
10608         * plugin.cc (ld_plugin_message): Change format parameter to const.
10609         Fix mismatch between new[] and delete.
10610
10611 2008-11-14  Cary Coutant  <ccoutant@google.com>
10612
10613         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10614         instead of -1U.
10615
10616 2008-11-05  Craig Silverstein  <csilvers@google.com>
10617
10618         * options.cc (General_options::parse_dynamic_list): New function.
10619         * options.h (General_options): New flags dynamic_list,
10620         dynamic_list_data, dynamic_list_cpp_new, and
10621         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10622         (General_options::in_dynamic_list): New function.
10623         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10624         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10625         (Lex::can_continue_name): Likewise.
10626         (yylex): Likewise.
10627         (read_script_file): New parameter script_options.
10628         (read_dynamic_list): New function.
10629         (Script_options::define_dynamic_list): New function.
10630         (dynamic_list_keyword_parsecodes): New variable.
10631         (dynamic_list_keywords): New variable.
10632         * script.h (Script_options::define_dynamic_list): New function
10633         prototype.
10634         (read_dynamic_list): New function prototype.
10635         * symtab.cc (strprefix): New macro.
10636         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10637         dynamic_list_data, dynamic_list_cpp_new, and
10638         dynamic_list_cpp_typeinfo.
10639         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10640         (dynamic_list_expr): New rule.
10641         (dynamic_list_nodes): Likewise.
10642         (dynamic_list_node): Likewise.
10643         * testsuite/Makefile.am (dynamic_list): New test.
10644         * testsuite/Makefile.in: Regenerated.
10645         * testsuite/dynamic_list.t: New file.
10646         * testsuite/dynamic_list.sh: New file.
10647
10648 2008-11-05  Craig Silverstein  <csilvers@google.com>
10649
10650         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10651         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10652         (t11_last): Likewise.
10653         * testsuite/ver_test_6.c (main): Likewise.
10654
10655 2008-10-07  Cary Coutant  <ccoutant@google.com>
10656
10657         * options.c (General_options::finalize): Add check for -static and
10658         -shared.
10659         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10660         is not empty.
10661
10662 2008-10-02  Cary Coutant  <ccoutant@google.com>
10663
10664         * plugin.cc (make_sized_plugin_object): Fix conditional
10665         compilation to work when not all targets are enabled.
10666
10667 2008-09-29  Cary Coutant  <ccoutant@google.com>
10668
10669         * archive.cc (Archive::get_file_and_offset): Use filename instead
10670         of name to get library path.
10671         (Archive::include_member): Unlock external member of a thin archive.
10672
10673         * testsuite/Makefile.am (TEST_AR): New variable.
10674         (thin_archive_test_1): New test.
10675         (thin_archive_test_2): New test.
10676         * testsuite/Makefile.in: Regenerate.
10677         * testsuite/thin_archive_main.cc: New file.
10678         * testsuite/thin_archive_test_1.cc: New file.
10679         * testsuite/thin_archive_test_2.cc: New file.
10680         * testsuite/thin_archive_test_3.cc: New file.
10681         * testsuite/thin_archive_test_4.cc: New file.
10682
10683 2008-09-29  Cary Coutant  <ccoutant@google.com>
10684
10685         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10686         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10687         instead of -1U.
10688         (Sized_relobj::do_finalize_local_symbols): Likewise.
10689         (Sized_relobj::map_to_kept_section): Likewise.
10690         * object.h (Sized_relobj::invalid_address): New constant.
10691         (Sized_relobj::do_output_section_offset): Check for invalid_address
10692         and return -1ULL.
10693         * output.cc (Output_reloc::local_section_offset): Use constant
10694         invalid_address instead of -1U.
10695         (Output_reloc::get_address): Likewise.
10696         (Output_section::output_address): Change -1U to -1ULL.
10697         * output.h (Output_reloc::invalid_address): New constant.
10698         * reloc.cc (Sized_relobj::write_sections): Use constant
10699         invalid_address instead of -1U.
10700         (Sized_relobj::relocate_sections): Likewise.
10701         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10702         values for merge sections.
10703         * target-reloc.h (relocate_for_relocatable): Use constant
10704         invalid_address instead of -1U.
10705
10706 2008-09-19  Cary Coutant  <ccoutant@google.com>
10707
10708         Add plugin functionality for link-time optimization (LTO).
10709         * configure.ac (plugins): Add --enable-plugins option.
10710         * configure: Regenerate.
10711         * config.in: Regenerate.
10712         * Makefile.am (LIBDL): New variable.
10713         (CCFILES): Add plugin.cc.
10714         (HFILES): Add plugin.h.
10715         (ldadd_var): Add LIBDL.
10716         * Makefile.in: Regenerate.
10717
10718         * archive.cc: Include "plugin.h".
10719         (Archive::setup): Don't preread archive symbols when using a plugin.
10720         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10721         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10722         files.
10723         (Archive::include_member): Add symbols from plugin objects.
10724         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10725         * descriptors.cc (Descriptors::open): Check for file descriptors
10726         abandoned by plugins.
10727         (Descriptors::claim_for_plugin): New function.
10728         * descriptors.h (Descriptors::claim_for_plugin): New function.
10729         (Open_descriptor::is_claimed): New field.
10730         (claim_descriptor_for_plugin): New function.
10731         * fileread.cc (File_read::claim_for_plugin): New function.
10732         * fileread.h (File_read::claim_for_plugin): New function.
10733         (File_read::descriptor): New function.
10734         * gold.cc: Include "plugin.h".
10735         (queue_initial_tasks): Add task to call plugin hooks for generating
10736         new object files.
10737         * main.cc: Include "plugin.h".
10738         (main): Load plugin libraries.
10739         * object.h (Pluginobj): Declare.
10740         (Object::pluginobj): New function.
10741         (Object::do_pluginobj): New function.
10742         (Object::set_target): New function.
10743         * options.cc: Include "plugin.h".
10744         (General_options::parse_plugin): New function.
10745         (General_options::General_options): Initialize plugins_ field.
10746         (General_options::add_plugin): New function.
10747         * options.h (Plugin_manager): Declare.
10748         (General_options): Add --plugin option.
10749         (General_options::has_plugins): New function.
10750         (General_options::plugins): New function.
10751         (General_options::add_plugin): New function.
10752         (General_options::plugins_): New field.
10753         * plugin.cc: New file.
10754         * plugin.h: New file.
10755         * readsyms.cc: Include "plugin.h".
10756         (Read_symbols::do_read_symbols): Check for archive before checking
10757         for ELF file.  Call plugin hooks to claim files.
10758         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10759         from a real object file; force override when processing replacement
10760         files.
10761         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10762         (Symbol::init_base_object): Likewise.
10763         (Symbol::init_base_output_data): Likewise.
10764         (Symbol::init_base_output_segment): Likewise.
10765         (Symbol::init_base_constant): Likewise.
10766         (Symbol::init_base_undefined): Likewise.
10767         (Symbol::output_section): Assert that object is not a plugin.
10768         (Symbol_table::add_from_pluginobj): New function.
10769         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10770         undefined.
10771         (Symbol_table::sized_write_globals): Likewise.
10772         (Symbol_table::add_from_pluginobj): Instantiate template.
10773         * symtab.h (Sized_pluginobj): Declare.
10774         (Symbol::in_real_elf): New function.
10775         (Symbol::set_in_real_elf): New function.
10776         (Symbol::in_real_elf_): New field.
10777         (Symbol_table::add_from_pluginobj): New function.
10778
10779         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10780         (LIBDL): New variable.
10781         (LDADD): Add LIBDL.
10782         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10783         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10784         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10785         (MOSTLYCLEANFILES): Likewise.
10786         * testsuite/Makefile.in: Regenerate.
10787         * testsuite/plugin_test.c: New file.
10788         * testsuite/plugin_test_1.sh: New file.
10789         * testsuite/plugin_test_2.sh: New file.
10790
10791 2008-09-16  Ian Lance Taylor  <iant@google.com>
10792
10793         * target-reloc.h (relocate_section): Check whether a symbol is
10794         defined by the ABI before reporting an undefined symbol error.
10795         * target.h (Target::is_defined_by_abi): Make parameter const.
10796         (Target::do_is_defined_by_abi): Likewise.
10797         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10798         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10799         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10800         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10801         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10802         * testsuite/Makefile.in: Rebuild.
10803
10804         * fileread.cc (make_view): Add casts to avoid warning.
10805
10806 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10807
10808         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10809         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10810
10811 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10812
10813         * options.h (General_options::output_is_executable): New.
10814         (General_options::output_is_pie): New.
10815         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10816         for shared libraries.
10817         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10818
10819 2008-09-11  Chris Demetriou  <cgd@google.com>
10820
10821         * options.h (origin): New -z option.
10822         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10823         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10824         in DT_FLAGS_1.
10825
10826 2008-09-05  Cary Coutant  <ccoutant@google.com>
10827
10828         * fileread.cc (File_read::make_view): Add check for attempt to map
10829         beyond end of file.
10830
10831 2008-09-05  Cary Coutant  <ccoutant@google.com>
10832
10833         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10834         explicit instantiations.
10835
10836 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10837
10838         PR gold/6858
10839         * options.cc (General_options::finalize): Allow undefined symbols
10840         in shlibs if linking -shared.
10841
10842         PR gold/6859
10843         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10844         symbols as not needing a dynsym entry.
10845
10846 2008-08-20  Craig Silverstein  <csilvers@google.com>
10847
10848         * fileread.cc (File_read::open): Do not lock the file unless it
10849         was successfully opened.
10850
10851 2008-08-14  Cary Coutant  <ccoutant@google.com>
10852
10853         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10854         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10855         * testsuite/tls_test.cc (struct int128): 128-bit struct
10856         for testing TLS relocs with non-zero addend.
10857         (v12): New TLS variable.
10858         (t12): New test.
10859         (t_last): Add check for v12.
10860         * testsuite/tls_test.h (t12): New function.
10861         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10862
10863 2008-08-13  Ian Lance Taylor  <iant@google.com>
10864
10865         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10866         set tls_segment_ or relro_segment_.
10867         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10868         when appropriate.
10869         * output.h (Output_section::clear_is_relro): New function.
10870         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10871         sections specially even when output_data_ is empty.
10872         (Output_segment::maximum_alignment): When first section is relro,
10873         only force alignment for PT_LOAD segments.
10874         * script.cc (script_data_segment_align): New function.
10875         (script_data_segment_relro_end): New function.
10876         * script-c.h (script_data_segment_align): Declare.
10877         (script_data_segment_relro_end): Declare.
10878         * script-sections.h (class Script_sections): Declare
10879         data_segment_align and data_segment_relro_end.  Add fields
10880         segment_align_index_ and saw_relro_end_.
10881         * script-sections.cc (class Sections_element): Add set_is_relro
10882         virtual function.  Add new bool* parameter to place_orphan_here.
10883         Add get_output_section virtual function.
10884         (class Output_section_definition): Add set_is_relro.  Add new
10885         bool* parameter to place_orphan_here.  Add get_output_section.
10886         Add is_relro_ field.
10887         (Output_section_definition::Output_section_definition): Initialize
10888         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10889         and is_relro_ fields.
10890         (Output_section_definition::place_orphan_here): Add is_relro
10891         parameter.
10892         (Output_section_definition::set_section_addresses): Set relro for
10893         output section.
10894         (Output_section_definition::alternate_constraint): Likewise.
10895         (class Orphan_output_section): Add new bool* parameter to
10896         place_orphan_here.  Add get_output_section.
10897         (Orphan_output_section::place_orphan_here): Add is_relro
10898         parameter.
10899         (Script_sections::Script_sections): Initialize
10900         data_segment_align_index_ and saw_relro_end_.
10901         (Script_sections::data_segment_align): New function.
10902         (Script_sections::data_segment_relro_end): New function.
10903         (Script_sections::place_orphan): Set or clear is_relro.
10904         (Script_sections::set_section_addresses): Force alignment of first
10905         TLS section.
10906         * yyscript.y (exp): Call script_data_segment_align and
10907         script_data_segment_relro_end.
10908         * testsuite/relro_script_test.t: New file.
10909         * testsuite/relro_test.cc (using_script): Declare.
10910         (t1, t2): Test using_script.
10911         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10912         (relro_script_test_SOURCES): Define.
10913         (relro_script_test_DEPENDENCIES): Define.
10914         (relro_script_test_LDFLAGS): Define.
10915         (relro_script_test_LDADD): Define.
10916         (relro_script_test.so): New target.
10917         * testsuite/Makefile.in: Rebuild.
10918
10919 2008-08-06  Cary Coutant <ccoutant@google.com>
10920
10921         * archive.cc (Archive::total_archives, Archive::total_members)
10922         (Archive::total_members_loaded): New variables.
10923         (Archive::setup): Add parameter.  Add option to preread
10924         archive symbols.
10925         (Archive::read_armap): Add counter.
10926         (Archive::get_file_and_offset): New function.
10927         (Archive::get_elf_object_for_member): New function.
10928         (Archive::read_all_symbols): New function.
10929         (Archive::read_symbols): New function.
10930         (Archive::add_symbols): Add counters.
10931         (Archive::include_all_members): Use armap to find members if it's
10932         already built.
10933         (Archive::include_member): Skip reading symbols if already read.
10934         Factored code into Archive::get_file_and_offset and
10935         Archive::get_elf_object_for_member.  Changed call to
10936         Mapfile::report_include_archive_member.
10937         (Archive::print_stats): New function.
10938         * archive.h: Declare Object and Read_symbols_data classes.
10939         (Archive::Archive): Add initializers for new members.
10940         (Archive::setup): Add parameter.
10941         (Archive::print_stats): New function.
10942         (Archive::total_archives, Archive::total_members)
10943         (Archive::total_members_loaded): New variables.
10944         (Archive::get_file_and_offset): New function.
10945         (Archive::get_elf_object_for_member): New function.
10946         (Archive::read_all_symbols): New function.
10947         (Archive::read_symbols): New function.
10948         (Archive::Archive_member): New class.
10949         (Archive::members_): New member.
10950         (Archive::num_members_): New member.
10951         * main.cc: Include archive.h.
10952         (main): Call Archive::print_stats.
10953         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10954         archive parameter; member_name is now the fully-decorated name.
10955         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10956         * options.h: (General_options): Add --preread-archive-symbols option.
10957         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10958         Archive::setup.
10959
10960 2008-08-04  Ian Lance Taylor  <iant@google.com>
10961
10962         * symtab.h (Symbol::use_plt_offset): New function.
10963         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10964         * powerpc.cc (Relocate::relocate): Likewise.
10965         * sparc.cc (Relocate::relocate): Likewise.
10966         * x86_64.cc (Relocate::relocate): Likewise.
10967         * testsuite/weak_plt.sh: New test.
10968         * testsuite/weak_plt_main.cc: New test.
10969         * testsuite/weak_plt_shared.cc: New test.
10970         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10971         (check_PROGRAMS): Add weak_plt.
10972         (check_DATA): Add weak_plt_shared.so.
10973         (weak_plt_main_pic.o, weak_plt): New targets.
10974         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10975         * testsuite/Makefile.in: Rebuild.
10976
10977         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10978         gcctestdir/ld.
10979         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10980         * testsuite/Makefile.in: Rebuild.
10981
10982 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10983
10984         * Makefile.am (POTFILES.in): Set LC_ALL=C.
10985         * Makefile.in: Regenerate.
10986         * po/POTFILES.in: Regenerate.
10987
10988 2008-07-29  Ian Lance Taylor  <iant@google.com>
10989
10990         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10991         symbols before other symbols.
10992         * testsuite/script_test_2.cc (test_addr): Declare.
10993         (test_addr_alias): Declare.
10994         (main): Check that test_addr and test_addr_alias have the right
10995         values.
10996         * testsuite/script_test_2.t: Define test_addr_alias and
10997         test_addr.
10998
10999 2008-07-24  Ian Lance Taylor  <iant@google.com>
11000
11001         PR 5990
11002         * descriptors.cc: New file.
11003         * descriptors.h: New file.
11004         * gold-threads.h (class Hold_optional_lock): New class.
11005         * fileread.cc: Include "descriptors.h".
11006         (File_read::~File_read): Release descriptor rather than closing
11007         it.
11008         (File_read::open) [file]: Call open_descriptor rather than open.
11009         Set is_descriptor_opened_.
11010         (File_read::open) [memory]: Assert that descriptor is not open.
11011         (File_read::reopen_descriptor): New function.
11012         (File_read::release): Release descriptor.
11013         (File_read::do_read): Make non-const.  Reopen descriptor.
11014         (File_read::read): Make non-const.
11015         (File_read::make_view): Reopen descriptor.
11016         (File_read::do_readv): Likewise.
11017         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11018         Update declarations.
11019         * layout.cc: Include "descriptors.h".
11020         (Layout::create_build_id): Use open_descriptor rather than open.
11021         * output.cc: Include "descriptors.h".
11022         (Output_file::open): Use open_descriptor rather than open.
11023         * archive.cc (Archive::const_iterator): Change Archive to be
11024         non-const.
11025         (Archive::begin, Archive::end): Make non-const.
11026         (Archive::count_members): Likewise.
11027         * archive.h (class Archive): Update declarations.
11028         * object.h (Object::read): Make non-const.
11029         * Makefile.am (CCFILES): Add descriptors.cc.
11030         (HFILES): Add descriptors.h.
11031         * Makefile.in: Rebuild.
11032
11033         PR 6716
11034         * gold.h: Always include <clocale>.  Add Solaris workarounds
11035         following code in binutils/sysdep.h.
11036
11037         PR 6048
11038         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11039         this->eh_frame_hdr_ is NULL before using it.
11040
11041         * dynobj.cc (Versions::Versions): Update comment.
11042
11043         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11044         the base version name.
11045
11046         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11047         array size plus one.
11048         (Stringpool_template::set_string_offsets): Subtract one from key
11049         before using it as an array index.
11050         (Stringpool_template::get_offset_with_length): Likewise.
11051         (Stringpool_template::write_to_buffer): Likewise.
11052         * stringpool.h (Stringpool_template::get_offset_from_key):
11053         Likewise.
11054
11055 2008-07-23  Ian Lance Taylor  <iant@google.com>
11056
11057         PR 6658
11058         * object.h (Merged_symbol_value::value): Do our best to handle a
11059         negative addend.
11060
11061         PR 6647
11062         * script.cc (Version_script_info::get_versions): Don't add empty
11063         version tag to return value.
11064         (Version_script_info::get_symbol_version_helper): Change return
11065         type to bool.  Add pversion parameter.  Change all callers.
11066         (script_register_vers_node): Don't require a non-NULL tag.
11067         * script.h (class Version_script_info): Update declarations.
11068         (Version_script_info::get_symbol_version): Change return type to
11069         bool.  Add version parameter.  Change all callers.
11070         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11071         handling.  Handle an empty version from a version script.
11072         (Symbol_table::define_special_symbol): Likewise.
11073         * testsuite/ver_test_10.script: New file.
11074         * testsuite/ver_test_10.sh: New file.
11075         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11076         (check_DATA): Add ver_test_10.syms.
11077         (ver_test_10.syms, ver_test_10.so): New target.
11078         * testsuite/Makefile.in: Rebuild.
11079
11080 2008-07-23  Simon Baldwin  <simonb@google.com>
11081
11082         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11083         to zero for undefined symbols from dynamic libraries.
11084
11085 2008-07-23  Ian Lance Taylor  <iant@google.com>
11086
11087         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11088         Change all callers.
11089         * symtab.h (class Symbol_table): Update declaration.
11090         * testsuite/ver_test_9.cc: New file.
11091         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11092         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11093         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11094         (ver_test_9.so, ver_test_9.o): New targets.
11095         * testsuite/Makefile.in: Rebuild.
11096
11097 2008-07-22  Ian Lance Taylor  <iant@google.com>
11098
11099         * options.h (class General_options): Define --check-sections.
11100         * layout.cc (Layout::set_segment_offsets): Handle
11101         --check-sections.
11102
11103         * options.h (class General_options): Define -n/--nmagic and
11104         -N/--omagic.
11105         * options.cc (General_options::finalize): For -n/--nmagic or
11106         -N/--omagic, set -static.
11107         * layout.cc (Layout::attach_allocated_section_to_segment): If
11108         -N/--omagic, don't put read-only and read-write sections in
11109         different segments.
11110         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11111         finding a read-only segment.
11112         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11113         don't set the minimum segment alignment to the common page size,
11114         and don't set the file offset to the address modulo the page size.
11115         * script-sections.cc (Script_sections::create_segments): If
11116         -n/--omagic, don't put read-only and read-write sections in
11117         different segments.
11118
11119         * cref.cc: New file.
11120         * cref.h: New file.
11121         * options.h (class General_options): Add --print-symbol-counts.
11122         * main.cc (main): Issue defined symbol report if requested.
11123         * archive.cc (Archive::interpret_header): Make into a const member
11124         function.
11125         (Archive::add_symbols): Call Input_objects::archive_start and
11126         archive_stop.
11127         (Archive::const_iterator): Define new class.
11128         (Archive::begin, Archive::end): New functions.
11129         (Archive::include_all_members): Rewrite to use iterator.
11130         (Archive::count_members): New function.
11131         * archive.h (class Archive): Update declarations.
11132         (Archive::filename): New function.
11133         * object.cc: Include "cref.h".
11134         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11135         (Sized_relobj::do_get_global_symbol_counts): New function.
11136         (Input_objects::add_object): Add object to cross-referencer.
11137         (Input_objects::archive_start): New function.
11138         (Input_objects::archive_stop): New function.
11139         (Input_objects::print_symbol_counts): New function.
11140         * object.h: Declare Cref and Archive.
11141         (Object::get_global_symbol_counts): New function.
11142         (Object::do_get_global_symbol_counts): New pure virtual function.
11143         (class Sized_relobj): Add defined_count_ field.  Update
11144         declarations.
11145         (class Input_objects): Add cref_ field.  Update constructor.
11146         Update declarations.
11147         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11148         defined_count_.
11149         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11150         symbol counts.
11151         (Sized_dynobj::do_get_global_symbol_counts): New function.
11152         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11153         defined_count_.  Update declarations.  Define Symbols typedef.
11154         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11155         parameter.  Change all callers.
11156         (Symbol_table::add_from_dynobj): Add sympointers and defined
11157         parameters.  Change all callers.
11158         * symtab.h (class Symbol_table): Update declarations.
11159         * Makefile.am (CCFILES): Add cref.cc.
11160         (HFILES): Add cref.h.
11161         * Makefile.in: Rebuild.
11162
11163 2008-07-22  Simon Baldwin  <simonb@google.com>
11164
11165         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11166         to zero when writing undefined symbols.
11167
11168 2008-07-22  Ian Lance Taylor  <iant@google.com>
11169
11170         * output.cc (Output_section::add_input_section): Don't try to
11171         merge empty merge sections.
11172
11173 2008-07-21  Craig Silverstein  <csilvers@google.com>
11174
11175         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11176         Include symbol version in error message.
11177
11178 2008-07-20  Chris Demetriou  <cgd@google.com>
11179
11180         * configure.ac (gold_cv_c_random_seed): New configured variable.
11181         (RANDOM_SEED_CFLAGS): New substituted variable.
11182         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11183         * configure: Rebuild.
11184         * Makefile.in: Likewise.
11185         * testsuite/Makefile.in: Likewise.
11186
11187 2008-07-18  Ian Lance Taylor  <iant@google.com>
11188
11189         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11190         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11191         * testsuite/ver_test_main.cc (main): Call t4.
11192         (t4, t4_2a): Define.
11193         * testsuite/ver_test_2.cc (t4_2): Define.
11194         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11195         * testsuite/ver_test_4.cc (t4_2a): Define.
11196         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11197         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11198
11199 2008-07-17  Ian Lance Taylor  <iant@google.com>
11200
11201         * dynobj.cc (Versions::add_def): If we give an error about a
11202         missing version, go ahead and create the version anyhow.
11203
11204 2008-07-10  Ian Lance Taylor  <iant@google.com>
11205
11206         Handle output sections with more than 0x7fffffff bytes.
11207         * object.h (class Relobj): Change map_to_output_ to
11208         output_sections_, and just keep a section pointer.  Change all
11209         uses.  Move comdat group support to Sized_relobj.
11210         (Relobj::is_section_specially_mapped): Remove.
11211         (Relobj::output_section): Remove poff parameter.  Change all
11212         callers.
11213         (Relobj::output_section_offset): New function.
11214         (Relobj::set_section_offset): Rewrite.
11215         (Relobj::map_to_output): Remove.
11216         (Relobj::output_sections): New function.
11217         (Relobj::do_output_section_offset): New pure virtual function.
11218         (Relobj::do_set_section_offset): Likewise.
11219         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11220         group support from Relobj.  Update declarations.
11221         (Sized_relobj::get_output_section_offset): New function.
11222         (Sized_relobj::do_output_section_offset): New function.
11223         (Sized_relobj::do_set_section_offset): New function.
11224         * object.cc (Relobj::output_section_address): Remove.
11225         (Sized_relobj::Sized_relobj): Initialize new fields.
11226         (Sized_relobj::include_section_group): Cast find_kept_object to
11227         Sized_relobj.
11228         (Sized_relobj::include_linkonce_section): Likewise.
11229         (Sized_relobj::do_layout): Use separate arrays for output section
11230         and output offset.
11231         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11232         output_sections.
11233         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11234         output_sections and section_offsets.
11235         (Sized_relobj::write_local_symbols): Likewise.
11236         (map_to_kept_section): Compute output address directly.
11237         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11238         output_sections and section_offsets.
11239         (Sized_relobj::write_sections): Likewise.
11240         (Sized_relobj::relocate_sections): Likewise.
11241         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11242         * output.h (class Output_reloc): Update declarations.  Change
11243         u2_.relobj to Sized_relobj*.
11244         (class Output_data_reloc): Change add functions to use
11245         Sized_relobj*.
11246         * output.cc (Output_reloc::Output_reloc): Change relobj to
11247         Sized_relobj*.
11248         (Output_reloc::local_section_offset): Change return type to
11249         Elf_Addr.  Use get_output_section_offset.
11250         (Output_reloc::get_address): Likewise.
11251         (Output_section::is_input_address_mapped): Don't call
11252         is_section_specially_mapped.
11253         (Output_section::output_offset): Likewise.
11254         (Output_section::output_address): Likewise.
11255         (Output_section::starting_output_address): Likewise.
11256         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11257         parameter to Sized_relobj*.
11258         (Copy_relocs::need_copy_reloc): Likewise.
11259         (Copy_relocs::save): Likewise.
11260         * copy-relocs.h (class Copy_relocs): Update declarations.
11261         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11262         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11263         * target-reloc.h (relocate_for_relocatable): Change
11264         offset_in_output_section type to Elf_Addr.  Change code that uses
11265         it as well.
11266         * layout.cc (Layout::layout): Always set *off.
11267         * mapfile.cc (Mapfile::print_input_section): Use
11268         output_section_offset.
11269         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11270         Sized_relobj*.
11271         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11272         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11273         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11274
11275 2008-07-03  Ian Lance Taylor  <iant@google.com>
11276
11277         * layout.cc (Layout::include_section): Do not discard unrecognized
11278         SHT_STRTAB sections.
11279
11280 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11281
11282         * script.cc (Lex::can_continue_name): Make '?' allowable in
11283         version-script names.
11284         * testsuite/version_script.map: Change glob pattern to use '?'
11285
11286 2008-06-30  Manish Singh  <yosh@gimp.org>
11287
11288         PR 6585
11289         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11290         Correct typo.
11291
11292 2008-06-30  Ian Lance Taylor  <iant@google.com>
11293
11294         PR 6660
11295         PR 6682
11296         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11297         versions]: Don't try to read the value in the contents, since we
11298         don't use it.  Use the template endianness when writing.
11299
11300 2008-06-25  Cary Coutant  <ccoutant@google.com>
11301
11302         * fileread.cc (File_read::make_view): Assert on zero-length view.
11303         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11304         symbol table when there are no symbols to read.
11305
11306 2008-06-23  Craig Silverstein  <csilvers@google.com>
11307
11308         * version.cc (version_string): Bump to 1.7
11309
11310 2008-06-18  Craig Silverstein  <csilvers@google.com>
11311
11312         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11313         constant 0xFFFF to type Valtype.
11314         (Powerpc_relocate_functions::rel16_ha): Likewise.
11315
11316 2008-06-17  Ian Lance Taylor  <iant@google.com>
11317
11318         * output.h (Output_section::Input_section): Initialize p2align_ to
11319         zero for Output_section_data constructors.
11320         (Output_section::Input_section::addralign): If not an input
11321         section, return the alignment of the Output_section_data.
11322         * testsuite/copy_test.cc: New file.
11323         * testsuite/copy_test_1.cc: New file.
11324         * testsuite/copy_test_2.cc: New file.
11325         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11326         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11327         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11328         (copy_test_1_pic.o, copy_test_1.so): New targets.
11329         (copy_test_2_pic.o, copy_test_2.so): New targets.
11330         * testsuite/Makefile.in: Rebuild.
11331
11332         * script-sections.cc (Script_sections::place_orphan): Initialize
11333         local variable exact.
11334
11335 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11336
11337         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11338
11339 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11340             David S. Miller  <davem@davemloft.net>
11341
11342         * powerpc.cc: New file.
11343         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11344         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11345         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11346         * Makefile.in: Rebuild.
11347
11348 2008-06-09  Ian Lance Taylor  <iant@google.com>
11349
11350         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11351         <exception>.
11352         (throwing, orig_terminate): New static variables.
11353         (terminate_handler): New static function.
11354         (t2): Set terminate handler.
11355
11356 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11357
11358         PR 6584
11359         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11360         alignment.
11361
11362 2008-05-30  Cary Coutant  <ccoutant@google.com>
11363
11364         * archive.cc (Archive::include_all_members) Correct to step
11365         over symbol table and extended name table in thin archives.
11366
11367 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11368
11369         PR 6407
11370         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11371         calculation.
11372
11373 2008-05-28  Caleb Howe  <cshowe@google.com>
11374
11375         * reduced_debug_output.cc: New file.
11376         * reduced_debug_output.h: New file.
11377         * options.h (class General_options): Add --strip-debug-non-line.
11378         * options.cc (General_options::finalize): Add strip_debug_non_line
11379         to the strip heirarchy.
11380         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11381         fields.
11382         * layout.cc: Include "reduced_debug_output.h".
11383         (Layout::Layout): Initialize new fields.
11384         (line_only_debug_sections): New static array.
11385         (is_lines_only_debug_sections): New static inline function.
11386         (Layout::include_section): Handle --strip-debug-non-line.
11387         (Layout::make_output_section): If --strip-debug-non-line, build
11388         new output sections for .debug_abbrev and .debug_info.
11389         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11390         gold.  Warn about possible overflow.
11391         (read_signed_LEB_128): Likewise.
11392         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11393         (read_signed_LEB_128): Declare.
11394         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11395         (HFILES): Add reduced_debug_output.h.
11396         * Makefile.in: Rebuild.
11397
11398 2008-05-21  Ian Lance Taylor  <iant@google.com>
11399
11400         * mapfile.cc: New file.
11401         * mapfile.h: New file.
11402         * options.h (class General_options): Add -M/--print-map and -Map.
11403         * options.cc (General_options::finalize): Make -M equivalent to
11404         -Map -.
11405         * main.cc: Include <cstdio> and "mapfile.h".
11406         (main): Open mapfile if requested.
11407         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11408         constructor.  Change caller.
11409         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11410         (queue_middle_tasks): Likewise.
11411         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11412         declarations.
11413         * archive.cc: Include "mapfile.h".
11414         (Archive::add_symbols): Add mapfile parameter.  Change all
11415         callers.  Pass mapfile, symbol, and reason to include_member.
11416         (Archive::include_all_members): Add mapfile parameter.  Change all
11417         callers.
11418         (Archive::include_member): Add mapfile, sym, and why parameters.
11419         Change all callers.  Report inclusion to map file.
11420         * archive.h: Include "fileread.h".
11421         (class Archive): Update declarations.
11422         (Archive::file): New const method.
11423         (class Add_archive_symbols): Add mapfile_ field.  Update
11424         constructor.  Change all callers.
11425         * readsyms.h (class Read_symbols): Likewise.
11426         (class Finish_group): Likewise.
11427         (class Read_script): Likewise.
11428         * common.cc: Include "mapfile.h".
11429         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11430         all callers.
11431         (Symbol_table::do_allocate_commons): Likewise.
11432         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11433         symbol allocation to mapfile.
11434         * common.h (class Allocate_commons_task): Add mapfile_ field.
11435         Update constructor.  Change all callers.
11436         * symtab.h (class Symbol_table): Update declarations.
11437         * layout.cc: Include "mapfile.h".
11438         (Layout_task_runner::run): Print information to mapfile.
11439         (Layout::create_gold_note): Change Output_data_fixed_space to
11440         Output_data_zero_fill.
11441         (Layout::create_build_id): Likewise.
11442         (Layout::print_to_mapfile): New function.
11443         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11444         constructor.  Change caller.
11445         (class Layout): Declare print_to_mapfile.
11446         * output.cc (Output_section::Input_section::print_to_mapfile): New
11447         function.
11448         (Output_section::add_input_section): If producing a map, always
11449         add to input_sections_ list.
11450         (Output_section::do_print_to_mapfile): New function.
11451         (Output_segment::print_sections_to_mapfile): New function.
11452         (Output_segment::print_section_list_to_mapfile): New function.
11453         * output.h: Include "mapfile.h".
11454         (Output_data::print_to_mapfile): New function.
11455         (Output_data::do_print_to_mapfile): New virtual function.
11456         (Output_segment_headers::do_print_to_mapfile): New function.
11457         (Output_file_header::do_print_to_mapfile): New function.
11458         (Output_data_const::do_print_to_mapfile): New function.
11459         (class Output_data_const_buffer): Add map_name_ field.  Update
11460         constructor.  Change all callers.  Add do_print_to_mapfile
11461         function.
11462         (class Output_data_fixed_space): Likewise.
11463         (class Output_data_space): Likewise.
11464         (class Output_data_zero_fill): New class.
11465         (Output_data_strtab::do_print_to_mapfile): New function.
11466         (Output_data_reloc_base::do_print_to_mapfile): New function.
11467         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11468         (Output_data_group::do_print_to_mapfile): New function.
11469         (Output_data_got::do_print_to_mapfile): New function.
11470         (Output_data_dynamic::do_print_to_mapfile): New function.
11471         (Output_symtab_xindex::do_print_to_mapfile): New function.
11472         (class Output_section): Declare do_print_to_mapflie.  Declare
11473         print_to_mapfile in Input_section.
11474         (class Output_segment): Declare new functions.
11475         * object.h (Sized_relobj::symbol_count): New function.
11476         * script-sections.cc
11477         (Output_section_element_dot_assignment::set_section_addresses):
11478         Change Output_data_fixed_space to Output_data_zero_fill.
11479         (Output_data_expression::do_print_to_mapfile): New function.
11480         * script.cc (read_input_script): Add mapfile parameter.  Change
11481         all callers.
11482         * script.h (read_input_script): Update declaration.
11483         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11484         (Eh_frame::do_print_to_mapfile): New function.
11485         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11486         (Output_merge_string::do_print_to_mapfile): New function.
11487         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11488         function.
11489         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11490         function.
11491         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11492         function.
11493         * Makefile.am (CCFILES): Add mapfile.cc.
11494         (HFILES): Add mapfile.h.
11495         * Makefile.in: Rebuild.
11496
11497 2008-05-19  Ian Lance Taylor  <iant@google.com>
11498
11499         * options.h (class General_options): Add -z relro.
11500         * layout.cc (Layout::Layout): Initialize relro_segment_.
11501         (Layout::add_output_section_data): Return the output section.
11502         (Layout::make_output_section): Rcognize relro sections and mark
11503         them appropriately.
11504         (Layout::attach_allocated_section_to_segment): Put relro sections
11505         in a PT_GNU_RELRO segment.
11506         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11507         section as relro.
11508         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11509         PT_TLS segments.
11510         (Layout::linkonce_mapping): Map d.rel.ro.local to
11511         .data.rel.ro.local.
11512         (Layout::output_section_name): Us .data.rel.ro.local for any
11513         section which begins with that.
11514         * layout.h (class Layout): Update add_output_section_data
11515         declaration.  Add relro_segment_ field.
11516         * output.cc (Output_section::Output_section): Initialize is_relro_
11517         and is_relro_local_ fields.
11518         (Output_segment::add_output_section): Group relro sections.
11519         (Output_segment::is_first_section_relro): New function.
11520         (Output_segment::maximum_alignment): If there is a relro section,
11521         align the segment to the common page size.
11522         (Output_segment::set_section_addresses): Track whether we are
11523         looking at relro sections.  If the last section is a relro
11524         section, align to the common page size.
11525         (Output_segment::set_section_list_addresses): Add in_relro
11526         parameter.  Change all callers.  Align to the page size when
11527         moving from relro to non-relro section.
11528         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11529         segment.
11530         * output.h (class Output_section): Add is_relro_ and
11531         is_relro_local_ fields.
11532         (Output_section::is_relro): New function.
11533         (Output_section::set_is_relro): New function.
11534         (Output_section::is_relro_local): New function.
11535         (Output_section::set_is_relro_local): New function.
11536         (class Output_segment): Update declarations.
11537         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11538         * sparc.cc (Target_sparc::got_section): Likewise.
11539         * x86_64.cc (Target_x86_64::got_section): Likewise.
11540         * testsuite/relro_test_main.cc: New file.
11541         * testsuite/relro_test.cc: New file.
11542         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11543         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11544         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11545         (relro_test.so, relro_test_pic.o): New targets.
11546         * testsuite/Makefile.in: Rebuild.
11547
11548 2008-05-16  Ian Lance Taylor  <iant@google.com>
11549
11550         * output.cc (Output_segment::add_output_section): Remove front
11551         parameter.
11552         * output.h (class Output_segment): Remove
11553         add_initial_output_section and overloaded add_output_section.
11554         Update declaration of remaining add_output_section.
11555         * layout.cc (Layout::create_interp): Call add_output_section
11556         rather than add_initial_output_section.
11557         (Layout::finish_dynamic_section): Likewise.
11558
11559         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11560         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11561         know the dynamic type.
11562         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11563         field.  Initialize it in constructor.
11564         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11565         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11566         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11567         reloc.
11568
11569         * output.cc (Output_reloc::get_address): Change return type to
11570         Elf_Addr.
11571         * output.h (class Output_reloc): Update get_address declaration.
11572         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11573         for section addresses.
11574
11575 2008-05-09  Ian Lance Taylor  <iant@google.com>
11576
11577         PR 6493
11578         * gold.cc (gold_nomem): Use return value of write.
11579
11580 2008-05-08  Ian Lance Taylor  <iant@google.com>
11581
11582         * symtab.c (Symbol::init_base_output_data): Add version
11583         parameter.  Change all callers.
11584         (Symbol::init_base_output_segment): Likewise.
11585         (Symbol::init_base_constant): Likewise.
11586         (Symbol::init_base_undefined): Likewise.
11587         (Sized_symbol::init_output_data): Likewise.
11588         (Sized_symbol::init_output_segment): Likewise.
11589         (Sized_symbol::init_constant): Likewise.
11590         (Sized_symbol::init_undefined): Likewise.
11591         (Symbol_table::do_define_in_output_data): If the new symbol has a
11592         version, mark it as the default.
11593         (Symbol_table::do_define_in_output_segment): Likewise.
11594         (Symbol_table::do_define_as_constant): Likewise.
11595         * symtab.h (class Symbol): Update declarations.
11596         (class Sized_symbol): Likewise.
11597         * resolve.cc (Symbol::override_version): New function.
11598         (Symbol::override_base): Call override_version.
11599         (Symbol::override_base_with_special): Likewise.
11600         * testsuite/ver_script_8.script: New file.
11601         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11602         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11603         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11604         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11605
11606 2008-05-06  Ian Lance Taylor  <iant@google.com>
11607
11608         PR 6049
11609         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11610         functions.
11611         (class General_options): Remove existing --undefined, and add
11612         --no-undefined instead.  Add new --undefined as synonym for -u.
11613         * archive.cc (Archive::add_symbols): Check whether symbol was
11614         named with -u.
11615         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11616         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11617         all uses.  Add IS_UNDEFINED.  Update declarations to split
11618         different versions of init_base.  Declare init_base_undefined.
11619         (Symbol::is_defined): Handle IS_UNDEFINED.
11620         (Symbol::is_undefined): Likewise.
11621         (Symbol::is_weak_undefined): Call is_undefined.
11622         (Symbol::is_absolute): Handle IS_CONSTANT.
11623         (class Sized_symbol): Update declarations to split different
11624         versions of init.  Declare init_undefined.
11625         (class Symbol_table): Declare new functions.
11626         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11627         Change all callers.
11628         (Symbol::init_base_output_data): Likewise.
11629         (Symbol::init_base_output_segment): Likewise.
11630         (Symbol::init_base_constant): Likewise.
11631         (Symbol::init_base_undefined): New function.
11632         (Sized_symbol::init_object): Rename from init.  Change all
11633         callers.
11634         (Sized_symbol::init_output_data): Likewise.
11635         (Sized_symbol::init_output_segment): Likewise.
11636         (Sized_symbol::init_constant): Likewise.
11637         (Sized_symbol::init_undefined): New function.
11638         (Symbol_table::add_undefined_symbols_from_command_line): New
11639         function.
11640         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11641         function.
11642         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11643         (Symbol::output_section): Likewise.
11644         (Symbol::set_output_section): Likewise.
11645         (Symbol_table::sized_finalize_symbol): Likewise.
11646         (Symbol_table::sized_write_globals): Likewise.
11647         * resolve.cc (Symbol_table::should_override): Likewise.
11648         (Symbol::override_base_with_special): Likewise.
11649
11650         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11651         symbol, change it to have default visibility.
11652         * testsuite/protected_1.cc: New file.
11653         * testsuite/protected_2.cc: New file.
11654         * testsuite/protected_3.cc: New file.
11655         * testsuite/protected_main_1.cc: New file.
11656         * testsuite/protected_main_2.cc: New file.
11657         * testsuite/protected_main_3.cc: New file.
11658         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11659         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11660         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11661         (protected_1.so): New target.
11662         (protected_1_pic.o, protected_2_pic.o): New targets.
11663         (protected_3_pic.o): New target.
11664         (check_PROGRAMS): Add protected_2.
11665         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11666         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11667         * testsuite/Makefile.in: Rebuild.
11668
11669         * options.h (DEFINE_var): Add set_user_set_##varname__.
11670         (DEFINE_bool_alias): New macro.
11671         (class General_options): Define -Bstatic using DEFINE_bool_alias
11672         rather than DEFINE_special.  Add --undefined as an alias for -z
11673         defs.
11674         * options.cc (General_options::parse_Bstatic): Remove.
11675
11676         * options.h (class General_options): Add --fatal-warnings.
11677         * main.cc (main): Implement --fatal-warnings.
11678         * errors.h (Errors::warning_count): New function.
11679
11680         * options.h (class General_options): Add -Bsymbolic-functions.
11681         * symtab.h (Symbol::is_preemptible): Check for
11682         -Bsymbolic-functions.
11683
11684 2008-05-05  Ian Lance Taylor  <iant@google.com>
11685
11686         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11687         as noVARNAME rather than no-VARNAME.
11688         (class General_options): Add option -z combreloc.
11689         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11690         get_address.
11691         (Output_reloc::sort_before) [SHT_REL]: New function.
11692         (Output_reloc::sort_before) [SHT_RELA]: New function.
11693         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11694         Sort_relocs_comparison.
11695         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11696         parameter.  Change all callers.
11697         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11698         sort_relocs parameter.  Change all callers.
11699         * output.cc (Output_reloc::get_address): New function, broken out
11700         of write_rel.
11701         (Output_reloc::write_rel): Call it.
11702         (Output_reloc::compare): New function.
11703         (Output_data_reloc_base::do_write): Optionally sort relocs.
11704
11705         * configure.ac: If targ_extra_obj is set, link it in.
11706         * configure.tgt: Initialize all variables.
11707         (x86_64*): Set targ_extra_obj and targ_extra_size.
11708         * configure: Rebuild.
11709
11710         * object.cc (Sized_relobj::include_section_group): Adjust section
11711         indexes read from group data.  Build vector to pass to
11712         layout_group.
11713         * layout.cc (Layout::layout_group): Add flags and shndxes
11714         parameters.  Remove contents parameter.  Change caller.  Update
11715         explicit instantiations.
11716         * layout.h (class Layout): Update layout_group declaration.
11717         * output.cc (Output_data_group::Output_data_group): Add flags and
11718         input_shndxes parameters.  Remove contents parameter.  Change
11719         caller.
11720         (Output_data_group::do_write): Change input_sections_ to
11721         input_shndxes_.
11722         * output.h (class Output_data_group): Update constructor
11723         declaration.  Rename input_sections_ to input_shndxes_.
11724         * testsuite/many_sections_test.cc: Add template.
11725
11726 2008-04-30  Cary Coutant  <ccoutant@google.com>
11727
11728         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11729
11730         * layout.cc (Layout::include_section): Refactored check for debug
11731         info section.
11732         (Layout::add_comdat): Add new parameters.  Change type
11733         of signature parameter.  Add object and shndx to signatures table.
11734         (Layout::find_kept_object): New function.
11735         * layout.h: Include <cstring>.
11736         (Layout::is_debug_info_section): New function.
11737         (Layout::add_comdat): Add new parameters.
11738         (Layout::find_kept_object): New function.
11739         (Layout::Kept_section): New struct.
11740         (Layout::Signatures): Change type of map range.
11741         * object.cc (Relobj::output_section_address): New function.
11742         (Sized_relobj::include_section_group): Add new parameters.  Change
11743         calls to Layout::add_comdat.  Change to build table of kept comdat
11744         groups and table mapping discarded sections to kept sections.
11745         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11746         (Sized_relobj::do_layout): Change calls to include_section_group and
11747         include_linkonce_section.
11748         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11749         value to zero when section is discarded.
11750         (Sized_relobj::map_to_kept_section): New function.
11751         * object.h (Relobj::output_section_address): New function.
11752         (Relobj::Comdat_group): New type.
11753         (Relobj::find_comdat_group): New function.
11754         (Relobj::Comdat_group_table): New type.
11755         (Relobj::Kept_comdat_section): New type.
11756         (Relobj::Kept_comdat_section_table): New type.
11757         (Relobj::add_comdat_group): New function.
11758         (Relobj::set_kept_comdat_section): New function.
11759         (Relobj::get_kept_comdat_section): New function.
11760         (Relobj::comdat_groups_): New field.
11761         (Relobj::kept_comdat_sections_): New field.
11762         (Symbol_value::input_value): Update comment.
11763         (Sized_relobj::map_to_kept_section) New function.
11764         (Sized_relobj::include_linkonce_section): Add new parameter.
11765         * target-reloc.h (Comdat_behavior): New type.
11766         (get_comdat_behavior): New function.
11767         (relocate_section): Add code to map a discarded section to the
11768         corresponding kept section when applying a relocation.
11769
11770 2008-04-30  Craig Silverstein  <csilvers@google.com>
11771
11772         * dwarf_reader.cc (next_generation_count): New static var.
11773         (Addr2line_cache_entry): New struct.
11774         (addr2line_cache): New static var.
11775         (Dwarf_line_info::one_addr2line): Added caching.
11776         (Dwarf_line_info::clear_addr2line_cache): New function.
11777         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11778         cache-size parameter.
11779         (Dwarf_line_info::one_addr2line_cache): New function.
11780         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11781         new cache-size argument to one_addr2line(), and clear cache.
11782
11783 2008-04-28  Cary Coutant  <ccoutant@google.com>
11784
11785         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11786         R_386_PC8 relocations.
11787
11788 2008-04-23  Ian Lance Taylor  <iant@google.com>
11789
11790         * object.cc (Sized_relobj::include_section_group): Check for
11791         invalid section group.
11792
11793         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11794         header size.
11795
11796         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11797         than read for file header.
11798         * archive.cc (Archive::include_member): Likewise.
11799
11800 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11801
11802         * aclocal.m4: Regenerate.
11803         * configure: Regenerate.
11804
11805 2008-04-19  Ian Lance Taylor  <iant@google.com>
11806
11807         * version.cc (version_string): Bump to 1.6.
11808
11809         * testsuite/Makefile.am (many_sections_r_test): New target.
11810         (many_sections_r_test_SOURCES): Remove.
11811         (many_sections_r_test_DEPENDENCIES): Remove.
11812         (many_sections_r_test_LDFLAGS): Remove.
11813         (many_sections_r_test_LDADD): Remove.
11814
11815         * object.cc (Sized_relobj::do_add_symbols): Always pass
11816         local_symbol_count_ to add_from_relobj.
11817
11818         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11819         every thousand variables.
11820         * testsuite/Makefile.in: Rebuild.
11821
11822         * object.cc (Xindex::initialize_symtab_xindex): New function.
11823         (Xindex::read_symtab_xindex): New function.
11824         (Xindex::sym_xindex_to_shndx): New function.
11825         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11826         available.
11827         (Sized_relobj::do_initialize_xindex): New function.
11828         (Sized_relobj::do_read_symbols): Adjust section links.
11829         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11830         parameter.  Change all callers.
11831         (Sized_relobj::include_section_group): Adjust section links and
11832         symbol section indexes.
11833         (Sized_relobj::do_layout): Adjust section links.
11834         (Sized_relobj::do_count_local_symbols): Adjust section links and
11835         symbol section indexes.
11836         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11837         ordinary and special symbols.
11838         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11839         dynsym_xindex parameters.  Change all callers.  Adjust section
11840         links.  Use SHN_XINDEX when needed.
11841         (Sized_relobj::get_symbol_location_info): Adjust section links.
11842         Don't get fooled by special symbols.
11843         * object.h (class Xindex): Define.
11844         (class Object): Add xindex_ parameter.  Declare virtual functoin
11845         do_initialize_xindex.
11846         (Object::adjust_sym_shndx): New function.
11847         (Object::set_xindex): New protected function.
11848         (class Symbol_value): Add is_ordinary_shndx_ field.
11849         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11850         (Symbol_value::value): Assert ordinary section.
11851         (Symbol_value::initialize_input_to_output_map): Likewise.
11852         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11853         Change all callers.
11854         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11855         all callers.
11856         (class Sized_relobj): Update declarations.
11857         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11858         parameter.  Change all callers.
11859         (Sized_relobj::adjust_shndx): New function.
11860         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11861         field.
11862         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11863         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11864         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11865         (Sized_dynobj::read_dynsym_section): Adjust section links.
11866         (Sized_dynobj::read_dynamic): Likewise.
11867         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11868         section links.
11869         (Sized_dynobj::do_initialize_xindex): New function.
11870         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11871         do_initialize_xindex.
11872         (Sized_dynobj::adjust_shndx): New function.
11873         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11874         dynsym_xindex_ fields.
11875         (Layout::finalize): Add a call to set_section_indexes before
11876         creating the symtab sections.
11877         (Layout::set_section_indexes): Don't do anything if the section
11878         already has a section index.
11879         (Layout::create_symtab_sections): Add shnum parameter.  Change
11880         caller.  Create .symtab_shndx section if needed.
11881         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11882         caller.
11883         (Layout::allocated_output_section_count): New function.
11884         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11885         needed.
11886         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11887         fields.  Update declarations.
11888         (Layout::symtab_xindex): New function.
11889         (Layout::dynsym_xindex): New function.
11890         (class Write_symbols_task): Add layout_ field.
11891         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11892         Change caller.
11893         * output.cc (Output_section_headers::Output_section_headers): Add
11894         shstrtab_section parameter.  Change all callers.
11895         (Output_section_headers::do_sized_write): Store overflow values
11896         for section count and section string table section index in
11897         section header zero.
11898         (Output_file_header::do_sized_write): Check for overflow of
11899         section count and section string table section index.
11900         (Output_symtab_xindex::do_write): New function.
11901         (Output_symtab_xindex::endian_do_write): New function.
11902         * output.h (class Output_section_headers): Add shstrtab_section_.
11903         Update declarations.
11904         (class Output_symtab_xindex): Define.
11905         (Output_section::has_out_shndx): New function.
11906         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11907         field.
11908         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11909         Change all callers.
11910         (Sized_symbol::init): Likewise.
11911         (Symbol::output_section): Check for ordinary symbol.
11912         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11913         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11914         callers.
11915         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11916         Change all callers.  Simplify handling of symbols from sections
11917         not included in the link.
11918         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11919         distinction.
11920         (Weak_alias_sorter::operator()): Assert that symbols are
11921         ordinary.
11922         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11923         distinction.
11924         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11925         parameters.  Change all callers.
11926         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11927         symbol distinction.  Use SHN_XINDEX when needed.
11928         (Symbol_table::write_section_symbol): Add symtab_xindex
11929         parameter.  Change all callers.
11930         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11931         SHN_XINDEX when needed.
11932         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11933         declarations.
11934         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11935         (Symbol::is_defined): Check is_ordinary.
11936         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11937         (Symbol::is_absolute, Symbol::is_common): Likewise.
11938         (class Sized_symbol): Update declarations.
11939         (class Symbol_table): Update declarations.
11940         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11941         parameters.  Change all callers.
11942         (Sized_symbol::override): Likewise.
11943         (Symbol_table::override): Likewise.
11944         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11945         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11946         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11947         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11948         to be in an ordinary section.
11949         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11950         object and is_ordinary parameters.  Change all callers.
11951         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11952         Change all callers.  Don't add undefined or non-ordinary symbols
11953         to reloc_map_.
11954         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11955         Change all callers.
11956         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11957         declarations.
11958         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11959         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11960         (Sized_relobj::relocate_sections): Likewise.
11961         * target-reloc.h (scan_relocs): Adjust section symbol index.
11962         (scan_relocatable_relocs): Likewise.
11963         * i386.cc (Scan::local): Check for ordinary symbols.
11964         * sparc.cc (Scan::local): Likewise.
11965         * x86_64.cc (Scan::local): Likewise.
11966         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11967         to symbol_section_and_value.
11968         * testsuite/many_sections_test.cc: New file.
11969         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11970         (check_PROGRAMS): Add many_sections_test.
11971         (many_sections_test_SOURCES): Define.
11972         (many_sections_test_DEPENDENCIES): Define.
11973         (many_sections_test_LDFLAGS): Define.
11974         (BUILT_SOURCES): Add many_sections_define.h.
11975         (many_sections_define.h): New target.
11976         (BUILT_SOURCES): Add many_sections_check.h.
11977         (many_sections_check.h): New target.
11978         (check_PROGRAMS): Add many_sections_r_test.
11979         (many_sections_r_test_SOURCES): Define.
11980         (many_sections_r_test_DEPENDENCIES): Define.
11981         (many_sections_r_test_LDFLAGS): Define.
11982         (many_sections_r_test_LDADD): Define.
11983         (many_sections_r_test.o): New target.
11984         * testsuite/Makefile.in: Rebuild.
11985
11986 2008-04-17  Cary Coutant  <ccoutant@google.com>
11987
11988         * errors.cc (Errors::info): New function.
11989         (gold_info): New function.
11990         * errors.h (Errors::info): New function.
11991         * gold.h (gold_info): New function.
11992         * object.cc (Input_objects::add_object): Print trace output.
11993         * options.cc (options::parse_set): New function.
11994         (General_options::parse_wrap): Deleted.
11995         (General_options::General_options): Deleted initializer.
11996         * options.h (options::String_set): New typedef.
11997         (options::parse_set): New function.
11998         (DEFINE_set): New macro.
11999         (General_options::wrap): Changed to use DEFINE_set. Changed
12000         callers of any_wrap_symbols and is_wrap_symbol.
12001         (General_options::trace, General_options::trace_symbol):
12002         New options.
12003         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12004         (General_options::wrap_symbols_): Deleted.
12005         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12006
12007 2008-04-17  David S. Miller  <davem@davemloft.net>
12008
12009         * options.cc (General_options::parse_V): New function.
12010         * options.h: Add entries for -V and -Qy.
12011
12012 2008-04-17  Ian Lance Taylor  <iant@google.com>
12013
12014         * common.cc (Symbol_table::allocate_commons): Remove options
12015         parameter.  Change caller.
12016         (Symbol_table::do_allocate_commons): Remove options parameter.
12017         Change caller.  Just call do_allocate_commons_list twice.
12018         (Symbol_table::do_allocate_commons_list): New function, broken out
12019         of do_allocate_commons.
12020         * common.h (class Allocate_commons_task): Remove options_ field.
12021         Update constructor.
12022         * symtab.cc (Symbol_table::Symbol_table): Initialize
12023         tls_commons_.
12024         (Symbol_table::add_from_object): Put TLS common symbols on
12025         tls_commons_ list.
12026         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12027         which are IN_OUTPUT_DATA.
12028         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12029         allocate_commons and do_allocate_commons declarations.  Declare
12030         do_allocate_commons_list.
12031         * gold.cc (queue_middle_tasks): Update creation of
12032         Allocate_commons_task to not pass options.
12033         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12034         (TLS_TEST_C_FLAGS): New variable.
12035         (tls_test_c_pic.o): New target.
12036         (tls_test_shared.so): Link in tls_test_c_pic.o.
12037         (tls_test_c_pic_ie.o): New target.
12038         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12039         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12040         (tls_test_c.o): New target.
12041         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12042         (tls_pic_test_LDADD): Likewise.
12043         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12044         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12045         (tls_test_c_gnu2.o): New target.
12046         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12047         tls_test_c_gnu2.o.
12048         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12049         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12050         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12051         * testsuite/tls_test.cc: Include "config.h".
12052         (t_last): Call t11_last.
12053         * testsuite/tls_test.h (t11, t11_last): Declare.
12054         * testsuite/tls_test_c.c: New file.
12055         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12056         * configure.ac: Check for OpenMP support.
12057         * configure, config.in, Makefile.in: Rebuild.
12058         * testsuite/Makefile.in: Rebuild.
12059
12060 2008-04-16  Cary Coutant  <ccoutant@google.com>
12061
12062         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12063         (Target_i386::tls_base_symbol_defined_): New field.
12064         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12065         (Target_i386::Scan::global): Likewise.
12066         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12067         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12068         (Target_x86_64::tls_base_symbol_defined_): New field.
12069         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12070         (Target_x86_64::Scan::global): Likewise.
12071
12072 2008-04-16  Cary Coutant  <ccoutant@google.com>
12073
12074         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12075         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12076         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12077         building shared libraries.
12078         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12079         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12080         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12081         * testsuite/Makefile.in: Rebuild.
12082         * testsuite/weak_undef.h: New file.
12083         * testsuite/weak_undef_file1.cc: Add extra test cases.
12084         * testsuite/weak_undef_file2.cc: Likewise.
12085         * testsuite/weak_undef_test.cc: Likewise.
12086
12087 2008-04-16  David S. Miller  <davem@davemloft.net>
12088
12089         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12090         Add issued_non_pic_error_ field.  Declare check_non_pic.
12091         (Target_sparc::Scan::check_non_pic): New function.
12092         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12093         (Target_sparc::Scan::global): Likewise.
12094
12095         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12096         * configure: Rebuild.
12097
12098         * options.h (DEFINE_enable): New macro.
12099         (new_dtags): New enable option.
12100         (initfirst, interpose, loadfltr, nodefaultlib,
12101         nodelete, nodlopen, nodump): New -z options.
12102         * layout.cc (Layout:finish_dynamic_section): If new
12103         dtags enabled, emit DT_RUNPATH.  Also, emit a
12104         DT_FLAGS_1 containing any specified -z flags.
12105
12106 2008-04-16  Ian Lance Taylor  <iant@google.com>
12107
12108         * copy-relocs.cc: New file.
12109         * copy-relocs.h: New file.
12110         * reloc.cc: Remove Copy_relocs code.
12111         * reloc.h: Likewise.
12112         * reloc-types.h (struct Reloc_types) [both versions]: Add
12113         get_reloc_addend_noerror.
12114         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12115         variants of add_global which take an addend which must be zero.
12116         * i386.cc: Include "copy-relocs.h".
12117         (class Target_i386): Change type of copy_relocs_ to variable,
12118         update initializer.
12119         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12120         Change all callers.
12121         (Target_i386::do_finalize_sections): Change handling of
12122         copy_relocs_.
12123         * sparc.cc: Include "copy-relocs.h".
12124         (class Target_sparc): Change type of copy_relocs_ to variable,
12125         update initializer.
12126         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12127         Change all callers.
12128         (Target_sparc::do_finalize_sections): Change handling of
12129         copy_relocs_.
12130         * x86_64.cc: Include "copy-relocs.h".
12131         (class Target_x86_64): Change type of copy_relocs_ to variable,
12132         update initializer.
12133         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12134         class.  Change all callers.
12135         (Target_x86_64::do_finalize_sections): Change handling of
12136         copy_relocs_.
12137         * Makefile.am (CCFILES): Add copy-relocs.cc.
12138         (HFILES): Add copy-relocs.h.
12139
12140         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12141
12142         * testsuite/script_test_4.sh: Permit leading zeroes.
12143
12144 2008-04-15  Ian Lance Taylor  <iant@google.com>
12145
12146         * script-sections.cc (Script_sections::create_segments): Use
12147         header_size_adjustment even when there is enough room for the
12148         headers.
12149         * testsuite/script_test_4.sh: New file.
12150         * testsuite/script_test_4.t: New file.
12151         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12152         (check_DATA): Add script_test_4.stdout.
12153         (MOSTLYCLEANFILES): Likewise.
12154         (script_test_4): New target.
12155         (script_test_4.stdout): New target.
12156         * testsuite/Makefile.in: Rebuild.
12157
12158         * sparc.cc: Add definitions for Output_data_plt_sparc class
12159         constants.
12160
12161 2008-04-14  David S. Miller  <davem@davemloft.net>
12162
12163         * sparc.cc: New file.
12164         * Makefile.am (TARGETSOURCES): Add sparc.cc
12165         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12166         * configure.tgt: Document targ_extra_size and
12167         targ_extra_big_endian.  Add entries for sparc-* and
12168         sparc64-*.
12169         * configure.ac: Handle targ_extra_size and
12170         targ_extra_big_endian.
12171         * Makefile.in: Rebuild.
12172         * configure: Likewise.
12173         * po/POTFILES.in: Likewise.
12174         * po/gold.pot: Likewise.
12175
12176 2008-04-14  Ian Lance Taylor  <iant@google.com>
12177
12178         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12179         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12180         in the name/type/flags to section mapping.  Don't call
12181         allocate_output_section.
12182         (Layout::choose_output_section): Change parameter from adjust_name
12183         to is_input_section.  Don't permit input sections after sections
12184         are attached to segments.  Don't call allocate_output_section.
12185         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12186         not write_enable_output_section.
12187         (Layout::make_output_section): Don't push to
12188         unattached_section_list_ nor call attach_to_segment.  Call
12189         attach_section_to_segment if sections are attached.
12190         (Layout::attach_sections_to_segments): New function.
12191         (Layout::attach_section_to_segment): New function.
12192         (Layout::attach_allocated_section_to_segment): Rename from
12193         attach_to_segment.  Remove flags parameter.
12194         (Layout::allocate_output_section): Remove function.
12195         (Layout::write_enable_output_section): Remove function.
12196         * layout.h (class Layout): Update for above changes.  Add new
12197         field sections_are_attached_.
12198         * output.h (Output_section::update_flags_for_input_section): New
12199         function.
12200         * output.cc (Output_section::add_input_section): Call
12201         update_flags_for_input_section.
12202         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12203
12204 2008-04-11  Cary Coutant  <ccoutant@google.com>
12205
12206         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12207         thought unnecessary.
12208         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12209
12210 2008-04-11  Ian Lance Taylor  <iant@google.com>
12211
12212         * output.h (class Output_section_data): Remove inline definition
12213         of set_addralign.
12214         * output.cc (Output_section_data::set_addralign): New function.
12215
12216 2008-04-11  Cary Coutant  <ccoutant@google.com>
12217
12218         Add support for TLS descriptors for i386 and x86_64.
12219         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12220         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12221         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12222         GOT_TYPE_TLS_DESC.
12223         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12224         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12225         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12226         relocations.
12227         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12228         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12229         Fix problem with initial-exec relocations.
12230         (Target_i386::Relocate::relocate_tls): Likewise.
12231         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12232         relaxation.
12233         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12234         support for section-plus-offset dynamic table entries.
12235         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12236         (Output_data_dynamic::Dynamic_entry): Add support for
12237         section-plus-offset dynamic table entries.
12238         (Output_data_dynamic::Classification): Likewise.
12239         (Output_data_dynamic::classification_): Renamed offset_.
12240         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12241         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12242         (Target_x86_64::make_plt_section): New function.
12243         (Target_x86_64::reserve_tlsdesc_entries): New function.
12244         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12245         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12246         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12247         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12248         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12249         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12250         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12251         add extra PLT entry for TLS descriptors.
12252         (Output_data_plt_x86_64::got_): New field.
12253         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12254         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12255         fields.
12256         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12257         descriptors.
12258         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12259         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12260         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12261         R_386_TLS_DESC_CALL relocations.
12262         (Target_x86_64::Scan::global): Likewise.
12263         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12264         for TLS descriptors.
12265         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12266         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12267         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12268         GD-to-IE relaxation.
12269         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12270         and TLS_DESCRIPTORS.
12271         * Makefile.in: Rebuild.
12272         * configure: Rebuild.
12273         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12274         (tls_test_shared2.so): New target.
12275         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12276         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12277         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12278         (tls_shared_gd_to_ie_test_LDADD): New variable.
12279         (tls_shared_gnu2_gd_to_ie_test): New target.
12280         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12281         New targets.
12282         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12283         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12284         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12285         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12286         (tls_shared_gnu2_test): New target.
12287         (tls_test_gnu2_shared.so): New target.
12288         (tls_shared_gnu2_test_SOURCES): New variable.
12289         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12290         (tls_shared_gnu2_test_LDFLAGS): New variable.
12291         (tls_shared_gnu2_test_LDADD): New variable.
12292         * testsuite/Makefile.in: Rebuild.
12293         * testsuite/Makefile.
12294
12295 2008-04-11  Ian Lance Taylor  <iant@google.com>
12296
12297         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12298         justsyms.t.
12299         * testsuite/Makefile.in: Rebuild.
12300
12301         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12302         long.
12303         * testsuite/script_test_2.cc (main): Adjust test.
12304
12305 2008-04-11  David S. Miller  <davem@davemloft.net>
12306             Ian Lance Taylor  <iant@google.com>
12307
12308         * options.h (General_options): Add entries for '-Y' and
12309         '-relax'.
12310         * options.cc (General_options:finalize): If -Y was used, add those
12311         entries to the library path instead of the default "/lib" and
12312         "/usr/lib".
12313
12314 2008-04-11  David S. Miller  <davem@davemloft.net>
12315
12316         * testsuite/justsyms.t: Start at 0x100.
12317         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12318         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12319         long.
12320         * testsuite/script_test_2.cc: Adjust string and section length
12321         checks.
12322
12323 2008-04-09  Ian Lance Taylor  <iant@google.com>
12324
12325         PR gold/5996
12326         * script-sections.cc (Sections_element::allocate_to_segment): Add
12327         orphan parameter.
12328         (Output_section_definition::allocate_to_segment): Likewise.
12329         (Orphan_output_section::allocate_to_segment): Likewise.
12330         (Script_sections::attach_sections_using_phdrs_clause): Don't
12331         propagate non-PT_LOAD segments to orphan sections.
12332         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12333         readelf rather than objdump.
12334         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12335         .interp section and PT_INTERP segment are the same size.
12336         * testsuite/Makefile.in: Rebuild.
12337
12338         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12339         aliases for symbols defined in the same object.
12340         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12341         (weak_alias_test_SOURCES): New variable.
12342         (weak_alias_test_DEPENDENCIES): New variable.
12343         (weak_alias_test_LDFLAGS): New variable.
12344         (weak_alias_test_LDADD): New variable.
12345         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12346         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12347         (weak_alias_test_3.o): New target.
12348         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12349         * testsuite/weak_alias_test_main.cc: New file.
12350         * testsuite/weak_alias_test_1.cc: New file.
12351         * testsuite/weak_alias_test_2.cc: New file.
12352         * testsuite/weak_alias_test_3.cc: New file.
12353
12354 2008-04-08  Ian Lance Taylor  <iant@google.com>
12355
12356         * options.h (class General_options): Add --noinhibit-exec option.
12357         * main.cc (main): Check --noinhibit-exec.
12358
12359         * options.h (class General_options): Define --wrap as a special
12360         option.  Add wrap_symbols_ field.
12361         (General_options::any_wrap_symbols): New function.
12362         (General_options::is_wrap_symbol): New function.
12363         * options.cc (General_options::parse_wrap): New function.
12364         (General_options::General_options): Initialize wrap_symbols_.
12365         * symtab.cc (Symbol_table::wrap_symbol): New function.
12366         (Symbol_table::add_from_object): Handle --wrap.
12367         * symtab.h (class Symbol_table): Declare wrap_symbol.
12368         * target.h (Target::wrap_char): New function.
12369         (Target::Target_info): Add wrap_char field.
12370         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12371         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12372         * testsuite/testfile.cc (Target_test::test_target_info):
12373         Likewise.
12374
12375         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12376         there is one.
12377
12378         * layout.h (class Layout): Add added_eh_frame_data_ field.
12379         * layout.cc (Layout::Layout): Initialize new field.
12380         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12381         output section until we find a section we merged successfully.
12382         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12383         that the size be non-zero.
12384
12385         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12386         qualifier.
12387
12388 2008-04-08  Craig Silverstein  <csilvers@google.com>
12389
12390         * configure.ac: Export new conditional variable HAVE_ZLIB.
12391         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12392         on HAVE_ZLIB.
12393         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12394         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12395
12396 2008-04-07  Ian Lance Taylor  <iant@google.com>
12397
12398         * version.cc (version_string): Set to "1.5".
12399
12400         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12401         Add issued_non_pic_error_ field.  Declare check_non_pic.
12402         (Target_x86_64::Scan::check_non_pic): New function.
12403         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12404         (Target_x86_64::Scan::global): Likewise.
12405
12406         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12407         addend parameter.  Change caller.  Handle merge sections.
12408         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12409         Address to Addend.  Don't add in the result of
12410         local_section_offset, pass down the addend and use the returned
12411         value.
12412         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12413         Update declarations of local_section_offset and symbol_value.
12414         * testsuite/two_file_test_1.cc (t18): New function.
12415         * testsuite/two_file_test_2.cc (f18): New function.
12416         * testsuite/two_file_test_main.cc (main): Call t18.
12417         * testsuite/two_file_test.h (t18, f18): Declare.
12418
12419         * configure.ac: Don't test for objdump, c++filt, or readelf.
12420         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12421         conditionals.
12422         (TEST_READELF): New variable.
12423         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12424         (check_PROGRAMS): Add two_file_strip_test.
12425         (two_file_strip_test): New target.
12426         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12427         (two_file_same_shared_strip_test_SOURCES): New variable.
12428         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12429         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12430         (two_file_same_shared_strip_test_LDADD): New variable.
12431         (two_file_shared_strip.so): New target.
12432         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12433         (ver_test_5.syms, ver_test_7.syms): Likewise.
12434         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12435         (strip_test_3.stdout): Use TEST_OBJDUMP.
12436         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12437
12438 2008-04-04  Cary Coutant  <ccoutant@google.com>
12439
12440         * symtab.h (Symbol::is_weak_undefined): New function.
12441         (Symbol::is_strong_undefined): New function.
12442         (Symbol::is_absolute): New function.
12443         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12444         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12445         absolute symbols.
12446         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12447         (weak_undef_test): New target.
12448         * testsuite/Makefile.in: Rebuild.
12449         * testsuite/weak_undef_file1.cc: New file.
12450         * testsuite/weak_undef_file2.cc: New file.
12451         * testsuite/weak_undef_test.cc: New file.
12452
12453 2008-04-03  Craig Silverstein  <csilvers@google.com>
12454
12455         * compressed_output.h (class Output_compressed_section): Use
12456         unsigned buffer.
12457         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12458         add zlib header.
12459         (zlib_compressed_suffix): Removed.
12460         (Output_compressed_section::set_final_data_size): Use unsigned
12461         buffers.
12462         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12463         Fix linker invocation.
12464         (flagstest_o_specialfile_and_compress_debug_sections):
12465         Likewise.
12466         * testsuite/Makefile.in: Regenerated.
12467
12468 2008-04-02  David S. Miller  <davem@davemloft.net>
12469
12470         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12471         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12472
12473 2008-04-02  Craig Silverstein  <csilvers@google.com>
12474
12475         * TODO: New file.
12476
12477 2008-04-02  Ian Lance Taylor  <iant@google.com>
12478
12479         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12480         parameters.  Update for new key type to views_.  Change all
12481         callers.
12482         (File_read::read): Adjust for byteshift in returned view.
12483         (File_read::add_view): New function, broken out of
12484         find_and_make_view.
12485         (File_read::make_view): New function, broken out of
12486         find_and_make_view.
12487         (File_read::find_or_make_view): Add offset and aligned
12488         parameters.  Rewrite accordingly.  Change all callers.
12489         (File_read::get_view): Add offset and aligned parameters.  Adjust
12490         for byteshift in return value.
12491         (File_read::get_lasting_view): Likewise.
12492         * fileread.h (class File_read): Update declarations.
12493         (class File_read::View): Add byteshift_ field.  Add byteshift to
12494         constructor.  Add byteshift method.
12495         * archive.h (Archive::clear_uncached_views): New function.
12496         (Archive::get_view): Add aligned parameter.  Change all callers.
12497         * object.h (Object::get_view): Add aligned parameter.  Change all
12498         callers.
12499         (Object::get_lasting_view): Likewise.
12500
12501         * fileread.cc (File_read::release): Don't call clear_views if
12502         there are multiple objects.
12503         * fileread.h (File_read::clear_uncached_views): New function.
12504         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12505         on the archive.
12506
12507 2008-03-31  Cary Coutant  <ccoutant@google.com>
12508
12509         Add thin archive support.
12510         * archive.cc (Archive::armagt): New const.
12511         (Archive::setup): Remove task parameter and calls to unlock.
12512         (Archive::unlock_nested_archives): New function.
12513         (Archive::read_header): Add nested_off parameter. Change
12514         all callers.
12515         (Archive::interpret_header): Likewise.
12516         (Archive::include_all_members): Change to handle thin
12517         archives.
12518         (Archive::include_member): Likewise.
12519         * archive.h (Archive::Archive): Add new parameters and
12520         initializers.
12521         (Archive::armagt): New const.
12522         (Archive::setup): Remove task parameter.
12523         (Archive::unlock_nested_archives): New function.
12524         (Archive::read_header): Add nested_off parameter.
12525         (Archive::interpret_header): Likewise.
12526         (Archive::Nested_archive_table): New typedef.
12527         (Archive::is_thin_archive_): New field.
12528         (Archive::nested_archives_): New field.
12529         (Archive::options_): New field.
12530         (Archive::dirpath_): New field.
12531         (Archive::task_): New field.
12532         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12533         for thin archives.  Pass additional parameters to
12534         Archive::Archive.  Unlock the archive file after calling
12535         Archive::setup.
12536
12537 2008-03-29  Ian Lance Taylor  <iant@google.com>
12538
12539         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12540         version symbol to be local.
12541         * testsuite/ver_test_4.sh: New file.
12542         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12543         (check_DATA): Add ver_test_4.syms.
12544         (ver_test_4.syms): New target.
12545         * testsuite/Makefile.in: Rebuild.
12546
12547         * output.cc
12548         (Output_section::Input_section_sort_entry::has_priority): New
12549         function.
12550         (Output_section::Input_section_sort_entry::match_file_name): New
12551         function.
12552         (Output_section::Input_section_sort_entry::match_section_name):
12553         Remove.
12554         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12555         Remove.
12556         (Output_section::Input_section_sort_entry::match_section_file):
12557         Remove.
12558         (Output_section::Input_section_sort_compare::operator()): Rewrite
12559         using new Input_section_sort_entry functions.  Sort crtbegin and
12560         crtend first.  Sort sections with no priority before sections with
12561         a priority.
12562         * testsuite/initpri1.c (d3): Check j != 4.
12563         (cd5): New constructor/destructor function.
12564         (main): Check j != 2.
12565
12566         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12567         new symbol when resolving, don't call set_is_default.
12568         * testsuite/ver_test_7.cc: New file.
12569         * testsuite/ver_test_7.sh: New file.
12570         * testsuite/Makefile.am (ver_test_7.so): New target.
12571         (ver_test_7.o): New target.
12572         (check_SCRIPTS): Add ver_test_7.sh.
12573         (check_DATA): Add ver_test_7.syms.
12574         (ver_test_7.syms): New target.
12575
12576 2008-03-28  Ian Lance Taylor  <iant@google.com>
12577
12578         * layout.cc (Layout::layout): If we see an input section with a
12579         name that needs sorting, set the must_sort flag for the output
12580         section.
12581         (Layout::make_output_section): If the name of the output section
12582         indicates that it might require sorting, set the may_sort flag.
12583         * output.h (Output_section::may_sort_attached_input_sections): New
12584         function.
12585         (Output_section::set_may_sort_attached_input_sections): New
12586         function.
12587         (Output_section::must_sort_attached_input_sections): New
12588         function.
12589         (Output_section::set_must_sort_attached_input_sections): New
12590         function.
12591         (class Output_section): Declare Input_section_sort_entry.  Define
12592         Input_section_sort_compare.  Declare
12593         sort_attached_input_sections.  Add new fields:
12594         may_sort_attached_input_sections_,
12595         must_sort_attached_input_sections_,
12596         attached_input_sections_are_sorted_.
12597         * output.cc (Output_section::Output_section): Initialize new
12598         fields.
12599         (Output_section::add_input_section): Add an entry to
12600         input_sections_ if may_sort or must_sort are true.
12601         (Output_section::set_final_data_size): Call
12602         sort_attached_input_sections if necessary.
12603         (Output_section::Input_section_sort_entry): Define new class.
12604         (Output_section::Input_section_sort_compare::operator()): New
12605         function.
12606         (Output_section::sort_attached_input_sections): New function.
12607         * configure.ac: Check whether the compiler supports constructor
12608         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12609         * testsuite/initpri1.c: New file.
12610         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12611         CONSTRUCTOR_PRIORITY.
12612         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12613         (initpri1_LDFLAGS): New variable.
12614         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12615
12616 2008-03-27  Ian Lance Taylor  <iant@google.com>
12617
12618         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12619         * testsuite/common_test_1.c: New file.
12620         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12621         (common_test_1_SOURCES): New variable.
12622         (common_test_1_DEPENDENCIES): New variable.
12623         (common_test_1_LDFLAGS): New variable.
12624
12625         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12626         and commons_ correctly when NAME/VERSION does not override
12627         NAME/NULL.
12628         * testsuite/ver_test_6.c: New file.
12629         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12630         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12631         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12632
12633 2008-03-26  Ian Lance Taylor  <iant@google.com>
12634
12635         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12636         of an undefined symbol from a version script.
12637         * testsuite/Makefile.am (ver_test_5.so): New target.
12638         (ver_test_5.o): New target.
12639         (check_SCRIPTS): Add ver_test_5.sh.
12640         (check_DATA): Add ver_test_5.syms.
12641         (ver_test_5.syms): New target.
12642         * testsuite/ver_test_5.cc: New file.
12643         * testsuite/ver_test_5.script: New file.
12644         * testsuite/ver_test_5.sh: New file.
12645         * Makefile.in, testsuite/Makefile.in: Rebuild.
12646
12647         PR gold/5986
12648         Fix problems building gold with gcc 4.3.0.
12649         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12650         (gold_error_at_location, gold_warning_at_location): Use it.
12651         * configure.ac: Check whether we can compile and use a template
12652         function with a printf attribute.
12653         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12654         when jumping over bytes.
12655         * object.cc: Instantiate Object::read_section_data.
12656         * debug.h: Include <cstring>
12657         * dwarf_reader.cc: Include <algorithm>
12658         * main.cc: Include <cstring>.
12659         * options.cc: Include <cstring>.
12660         * output.cc: Include <cstring>.
12661         * script.cc: Include <cstring>.
12662         * script.h: Include <string>.
12663         * symtab.cc: Include <cstring> and <algorithm>.
12664         * target-select.cc: Include <cstring>.
12665         * version.cc: Include <string>.
12666         * testsuite/testmain.cc: Include <cstdlib>.
12667         * configure, config.in: Rebuild.
12668
12669 2008-03-25  Ian Lance Taylor  <iant@google.com>
12670
12671         * options.cc: Include "../bfd/bfdver.h".
12672         (options::help): Print bug reporting address.
12673
12674         * version.cc (print_version): Adjust output for current value of
12675         BFD_VERSION_STRING.
12676
12677         * NEWS: New file.
12678
12679         * options.cc (options::help): Print list of supported targets.
12680         * target-select.h: Include <vector>.
12681         (class Target_selector): Make machine_, size_, and is_big_endian_
12682         fields const.  Add bfd_name_ and instantiated_target_ fields.
12683         (Target_selector::Target_selector): Add bfd_name parameter.
12684         (Target_selector::recognize): Make non-virtual, call
12685         do_recognize.
12686         (Target_selector::recognize_by_name): Make non-virtual, call
12687         do_recognize_by_name.
12688         (Target_selector::supported_names): New function.
12689         (Target_selector::bfd_name): New function.
12690         (Target_selector::do_instantiate_target): New pure virtual
12691         function.
12692         (Target_selector::do_recognize): New virtual function.
12693         (Target_selector::do_recognize_by_name): New virtual function.
12694         (Target_selector::instantiate_target): New private function.
12695         (supported_target_names): Declare.
12696         * target-select.cc (Target_selector::Target_selector): Update for
12697         new parameter and fields.
12698         (select_target_by_name): Check that the name matches before
12699         calling recognize_by_name.
12700         (supported_target_names): New function.
12701         * i386.cc (class Target_selector_i386): Update Target_selector
12702         constructor call.  Remove recognize and recognize_by_name.  Add
12703         do_instantiate_target.
12704         * x86_64.cc (class Target_selector_x86_64): Likewise.
12705         * testsuite/testfile.cc (class Target_selector_test): Update for
12706         changes to Target_selector.
12707
12708         * README: Rewrite, with some notes on unsupported features.
12709
12710 2008-03-24  Cary Coutant  <ccoutant@google.com>
12711
12712         * i386.cc (Target_i386::Got_type): New enum declaration.
12713         (Target_i386::Scan::local): Updated callers of Output_data_got
12714         member functions.
12715         (Target_i386::Scan::global): Likewise.
12716         (Target_i386::Relocate::relocate): Likewise.
12717         (Target_i386::Relocate::relocate_tls): Likewise.
12718         * object.h (Got_offset_list): New class.
12719         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12720         (Sized_relobj::local_got_offset): Likewise.
12721         (Sized_relobj::set_local_got_offset): Likewise.
12722         (Sized_relobj::local_has_tls_got_offset): Removed.
12723         (Sized_relobj::local_tls_got_offset): Removed.
12724         (Sized_relobj::set_local_tls_got_offset): Removed.
12725         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12726         * output.cc (Output_data_got::add_global): Added got_type parameter.
12727         (Output_data_got::add_global_with_rel): Likewise.
12728         (Output_data_got::add_global_with_rela): Likewise.
12729         (Output_data_got::add_global_pair_with_rel): New function.
12730         (Output_data_got::add_global_pair_with_rela): New function.
12731         (Output_data_got::add_local): Added got_type parameter.
12732         (Output_data_got::add_local_with_rel): Likewise.
12733         (Output_data_got::add_local_with_rela): Likewise.
12734         (Output_data_got::add_local_pair_with_rel): New function.
12735         (Output_data_got::add_local_pair_with_rela): New function.
12736         (Output_data_got::add_global_tls): Removed.
12737         (Output_data_got::add_global_tls_with_rel): Removed.
12738         (Output_data_got::add_global_tls_with_rela): Removed.
12739         (Output_data_got::add_local_tls): Removed.
12740         (Output_data_got::add_local_tls_with_rel): Removed.
12741         (Output_data_got::add_local_tls_with_rela): Removed.
12742         * output.h (Output_data_got::add_global): Added got_type parameter.
12743         (Output_data_got::add_global_with_rel): Likewise.
12744         (Output_data_got::add_global_with_rela): Likewise.
12745         (Output_data_got::add_global_pair_with_rel): New function.
12746         (Output_data_got::add_global_pair_with_rela): New function.
12747         (Output_data_got::add_local): Added got_type parameter.
12748         (Output_data_got::add_local_with_rel): Likewise.
12749         (Output_data_got::add_local_with_rela): Likewise.
12750         (Output_data_got::add_local_pair_with_rel): New function.
12751         (Output_data_got::add_local_pair_with_rela): New function.
12752         (Output_data_got::add_global_tls): Removed.
12753         (Output_data_got::add_global_tls_with_rel): Removed.
12754         (Output_data_got::add_global_tls_with_rela): Removed.
12755         (Output_data_got::add_local_tls): Removed.
12756         (Output_data_got::add_local_tls_with_rel): Removed.
12757         (Output_data_got::add_local_tls_with_rela): Removed.
12758         * resolve.cc (Symbol::override_base_with_special): Removed
12759         reference to has_got_offset_ field.
12760         * symtab.cc (Symbol::init_fields): Replaced initialization
12761         of got_offset_ with got_offsets_.  Removed initialization
12762         of has_got_offset_
12763         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12764         (Symbol::got_offset): Likewise.
12765         (Symbol::set_got_offset): Likewise.
12766         (Symbol::has_tls_got_offset): Removed.
12767         (Symbol::tls_got_offset): Removed.
12768         (Symbol::set_tls_got_offset): Removed.
12769         (Symbol::got_offset_): Removed.
12770         (Symbol::tls_mod_got_offset_): Removed.
12771         (Symbol::tls_pair_got_offset_): Removed.
12772         (Symbol::got_offsets_): New field.
12773         (Symbol::has_got_offset): Removed.
12774         (Symbol::has_tls_mod_got_offset): Removed.
12775         (Symbol::has_tls_pair_got_offset): Removed.
12776         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12777         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12778         member functions.
12779         (Target_x86_64::Scan::global): Likewise.
12780         (Target_x86_64::Relocate::relocate): Likewise.
12781         (Target_x86_64::Relocate::relocate_tls): Likewise.
12782
12783 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12784
12785         * yyscript.y: Fix spelling error in comment.
12786
12787 2008-03-24  Ian Lance Taylor  <iant@google.com>
12788
12789         * options.h (class General_options): Define build_id option.
12790         * layout.h (class Layout): Declare write_build_id, create_note,
12791         create_build_id.  Add build_id_note_ member.
12792         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12793         "libiberty.h", "md5.h", "sha1.h".
12794         (Layout::Layout): Initialize eh_frame_data_,
12795         eh_frame_hdr_section_, and build_id_note_.
12796         (Layout::finalize): Call create_build_id.
12797         (Layout::create_note): New function, broken out of
12798         Layout::create_gold_note.
12799         (Layout::create_gold_note): Call create_note.
12800         (Layout::create_build_id): New function.
12801         (Layout::write_build_id): New function.
12802         (Close_task_runner::run): Call write_build_id.
12803
12804         * x86_64.cc: Correct license to GPLv3.
12805
12806 2008-03-23  Ian Lance Taylor  <iant@google.com>
12807
12808         * options.cc: Include "demangle.h".
12809         (parse_optional_string): New function.
12810         (parse_long_option): Handle takes_optional_argument.
12811         (parse_short_option): Update dash_z initializer.  Handle
12812         takes_optional_argument.
12813         (General_options::General_options): Initialize do_demangle_.
12814         (General_options::finalize): Set do_demangle_.  Handle demangling
12815         style.
12816         * options.h (parse_optional_string): Declare.
12817         (struct One_option): Add optional_arg field.  Update constructor.
12818         Update call constructor calls.  Add takes_optional_argument
12819         function.
12820         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12821         (DEFINE_optional_string): Define.
12822         (General_options::demangle): Change from DEFINE_bool to
12823         DEFINE_optional_string.
12824         (General_options::no_demangle): New function.
12825         (General_options::do_demangle): New function.
12826         (General_options::set_do_demangle): New function.
12827         (General_options::execstack_status_): Move definition to end of
12828         class definition.
12829         (General_options::static_): Likewise.
12830         (General_options::do_demangle_): New field.
12831         * object.cc (big_endian>::get_symbol_location_info): Call
12832         Options::do_demangle, not Options::demangle.
12833         * symtab.cc (demangle): Likewise.
12834
12835 2008-03-22  Ian Lance Taylor  <iant@google.com>
12836
12837         * gold.h: Include <cstddef> and <sys/types.h>
12838         * options.h: Include <cstring>.
12839
12840 2008-03-21  Ian Lance Taylor  <iant@google.com>
12841
12842         * Added source code to GNU binutils.