elfcpp/
[external/binutils.git] / gold / ChangeLog
1 2012-04-23  Cary Coutant  <ccoutant@google.com>
2
3         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4         CU range table of gdb index.
5
6 2012-04-20  David S. Miller  <davem@davemloft.net>
7
8         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
9         instead of false.
10
11 2012-04-16  David S. Miller  <davem@davemloft.net>
12
13         * sparc.cc (Target_sparc::got_address): New function.
14         (Sparc_relocate_functions::gdop_hix22): New function.
15         (Sparc_relocate_functions::gdop_lox10): New function.
16         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
17         relocs.
18         (Target_sparc::Scan::local): Likewise if the global symbol is not
19         preemptible and is not IFUNC.
20         (Target_sparc::Relocate::relocate): Perform GOTDATA code
21         transformations for local and non-preemptible non-IFUNC global
22         symbols.
23
24         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
25         writing out 64-bit part of ranges.
26
27         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
28         -fpic and -fpie respectively.
29         * Makefile.in: Regenerate.
30
31         * sparc.cc (class Target_sparc): Add rela_ifunc_.
32         (Target_sparc::Target_sparc): Initialize new field.
33         (Target_sparc::do_plt_section_for_global): New function.
34         (Target_sparc::do_plt_section_for_local): New function.
35         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
36         (Target_sparc::make_plt_section): New function, broken out of
37         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
38         (Target_sparc::make_plt_entry): Call make_plt_section.
39         (Target_sparc::make_local_ifunc_plt_entry): New function.
40         (Target_sparc::rela_ifunc_section): New function.
41         (Target_sparc::plt_section): Remove const.
42         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
43         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
44         and ifunc_count_ fields.
45         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
46         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
47         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
48         (Output_data_plt_sparc::rela_ifunc): New function.
49         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
50         (Output_data_plt_sparc::has_ifunc_section): New function.
51         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
52         (Output_data_plt_sparc::address_for_global): New function.
53         (Output_data_plt_sparc::address_for_local): New function.
54         (Output_data_plt_sparc::plt_index_to_offset): New function.
55         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
56         and entry_count.
57         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
58         entry_count.
59         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
60         R_SPARC_JMP_IREL to switch.
61         (Target_sparc::Scan::check_non_pic): Likewise.
62         (Target_sparc::Scan::local): Handle IFUNC symbols.
63         (Target_sparc::Scan::local): Likewise.
64         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
65         and plt_address_for_local.
66         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
67         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
68
69         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
70         (class Output_data_reloc): Adjust calls to Output_reloc_type.
71         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
72         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
73         global relocs too.
74         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
75         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
76         calls.
77         * sparc.cc (Target_sparc::Scan::global): Likewise.
78         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
79
80 2012-04-16  Cary Coutant  <ccoutant@google.com>
81
82         * archive.cc (Library_base::should_include_member): Check for
83         --export-dynamic-symbol.
84         * options.h (class General_options): Add --export-dynamic-symbol.
85         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
86         --export-dynamic-symbol.
87         (Symbol_table::gc_mark_undef_symbols): Likewise.
88         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
89
90 2012-04-12  David S. Miller  <davem@davemloft.net>
91
92         * sparc.cc (Reloc::wdisp10): New relocation method.
93         (Reloc::h34): Likewise.
94         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
95         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
96         R_SPARC_WDISP10.
97         (Target_sparc::Scan::local): Likewise.
98         (Target_sparc::Scan::global): Likewise.
99         (Target_sparc::Relocate::relocate): Likewise.
100
101 2012-04-09  Cary Coutant  <ccoutant@google.com>
102
103         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
104         low_pc == 0.
105
106 2012-04-06  Ian Lance Taylor  <iant@google.com>
107
108         * timer.cc: #include <unistd.h>.
109
110 2012-04-06  Roland McGrath  <mcgrathr@google.com>
111
112         * configure.in (AC_CHECK_HEADERS): Add locale.h.
113         * config.in: Regenerate.
114         * configure: Regenerate.
115
116 2012-04-05  Nick Clifton  <nickc@redhat.com>
117
118         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
119         (AM_LC_MESSAGES): Add.
120         * aclocal.m4: Regenerate.
121         * config.in: Regenerate.
122         * configure: Regenerate.
123
124 2012-03-21  Cary Coutant  <ccoutant@google.com>
125
126         * Makefile.am: Add gdb-index.cc, gdb-index.h.
127         * Makefile.in: Regenerate.
128         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
129         (Sized_elf_reloc_mapper::symbol_section): New function.
130         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
131         (make_elf_reloc_mapper): New function.
132         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
133         (Dwarf_abbrev_table::do_read_abbrevs): New function.
134         (Dwarf_abbrev_table::do_get_abbrev): New function.
135         (Dwarf_ranges_table::read_ranges_table): New function.
136         (Dwarf_ranges_table::read_range_list): New function.
137         (Dwarf_pubnames_table::read_section): New function.
138         (Dwarf_pubnames_table::read_header): New function.
139         (Dwarf_pubnames_table::next_name): New function.
140         (Dwarf_die::Dwarf_die): New function.
141         (Dwarf_die::read_attributes): New function.
142         (Dwarf_die::skip_attributes): New function.
143         (Dwarf_die::set_name): New function.
144         (Dwarf_die::set_linkage_name): New function.
145         (Dwarf_die::attribute): New function.
146         (Dwarf_die::string_attribute): New function.
147         (Dwarf_die::int_attribute): New function.
148         (Dwarf_die::uint_attribute): New function.
149         (Dwarf_die::ref_attribute): New function.
150         (Dwarf_die::child_offset): New function.
151         (Dwarf_die::sibling_offset): New function.
152         (Dwarf_info_reader::check_buffer): New function.
153         (Dwarf_info_reader::parse): New function.
154         (Dwarf_info_reader::do_parse): New function.
155         (Dwarf_info_reader::do_read_string_table): New function.
156         (Dwarf_info_reader::lookup_reloc): New function.
157         (Dwarf_info_reader::get_string): New function.
158         (Dwarf_info_reader::visit_compilation_unit): New function.
159         (Dwarf_info_reader::visit_type_unit): New function.
160         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
161         Sized_elf_reloc_mapper.
162         (Sized_dwarf_line_info::symbol_section): Remove function.
163         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
164         (Sized_dwarf_line_info::read_line_mappings): Remove object
165         parameter, adjust callers.
166         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
167         * dwarf_reader.h: Include <sys/types.h>.
168         (class Track_relocs): Remove forward declaration.
169         (class Elf_reloc_mapper): New class.
170         (class Sized_elf_reloc_mapper): New class.
171         (class Dwarf_abbrev_table): New class.
172         (class Dwarf_range_list): New class.
173         (class Dwarf_ranges_table): New class.
174         (class Dwarf_pubnames_table): New class.
175         (class Dwarf_die): New class.
176         (class Dwarf_info_reader): New class.
177         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
178         (Sized_dwarf_line_info::symbol_section): Remove member function.
179         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
180         base class.
181         * gdb-index.cc: New source file.
182         * gdb-index.h: New source file.
183         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
184         and .debug_types sections, call Layout::add_to_gdb_index.
185         (Sized_relobj_incr::do_section_name): Implement.
186         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
187         return type; Implement.
188         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
189         return type.
190         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
191         parameter list and return type.
192         (Sized_incr_dynobj::do_section_contents): Likewise.
193         * layout.cc: Include gdb-index.h.
194         (Layout::Layout): Initialize gdb_index_data_.
195         (Layout::init_fixed_output_section): Check for .gdb_index section.
196         (Layout::add_to_gdb_index): New function. Instantiate.
197         * layout.h: Add forward declaration for class Gdb_index.
198         (Layout::add_to_gdb_index): New member function.
199         (Layout::gdb_index_data_): New data member.
200         * main.cc: Include gdb-index.h.
201         (main): Print statistics for gdb index.
202         * object.cc (Object::section_contents): Move code into
203         do_section_contents.
204         (need_decompressed_section): Check for sections needed when building
205         gdb index.
206         (build_compressed_section_map): Likewise.
207         (Sized_relobj_file::do_read_symbols): Need local symbols when building
208         gdb index.
209         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
210         sections; call Layout::add_to_gdb_index.
211         (Sized_relobj_file::do_decompressed_section_contents): Call
212         do_section_contents directly.
213         * object.h (Object::do_section_contents): Adjust parameter list and
214         return type.
215         (Object::do_decompressed_section_contents): Call do_section_contents
216         directly.
217         (Sized_relobj_file::do_section_contents): Adjust parameter list and
218         return type.
219         * options.h (class General_options): Add --gdb-index option.
220         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
221         list and return type.
222         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
223         * reloc.h (Track_relocs::checkpoint): New function.
224         (Track_relocs::reset): New function.
225
226         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
227         New test cases.
228         * testsuite/Makefile.in: Regenerate.
229         * testsuite/gdb_index_test.cc: New test source file.
230         * testsuite/gdb_index_test_1.sh: New test source file.
231         * testsuite/gdb_index_test_2.sh: New test source file.
232
233 2012-03-19  Doug Kwan  <dougkwan@google.com>
234
235         * arm.cc (Target_arm::do_define_standard_symbols): New method.
236         (Target_arm::do_finalize_sections): Remove code which defines
237         __exidx_start and __exidx_end.  Make symbol table parameter
238         anonymous as it is not used.
239         * gold.cc (queue_middle_tasks): Call target hook to define any
240         target-specific symbols.
241         * target.h (Target::define_standard_symbols): New method.
242         (Target::do_define_standard_symbols): Same.
243         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
244         * testsuite/Makefile.in: Regenerate.
245         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
246         and __exidx_end.
247         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
248         relocations are generated for __exidx_start and __exidx_end.
249
250 2012-03-16  Doug Kwan  <dougkwan@google.com>
251
252         * testsuite/Makefile.am: Disable test initpri3b.
253         * testsuite/Makefile.in: Regenerate.
254
255 2012-03-15  Doug Kwan  <dougkwan@google.com>
256
257         * arm.cc (Target_arm::got_section): Make .got section read-only
258         if -z now is given.
259
260 2012-03-15  Ian Lance Taylor  <iant@google.com>
261
262         PR gold/13850
263         * layout.cc (Layout::make_output_section): Correctly mark
264         SHT_INIT_ARRAY, et. al., as relro.
265
266 2012-03-14  Doug Kwan  <dougkwan@google.com>
267
268         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
269         dynamic relocations for protected symbols in shared objects.
270
271 2012-03-13  Ian Lance Taylor  <iant@google.com>
272
273         * resolve.cc (Symbol_table::resolve): When merging common symbols,
274         keep the larger alignment.
275
276 2012-03-12  Cary Coutant  <ccoutant@google.com>
277
278         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
279         handling of DW_LNE_define_file.
280
281 2012-03-12  Cary Coutant  <ccoutant@google.com>
282
283         * reduced_debug_output.cc
284         (Output_reduced_debug_info_section::get_die_end): Add new FORM
285         codes to switch.
286
287 2012-02-29  Cary Coutant  <ccoutant@google.com>
288
289         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
290
291 2012-02-29  Cary Coutant  <ccoutant@google.com>
292
293         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
294         Call Object::decompressed_section_contents.
295         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
296         New dtor.
297         (Sized_dwarf_line_info::buffer_start_): New data member.
298         * merge.cc (Output_merge_data::do_add_input_section): Call
299         Object::decompressed_section_contents.
300         (Output_merge_string::do_add_input_section): Likewise.
301         * object.cc (need_decompressed_section): New function.
302         (build_compressed_section_map): Decompress sections needed later.
303         (Sized_relobj_file::do_decompressed_section_contents): New function.
304         (Sized_relobj_file::do_discard_decompressed_sections): New function.
305         * object.h (Object::decompressed_section_contents): New function.
306         (Object::discard_decompressed_sections): New function.
307         (Object::do_decompressed_section_contents): New function.
308         (Object::do_discard_decompressed_sections): New function.
309         (Compressed_section_info): New type.
310         (Compressed_section_map): Include decompressed section contents.
311         (Sized_relobj_file::do_decompressed_section_contents): New function.
312         (Sized_relobj_file::do_discard_decompressed_sections): New function.
313
314 2012-02-16  Cary Coutant  <ccoutant@google.com>
315
316         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
317         * testsuite/Makefile.in: Regenerate.
318
319 2012-02-14  Cary Coutant  <ccoutant@google.com>
320
321         * options.cc (General_options::finalize): Disallow -pie and -static.
322
323 2012-02-03  Doug Kwan  <dougkwan@google.com>
324
325         * arm.cc (Arm_relocate_functions::abs8,
326         Arm_relocate_functions::abs16): Use
327         Bits::has_signed_unsigned_overflow32.
328         (Arm_relocate_functions::thm_abs8): Correct range of
329         overflow check.
330         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
331         in assertions.
332
333 2012-02-02  Doug Kwan  <dougkwan@google.com>
334
335         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
336         position independent outputs, not just shared objects.
337
338 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
339
340         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
341         * configure: Regenerated.
342
343 2012-01-27  Ian Lance Taylor  <iant@google.com>
344
345         * reloc.h (Bits): New class with static functions, copied from
346         namespace utils in arm.cc.
347         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
348         instead.
349
350 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
351
352         * incremental.cc (write_info_blocks): Correct relocation offset.
353
354 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
355
356         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
357         (Relocate::tls_gd_to_le): Likewise.
358
359 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
360
361         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
362
363 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
364
365         * configure.ac: Check if -mcmodel=medium works.
366         * configure: Regenerated.
367
368 2012-01-24  Cary Coutant  <ccoutant@google.com>
369
370         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
371         definition and ...
372         (read_unsigned_LEB_128_x): ... this new function.
373         (read_signed_LEB_128): Replaced with inline definition and ...
374         (read_signed_LEB_128_x): ... this new function.
375         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
376         (read_unsigned_LEB_128): Add inline definition.
377         (read_signed_LEB_128_x): New function.
378         (read_signed_LEB_128): Add inline definition.
379         * testsuite/Makefile.am (leb128_unittest): New unit test.
380         * testsuite/Makefile.in: Regenerate.
381         * testsuite/leb128_unittest.cc: New unit test.
382
383 2012-01-23  Ian Lance Taylor  <iant@google.com>
384
385         PR gold/13617
386         * i386.cc (Target_i386::do_code_fill): When using a jmp
387         instruction, pad with nop instructions.
388         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
389
390 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
391
392         * x86_64.cc (gc_process_relocs): Add typename on types used in
393         template.
394         (scan_relocs): Likewise.
395         (relocate_section): Likewise.
396         (apply_relocation): Likewise.
397
398 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
399
400         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
401         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
402         under x32.
403
404 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
405
406         * x86_64.cc: Initial support for x32.
407
408 2012-01-03  Cary Coutant  <ccoutant@google.com>
409
410         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
411         Use abstract base class for GOT.
412         * gold/output.h (class Output_data_got_base): New abstract base class.
413         (class Output_data_got): Derive from new base class, adjust ctors.
414         (Output_data_got::reserve_slot): Make virtual; rename to
415         do_reserve_slot; Adjust callers.
416         * gold/target.h (Sized_target::init_got_plt_for_update): Return
417         pointer to abstract base class.
418         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
419
420 2011-12-18  Ian Lance Taylor  <iant@google.com>
421
422         * object.h (Relobj::local_symbol_value): New function.
423         (Relobj::local_plt_offset): New function.
424         (Relobj::local_has_got_offset): New function.
425         (Relobj::local_got_offset): New function.
426         (Relobj::set_local_got_offset): New function.
427         (Relobj::do_local_symbol_value): New pure virtual function.
428         (Relobj::do_local_plt_offset): Likewise.
429         (Relobj::do_local_has_got_offset): Likewise.
430         (Relobj::do_local_got_offset): Likewise.
431         (Relobj::do_set_local_got_offset): Likewise.
432         (Sized_relobj::do_local_has_got_offset): Rename from
433         local_has_got_offset.
434         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
435         (Sized_relobj::do_set_local_got_offset): Rename from
436         set_local_got_offset.
437         (Sized_relobj_file::do_local_plt_offset): Rename from
438         local_plt_offset.
439         (Sized_relobj_file::do_local_symbol_value): New function.
440         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
441         local_plt_offset.
442         * output.cc (Output_data_got::Got_entry::write): Change object to
443         Relobj.  Use local_symbol_value.
444         (Output_data_got::add_global_with_rel): Change rel_dyn to
445         Output_data_reloc_generic*.  Use add_global_generic.
446         (Output_data_got::add_global_with_rela): Remove.  Change all
447         callers to use add_global_with_rel.
448         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
449         Output_data_reloc_generic*.  Use add_global_generic.
450         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
451         callers to use add_global_pair_with_rel.
452         (Output_data_got::add_local): Change object to Relobj*.
453         (Output_data_got::add_local_plt): Likewise.
454         (Output_data_got::add_local_with_rel): Change object to Relobj*,
455         change rel_dyn to Output_data_reloc_generic*.  Use
456         add_local_generic.
457         (Output_data_got::add_local_with_rela): Remove.  Change all
458         callers to use all_local_with_rel.
459         (Output_data_got::add_local_pair_with_rel): Change object to
460         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
461         add_output_section_generic.
462         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
463         callers to use add_local_pair_with_rel.
464         (Output_data_got::reserve_local): Change object to Relobj*.
465         * output.h: (class Output_data_reloc_generic): Add pure virtual
466         declarations for add_global_generic, add_local_generic,
467         add_output_section_generic.
468         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
469         functions for Output_data_reloc_generic.  Update declarations for
470         changes listed in output.cc.
471         (class Output_data_got): Change template parameter to got_size.
472         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
473         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
474         function.
475         (Sized_relobj_incr::do_local_plt_offset): New function.
476         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
477         add_global_generic.
478
479 2011-12-17  Cary Coutant  <ccoutant@google.com>
480
481         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
482         * resolve.cc (Symbol_table::resolve): Likewise.
483         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
484         arrays.
485         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
486
487 2011-12-16  Ian Lance Taylor  <iant@google.com>
488
489         * output.h (Output_data_reloc_generic::add): Only call
490         add_dynamic_reloc if this is a dynamic reloc section.
491
492 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
493
494         PR gold/13505
495         * target-reloc.h (apply_relocation): Replace <64, false> with
496         <size, big_endian>.
497
498 2011-11-25  Nick Clifton  <nickc@redhat.com>
499
500         * po/it.po: New Italian translation.
501
502 2011-11-17  Sterling Augustine  <saugustine@google.com>
503
504         * script.cc (script_include_directive): Implement.
505         (read_script_file): New local variables name and search_path. Update
506         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
507         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
508         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
509
510 2011-11-11  Sterling Augustine  <saugustine@google.com>
511
512         * yyscript.y (section_cmd): Add support for INCLUDE directive.
513         (file_or_sections_cmd): Likewise.
514
515 2011-11-11  Doug Kwan  <dougkwan@google.com>
516
517         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
518         if --just-symbols is given.
519
520 2011-11-10  Doug Kwan  <dougkwan@google.com>
521
522         PR gold/13362
523         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
524         when processing data relocs.
525         * reloc.h (Relocate_functions::rel_unaligned): New method.
526         (Relocate_functions::pcrel_unaligned): Ditto.
527         (Relocate_functions::rel32_unaligned): Ditto.
528         (Relocate_functions::pcrel32_unaligned): Ditto.
529
530 2011-11-09  Doug Kwan  <dougkwan@google.com>
531
532         PR gold/13362
533         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
534         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
535         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
536         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
537         (Relocate_functions::rel_unaligned): New.
538         (Relocate_functions::rel32_unaligned): New.
539         * target-reloc.h (relocate_for_relocatable): Add code to handle
540         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
541         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
542         arm_unaligned_reloc_r): New targets.
543         * testsuite/Makefile.in: Regenerate.
544         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
545         linking.
546
547 2011-11-02  Ian Lance Taylor  <iant@google.com>
548
549         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
550         NATIVE_LINKER.
551         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
552         * options.cc (General_options::finalize): Use library search path
553         from configure script if specified.  If not native and no sysroot,
554         only search TOOLLIBDIR.
555         * options.h (Search_directory::Search_directory): Change name to
556         const std::string&.
557         (General_options::add_to_library_path_with_sysroot): Change arg to
558         const std::string&.
559         * configure, Makefile.in, config.in: Rebuild.
560
561 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
562
563         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
564         we are working around the ARM1176 Erratum.
565         * options.h (General_options::fix_arm1176): Add option.
566         * testsuite/Makefile.am: Add testcases, and keep current ones
567         working.
568         * testsuite/Makefile.in: Regenerate.
569         * testsuite/arm_fix_1176.s: New file.
570         * testsuite/arm_fix_1176.sh: Likewise.
571
572 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
573
574         * arm.cc (Target_arm::Target_arm): Remove initialisation of
575         may_use_blx_.
576         (Target_arm::may_use_blx): Remove method.
577         (Target_arm::set_may_use_blx): Likewise.
578         (Target_arm::may_use_v4t_interworking): New method.
579         (Target_arm::may_use_v5t_interworking): Likewise.
580         (Target_arm::may_use_blx_): Remove member variable.
581         (Arm_relocate_functions::arm_branch_common): Check for v5T
582         interworking.
583         (Arm_relocate_functions::thumb_branch_common): Likewise.
584         (Reloc_stub::stub_type_for_reloc): Likewise.
585         (Target_arm::do_finalize_sections): Correct interworking checks.
586         * testsuite/Makefile.am: Add new tests.
587         * testsuite/Makefile.in: Regenerate.
588         * testsuite/arm_farcall_arm_arm.s: New test.
589         * testsuite/arm_farcall_arm_arm.sh: Likewise.
590         * testsuite/arm_farcall_arm_thumb.s: Likewise.
591         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
592         * testsuite/arm_farcall_thumb_arm.s: Likewise.
593         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
594         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
595         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
596
597 2011-10-31  Cary Coutant  <ccoutant@google.com>
598
599         PR gold/13023
600         * expression.cc (Expression::eval_with_dot): Add
601         is_section_dot_assignment parameter.
602         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
603         absolute and assigning to dot within a section.
604         * script-sections.cc
605         (Output_section_element_assignment::set_section_addresses): Pass
606         dot_section to set_if_absolute.
607         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
608         as is_section_dot_assignment flag to eval_with_dot.
609         (Output_section_element_dot_assignment::set_section_addresses):
610         Likewise.
611         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
612         parameter.  Also set value if relative to dot_section; set the
613         symbol's output_section.
614         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
615         parameter.  Adjust all callers.
616         (Expression::eval_maybe_dot): Likewise.
617         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
618         Adjust all callers.
619         * testsuite/script_test_2.t: Test assignment of an absolute value
620         to dot within an output section element.
621
622 2011-10-31  Cary Coutant  <ccoutant@google.com>
623
624         * options.h (class General_options): Add --[no-]gnu-unique options.
625         * symtab.cc (Symbol_table::sized_write_globals): Convert
626         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
627
628 2011-10-31  Cary Coutant  <ccoutant@google.com>
629
630         PR gold/13359
631         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
632         unnecessary assertion.
633         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
634
635 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
636
637         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
638         gc_mark_symbol.
639         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
640         gc_mark_symbol.
641         Change to just keep the section associated with symbol.
642         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
643         they are externally visible and --export-dynamic is turned on.
644         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
645
646 2011-10-19  Ian Lance Taylor  <iant@google.com>
647
648         PR gold/13163
649         * script-sections.cc
650         (Output_section_element_dot_assignment::needs_output_section): New
651         function.
652
653 2011-10-19  Ian Lance Taylor  <iant@google.com>
654
655         PR gold/13204
656         * layout.cc (Layout::segment_precedes): Don't assert failure if a
657         --section-start option was seen.
658         * options.h (General_options::any_section_start): New function.
659
660 2011-10-18  David S. Miller  <davem@davemloft.net>
661
662         PR binutils/13301
663         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
664         member to track relocation locations that have moved during TLS
665         reloc optimizations.
666         (Target_sparc::Relocate::Relocate): Initialize to NULL.
667         (Target_sparc::Relocate::relocate): Adjust view down by 4
668         bytes if it matches reloc_adjust_addr_.
669         (Target_sparc::Relocate::relocate_tls): Always move the
670         __tls_get_addr call delay slot instruction forward 4 bytes when
671         performing relaxation.
672
673 2011-10-18  Cary Coutant  <ccoutant@google.com>
674
675         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
676         (Output_file::map_no_anonymous): Check for non-zero
677         return code from posix_fallocate.
678
679 2011-10-17  Cary Coutant  <ccoutant@google.com>
680
681         PR gold/13245
682         * plugin.cc (is_visible_from_outside): Check for symbols
683         referenced from dynamic objects.
684         * resolve.cc (Symbol_table::resolve): Don't count references
685         from dynamic objects as references from real ELF files.
686         * testsuite/plugin_test_2.sh: Adjust expected result.
687
688 2011-10-17  Cary Coutant  <ccoutant@google.com>
689
690         * gold.cc: Include timer.h.
691         (queue_middle_tasks): Stamp time.
692         (queue_final_tasks): Likewise.
693         * main.cc (main): Store timer in parameters.  Print timers
694         for each pass.
695         * parameters.cc (Parameters::Parameters): Initialize timer_.
696         (Parameters::set_timer): New function.
697         (set_parameters_timer): New function.
698         * parameters.h (Parameters::set_timer): New function.
699         (Parameters::timer): New function.
700         (Parameters::timer_): New data member.
701         (set_parameters_timer): New function.
702         * timer.cc (Timer::stamp): New function.
703         (Timer::get_pass_time): New function.
704         * timer.h (Timer::stamp): New function.
705         (Timer::get_pass_time): New function.
706         (Timer::pass_times_): New data member.
707
708 2011-10-17  Cary Coutant  <ccoutant@google.com>
709
710         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
711         task for members of lib groups.
712
713 2011-10-17  Cary Coutant  <ccoutant@google.com>
714
715         PR gold/13288
716         * fileread.cc (File_read::find_view): Add assert.
717         (File_read::make_view): Move bounds check (replace with assert)...
718         (File_read::find_or_make_view): ... to here.
719
720 2011-10-12  Cary Coutant  <ccoutant@google.com>
721
722         * output.cc (Output_file::open_base_file): Handle case where
723         ::read returns less than requested size.
724
725 2011-10-10  Cary Coutant  <ccoutant@google.com>
726
727         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
728         Initialize defined_count_.
729         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
730         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
731         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
732         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
733         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
734         * incremental.h (Sized_relobj_incr::defined_count_): New data
735         member.
736         (Sized_incr_dynobj::defined_count_): New data member.
737         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
738         Return zeroes instead of internal error.
739
740 2011-10-10  Cary Coutant  <ccoutant@google.com>
741
742         PR gold/13249
743         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
744         (Output_reloc::symbol_value): Return PLT offset if flag is set.
745         * output.h (class Output_reloc): Add use_plt_offset flag.
746         (Output_reloc::type_): Adjust size of bit field.
747         (Output_reloc::use_plt_offset_): New bit field.
748         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
749         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
750         flag.  Adjust all callers.
751         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
752         creating RELATIVE relocations.
753
754 2011-10-10  Nick Clifton  <nickc@redhat.com>
755
756         * po/es.po: Updated Spanish translation.
757         * po/fi.po: Updated Finnish translation.
758
759 2011-10-03   Diego Novillo  <dnovillo@google.com>
760
761         * options.cc (parse_uint): Fix dereference of RETVAL.
762
763 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
764
765         * layout.h (section_order_map_): New member.
766         (get_section_order_map): New member function.
767         * output.cc (Output_section::add_input_section): Check for patterns
768         only when --section-ordering-file is specified.
769         * gold.cc (queue_middle_tasks): Delay updating order of sections till
770         output_sections have been formed.
771         * layout.cc (Layout_Layout): Initialize section_order_map_.
772         * plugin.cc (update_section_order): Store order in order_map. Do not
773         update the order.
774         * testsuite/Makefile.am: Add test case for plugin_final_layout.
775         * testsuite/Makefile.in: Regenerate.
776         * testsuite/plugin_section_order.c: New file.
777         * testsuite/plugin_final_layout.cc: New file.
778         * testsuite/plugin_final_layout.sh: New file.
779
780 2011-09-29  Cary Coutant  <ccoutant@google.com>
781
782         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
783         Check for NULL.
784         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
785         symbols during incremental update.
786         (Symbol_table::add_from_dynobj): Likewise.
787
788 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
789             Ian Lance Taylor  <iant@google.com>
790
791         * symtab.cc (Symbol_table::define_special_symbol): Always
792         canonicalize version string.
793
794 2011-09-26  Cary Coutant  <ccoutant@google.com>
795
796         * gold.cc (queue_initial_tasks): Move option checks ...
797         * options.cc (General_options::finalize): ... to here. Disable
798         some options; make others fatal.
799
800 2011-09-26  Cary Coutant  <ccoutant@google.com>
801
802         gcc PR lto/47247
803         * plugin.cc (get_symbols_v2): New function.
804         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
805         (is_referenced_from_outside): New function.
806         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
807         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
808         (get_symbols): Pass version parameter.
809         (get_symbols_v2): New function.
810         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
811         parameter.
812         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
813         (onload): Add LDPT_GET_SYMBOLS_V2.
814         (all_symbols_read_hook): Use get_symbols_v2; check for
815         LDPR_PREVAILING_DEF_IRONLY_EXP.
816         * testsuite/plugin_test_3.sh: Update expected results.
817
818 2011-09-23  Simon Baldwin  <simonb@google.com>
819
820         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
821         configuration options.
822         * configure: Regenerate.
823         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
824         * Makefile.in: Regenerate.
825         * testsuite/Makefile.in: Regenerate.
826
827 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
828
829         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
830
831 2011-09-19  Cary Coutant  <ccoutant@google.com>
832
833         * incremental.cc (can_incremental_update): Fix typo in comment.
834         * incremental.h (can_incremental_update): Likewise.
835
836 2011-09-18  Cary Coutant  <ccoutant@google.com>
837
838         * incremental.cc (can_incremental_update): New function.
839         * incremental.h (can_incremental_update): New function.
840         * layout.cc (Layout::init_fixed_output_section): Call it.
841         (Layout::make_output_section): Don't allow patch space in .eh_frame.
842         * object.cc (Sized_relobj_file::do_layout): Call
843         can_incremental_update.
844
845 2011-09-13  Cary Coutant  <ccoutant@google.com>
846
847         * configure.ac: Check for glibc support for gnu_indirect_function
848         support with static linking, setting automake conditional
849         IFUNC_STATIC.
850         * Makefile.in: Regenerate.
851         * configure: Regenerate.
852
853         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
854         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
855         for IFUNC_STATIC.
856         * testsuite/Makefile.in: Regenerate.
857
858 2011-09-13  Cary Coutant  <ccoutant@google.com>
859
860         * incremental.cc (Sized_relobj_incr::do_layout): Call
861         report_comdat_group for kept comdat sections.
862         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
863         * testsuite/Makefile.in: Regenerate.
864         * testsuite/incr_comdat_test_1.cc: New source file.
865         * testsuite/incr_comdat_test_2_v1.cc: New source file.
866         * testsuite/incr_comdat_test_2_v2.cc: New source file.
867         * testsuite/incr_comdat_test_2_v3.cc: New source file.
868
869 2011-09-13  Ian Lance Taylor  <iant@google.com>
870
871         * object.cc (Sized_relobj_file::do_layout): Remove unused local
872         variable external_symbols_offset.
873
874 2011-09-12  Ian Lance Taylor  <iant@google.com>
875
876         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
877         triggered if object has no symbols.
878
879 2011-09-09  David S. Miller  <davem@davemloft.net>
880
881         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
882         (Output_fill_debug_line::do_write): Likewise.
883
884 2011-08-29  Cary Coutant  <ccoutant@google.com>
885
886         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
887         casts to match formatting specs.
888         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
889
890 2011-08-26  Cary Coutant  <ccoutant@google.com>
891
892         * layout.cc (Free_list::allocate): Provide guarantee of minimum
893         remaining hole size when allocating.
894         (Layout::make_output_section): Set fill methods for debug sections.
895         * layout.h (Free_list::Free_list_node): Move from private to
896         public.
897         (Free_list::set_min_hole_size): New function.
898         (Free_list::begin, Free_list::end): New functions.
899         (Free_list::min_hole_): New data member.
900         * output.cc: Include dwarf.h.
901         (Output_fill_debug_info::do_minimum_hole_size): New function.
902         (Output_fill_debug_info::do_write): New function.
903         (Output_fill_debug_line::do_minimum_hole_size): New function.
904         (Output_fill_debug_line::do_write): New function.
905         (Output_section::Output_section): Initialize new data member.
906         (Output_section::set_final_data_size): Ensure patch space is larger
907         than minimum hole size.
908         (Output_section::do_write): Fill holes in debug sections.
909         * output.h (Output_fill): New class.
910         (Output_fill_debug_info): New class.
911         (Output_fill_debug_line): New class.
912         (Output_section::set_free_space_fill): New function.
913         (Output_section::free_space_fill_): New data member.
914         * testsuite/Makefile.am (incremental_test_3): Add
915         --incremental-patch option.
916         (incremental_test_4): Likewise.
917         (incremental_test_5): Likewise.
918         (incremental_test_6): Likewise.
919         (incremental_copy_test): Likewise.
920         (incremental_common_test_1): Likewise.
921         * testsuite/Makefile.in: Regenerate.
922
923 2011-08-26  Nick Clifton  <nickc@redhat.com>
924
925         * po/es.po: Updated Spanish translation.
926
927 2011-08-01  Cary Coutant  <ccoutant@google.com>
928
929         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
930         * gold/testsuite/Makefile.in: Regenerate.
931         * gold/testsuite/justsyms_exec.c: New source file.
932         * gold/testsuite/justsyms_lib.c: New source file.
933
934 2011-08-01  Cary Coutant  <ccoutant@google.com>
935
936         * layout.cc (Layout::set_segment_offsets): Don't realign text
937         segment if -Ttext was specified.
938         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
939         file type.
940         * object.h (Sized_relobj_file::e_type): New function.
941         (Sized_relobj_file::e_type_): New data member.
942         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
943         base address for ET_EXEC files.
944         * target.cc (Target::do_make_elf_object_implementation): Allow
945         ET_EXEC files with --just-symbols option.
946
947 2011-07-28  Cary Coutant  <ccoutant@google.com>
948
949         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
950         Add thread_number parameter.
951         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
952         * workqueue-threads.cc
953         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
954         current thread if its thread number is greater than desired thread
955         count.
956         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
957         Add thread_number parameter.
958         (Workqueue::should_cancel_thread): Likewise.
959         (Workqueue::find_runnable_or_wait): Pass thread_number to
960         should_cancel_thread.
961         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
962         parameter.
963
964 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
965
966         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
967         only after checking if it cannot be forced local.
968         * symtab.h (is_externally_visible): Check if the symbol is not forced
969         local.
970
971 2011-07-15  Ian Lance Taylor  <iant@google.com>
972
973         * options.h (class General_options): Add --print-output-format.
974         Move -EL next to -EB, for  better --help output.
975         * target-select.cc: Include <cstdio>, "options.h", and
976         "parameters.h".
977         (Target_selector::do_target_bfd_name): New function.
978         (print_output_format): New function.
979         * target-select.h (class Target_selector): Update declarations.
980         (Target_selector::target_bfd_name): New function.
981         (print_output_format): Declare.
982         * main.cc: Include "target-select.h".
983         (main): Handle --print-output-format.
984         * gold.cc: Include "target-select.h".
985         (queue_initial_tasks): Handle --print-output-format when there are
986         no input files.
987         * parameters.cc (parameters_force_valid_target): Give a better
988         error message if -EB/-EL does not match target.
989         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
990         function.
991
992 2011-07-15  Ian Lance Taylor  <iant@google.com>
993
994         * i386.cc (class Output_data_plt_i386): Add layout_ field.
995         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
996         (Output_data_plt_i386::do_write): Write address of .dynamic
997         section to first entry in .got.plt section.
998         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
999         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1000         Initialize layout_.
1001         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1002         section to first entry in .got.plt section.
1003         * layout.h (Layout::dynamic_section): New function.
1004
1005 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1006
1007         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1008         to claim_file call.
1009         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1010         input_section_position_, and input_section_glob_.
1011         (read_layout_from_file): Call function section_ordering_specified.
1012         * layout.h (is_section_ordering_specified): New function.
1013         (section_ordering_specified): New function.
1014         (section_ordering_specified_): New boolean member.
1015         * main.cc(main): Call load_plugins after layout object is defined.
1016         * output.cc (Output_section::add_input_section): Use
1017         function section_ordering_specified to check if section ordering is
1018         needed.
1019         * output.cc (Output_section::add_relaxed_input_section): Use
1020         function section_ordering_specified to check if section ordering is
1021         needed.
1022         (Output_section::update_section_layout): New function.
1023         (Output_section::sort_attached_input_sections): Check if input section
1024         must be reordered.
1025         * output.h (Output_section::update_section_layout): New function.
1026         * plugin.cc (get_section_count): New function.
1027         (get_section_type): New function.
1028         (get_section_name): New function.
1029         (get_section_contents): New function.
1030         (update_section_order): New function.
1031         (allow_section_ordering): New function.
1032         (Plugin::load): Add the new interfaces to the transfer vector.
1033         (Plugin_manager::load_plugins): New parameter.
1034         (Plugin_manager::all_symbols_read): New parameter.
1035         (Plugin_manager::claim_file): New parameter. Save the elf object for
1036         unclaimed objects.
1037         (Plugin_manager::get_elf_object): New function.
1038         (Plugin_manager::get_view): Change to directly use the bool to check
1039         if get_view is called from claim_file_hook.
1040         * plugin.h (input_objects): New function
1041         (Plugin__manager::load_plugins): New parameter.
1042         (Plugin_manager::claim_file): New parameter.
1043         (Plugin_manager::get_elf_object): New function.
1044         (Plugin_manager::in_claim_file_handler): New function.
1045         (Plugin_manager::in_claim_file_handler_): New member.
1046         (layout): New function.
1047         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1048         handler with an extra parameter. Make the elf object before calling
1049         claim_file handler.
1050         * testsuite/plugin_test.c (get_section_count): New function pointer.
1051         (get_section_type): New function pointer.
1052         (get_section_name): New function pointer.
1053         (get_section_contents): New function pointer.
1054         (update_section_order): New function pointer.
1055         (allow_section_ordering): New function pointer.
1056         (onload): Check if the new interfaces exist.
1057
1058 2011-07-13  Ian Lance Taylor  <iant@google.com>
1059
1060         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1061         relro section.
1062         * x86_64.cc (Target_x86_64::got_section): Likewise.
1063         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1064         (relro_now_test_SOURCES): New variable.
1065         (relro_now_test_DEPENDENCIES): New variable.
1066         (relro_now_test_LDFLAGS): New variable.
1067         (relro_now_test_LDADD): New variable.
1068         (relro_now_test.so): New target.
1069         * testsuite/Makefile.in: Rebuild.
1070
1071 2011-07-12  Ian Lance Taylor  <iant@google.com>
1072
1073         PR gold/12980
1074         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1075         GLOB_DAT relocation rather than a RELATIVE relocation for a
1076         protected symbol when creating a shared library.
1077         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1078         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1079         * testsuite/protected_main_1.cc (main): Test that protected
1080         function has same address.
1081
1082 2011-07-11  Ian Lance Taylor  <iant@google.com>
1083
1084         PR gold/12979
1085         * options.h (class General_options): Add -Bgroup.
1086         * options.cc (General_options::finalize): If -Bgroup is set,
1087         default to --unresolved-symbols=report-all.
1088         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1089         * target-reloc.h (issue_undefined_symbol_error): Handle
1090         --unresolved-symbols=report-all.
1091
1092 2011-07-08  Ian Lance Taylor  <iant@google.com>
1093
1094         PR gold/11985
1095         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1096         if linker script discards key sections.
1097         (Layout::create_dynamic_symtab): Likewise.
1098         (Layout::assign_local_dynsym_offsets): Likewise.
1099         (Layout::sized_create_version_sections): Likewise.
1100         (Layout::create_interp): Likewise.
1101         (Layout::finish_dynamic_section): Likewise.
1102         (Layout::set_dynamic_symbol_size): Likewise.
1103
1104 2011-07-08  Ian Lance Taylor  <iant@google.com>
1105
1106         PR gold/12386
1107         * options.h (class General_options): Add --unresolved-symbols.
1108         * target-reloc.h (issue_undefined_symbol_error): Check
1109         --unresolved-symbols.  Add comments.
1110
1111 2011-07-08  Ian Lance Taylor  <iant@google.com>
1112
1113         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1114         expression more complex.
1115
1116 2011-07-08  Ian Lance Taylor  <iant@google.com>
1117
1118         PR gold/11317
1119         * target-reloc.h (issue_undefined_symbol_error): New inline
1120         function, broken out of relocate_section.
1121         (relocate_section): Call issue_undefined_symbol_error.
1122         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1123         there is no TLS segment if we are about to issue an undefined
1124         symbol error.
1125         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1126
1127 2011-07-08  Ian Lance Taylor  <iant@google.com>
1128
1129         PR gold/12279
1130         * resolve.cc (Symbol_table::should_override): Add fromtype
1131         parameter.  Change all callers.  Give error when linking together
1132         TLS and non-TLS symbol.
1133         (Symbol_table::should_override_with_special): Add fromtype
1134         parameter.  Change all callers.
1135         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1136         there is no TLS segment if we have reported some errors.
1137         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1138
1139 2011-07-08  Ian Lance Taylor  <iant@google.com>
1140
1141         PR gold/12372
1142         * target.h (Target::plt_address_for_global): New function.
1143         (Target::plt_address_for_local): New function.
1144         (Target::plt_section_for_global): Remove.
1145         (Target::plt_section_for_local): Remove.
1146         (Target::do_plt_address_for_global): New virtual function.
1147         (Target::do_plt_address_for_local): New virtual function.
1148         (Target::do_plt_section_for_global): Remove.
1149         (Target::do_plt_section_for_local): Remove.
1150         (Target::register_global_plt_entry): Add Symbol_table and Layout
1151         parameters.
1152         * output.cc (Output_data_got::Got_entry::write): Use
1153         plt_address_for_global and plt_address_for_local.
1154         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1155         address of output section.
1156         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1157         got_irelative_, and irelative_count_ fields.  Update
1158         declarations.
1159         (Output_data_plt_i386::has_irelative_section): New function.
1160         (Output_data_plt_i386::entry_count): Add irelative_count_.
1161         (Output_data_plt_i386::set_final_data_size): Likewise.
1162         (class Target_i386): Add got_irelative_ and rel_irelative_
1163         fields.  Update declarations.
1164         (Target_i386::Target_i386): Initialize new fields.
1165         (Target_i386::do_plt_address_for_global): New function replacing
1166         do_plt_section_for_global.
1167         (Target_i386::do_plt_address_for_local): New function replacing
1168         do_plt_section_for_local.
1169         (Target_i386::got_section): Create got_irelative_.
1170         (Target_i386::rel_irelative_section): New function.
1171         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1172         fields.  Don't define __rel_iplt_{start,end}.
1173         (Output_data_plt_i386::add_entry): Add symtab and layout
1174         parameters.  Change all callers.  Use different PLT and GOT for
1175         IFUNC symbols.
1176         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1177         layout parameters.  Change all callers.  Use different PLT and
1178         GOT.
1179         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1180         (Output_data_plt_i386::rel_irelative): New function.
1181         (Output_data_plt_i386::address_for_global): New function.
1182         (Output_data_plt_i386::address_for_local): New function.
1183         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1184         IRELATIVE GOT when changing IFUNC GOT entries.
1185         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1186         reloc.
1187         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1188         if we didn't create an IRELATIVE GOT.
1189         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1190         plt_address_for_local.
1191         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1192         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1193         got_irelative_, and irelative_count_ fields.  Update
1194         declarations.
1195         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1196         Initialize new fields.  Remove symtab parameter.  Change all
1197         callers.
1198         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1199         irelative_count_.
1200         (Output_data_plt_x86_64::has_irelative_section): New function.
1201         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1202         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1203         fields.  Update declarations.
1204         (Target_x86_64::Target_x86_64): Initialize new fields.
1205         (Target_x86_64::do_plt_address_for_global): New function replacing
1206         do_plt_section_for_global.
1207         (Target_x86_64::do_plt_address_for_local): New function replacing
1208         do_plt_section_for_local.
1209         (Target_x86_64::got_section): Create got_irelative_.
1210         (Target_x86_64::rela_irelative_section): New function.
1211         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1212         all callers.  Don't create __rel_iplt_{start,end}.
1213         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1214         parameters.  Change all callers.  Use different PLT and GOT for
1215         IFUNC symbols.
1216         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1217         layout parameters.  Change all callers.  Use different PLT and
1218         GOT.
1219         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1220         parameters.  Change all callers.  Use different PLT and GOT for
1221         IFUNC symbols.
1222         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1223         (Output_data_plt_x86_64::rela_irelative): New function.
1224         (Output_data_plt_x86_64::address_for_global): New function.
1225         (Output_data_plt_x86_64::address_for_local): New function.
1226         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1227         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1228         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1229         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1230         parameters.
1231         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1232         reloc.
1233         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1234         symbols if we didn't create an IRELATIVE GOT.
1235         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1236         plt_address_for_local.
1237         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1238         * testsuite/ifuncvar1.c: New test file.
1239         * testsuite/ifuncvar2.c: New test file.
1240         * testsuite/ifuncvar3.c: New test file.
1241         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1242         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1243         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1244         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1245         * testsuite/Makefile.in: Rebuild.
1246
1247 2011-07-07  Cary Coutant  <ccoutant@google.com>
1248
1249         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1250         (two_file_test_1_ndebug.o): Likewise.
1251         (two_file_test_1b_ndebug.o): Likewise.
1252         (two_file_test_2_ndebug.o): Likewise.
1253         (two_file_test_main_ndebug.o): Likewise.
1254         (incremental_test_2): Link with no-debug versions.
1255
1256 2011-07-06  Cary Coutant  <ccoutant@google.com>
1257
1258         * gold/incremental.cc
1259         (Output_section_incremental_inputs::write_info_blocks): Check for
1260         hidden and internal symbols.
1261
1262 2011-07-06  Cary Coutant  <ccoutant@google.com>
1263
1264         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1265         Check disposition for startup file.
1266         (Incremental_inputs::report_command_line): Ignore
1267         --incremental-startup-unchanged option.
1268         * options.cc (General_options::parse_incremental_startup_unchanged):
1269         New function.
1270         (General_options::General_options): Initialize new data member.
1271         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1272         (General_options): Add --incremental-startup-unchanged option.
1273         (General_options::incremental_startup_disposition): New function.
1274         (General_options::incremental_startup_disposition_): New data member.
1275
1276 2011-07-06  Cary Coutant  <ccoutant@google.com>
1277
1278         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1279         input file index to Script_info ctor.
1280         (Sized_incremental_binary::do_file_has_changed): Find the
1281         command-line argument for files named in scripts.
1282         * incremental.h (Script_info::Script_info): New ctor
1283         with input file index.
1284         (Script_info::input_file_index): New function.
1285         (Script_info::input_file_index_): New data member.
1286         (Incremental_binary::get_library): Add const.
1287         (Incremental_binary::get_script_info): Add const.
1288         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1289         * testsuite/Makefile.am (incremental_test_5): New test case.
1290         (incremental_test_6): New test case.
1291         * testsuite/Makefile.in: Regenerate.
1292
1293 2011-07-06  Cary Coutant  <ccoutant@google.com>
1294
1295         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1296         debug output when command lines differ.
1297
1298 2011-07-06  Cary Coutant  <ccoutant@google.com>
1299
1300         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1301         --incremental-patch option.
1302         * layout.cc (Free_list::allocate): Extend allocation beyond original
1303         end if enabled.
1304         (Layout::make_output_section): Mark sections that should get
1305         patch space.
1306         * options.cc (parse_percent): New function.
1307         * options.h (parse_percent): New function.
1308         (DEFINE_percent): New macro.
1309         (General_options): Add --incremental-patch option.
1310         * output.cc (Output_section::Output_section): Initialize new data
1311         members.
1312         (Output_section::add_input_section): Print section name when out
1313         of patch space.
1314         (Output_section::add_output_section_data): Likewise.
1315         (Output_section::set_final_data_size): Add patch space when
1316         doing --incremental-full.
1317         (Output_section::do_reset_address_and_file_offset): Remove patch
1318         space.
1319         (Output_segment::set_section_list_addresses): Print debug output
1320         only if --incremental-update.
1321         * output.h (Output_section::set_is_patch_space_allowed): New function.
1322         (Output_section::is_patch_space_allowed_): New data member.
1323         (Output_section::patch_space_): New data member.
1324         * parameters.cc (Parameters::incremental_full): New function.
1325         * parameters.h (Parameters::incremental_full): New function
1326         * testsuite/Makefile.am (incremental_test_2): Add test for
1327         --incremental-patch option.
1328         * testsuite/Makefile.in: Regenerate.
1329         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1330         (t18): Remove function body.
1331
1332 2011-07-05  Doug Kwan  <dougkwan@google.com>
1333
1334         PR gold/12771
1335         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1336         Arm_Address type for relocation result.
1337         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1338         overflow check.
1339         (Arm_relocate_functions::abs32): Use unaligned access.
1340         (Arm_relocate_functions::rel32): Ditto.
1341         (Arm_relocate_functions::prel31): Ditto.
1342         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1343         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1344         static data relocations.
1345         * testsuite/Makefile.in: Regnerate.
1346         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1347
1348 2011-07-05  Ian Lance Taylor  <iant@google.com>
1349
1350         PR gold/12392
1351         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1352         symbols if necessary.
1353         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1354
1355 2011-07-05  Ian Lance Taylor  <iant@google.com>
1356
1357         PR gold/12952
1358         * resolve.cc (Symbol::override_base_with_special): Simply override
1359         version with special symbol version, ignoring previous version.
1360
1361 2011-07-05  Ian Lance Taylor  <iant@google.com>
1362
1363         * object.cc (Sized_relobj_file::include_section_group): Add
1364         information to comment about signature location.
1365
1366 2011-07-02  Ian Lance Taylor  <iant@google.com>
1367
1368         PR gold/12957
1369         * options.h (class General_options): Add -f and -F.
1370         * options.cc (General_options::finalize): Fatal error if -f/-F
1371         are used without -shared.
1372         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1373
1374 2011-07-02  Ian Lance Taylor  <iant@google.com>
1375
1376         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1377
1378 2011-07-01  Ian Lance Taylor  <iant@google.com>
1379
1380         PR gold/12525
1381         PR gold/12952
1382         * resolve.cc (Symbol::override_base_with_special): Don't override
1383         the version if the overriding symbol has a different name.
1384         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1385         all callers.  If we give an error about an undefined version,
1386         define the base version if necessary.
1387         * dynobj.h (class Versions): Update declaration.
1388         * testsuite/weak_alias_test_5.cc: New file.
1389         * testsuite/weak_alias_test.script: New file.
1390         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1391         and versioned_alias have the right value, and call t2.
1392         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1393         weak_alias_test_5.so.
1394         (weak_alias_test_LDADD): Likewise.
1395         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1396         * testsuite/Makefile.in: Rebuild.
1397
1398 2011-07-01  Ian Lance Taylor  <iant@google.com>
1399
1400         PR gold/12525
1401         * options.h (class General_options): Support -z notext.
1402         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1403         -Wl,-z,notext.
1404         (two_file_shared_nonpic.so): Likewise.
1405         (two_file_shared_mixed.so): Likewise.
1406         (two_file_shared_mixed_1.so): Likewise.
1407         (weak_undef_lib_nonpic.so): Likewise.
1408         (alt/weak_undef_lib_nonpic.so): Likewise.
1409         (tls_test_shared_nonpic.so): Likewise.
1410         * testsuite/Makefile.in: Rebuild.
1411
1412 2011-07-01  Ian Lance Taylor  <iant@google.com>
1413
1414         PR gold/12525
1415         * configure.ac: Test whether static linking works, setting
1416         the automake conditional HAVE_STATIC.
1417         * testsuite/Makefile.am: Disable tests using -static if
1418         HAVE_STATIC is not true.
1419         * configure, testsuite/Makefile.in: Rebuild.
1420
1421 2011-07-01  Ian Lance Taylor  <iant@google.com>
1422
1423         PR gold/12525
1424         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1425         Assert if we see DW_EH_PE_indirect.
1426         * target.h (Target::ehframe_datarel_base): New function.
1427         (Target::do_ehframe_datarel_base): New target function.
1428         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1429         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1430         function.
1431
1432 2011-07-01  Ian Lance Taylor  <iant@google.com>
1433
1434         PR gold/12571
1435         * options.h (class General_options): Add
1436         --ld-generated-unwind-info.
1437         * ehframe.cc (Fde::write): Add address parameter.  Change all
1438         callers.  If associated with PLT, fill in address and size.
1439         (Cie::set_output_offset): Only add merge mapping if there is an
1440         object.
1441         (Cie::write): Add address parameter.  Change all callers.
1442         (Eh_frame::add_ehframe_for_plt): New function.
1443         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1444         input_offset_ fields into union u_, with new plt field.
1445         (Fde::Fde): Adjust for new union field.
1446         (Fde::Fde) [Output_data version]: New constructor.
1447         (Fde::add_mapping): Only add merge mapping if there is an object.
1448         (class Cie): Update declarations.
1449         (class Eh_frame): Declare add_ehframe_for_plt.
1450         * layout.cc (Layout::layout_eh_frame): Break out code into
1451         make_eh_frame_section, and call it.
1452         (Layout::make_eh_frame_section): New function.
1453         (Layout::add_eh_frame_for_plt): New function.
1454         * layout.h (class Layout): Update declarations.
1455         * merge.cc (Merge_map::add_mapping): Add assertion.
1456         * i386.cc: Include "dwarf.h".
1457         (class Output_data_plt_i386): Make first_plt_entry,
1458         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1459         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1460         and plt_eh_frame_fde.
1461         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1462         boundary.  Call add_eh_frame_for_plt if appropriate.
1463         * x86_64.cc: Include "dwarf.h".
1464         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1465         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1466         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1467         and plt_eh_frame_fde.
1468         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1469         appropriate.
1470
1471 2011-06-29  Ian Lance Taylor  <iant@google.com>
1472
1473         PR gold/12629
1474         * object.cc (Sized_relobj_file::layout_section): Change shdr
1475         parameter to be const.
1476         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1477         out of do_layout.
1478         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1479         appropriate.  Call layout_eh_frame_section.
1480         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1481         sections.
1482         * object.h (class Sized_relobj_file): Update declarations.
1483
1484 2011-06-29  Ian Lance Taylor  <iant@google.com>
1485
1486         PR gold/12652
1487         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1488         modifier.
1489         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1490
1491 2011-06-29  Ian Lance Taylor  <iant@google.com>
1492
1493         PR gold/12675
1494         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1495         SHT_X86_64_UNWIND.
1496         * layout.cc (Layout::layout_eh_frame): Likewise.
1497
1498 2011-06-29  Ian Lance Taylor  <iant@google.com>
1499
1500         PR gold/12695
1501         * layout.cc (Layout::symtab_section_shndx): New function.
1502         * layout.h (class Layout): Declare symtab_section_shndx.
1503         * output.cc (Output_section::write_header): Call it.
1504
1505 2011-06-29  Ian Lance Taylor  <iant@google.com>
1506
1507         PR gold/12818
1508         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1509         symbols which are not used in a relocation.
1510
1511 2011-06-28  Ian Lance Taylor  <iant@google.com>
1512
1513         PR gold/12898
1514         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1515         script create indistinguishable segments.
1516         (Layout::set_segment_offsets): Use stable_sort when sorting
1517         segments.  Pass this to Compare_segments constructor.
1518         * layout.h (class Layout): Make segment_precedes non-static.
1519         (class Compare_segments): Change from struct to class.  Add
1520         layout_ field.  Add constructor.
1521         * script-sections.cc
1522         (Script_sections::attach_sections_using_phdrs_clause): Rename
1523         local orphan to is_orphan.  Don't report failure to put empty
1524         section in segment.  On attachment failure, report name of
1525         section, and attach to first PT_LOAD segment.
1526
1527 2011-06-28  Ian Lance Taylor  <iant@google.com>
1528
1529         PR gold/12934
1530         * target-select.cc (Target_selector::Target_selector): Add
1531         emulation parameter.  Change all callers.
1532         (select_target_by_bfd_name): Rename from select_target_by_name.
1533         Change all callers.
1534         (select_target_by_emulation): New function.
1535         (supported_emulation_names): New function.
1536         * target-select.h (class Target_selector): Add emulation_ field.
1537         Update declarations.
1538         (Target_selector::recognize_by_bfd_name): Rename from
1539         recognize_by_name.  Change all callers.
1540         (Target_selector::supported_bfd_names): Rename from
1541         supported_names.  Change all callers.
1542         (Target_selector::recognize_by_emulation): New function.
1543         (Target_selector::supported_emulations): New function.
1544         (Target_selector::emulation): New function.
1545         (Target_selector::do_recognize_by_bfd_name): Rename from
1546         do_recognize_by_name.  Change all callers.
1547         (Target_selector::do_supported_bfd_names): Rename from
1548         do_supported_names.  Change all callers.
1549         (Target_selector::do_recognize_by_emulation): New function.
1550         (Target_selector::do_supported_emulations): New function.
1551         (select_target_by_bfd_name): Change name in declaration.
1552         (select_target_by_emulation): Declare.
1553         (supported_emulation_names): Declare.
1554         * parameters.cc (parameters_force_valid_target): Try to find
1555         target based on emulation from -m option.
1556         * options.h (class General_options): Change doc string for -m.
1557         * options.cc (help): Print emulations.
1558         (General_options::parse_V): Likewise.
1559         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1560         Add emulation parameter.  Change all callers.
1561
1562 2011-06-28  Ian Lance Taylor  <iant@google.com>
1563
1564         * target.h (class Target): Add osabi_ field.
1565         (Target::osabi): New function.
1566         (Target::set_osabi): New function.
1567         (Target::Target): Initialize osabi_.
1568         (Target::do_adjust_elf_header): Make pure virtual.
1569         (Sized_target::do_adjust_elf_header): Declare.
1570         * target.cc (Sized_target::do_adjust_elf_header): New function.
1571         (class Sized_target): Instantiate all versions.
1572         * freebsd.h (class Target_freebsd): Remove.
1573         (Target_selector_freebsd::do_recognize): Call set_osabi on
1574         Target.
1575         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1576         (Target_selector_freebsd::set_osabi): Remove.
1577         * i386.cc (class Target_i386): Inherit from Sized_target rather
1578         than Target_freebsd.
1579         * x86_64.cc (class Target_x86_64): Likewise.
1580
1581 2011-06-28  Ian Lance Taylor  <iant@google.com>
1582
1583         * target.h (Target::can_check_for_function_pointers): Rewrite.
1584         Make non-virtual.
1585         (Target::can_icf_inline_merge_sections): Likewise.
1586         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1587         (Target::Target_info): Add can_icf_inline_merge_sections field.
1588         (Target::do_can_check_for_function_pointers): New virtual
1589         function.
1590         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1591         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1592         from can_check_for_function_pointers, move in file.
1593         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1594         section_may_have_icf_unsafe_poineters, move in file.
1595         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1596         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1597         Rename from can_check_for_function_pointers, move in file.
1598         (Target_i386::can_icf_inline_merge_sections): Remove.
1599         (Target_i386::i386_info): Initialize
1600         can_icf_inline_merge_sections.
1601         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1602         Initialize can_icf_inline_merge_sections.
1603         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1604         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1605         Rename from can_check_for_function_pointers, move in file.
1606         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1607         (Target_x86_64::x86_64_info): Initialize
1608         can_icf_inline_merge_sections.
1609         * testsuite/testfile.cc (Target_test::test_target_info):
1610         Likewise.
1611         * icf.cc (get_section_contents): Correct formatting.
1612
1613 2011-06-27  Ian Lance Taylor  <iant@google.com>
1614
1615         * symtab.cc (Symbol::versioned_name): New function.
1616         (Symbol_table::add_to_final_symtab): Use versioned_name when
1617         appropriate.
1618         (Symbol_table::sized_write_symbol): Likewise.
1619         * symtab.h (class Symbol): Declare versioned_name.
1620         * stringpool.h (class Stringpool_template): Add variant of add
1621         which takes a std::basic_string.
1622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1623         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1624         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1625         (ver_test_12.o): New target.
1626         * testsuite/Makefile.in: Rebuild.
1627
1628 2011-06-27  Doug Kwan  <dougkwan@google.com>
1629
1630         * arm.cc (Arm_relocate_functions::thm_jump8,
1631         Arm_relocate_functions::thm_jump11): Use a wider signed
1632         type to compute offset.
1633         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1634         arm_thm_jump8.
1635         * testsuite/Makefile.in: Regenerate.
1636         * testsuite/arm_branch_in_range.sh: Check test results of
1637         arm_thm_jump11 and arm_thm_jump8.
1638         * testsuite/arm_thm_jump11.s: New test source file.
1639         * testsuite/arm_thm_jump11.t: New linker script.
1640         * testsuite/arm_thm_jump8.s: New test source file.
1641         * testsuite/arm_thm_jump8.t: New linker script.
1642
1643 2011-06-24  Ian Lance Taylor  <iant@google.com>
1644
1645         * layout.cc: Include "object.h".
1646         (ctors_sections_in_init_array): New static variable.
1647         (Layout::is_ctors_in_init_array): New function.
1648         (Layout::layout): Add entry to ctors_sections_in_init_array if
1649         appropriate.
1650         * layout.h (class Layout): Declare is_ctors_in_init_array.
1651         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1652         is_ctors_reverse_view is set.
1653         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1654         all callers.  Set is_ctors_reverse_view field of View_size.
1655         (Sized_relobj_file::reverse_words): New function.
1656         * object.h (Sized_relobj_file::View_size): Add
1657         is_ctors_reverse_view field.
1658         (class Sized_relobj_file): Update declarations.
1659         * testsuite/initpri3.c: New test.
1660         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1661         initpri3b.
1662         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1663         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1664         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1665         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1666         * testsuite/Makefile.in: Rebuild.
1667
1668 2011-06-24  Cary Coutant  <ccoutant@google.com>
1669
1670         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1671         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1672         (debug_msg_cdebug.err): New targets.
1673         * testsuite/Makefile.in: Regenerate.
1674         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1675         Fix checks for link with shared library.
1676
1677 2011-06-24  Doug Kwan  <dougkwan@google.com>
1678
1679         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1680         skip empty text sections.
1681         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1682
1683 2011-06-22  Ian Lance Taylor  <iant@google.com>
1684
1685         PR gold/12910
1686         * options.h (class General_options): Add --ctors-in-init-array.
1687         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1688         friends as SHT_PROGBITS for merging sections.
1689         (Layout::layout): Remove special handling of .init_array and
1690         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1691         and .dtors if ctors_in_init_array.
1692         (Layout::make_output_section): Force correct section types for
1693         .init_array and friends.  Don't sort if doing relocatable link,
1694         Don't sort .ctors and .dtors if ctors_in_init_array.
1695         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1696         (Layout::output_section_name): Add relobj parameter.  Change all
1697         callers.  Handle .ctors. and .dtors. in code rather than table.
1698         Handle .ctors and .dtors if ctors_in_init_array.
1699         (Layout::match_file_name): New function, moved from output.cc.
1700         * layout.h (class Layout): Update declarations.
1701         * output.cc: Include "layout.h".
1702         (Input_section_sort_entry::get_priority): New function.
1703         (Input_section_sort_entry::match_file_name): Just call
1704         Layout::match_file_name.
1705         (Output_section::Input_section_sort_init_fini_compare::operator()):
1706         Handle .ctors and .dtors.  Sort by explicit priority rather than
1707         by name.
1708         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1709         * testsuite/initpri2.c: New test.
1710         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1711         (check_PROGRAMS): Add initpri2.
1712         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1713         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1714         * configure, testsuite/Makefile.in: Rebuild.
1715
1716 2011-06-19  Ian Lance Taylor  <iant@google.com>
1717
1718         PR gold/12880
1719         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1720         .interp section to a PT_INTERP segment even if we have seen a
1721         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1722         clause in a linker script.
1723         (Layout::finalize): Don't create a .interp section if we've
1724         already create a PT_INTERP segment.
1725         (Layout::create_interp): Always call choose_output_section (revert
1726         patch of 2011-06-17).  Don't create PT_INTERP segment.
1727         * script-sections.cc
1728         (Script_sections::create_note_and_tls_segments): Add a .interp
1729         section to a PT_INTERP segment even if we have seen a
1730         --dynamic-linker option.
1731
1732 2011-06-18  Ian Lance Taylor  <iant@google.com>
1733
1734         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1735         merely because a non-PT_LOAD segment has a dynamic reloc.
1736
1737 2011-06-18  Ian Lance Taylor  <iant@google.com>
1738
1739         * layout.cc (Layout::finish_dynamic_section): Don't create
1740         DT_FLAGS entry if not needed.
1741
1742 2011-06-18  Ian Lance Taylor  <iant@google.com>
1743
1744         PR gold/12745
1745         * layout.cc (Layout::layout_eh_frame): Correct handling of
1746         writable .eh_frame section.
1747
1748 2011-06-17  Ian Lance Taylor  <iant@google.com>
1749
1750         PR gold/12893
1751         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1752         symbol is redefined with the exact same object and value.
1753
1754 2011-06-17  Ian Lance Taylor  <iant@google.com>
1755
1756         PR gold/12880
1757         * layout.h (class Layout): Add interp_segment_ field.
1758         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1759         (Layout::attach_allocated_section_to_segment): If making shared
1760         library, put .interp section in PT_INTERP segment.
1761         (Layout::finalize): Also call create_interp if -dynamic-linker
1762         option was used.
1763         (Layout::create_interp): Assert that there is no PT_INTERP
1764         segment.  If not using a SECTIONS clause, use make_output_section.
1765         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1766         * script-sections.cc
1767         (Script_sections::create_note_and_tls_segments): If making shared
1768         library, put .interp section in PT_INTERP segment.
1769
1770 2011-06-17  Ian Lance Taylor  <iant@google.com>
1771
1772         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1773         when making a shared library.
1774
1775 2011-06-17  Ian Lance Taylor  <iant@google.com>
1776
1777         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1778         parameter.  Change all callers.  Don't issue warning about PC32
1779         against locally defined symbol.
1780
1781 2011-06-16  Ian Lance Taylor  <iant@google.com>
1782
1783         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1784         occurs in same object.
1785
1786 2011-06-14  Alan Modra  <amodra@gmail.com>
1787
1788         * po/POTFILES.in: Regenerate.
1789
1790 2011-06-09  Ian Lance Taylor  <iant@google.com>
1791
1792         * script-sections.cc
1793         (Orphan_output_section::set_section_addresses): For a relocatable
1794         link set address to 0.
1795
1796 2011-06-09  Cary Coutant  <ccoutant@google.com>
1797
1798         PR gold/12804
1799         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1800         used with --compress-debug-sections.
1801         * gold/object.cc (Sized_relobj_file::do_layout): Report
1802         uncompressed size of compressed input sections.
1803
1804 2011-06-08  Cary Coutant  <ccoutant@google.com>
1805
1806         PR gold/12804
1807         * testsuite/two_file_test_2_v1.cc: Change initialization of
1808         v2 to keep it in .data.
1809
1810 2011-06-07  Cary Coutant  <ccoutant@google.com>
1811
1812         * common.cc (Symbol_table::do_allocate_commons_list): Call
1813         gold_fallback.
1814         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1815         (Errors::fallback): New function.
1816         (gold_fallback): New function.
1817         * errors.h (Errors::fallback): New function.
1818         * gold.cc (gold_exit): Change status parameter to enum; adjust
1819         all callers.
1820         (queue_initial_tasks): Call gold_fallback.
1821         * gold.h: Include cstdlib.
1822         (Exit_status): New enum type.
1823         (gold_exit): Change status parameter to enum.
1824         (gold_fallback): New function.
1825         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1826         (Layout::create_symtab_sections): Likewise.
1827         (Layout::create_shdrs): Likewise.
1828         * main.cc (main): Adjust call to gold_exit.
1829         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1830         (Output_data_got::add_got_entry_pair): Likewise.
1831         (Output_section::add_input_section): Likewise.
1832         (Output_section::add_output_section_data): Likewise.
1833         (Output_segment::set_section_list_addresses): Likewise.
1834         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1835
1836 2011-06-07  Cary Coutant  <ccoutant@google.com>
1837
1838         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1839         for incremental links.
1840         * output.cc (Output_segment::set_section_list_addresses): Remove
1841         FIXME and test for TLS or BSS.
1842
1843 2011-06-07  Cary Coutant  <ccoutant@google.com>
1844
1845         * testsuite/Makefile.am: Add incremental_copy_test,
1846         incremental_common_test_1.
1847         * testsuite/Makefile.in: Regenerate.
1848         * testsuite/common_test_1_v1.c: New source file.
1849         * testsuite/common_test_1_v2.c: New source file.
1850         * testsuite/copy_test_v1.cc: New source file.
1851
1852 2011-06-07  Cary Coutant  <ccoutant@google.com>
1853
1854         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1855         update, allocate common from bss section's free list.
1856         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1857         linker-defined symbols.
1858         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1859         Skip GOT and PLT entries that are no longer referenced.
1860         (Output_section_incremental_inputs::write_info_blocks): Mark
1861         linker-defined symbols.
1862         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1863         * output.cc (Output_section::allocate): New function.
1864         * output.h (Output_section::allocate): New function.
1865         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1866         linker-defined symbols.
1867         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1868         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1869         (Symbol::init_base_output_data): Likewise.
1870         (Symbol::init_base_output_segment): Likewise.
1871         (Symbol::init_base_constant): Likewise.
1872         (Sized_symbol::init_output_data): Likewise.
1873         (Sized_symbol::init_output_segment): Likewise.
1874         (Sized_symbol::init_constant): Likewise.
1875         (Symbol_table::do_define_in_output_data): Likewise.
1876         (Symbol_table::do_define_in_output_segment): Likewise.
1877         (Symbol_table::do_define_as_constant): Likewise.
1878         * symtab.h (Symbol::is_predefined): New function.
1879         (Symbol::init_base_output_data): Add is_predefined parameter.
1880         (Symbol::init_base_output_segment): Likewise.
1881         (Symbol::init_base_constant): Likewise.
1882         (Symbol::is_predefined_): New data member.
1883         (Sized_symbol::init_output_data): Add is_predefined parameter.
1884         (Sized_symbol::init_output_segment): Likewise.
1885         (Sized_symbol::init_constant): Likewise.
1886         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1887
1888 2011-06-07  Cary Coutant  <ccoutant@google.com>
1889
1890         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1891         instead of emit_copy_reloc.
1892         (Copy_relocs::emit_copy_reloc): Refactor.
1893         (Copy_relocs::make_copy_reloc): New function.
1894         (Copy_relocs::add_copy_reloc): Remove.
1895         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1896         section.
1897         (Copy_relocs::make_copy_reloc): New function.
1898         (Copy_relocs::add_copy_reloc): Remove.
1899         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1900         unchanged input files.
1901         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1902         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1903         Reserve BSS space for COPY relocations.
1904         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1905         (Output_section_incremental_inputs::write_info_blocks): Record
1906         whether a symbol is copied from a shared object.
1907         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1908         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1909         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1910         (Incremental_input_entry_reader::get_output_symbol_index): Add
1911         is_copy parameter.
1912         (Incremental_binary::emit_copy_relocs): New function.
1913         (Incremental_binary::do_emit_copy_relocs): New function.
1914         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1915         new data member.
1916         (Sized_incremental_binary::add_copy_reloc): New function.
1917         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1918         (Sized_incremental_binary::Copy_reloc): New struct.
1919         (Sized_incremental_binary::Copy_relocs): New typedef.
1920         (Sized_incremental_binary::copy_relocs_): New data member.
1921         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1922         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1923         * target.h (Sized_target::emit_copy_reloc): New function.
1924         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1925
1926 2011-06-02  Cary Coutant  <ccoutant@google.com>
1927
1928         PR gold/12163
1929         * gold/archive.cc (Archive::Archive): Initialize new data member.
1930         (Archive::include_all_members): Return if archive has already been
1931         included.
1932         * gold/archive.h (Archive::include_all_members_): New data member.
1933
1934 2011-06-02  Nick Clifton  <nickc@redhat.com>
1935
1936         * dynobj.h: Fix spelling mistake in comment.
1937         * output.cc: Likewise.
1938
1939 2011-05-31  Doug Kwan  <dougkwan@google.com>
1940             Asier Llano
1941
1942         PR gold/12826
1943         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1944         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1945         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1946         redundant arm_exidx_test.so.
1947         * testsuite/Makefile.in: Regenerate.
1948         (check_SCRIPTS): Add pr12826.sh
1949         (check_DATA): Add pr12826.stdout
1950         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1951         * testsuite/pr12826.sh: New file.
1952         * testsuite/pr12826_1.s: Ditto.
1953         * testsuite/pr12826_1.s: Ditto.
1954
1955 2011-05-30  Ian Lance Taylor  <iant@google.com>
1956
1957         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1958         sections.
1959
1960 2011-05-29  Ian Lance Taylor  <iant@google.com>
1961
1962         PR gold/12804
1963         * testsuite/Makefile.am: Use different file name for two_file_test
1964         temporary file for each incremental test.
1965         * testsuite/Makefile.in: Rebuild.
1966
1967 2011-05-29  Ian Lance Taylor  <iant@google.com>
1968
1969         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1970         binary input file is empty.
1971
1972 2011-05-27  Ian Lance Taylor  <iant@google.com>
1973
1974         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1975         (ver_test_9.so): Likewise.
1976         * testsuite/Makefile.in: Rebuild.
1977
1978 2011-05-26 Cary Coutant  <ccoutant@google.com>
1979
1980         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1981         * incremental.cc (Incremental_inputs::report_input_section): Fix
1982         comment, indentation.
1983         (Incremental_inputs::report_comdat_group): New function.
1984         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1985         of data for incremental input file entry.
1986         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1987         group count, COMDAT group signatures.
1988         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1989         an unchanged input file.
1990         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1991         Initialize new data member.
1992         (Incremental_object_entry::add_comdat_group): New function.
1993         (Incremental_object_entry::get_comdat_group_count): New function.
1994         (Incremental_object_entry::get_comdat_signature_key): New function.
1995         (Incremental_object_entry::groups_): New data member.
1996         (Incremental_inputs::report_comdat_group): New function.
1997         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1998         data for incremental input file entry.
1999         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2000         (Incremental_input_entry_reader::get_input_section): Adjust size of
2001         data for incremental input file entry.
2002         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2003         (Incremental_input_entry_reader::get_comdat_group_signature): New
2004         function.
2005         * object.cc (Sized_relobj::include_section_group): Report kept
2006         COMDAT groups for incremental links.
2007
2008 2011-05-24  David Meyer  <pdox@google.com>
2009
2010         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2011         with name parameter.  Add found_name parameter.
2012         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2013         * dirsearch.h (class Dirsearch): Update declaration.
2014
2015 2011-05-24  Ian Lance Taylor  <iant@google.com>
2016
2017         * archive.cc (Library_base::should_include_member): Pull in object
2018         from archive if it defines the entry symbol.
2019         * parameters.cc (Parameters::entry): New function.
2020         * parameters.h (class Parameters): Declare entry.
2021         * output.h (class Output_file_header): Remove entry_ field.
2022         * output.cc (Output_file_header::Output_file_header): Remove entry
2023         parameter.  Change all callers.
2024         (Output_file_header::entry): Use parameters->entry.
2025         * gold.cc (queue_middle_tasks): Likewise.
2026         * plugin.cc (Plugin_hook::run): Likewise.
2027
2028 2011-05-24 Cary Coutant  <ccoutant@google.com>
2029
2030         * gold.cc (queue_initial_tasks): Pass incremental base filename
2031         to Output_file::open_base_file; don't print error message.
2032         * incremental-dump.cc (main): Adjust call to
2033         Output_file::open_for_modification.
2034         * incremental-dump.cc (main): Likewise.
2035         * incremental.cc (Incremental_inputs::report_command_line):
2036         Ignore --incremental-base option when comparing command lines.
2037         Ignore parameter when given as separate argument.
2038         * options.h (class General_options): Add --incremental-base.
2039         * output.cc (Output_file::Output_file):
2040         (Output_file::open_base_file): Add base_name and writable parameters;
2041         read base file into new file; print error message here.
2042         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2043         callers.
2044         * output.h (Output_file::open_for_modification): Rename to...
2045         (Output_file::open_base_file): ...this; add base_name and
2046         writable parameters; adjust all callers.
2047         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2048         callers.
2049         * testsuite/Makefile.am (incremental_test_4): Test
2050         --incremental-base.
2051         * testsuite/Makefile.in: Regenerate.
2052
2053 2011-05-24 Cary Coutant  <ccoutant@google.com>
2054
2055         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2056         incremental_test_4.
2057         * testsuite/Makefile.in: Regenerate.
2058         * testsuite/two_file_test_1_v1.cc: New test source file.
2059         * testsuite/two_file_test_1b_v1.cc: New test source file.
2060         * testsuite/two_file_test_2_v1.cc: New test source file.
2061
2062 2011-05-24 Cary Coutant  <ccoutant@google.com>
2063
2064         * dynobj.h (Dynobj::do_dynobj): New function.
2065         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2066         flag and soname for shared objects.
2067         * incremental.cc (Incremental_inputs::report_object): Make
2068         either Incremental_object_entry or Incremental_dynobj_entry; add
2069         soname to string table.
2070         (Incremental_inputs::report_input_section): Add assertion.
2071         (Output_section_incremental_inputs::set_final_data_size): Adjust
2072         type of input file entry for shared libraries; adjust size of
2073         shared library info entry.
2074         (Output_section_incremental_inputs::write_input_files): Write
2075         as_needed flag for shared libraries.
2076         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2077         of input file entry for shared libraries; write soname.
2078         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2079         soname from incremental info.
2080         * incremental.h (enum Incremental_input_flags): Add
2081         INCREMENTAL_INPUT_AS_NEEDED.
2082         (Incremental_input_entry::Incremental_input_entry): Initialize new
2083         data member.
2084         (Incremental_input_entry::set_as_needed): New function.
2085         (Incremental_input_entry::as_needed): New function.
2086         (Incremental_input_entry::do_dynobj_entry): New function.
2087         (Incremental_input_entry::as_needed_): New data member.
2088         (Incremental_object_entry::Incremental_object_entry): Don't check
2089         for shared library.
2090         (Incremental_object_entry::do_type): Likewise.
2091         (class Incremental_dynobj_entry): New class.
2092         (Incremental_input_entry_reader::as_needed): New function.
2093         (Incremental_input_entry_reader::get_soname): New function.
2094         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2095         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2096         size of shared library info entry.
2097         * layout.cc (Layout::finish_dynamic_section): Don't test for
2098         incremental link when adding DT_NEEDED entries.
2099         * object.h (Object::Object): Initialize new data member.
2100         (Object::dynobj): New function.
2101         (Object::set_as_needed): New function.
2102         (Object::as_needed): New function.
2103         (Object::do_dynobj): New function.
2104         (Object::as_needed_): New data member.
2105
2106 2011-05-24 Cary Coutant  <ccoutant@google.com>
2107
2108         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2109         info; adjust display of GOT entries.
2110         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2111         vector of input objects; remove file_status_.
2112         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2113         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2114         got_plt reader; call target hooks to reserve GOT entries.
2115         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2116         of input file info header and GOT info entry.
2117         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2118         relocation info.
2119         (Got_plt_view_info::got_descriptor): Remove.
2120         (Got_plt_view_info::sym_index): New data member.
2121         (Got_plt_view_info::input_index): New data member.
2122         (Local_got_offset_visitor::visit): Write input file index.
2123         (Global_got_offset_visitor::visit): Write 0 for input file index.
2124         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2125         with sym_index and input_index.
2126         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2127         incremental info GOT entry; replace got_descriptor with input_index.
2128         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2129         map from input file index to object.
2130         (Sized_relobj_incr::do_layout): Replace direct data member reference
2131         with accessor function.
2132         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2133         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2134         Adjust size of input file info header.
2135         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2136         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2137         (Incremental_input_entry_reader::get_input_section): Adjust size of
2138         input file info header.
2139         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2140         of incremental info GOT entry.
2141         (Incremental_got_plt_reader::get_got_desc): Remove.
2142         (Incremental_got_plt_reader::get_got_symndx): New function.
2143         (Incremental_got_plt_reader::get_got_input_index): New function.
2144         (Sized_incremental_binary::Sized_incremental_binary): Remove
2145         file_status_; add input_objects_.
2146         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2147         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2148         (Sized_incremental_binary::file_is_unchanged): Remove.
2149         (Sized_incremental_binary::set_input_object): New function.
2150         (Sized_incremental_binary::input_object): New function.
2151         (Sized_incremental_binary::file_status_): Remove.
2152         (Sized_incremental_binary::input_objects_): New data member.
2153         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2154         references.
2155         (Sized_relobj_incr::invalid_address): Move to base class.
2156         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2157         class.
2158         (Sized_relobj_incr::do_output_section_offset): Likewise.
2159         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2160         (Sized_relobj_incr::section_offsets_): Likewise.
2161         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2162         function.
2163         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2164         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2165         with accessor function.
2166         (Sized_relobj_file::do_layout): Likewise.
2167         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2168         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2169         (Sized_relobj_file::compute_final_local_value): Replace refs to
2170         section_offsets_ with accessor function.
2171         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2172         * object.h (Relobj::Relobj): Initialize new data members.
2173         (Relobj::add_dyn_reloc): New function.
2174         (Relobj::first_dyn_reloc): New function.
2175         (Relobj::dyn_reloc_count): New function.
2176         (Relobj::first_dyn_reloc_): New data member.
2177         (Relobj::dyn_reloc_count_): New data member.
2178         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2179         references.
2180         (Sized_relobj::Address): New typedef.
2181         (Sized_relobj::invalid_address): Move here from child class.
2182         (Sized_relobj::Sized_relobj): Initialize new data members.
2183         (Sized_relobj::sized_relobj): New function.
2184         (Sized_relobj::is_output_section_offset_invalid): Move here from
2185         child class.
2186         (Sized_relobj::get_output_section_offset): Likewise.
2187         (Sized_relobj::local_has_got_offset): Likewise.
2188         (Sized_relobj::local_got_offset): Likewise.
2189         (Sized_relobj::set_local_got_offset): Likewise.
2190         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2191         (Sized_relobj::clear_got_offsets): New function.
2192         (Sized_relobj::section_offsets): Move here from child class.
2193         (Sized_relobj::do_output_section_offset): Likewise.
2194         (Sized_relobj::do_set_section_offset): Likewise.
2195         (Sized_relobj::Local_got_offsets): Likewise.
2196         (Sized_relobj::local_got_offsets_): Likewise.
2197         (Sized_relobj::section_offsets_): Likewise.
2198         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2199         references.
2200         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2201         class.
2202         (Sized_relobj_file::sized_relobj): New function
2203         (Sized_relobj_file::local_has_got_offset): Move to base class.
2204         (Sized_relobj_file::local_got_offset): Likewise.
2205         (Sized_relobj_file::set_local_got_offset): Likewise.
2206         (Sized_relobj_file::get_output_section_offset): Likewise.
2207         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2208         (Sized_relobj_file::do_output_section_offset): Likewise.
2209         (Sized_relobj_file::do_set_section_offset): Likewise.
2210         (Sized_relobj_file::Local_got_offsets): Likewise.
2211         (Sized_relobj_file::local_got_offsets_): Likewise.
2212         (Sized_relobj_file::section_offsets_): Likewise.
2213         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2214         (all constructors).
2215         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2216         (Output_reloc::get_symbol_index): Likewise.
2217         (Output_reloc::local_section_offset): Likewise.
2218         (Output_reloc::get_address): Likewise.
2219         (Output_reloc::symbol_value): Likewise.
2220         (Output_data_got::reserve_slot): Move to class definition.
2221         (Output_data_got::reserve_local): New function.
2222         (Output_data_got::reserve_slot_for_global): Remove.
2223         (Output_data_got::reserve_global): New function.
2224         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2225         (all constructors, two instantiations).
2226         (Output_reloc::get_relobj): New function (two instantiations).
2227         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2228         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2229         (Output_data_reloc::add_global): Adjust type of relobj.
2230         (Output_data_reloc::add_global_relative): Likewise.
2231         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2232         (Output_data_reloc::add_local): Likewise.
2233         (Output_data_reloc::add_local_relative): Likewise.
2234         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2235         (Output_data_reloc::add_local_section): Likewise.
2236         (Output_data_reloc::add_output_section): Likewise.
2237         (Output_data_reloc::add_absolute): Likewise.
2238         (Output_data_reloc::add_target_specific): Likewise.
2239         (Output_data_got::reserve_slot): Move definition here.
2240         (Output_data_got::reserve_local): New function.
2241         (Output_data_got::reserve_global): New function.
2242         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2243         section_offsets_ with accessor function.
2244         (Sized_relobj_file::write_sections): Likewise.
2245         (Sized_relobj_file::do_relocate_sections): Likewise.
2246         * target.h (Sized_target::reserve_local_got_entry): New function.
2247         (Sized_target::reserve_global_got_entry): New function.
2248         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2249         (Target_x86_64::reserve_global_got_entry): New function.
2250         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2251
2252 2011-05-23 Cary Coutant  <ccoutant@google.com>
2253
2254         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2255         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2256         bit when checking got_type.
2257         * incremental.cc (Sized_incremental_binary::setup_readers):
2258         Store symbol table and string table locations; initialize bit vector
2259         of file status flags.
2260         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2261         unchanged files.
2262         (Sized_incremental_binary::do_process_got_plt): New function.
2263         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2264         (Output_section_incremental_inputs::set_final_data_size): Record
2265         file index for each input file.
2266         (Output_section_incremental_inputs::write_got_plt): Store file index
2267         instead of input entry offset for each GOT entry.
2268         * incremental.h
2269         (Incremental_input_entry::Incremental_input_entry): Initialize new
2270         data member.
2271         (Incremental_input_entry::set_offset): Store file index.
2272         (Incremental_input_entry::get_file_index): New function.
2273         (Incremental_input_entry::file_index_): New data member.
2274         (Incremental_binary::process_got_plt): New function.
2275         (Incremental_binary::do_process_got_plt): New function.
2276         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2277         data members.
2278         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2279         (Sized_incremental_binary::set_file_is_unchanged): New function.
2280         (Sized_incremental_binary::file_is_unchanged): New function.
2281         (Sized_incremental_binary::do_process_got_plt): New function.
2282         (Sized_incremental_binary::file_status_): New data member.
2283         (Sized_incremental_binary::main_symtab_loc_): New data member.
2284         (Sized_incremental_binary::main_strtab_loc_): New data member.
2285         * output.cc (Output_data_got::Got_entry::write): Add case
2286         RESERVED_CODE.
2287         (Output_data_got::add_global): Call add_got_entry.
2288         (Output_data_got::add_global_plt): Likewise.
2289         (Output_data_got::add_global_with_rel): Likewise.
2290         (Output_data_got::add_global_with_rela): Likewise.
2291         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2292         (Output_data_got::add_global_pair_with_rela): Likewise.
2293         (Output_data_got::add_local): Call add_got_entry.
2294         (Output_data_got::add_local_plt): Likewise.
2295         (Output_data_got::add_local_with_rel): Likewise.
2296         (Output_data_got::add_local_with_rela): Likewise.
2297         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2298         (Output_data_got::add_local_pair_with_rela): Likewise.
2299         (Output_data_got::reserve_slot): New function.
2300         (Output_data_got::reserve_slot_for_global): New function.
2301         (Output_data_got::add_got_entry): New function.
2302         (Output_data_got::add_got_entry_pair): New function.
2303         (Output_section::add_output_section_data): Edit FIXME.
2304         * output.h
2305         (Output_section_data_build::Output_section_data_build): New
2306         constructor with size parameter.
2307         (Output_data_space::Output_data_space): Likewise.
2308         (Output_data_got::Output_data_got): Initialize new data member; new
2309         constructor with size parameter.
2310         (Output_data_got::add_constant): Call add_got_entry.
2311         (Output_data_got::reserve_slot): New function.
2312         (Output_data_got::reserve_slot_for_global): New function.
2313         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2314         (Output_data_got::add_got_entry): New function.
2315         (Output_data_got::add_got_entry_pair): New function.
2316         (Output_data_got::free_list_): New data member.
2317         * target.h (Sized_target::init_got_plt_for_update): New function.
2318         (Sized_target::register_global_plt_entry): New function.
2319         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2320         Initialize new data member; call init; add constructor with PLT count.
2321         (Output_data_plt_x86_64::init): New function.
2322         (Output_data_plt_x86_64::add_relocation): New function.
2323         (Output_data_plt_x86_64::reserve_slot): New function.
2324         (Output_data_plt_x86_64::free_list_): New data member.
2325         (Target_x86_64::init_got_plt_for_update): New function.
2326         (Target_x86_64::register_global_plt_entry): New function.
2327         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2328         incremental updates.
2329         (Output_data_plt_x86_64::add_relocation): New function.
2330         * testsuite/object_unittest.cc (Object_test): Set default options.
2331
2332 2011-05-16  Ian Lance Taylor  <iant@google.com>
2333
2334         * options.h (class General_options): Make -i a synonym for -r.
2335
2336 2011-05-16  Ian Lance Taylor  <iant@google.com>
2337
2338         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2339
2340 2011-05-10 Cary Coutant  <ccoutant@google.com>
2341
2342         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2343         strip_all (-s).
2344
2345 2011-05-06  Ian Lance Taylor  <iant@google.com>
2346
2347         * layout.cc (Layout::layout): If the output section flags change,
2348         update the ordering.
2349
2350 2011-04-25 Cary Coutant  <ccoutant@google.com>
2351
2352         * incremental-dump.cc (dump_incremental_inputs): Print local
2353         symbol info for each input file.
2354         * incremental.cc
2355         (Output_section_incremental_inputs::set_final_data_size): Add local
2356         symbol info to input file entries in incremental info.
2357         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2358         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2359         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2360         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2361         implementation.
2362         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2363         (Sized_incr_relobj::do_relocate): Write the local symbols.
2364         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2365         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2366         Adjust size of input file header.
2367         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2368         (Incremental_inputs_reader::get_local_symbol_count): New function.
2369         (Incremental_inputs_reader::get_input_section): Adjust size of input
2370         file header.
2371         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2372         (Sized_incr_relobj::This): New typedef.
2373         (Sized_incr_relobj::sym_size): New const data member.
2374         (Sized_incr_relobj::Local_symbol): New struct.
2375         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2376         (Sized_incr_relobj::do_local_symbol_offset): New function.
2377         (Sized_incr_relobj::local_symbol_count_): New data member.
2378         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2379         (Sized_incr_relobj::local_symbol_index_): New data member.
2380         (Sized_incr_relobj::local_symbol_offset_): New data member.
2381         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2382         (Sized_incr_relobj::local_symbols_): New data member.
2383         * object.h (Relobj::output_local_symbol_count): New function.
2384         (Relobj::local_symbol_offset): New function.
2385         (Relobj::do_output_local_symbol_count): New function.
2386         (Relobj::do_local_symbol_offset): New function.
2387         (Sized_relobj::do_output_local_symbol_count): New function.
2388         (Sized_relobj::do_local_symbol_offset): New function.
2389
2390 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2391
2392         * descriptors.cc (set_close_on_exec): New function.
2393         (Descriptors::open): Use set_close_on_exec.
2394         * output.cc (S_ISLNK): Define if not defined.
2395
2396 2011-04-22 Cary Coutant  <ccoutant@google.com>
2397
2398         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2399         global symbol map.
2400         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2401         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2402         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2403         relocations.
2404         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2405         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2406         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2407         * incremental.h
2408         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2409         function.
2410         (Incremental_binary::apply_incremental_relocs): New function.
2411         (Incremental_binary::do_apply_incremental_relocs): New function.
2412         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2413         data member.
2414         (Sized_incremental_binary::add_global_symbol): New function.
2415         (Sized_incremental_binary::global_symbol): New function.
2416         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2417         (Sized_incremental_binary::symbol_map_): New data member.
2418         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2419         * target.h (Sized_target::apply_relocation): New function.
2420         * target-reloc.h (apply_relocation): New function.
2421         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2422
2423 2011-04-22  Doug Kwan  <dougkwan@google.com>
2424
2425         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2426         flag of a SHT_ARM_EXIDX section.
2427         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2428         * testsuite/Makefile.in: Regenerate.
2429         * testsuite/arm_exidx_test.s: New file.
2430         * testsuite/arm_exidx_test.sh: Same.
2431
2432 2011-04-20 Cary Coutant  <ccoutant@google.com>
2433
2434         PR gold/12689
2435         * archive.h (Incremental_archive_entry::Archive_member):
2436         Initialize arg_serial_ (second constructor).
2437
2438 2011-04-17  Ian Lance Taylor  <iant@google.com>
2439
2440         * object.cc (Relocate_info::location): Simplify location string.
2441         * errors.cc (Errors::error_at_location): Don't print program
2442         name.
2443         (Errors::warning_at_location): Likewise.
2444         (Errors::undefined_symbol): Likewise.
2445         * testsuite/debug_msg.sh: Update accordingly.
2446
2447 2011-04-14 Cary Coutant  <ccoutant@google.com>
2448
2449         * gold/layout.cc (Layout::symtab_section_offset): New function.
2450         * gold/layout.h (Layout::symtab_section_offset): New function.
2451         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2452
2453 2011-04-12  Ian Lance Taylor  <iant@google.com>
2454
2455         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2456         with MREMAP_MAYMOVE.
2457         * output.h (class Output_file): Add map_is_allocated_ field.
2458         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2459         not available, provide stubs.  If mremap is not available, #define
2460         it to gold_mremap.
2461         (MREMAP_MAYMOVE): Define if not defined.
2462         (Output_file::Output_file): Initialize map_is_allocated_.
2463         (Output_file::resize): Check map_is_allocated_.
2464         (Output_file::map_anonymous): If mmap fails, use malloc.
2465         (Output_file::unmap): Don't do anything for an anonymous map.
2466         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2467         is not available, provide stubs.
2468         (File_read::View::~View): Use free rather than delete[].
2469         (File_read::make_view): Use malloc rather than new[].  If mmap
2470         fails, use malloc.
2471         (File_read::find_or_make_view): Use malloc rather than new[].
2472         * gold.h: Remove HAVE_REMAP code.
2473         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2474         exists.  Rename mremap to gold_mremap.  If mmap is not available
2475         don't do anything.
2476         * configure, config.in: Rebuild.
2477
2478 2011-04-11  Ian Lance Taylor  <iant@google.com>
2479
2480         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2481         initialize local variable v.
2482
2483 2011-04-11  Cary Coutant  <ccoutant@google.com>
2484
2485         * archive.cc (Archive::include_member): Adjust call to
2486         report_object.
2487         (Add_archive_symbols::run): Track argument serial numbers.
2488         (Lib_group::include_member): Likewise.
2489         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2490         * archive.h (Incremental_archive_entry::Archive_member):
2491         Initialize arg_serial_.
2492         (Archive_member::arg_serial_): New data member.
2493         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2494         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2495         incremental link.
2496         (Sized_dynobj::do_for_all_local_got_entries): New function.
2497         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2498         function.
2499         * fileread.cc (get_mtime): New function.
2500         * fileread.h (get_mtime): New function.
2501         * gold.cc (queue_initial_tasks): Check for incremental update.
2502         (process_incremental_input): New function.
2503         (queue_middle_tasks): Don't force valid target for incremental
2504         update.
2505         * incremental-dump.cc (find_input_containing_global): Adjust
2506         size of symbol info entry.
2507         (dump_incremental_inputs): Dump argument serial number and
2508         in_system_directory flag; bias shndx by 1; print symbol names
2509         when dumping per-file symbol lists; use new symbol info readers.
2510         * incremental.cc
2511         (Output_section_incremental_inputs:update_data_size): New function.
2512         (Sized_incremental_binary::setup_readers): Setup input readers
2513         for each input file; build maps for files added from libraries
2514         and scripts.
2515         (Sized_incremental_binary::check_input_args): New function.
2516         (Sized_incremental_binary::do_check_inputs): Build map of argument
2517         serial numbers to input arguments.
2518         (Sized_incremental_binary::do_file_has_changed): Rename
2519         do_file_is_unchanged to this; compare file modification times.
2520         (Sized_incremental_binary::do_init_layout): New function.
2521         (Sized_incremental_binary::do_reserve_layout): New function.
2522         (Sized_incremental_binary::do_get_input_reader): Remove.
2523         (Sized_incremental_binary::get_symtab_view): New function.
2524         (Incremental_checker::can_incrementally_link_output_file): Remove.
2525         (Incremental_inputs::report_command_line): Exclude --debug options.
2526         (Incremental_inputs::report_archive_begin): Add parameter; track
2527         argument serial numbers; don't put input file entry for archive
2528         before archive members.
2529         (Incremental_inputs::report_archive_end): Put input file entry
2530         for archive after archive members.
2531         (Incremental_inputs::report_object): Add parameter; track argument
2532         serial numbers and in_system_directory flag.
2533         (Incremental_inputs::report_script): Add parameter; track argument
2534         serial numbers.
2535         (Output_section_incremental_inputs::set_final_data_size): Adjust
2536         size of symbol info entry; check for forwarding symbols.
2537         (Output_section_incremental_inputs::write_input_files): Write
2538         in_system_directory flag and argument serial number.
2539         (Output_section_incremental_inputs::write_info_blocks): Map section
2540         indices between incremental info and original input file; store
2541         input section index for each symbol.
2542         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2543         change operator() to visit().
2544         (class Global_got_offset_visitor): Likewise.
2545         (class Global_symbol_visitor_got_plt):
2546         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2547         classes.
2548         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2549         (Sized_incr_relobj::do_read_symbols): New function.
2550         (Sized_incr_relobj::do_layout): New function.
2551         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2552         (Sized_incr_relobj::do_add_symbols): New function.
2553         (Sized_incr_relobj::do_should_include_member): New function.
2554         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2555         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2556         (Sized_incr_relobj::do_section_size): New function.
2557         (Sized_incr_relobj::do_section_name): New function.
2558         (Sized_incr_relobj::do_section_contents): New function.
2559         (Sized_incr_relobj::do_section_flags): New function.
2560         (Sized_incr_relobj::do_section_entsize): New function.
2561         (Sized_incr_relobj::do_section_address): New function.
2562         (Sized_incr_relobj::do_section_type): New function.
2563         (Sized_incr_relobj::do_section_link): New function.
2564         (Sized_incr_relobj::do_section_info): New function.
2565         (Sized_incr_relobj::do_section_addralign): New function.
2566         (Sized_incr_relobj::do_initialize_xindex): New function.
2567         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2568         (Sized_incr_relobj::do_read_relocs): New function.
2569         (Sized_incr_relobj::do_gc_process_relocs): New function.
2570         (Sized_incr_relobj::do_scan_relocs): New function.
2571         (Sized_incr_relobj::do_count_local_symbols): New function.
2572         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2573         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2574         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2575         (Sized_incr_relobj::do_relocate): New function.
2576         (Sized_incr_relobj::do_set_section_offset): New function.
2577         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2578         (Sized_incr_dynobj::do_read_symbols): New function.
2579         (Sized_incr_dynobj::do_layout): New function.
2580         (Sized_incr_dynobj::do_add_symbols): New function.
2581         (Sized_incr_dynobj::do_should_include_member): New function.
2582         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2583         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2584         (Sized_incr_dynobj::do_section_size): New function.
2585         (Sized_incr_dynobj::do_section_name): New function.
2586         (Sized_incr_dynobj::do_section_contents): New function.
2587         (Sized_incr_dynobj::do_section_flags): New function.
2588         (Sized_incr_dynobj::do_section_entsize): New function.
2589         (Sized_incr_dynobj::do_section_address): New function.
2590         (Sized_incr_dynobj::do_section_type): New function.
2591         (Sized_incr_dynobj::do_section_link): New function.
2592         (Sized_incr_dynobj::do_section_info): New function.
2593         (Sized_incr_dynobj::do_section_addralign): New function.
2594         (Sized_incr_dynobj::do_initialize_xindex): New function.
2595         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2596         (make_sized_incremental_object): New function.
2597         (Incremental_library::copy_unused_symbols): New function.
2598         (Incremental_library::do_for_all_unused_symbols): New function.
2599         * incremental.h (enum Incremental_input_flags): New type.
2600         (class Incremental_checker): Remove.
2601         (Incremental_input_entry::Incremental_input_entry): Add argument
2602         serial number.
2603         (Incremental_input_entry::arg_serial): New function.
2604         (Incremental_input_entry::set_is_in_system_directory): New function.
2605         (Incremental_input_entry::is_in_system_directory): New function.
2606         (Incremental_input_entry::arg_serial_): New data member.
2607         (Incremental_input_entry::is_in_system_directory_): New data member.
2608         (class Script_info): Move here from script.h.
2609         (Script_info::Script_info): Add filename parameter.
2610         (Script_info::filename): New function.
2611         (Script_info::filename_): New data member.
2612         (Incremental_script_entry::Incremental_script_entry): Add argument
2613         serial number.
2614         (Incremental_object_entry::Incremental_object_entry): Likewise.
2615         (Incremental_object_entry::add_input_section): Build list of input
2616         sections with map to original shndx.
2617         (Incremental_object_entry::get_input_section_index): New function.
2618         (Incremental_object_entry::shndx_): New data member.
2619         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2620         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2621         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2622         serial number.
2623         (Incremental_inputs::report_archive_begin): Likewise.
2624         (Incremental_inputs::report_object): Likewise.
2625         (Incremental_inputs::report_script): Likewise.
2626         (class Incremental_global_symbol_reader): New class.
2627         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2628         and store flags and input file type.
2629         (Incremental_input_entry_reader::arg_serial): New function.
2630         (Incremental_input_entry_reader::type): Extract type from flags.
2631         (Incremental_input_entry_reader::is_in_system_directory): New function.
2632         (Incremental_input_entry_reader::get_input_section_count): Call
2633         accessor function for type.
2634         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2635         function for type; adjust size of global symbol entry.
2636         (Incremental_input_entry_reader::get_global_symbol_count): Call
2637         accessor function for type.
2638         (Incremental_input_entry_reader::get_object_count): Likewise.
2639         (Incremental_input_entry_reader::get_object_offset): Likewise.
2640         (Incremental_input_entry_reader::get_member_count): Likewise.
2641         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2642         (Incremental_input_entry_reader::get_member_offset): Likewise.
2643         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2644         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2645         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2646         (Incremental_input_entry_reader::get_global_symbol_reader): New
2647         function.
2648         (Incremental_input_entry_reader::get_output_symbol_index): New
2649         function.
2650         (Incremental_input_entry_reader::type_): Remove.
2651         (Incremental_input_entry_reader::flags_): New data member.
2652         (Incremental_inputs_reader::input_file_offset): New function.
2653         (Incremental_inputs_reader::input_file_index): New function.
2654         (Incremental_inputs_reader::input_file): Call input_file_offset.
2655         (Incremental_inputs_reader::input_file_at_offset): New function.
2656         (Incremental_relocs_reader::get_r_type): Reformat.
2657         (Incremental_relocs_reader::get_r_shndx): Reformat.
2658         (Incremental_relocs_reader::get_r_offset): Reformat.
2659         (Incremental_relocs_reader::data): New function.
2660         (Incremental_binary::Incremental_binary): Initialize new data members.
2661         (Incremental_binary::check_inputs): Add cmdline parameter.
2662         (Incremental_binary::file_is_unchanged): Remove.
2663         (Input_reader::arg_serial): New function.
2664         (Input_reader::get_unused_symbol_count): New function.
2665         (Input_reader::get_unused_symbol): New function.
2666         (Input_reader::do_arg_serial): New function.
2667         (Input_reader::do_get_unused_symbol_count): New function.
2668         (Input_reader::do_get_unused_symbol): New function.
2669         (Incremental_binary::input_file_count): New function.
2670         (Incremental_binary::get_input_reader): Change signature to use
2671         index instead of filename.
2672         (Incremental_binary::file_has_changed): New function.
2673         (Incremental_binary::get_input_argument): New function.
2674         (Incremental_binary::get_library): New function.
2675         (Incremental_binary::get_script_info): New function.
2676         (Incremental_binary::init_layout): New function.
2677         (Incremental_binary::reserve_layout): New function.
2678         (Incremental_binary::output_file): New function.
2679         (Incremental_binary::do_check_inputs): New function.
2680         (Incremental_binary::do_file_is_unchanged): Remove.
2681         (Incremental_binary::do_file_has_changed): New function.
2682         (Incremental_binary::do_init_layout): New function.
2683         (Incremental_binary::do_reserve_layout): New function.
2684         (Incremental_binary::do_input_file_count): New function.
2685         (Incremental_binary::do_get_input_reader): Change signature.
2686         (Incremental_binary::input_args_map_): New data member.
2687         (Incremental_binary::library_map_): New data member.
2688         (Incremental_binary::script_map_): New data member.
2689         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2690         new data members.
2691         (Sized_incremental_binary::output_section): New function.
2692         (Sized_incremental_binary::inputs_reader): Add const.
2693         (Sized_incremental_binary::symtab_reader): Add const.
2694         (Sized_incremental_binary::relocs_reader): Add const.
2695         (Sized_incremental_binary::got_plt_reader): Add const.
2696         (Sized_incremental_binary::get_symtab_view): New function.
2697         (Sized_incremental_binary::Inputs_reader): New typedef.
2698         (Sized_incremental_binary::Input_entry_reader): New typedef.
2699         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2700         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2701         (Sized_incremental_binary::do_file_has_changed): New function.
2702         (Sized_incremental_binary::do_init_layout): New function.
2703         (Sized_incremental_binary::do_reserve_layout): New function.
2704         (Sized_input_reader::Inputs_reader): Remove.
2705         (Sized_input_reader::Input_entry_reader): Remove.
2706         (Sized_input_reader::do_arg_serial): New function.
2707         (Sized_input_reader::do_get_unused_symbol_count): New function.
2708         (Sized_input_reader::do_get_unused_symbol): New function.
2709         (Sized_incremental_binary::do_input_file_count): New function.
2710         (Sized_incremental_binary::do_get_input_reader): Change signature;
2711         use index instead of filename.
2712         (Sized_incremental_binary::section_map_): New data member.
2713         (Sized_incremental_binary::input_entry_readers_): New data member.
2714         (class Sized_incr_relobj): New class.
2715         (class Sized_incr_dynobj): New class.
2716         (make_sized_incremental_object): New function.
2717         (class Incremental_library): New class.
2718         * layout.cc (Free_list::num_lists): New static data member.
2719         (Free_list::num_nodes): New static data member.
2720         (Free_list::num_removes): New static data member.
2721         (Free_list::num_remove_visits): New static data member.
2722         (Free_list::num_allocates): New static data member.
2723         (Free_list::num_allocate_visits): New static data member.
2724         (Free_list::init): New function.
2725         (Free_list::remove): New function.
2726         (Free_list::allocate): New function.
2727         (Free_list::dump): New function.
2728         (Free_list::print_stats): New function.
2729         (Layout_task_runner::run): Resize output file for incremental updates.
2730         (Layout::Layout): Initialize new data members.
2731         (Layout::set_incremental_base): New function.
2732         (Layout::init_fixed_output_section): New function.
2733         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2734         incremental updates.
2735         (Layout::create_gold_note): Do not create gold note section for
2736         incremental updates.
2737         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2738         for incremental updates.
2739         (Layout::set_section_offsets): For incremental updates, allocate space
2740         from free list.
2741         (Layout::create_symtab_sections): Layout with offsets relative to
2742         start of section; for incremental updates, allocate space from free
2743         list.
2744         (Layout::create_shdrs): For incremental updates, allocate space from
2745         free list.
2746         (Layout::finish_dynamic_section): For incremental updates, do not
2747         check --as-needed (fixed in subsequent patch).
2748         * layout.h (class Free_list): New class.
2749         (Layout::set_incremental_base): New function.
2750         (Layout::incremental_base): New function.
2751         (Layout::init_fixed_output_section): New function.
2752         (Layout::allocate): New function.
2753         (Layout::incremental_base_): New data member.
2754         (Layout::free_list_): New data member.
2755         * main.cc (main): Print Free_list statistics.
2756         * object.cc (Relobj::finalize_incremental_relocs): Add
2757         clear_counts parameter; clear counts only when clear_counts is set.
2758         (Sized_relobj::Sized_relobj): Initialize new base class.
2759         (Sized_relobj::do_layout): Don't report special sections.
2760         (Sized_relobj::do_for_all_local_got_entries): New function.
2761         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2762         symtab_off to all symbol table offsets.
2763         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2764         * object.h (class Got_offset_list): Move to top of file.
2765         (Object::Object): Allow case where input_file == NULL.
2766         (Object::~Object): Likewise.
2767         (Object::input_file): Assert that input_file != NULL.
2768         (Object::lock): Allow case where input_file == NULL.
2769         (Object::unlock): Likewise.
2770         (Object::is_locked): Likewise.
2771         (Object::token): Likewise.
2772         (Object::release): Likewise.
2773         (Object::is_incremental): New function.
2774         (Object::get_mtime): New function.
2775         (Object::for_all_local_got_entries): New function.
2776         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2777         (Object::set_is_in_system_directory): New function.
2778         (Object::is_in_system_directory): New function.
2779         (Object::do_is_incremental): New function.
2780         (Object::do_get_mtime): New function.
2781         (Object::do_for_all_local_got_entries): New function.
2782         (Object::is_in_system_directory_): New data member.
2783         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2784         (class Sized_relobj_base): New class.
2785         (class Sized_relobj): Derive from Sized_relobj_base.
2786         (class Sized_relobj::Symbols): Redeclare from base class.
2787         (class Sized_relobj::local_got_offset_list): Remove.
2788         (class Sized_relobj::Output_sections): Redeclare from base class.
2789         (class Sized_relobj::do_for_all_local_got_entries): New function.
2790         (class Sized_relobj::write_local_symbols): Add offset parameter.
2791         (class Sized_relobj::local_symbol_offset_): Update comment.
2792         (class Sized_relobj::local_dynsym_offset_): Update comment.
2793         * options.cc (Input_arguments::add_file): Remove const.
2794         * options.h (Input_file_argument::Input_file_argument):
2795         Initialize arg_serial_ (all constructors).
2796         (Input_file_argument::set_arg_serial): New function.
2797         (Input_file_argument::arg_serial): New function.
2798         (Input_file_argument::arg_serial_): New data member.
2799         (Input_arguments::Input_arguments): Initialize file_count_.
2800         (Input_arguments::add_file): Remove const.
2801         (Input_arguments::number_of_input_files): New function.
2802         (Input_arguments::file_count_): New data member.
2803         (Command_line::number_of_input_files): Call
2804         Input_arguments::number_of_input_files.
2805         * output.cc (Output_segment_headers::Output_segment_headers):
2806         Set current size.
2807         (Output_section::Input_section::current_data_size): New function.
2808         (Output_section::Output_section): Initialize new data members.
2809         (Output_section::add_input_section): Don't do merge sections for
2810         an incremental link; allocate space from free list for an
2811         incremental update.
2812         (Output_section::add_output_section_data): Allocate space from
2813         free list for an incremental update.
2814         (Output_section::update_data_size): New function.
2815         (Output_section::set_fixed_layout): New function.
2816         (Output_section::reserve): New function.
2817         (Output_segment::set_section_addresses): Remove const.
2818         (Output_segment::set_section_list_addresses): Remove const; allocate
2819         space from free list for an incremental update.
2820         (Output_segment::set_offset): Adjust size of RELRO segment for an
2821         incremental update.
2822         * output.h (Output_data::current_data_size): Move here from
2823         child classes.
2824         (Output_data::pre_finalize_data_size): New function.
2825         (Output_data::update_data_size): New function.
2826         (Output_section_headers::update_data_size): new function.
2827         (Output_section_data_build::current_data_size): Move to Output_data.
2828         (Output_data_strtab::update_data_size): New function.
2829         (Output_section::current_data_size): Move to Output_data.
2830         (Output_section::set_fixed_layout): New function.
2831         (Output_section::has_fixed_layout): New function.
2832         (Output_section::reserve): New function.
2833         (Output_section::update_data_size): New function.
2834         (Output_section::has_fixed_layout_): New data member.
2835         (Output_section::free_list_): New data member.
2836         (Output_segment::set_section_addresses): Remove const.
2837         (Output_segment::set_section_list_addresses): Remove const.
2838         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2839         New function.
2840         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2841         New function.
2842         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2843         parameter when calling Add_symbols constructor; store argument
2844         serial number for members of a lib group.
2845         (Add_symbols::locks): Allow case where token == NULL.
2846         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2847         (Read_member::~Read_member): New function.
2848         (Read_member::is_runnable): New function.
2849         (Read_member::locks): New function.
2850         (Read_member::run): New function.
2851         (Check_script::~Check_script): New function.
2852         (Check_script::is_runnable): New function.
2853         (Check_script::locks): New function.
2854         (Check_script::run): New function.
2855         (Check_library::~Check_library): New function.
2856         (Check_library::is_runnable): New function.
2857         (Check_library::locks): New function.
2858         (Check_library::run): New function.
2859         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2860         (Add_symbols::library_): New data member.
2861         (class Read_member): New class.
2862         (class Check_script): New class.
2863         (class Check_library): New class.
2864         * reloc.cc (Read_relocs::is_runnable): Allow case where
2865         token == NULL.
2866         (Read_relocs::locks): Likewise.
2867         (Scan_relocs::locks): Likewise.
2868         (Relocate_task::locks): Likewise.
2869         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2870         to clear counters.
2871         (Sized_relobj::incremental_relocs_scan): Fix comment.
2872         (Sized_relobj::do_relocate): Pass output file offset to
2873         write_local_symbols.
2874         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2875         from class declaration.
2876         * script.cc (read_input_script): Allocate Script_info; pass
2877         argument serial number to report_script.
2878         * script.h (class Script_info): Move to incremental.h.
2879         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2880         * symtab.h (Symbol_table::add_from_incrobj): New function.
2881         (Symbol_table::set_file_offset): New function.
2882
2883 2011-04-05  Cary Coutant  <ccoutant@google.com>
2884
2885         * incremental-dump.cc (dump_incremental_inputs): Change signature
2886         to take a Sized_incremental_binary; change caller.  Use readers
2887         in Sized_incremental_binary.
2888         * incremental.cc
2889         (Sized_incremental_binary::find_incremental_inputs_sections):
2890         Rename do_find_incremental_inputs_sections to this.
2891         (Sized_incremental_binary::setup_readers): New function.
2892         (Sized_incremental_binary::do_check_inputs): Check
2893         has_incremental_info_ flag; move setup code to setup_readers;
2894         use input readers.
2895         (Sized_incremental_binary::do_file_is_unchanged): New function.
2896         (Sized_incremental_binary::do_get_input_reader): New function.
2897         * incremental.h (class Incremental_binary): Move to end of file.
2898         (Incremental_binary::file_is_unchanged): New function.
2899         (Incremental_binary::do_file_is_unchanged): New function.
2900         (Incremental_binary::Input_reader): New class.
2901         (Incremental_binary::get_input_reader): New function.
2902         (class Sized_incremental_binary): Move to end of file.
2903         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2904         input section reader classes.
2905         (Sized_incremental_binary::has_incremental_info): New function.
2906         (Sized_incremental_binary::inputs_reader): New function.
2907         (Sized_incremental_binary::symtab_reader): New function.
2908         (Sized_incremental_binary::relocs_reader): New function.
2909         (Sized_incremental_binary::got_plt_reader): New function.
2910         (Sized_incremental_binary::do_file_is_unchanged): New function.
2911         (Sized_incremental_binary::Sized_input_reader): New class.
2912         (Sized_incremental_binary::get_input_reader): New function.
2913         (Sized_incremental_binary::find_incremental_inputs_sections):
2914         Rename do_find_incremental_inputs_sections to this.
2915         (Sized_incremental_binary::setup_readers): New function.
2916         (Sized_incremental_binary::has_incremental_info_): New data member.
2917         (Sized_incremental_binary::inputs_reader_): New data member.
2918         (Sized_incremental_binary::symtab_reader_): New data member.
2919         (Sized_incremental_binary::relocs_reader_): New data member.
2920         (Sized_incremental_binary::got_plt_reader_): New data member.
2921         (Sized_incremental_binary::current_input_file_): New data member.
2922
2923 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2924
2925         PR gold/12640
2926         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2927         violation.
2928
2929 2011-03-30  Cary Coutant  <ccoutant@google.com>
2930
2931         * archive.cc (Archive::include_member): Adjust call to report_object.
2932         (Add_archive_symbols::run): Add script_info to call to
2933         report_archive_begin.
2934         (Lib_group::include_member): Adjust call to report_object.
2935         (Add_lib_group_symbols::run): Adjust call to report_object.
2936         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2937         blocks.  Add object count for script input files.
2938         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2939         script_info parameter; change all callers.
2940         (Incremental_inputs::report_object): Add script_info parameter;
2941         change all callers.
2942         (Incremental_inputs::report_script): Store backpointer to
2943         incremental info entry.
2944         (Output_section_incremental_inputs::set_final_data_size): Record
2945         additional information for scripts.
2946         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2947         * incremental.h (Incremental_script_entry::add_object): New function.
2948         (Incremental_script_entry::get_object_count): New function.
2949         (Incremental_script_entry::get_object): New function.
2950         (Incremental_script_entry::objects_): New data member; adjust
2951         constructor.
2952         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2953         (Incremental_inputs::report_object): Add script_info parameter.
2954         (Incremental_inputs_reader::get_object_count): New function.
2955         (Incremental_inputs_reader::get_object_offset): New function.
2956         * options.cc (Input_arguments::add_file): Return reference to
2957         new input argument.
2958         * options.h (Input_argument::set_script_info): New function.
2959         (Input_argument::script_info): New function.
2960         (Input_argument::script_info_): New data member; adjust all
2961         constructors.
2962         (Input_file_group::add_file): Return reference to new input argument.
2963         (Input_file_lib::add_file): Likewise.
2964         (Input_arguments::add_file): Likewise.
2965         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2966         * script.cc (Parser_closure::Parser_closure): Add script_info
2967         parameter; adjust all callers.
2968         (Parser_closure::script_info): New function.
2969         (Parser_closure::script_info_): New data member.
2970         (read_input_script): Report scripts earlier to incremental info.
2971         (script_add_file): Set script_info in Input_argument.
2972         (script_add_library): Likewise.
2973         * script.h (Script_options::Script_info): Rewrite class.
2974
2975 2011-03-29  Cary Coutant  <ccoutant@google.com>
2976
2977         * archive.cc (Library_base::should_include_member): Move
2978         method here from class Archive.
2979         (Archive::Archive): Initialize base class.
2980         (Archive::should_include_member): Move to base class.
2981         (Archive::do_for_all_unused_symbols): New function.
2982         (Add_archive_symbols::run): Remove redundant access to
2983         incremental_inputs.
2984         (Lib_group::Lib_group): Initialize base class.
2985         (Lib_group::do_filename): New function.
2986         (Lib_group::include_member): Pass pointer to Lib_group to
2987         report_object.
2988         (Lib_group::do_for_all_unused_symbols): New function.
2989         (Add_lib_group_symbols::run): Report archive information for
2990         incremental links.
2991         * archive.h (class Library_base): New base class.
2992         (class Archive): Derive from Library_base.
2993         (Archive::filename): Move to base class.
2994         (Archive::set_incremental_info): Likewise.
2995         (Archive::incremental_info): Likewise.
2996         (Archive::Should_include): Likewise.
2997         (Archive::should_include_member): Likewise.
2998         (Archive::Armap_entry): Remove.
2999         (Archive::Unused_symbol_iterator): Remove.
3000         (Archive::unused_symbols_begin): Remove.
3001         (Archive::unused_symbols_end): Remove.
3002         (Archive::do_filename): New function.
3003         (Archive::do_get_mtime): New function.
3004         (Archive::do_for_all_unused_symbols): New function.
3005         (Archive::task_): Move to base class.
3006         (Archive::incremental_info_): Likewise.
3007         (class Lib_group): Derive from Library_base.
3008         (Lib_group::do_filename): New function.
3009         (Lib_group::do_get_mtime): New function.
3010         (Lib_group::do_for_all_unused_symbols): New function.
3011         (Lib_group::task_): Move to base class.
3012         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3013         function.
3014         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3015         function.
3016         * incremental.cc (Incremental_inputs::report_archive_begin):
3017         Use Library_base; call library's get_mtime; add incremental inputs
3018         entry before members.
3019         (class Unused_symbol_visitor): New class.
3020         (Incremental_inputs::report_archive_end): Use Library_base; use
3021         visitor class to record unused symbols; don't add incremental inputs
3022         entry after members.
3023         (Incremental_inputs::report_object): Use Library_base.
3024         * incremental.h
3025         (Incremental_archive_entry::Incremental_archive_entry): Remove
3026         unused Archive parameter.
3027         (Incremental_inputs::report_archive_begin): Use Library_base.
3028         (Incremental_inputs::report_archive_end): Likewise.
3029         (Incremental_inputs::report_object): Likewise.
3030         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3031         function.
3032         * object.h (Object::for_all_global_symbols): New function.
3033         (Object::do_for_all_global_symbols): New function.
3034         (Sized_relobj::do_for_all_global_symbols): New function.
3035         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3036         function.
3037         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3038         function.
3039
3040 2011-03-27  Ian Lance Taylor  <iant@google.com>
3041
3042         * archive.cc (Archive::interpret_header): Return -1 if something
3043         goes wrong.  Change callers accordingly.
3044
3045 2011-03-25  Cary Coutant  <ccoutant@google.com>
3046
3047         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3048         * testsuite/Makefile.in: Regenerate.
3049
3050 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3051
3052         * plugin.cc (get_view): New.
3053         (Plugin::load): Pass get_view to the plugin.
3054         (Plugin_manager::get_view): New.
3055
3056 2011-03-21  Ian Lance Taylor  <iant@google.com>
3057
3058         * testsuite/final_layout.sh: Rewrite to not use dc.
3059         * testsuite/relro_test.sh: Fail if dc is not present.
3060
3061 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3062
3063         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3064         Change == to -eq.
3065         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3066         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3067         Change == to -eq.
3068         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3069         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3070
3071 2011-03-14  Ian Lance Taylor  <iant@google.com>
3072
3073         * script-sections.cc (Sort_output_sections::script_compare):
3074         Rename from is_before, change return type.
3075         (Sort_output_sections::operator()): Adjust accordingly.
3076
3077 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3078
3079         PR gold/12572
3080         * testsuite/odr_violation2.cc: Add comment to make all error line
3081         numbers double digits.
3082         * testsuite/debug_msg.sh: Adjust expected errors.
3083
3084 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3085
3086         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3087         but mark earlier ones as non-canonical
3088         (offset_to_iterator): Update search target and example
3089         (do_addr2line): Return extra lines in a vector*
3090         (format_file_lineno): Extract from do_addr2line
3091         (one_addr2line): Add vector* out-param
3092         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3093         when a lineno entry appeared last for its instruction
3094         (Dwarf_line_info): Add vector* out-param
3095         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3096         * symtab.cc (Odr_violation_compare): Include the lineno in the
3097         comparison again.
3098         (linenos_from_loc): New. Combine the canonical line for an
3099         address with its other lines.
3100         (True_if_intersect): New. Helper functor to make
3101         std::set_intersection a query.
3102         (detect_odr_violations): Compare sets of lines instead of just
3103         one line for each function. This became less deterministic, but
3104         has fewer false positives.
3105         * symtab.h: Declarations.
3106         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3107         mix an optimized and non-optimized object in the same binary
3108         (odr_violation2.so): Same.
3109         * testsuite/Makefile.in: Regenerate from Makefile.am.
3110         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3111         * testsuite/debug_msg.sh: Update line numbers and add
3112         assertions.
3113         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3114         non-optimized context.
3115         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3116         isn't inlined, and use OdrDerived in an optimized context.
3117         * testsuite/odr_header1.h: Defines OdrDerived, where
3118         optimization will change the
3119         first-instruction-in-the-destructor's file and line number.
3120         * testsuite/odr_header2.h: Defines OdrBase.
3121
3122 2011-03-09  Ian Lance Taylor  <iant@google.com>
3123
3124         * fileread.cc (File_read::clear_views): Don't delete the whole
3125         file view.
3126
3127 2011-03-08  Ian Lance Taylor  <iant@google.com>
3128
3129         PR gold/12525
3130         * fileread.cc: #include <climits>.
3131         (GOLD_IOV_MAX): Define.
3132         (File_read::read_multiple): Limit number of entries by iov_max.
3133         * fileread.h (class File_read): Always set max_readv_entries to
3134         128.
3135
3136 2011-03-07  Ian Lance Taylor  <iant@google.com>
3137
3138         PR gold/12525
3139         * options.h (class General_options): Add -dy and -dn.
3140
3141 2011-03-02  Cary Coutant  <ccoutant@google.com>
3142
3143         * testsuite/script_test_9.t: Add TLS segment.
3144
3145 2011-03-02  Simon Baldwin  <simonb@google.com>
3146
3147         * configure.ac: Add check for gnu_indirect_function support in
3148         the toolchain building binutils.
3149         * configure: Rebuild.
3150
3151 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3152
3153         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3154         plugin only symbols.
3155         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3156         in plugin files as not needed in the symbol table.
3157
3158 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3159
3160         * output.cc (Output_section::add_input_section): Delay fill
3161         generation for section ordering.
3162
3163 2011-02-09  Ian Lance Taylor  <iant@google.com>
3164
3165         PR gold/12316
3166         * object.h (class Sized_relobj): Remove clear_local_symbols.
3167         * reloc.cc (Sized_relobj::do_relocate): Don't call
3168         clear_local_symbols.
3169
3170 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3171
3172         * plugin.cc (is_visible_from_outside): Return true for symbols
3173         in the -u option.
3174
3175 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3176
3177         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3178         filename.
3179
3180 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3181
3182         * icf.h (is_section_foldable_candidate): Change type of parameter
3183         to std::string.
3184         * icf.cc (Icf::find_identical_sections): Change type of local variable
3185         section_name to be std::string.
3186         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3187
3188 2011-01-25  Ian Lance Taylor  <iant@google.com>
3189
3190         * script.cc (script_add_extern): Rewrite to use
3191         add_symbol_reference.
3192
3193 2011-01-25  Doug Kwan  <dougkwan@google.com>
3194
3195         * icf.cc (get_section_contents): Always lock section's object.
3196
3197 2011-01-24  Ian Lance Taylor  <iant@google.com>
3198
3199         * options.h (class General_options): Accept
3200         --no-detect-odr-violations.
3201
3202 2011-01-24  Ian Lance Taylor  <iant@google.com>
3203
3204         * version.cc (version_string): Bump to 1.11.
3205
3206 2011-01-24  Ian Lance Taylor  <iant@google.com>
3207
3208         * plugin.cc (class Plugin_rescan): Define new class.
3209         (Plugin_manager::claim_file): Set any_claimed_.
3210         (Plugin_manager::save_archive): New function.
3211         (Plugin_manager::save_input_group): New function.
3212         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3213         necessary.
3214         (Plugin_manager::new_undefined_symbol): New function.
3215         (Plugin_manager::rescan): New function.
3216         (Plugin_manager::rescannable_defines): New function.
3217         (Plugin_manager::add_input_file): Set any_added_.
3218         * plugin.h (class Plugin_manager): define new fields rescannable_,
3219         undefined_symbols_, any_claimed_, and any_added_.  Declare
3220         Plugin_rescan as friend.  Declare new functions.
3221         (Plugin_manager::Rescannable): Define type.
3222         (Plugin_manager::Rescannable_list): Define type.
3223         (Plugin_manager::Undefined_symbol_list): Define type.
3224         (Plugin_manager::Plugin_manager): Initialize new fields.
3225         * archive.cc (Archive::defines_symbol): New function.
3226         (Add_archive_symbols::run): Pass archive to plugins if any.
3227         * archive.h (class Archive): Declare defines_symbol.
3228         * readsyms.cc (Input_group::~Input_group): New function.
3229         (Finish_group::run): Pass input_group to plugins if any.
3230         * readsyms.h (class Input_group): Declare destructor.
3231         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3232         any.
3233
3234 2011-01-10  Ian Lance Taylor  <iant@google.com>
3235
3236         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3237         section as relro.
3238         (Layout::set_segment_offsets): Reset increase_relro before calling
3239         set_section_addresses a second time.
3240
3241 2011-01-04  Cary Coutant  <ccoutant@google.com>
3242
3243         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3244         sections before NOBITS sections.
3245
3246 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3247
3248         * version.cc (print_version): Update copyright to 2011.
3249
3250 2010-12-23  Cary Coutant  <ccoutant@google.com>
3251
3252         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3253         of OS to this->add.  Add OD parameter to second form of the function.
3254
3255 2010-12-20  Ian Lance Taylor  <iant@google.com>
3256
3257         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3258         second of two consecutive entries with same offset.
3259
3260 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3261
3262         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3263         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3264         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3265         to avoid unneeded links against $(LDADD).
3266         * testsuite/Makefile.in: Regenerate.
3267
3268 2010-12-15  Ian Lance Taylor  <iant@google.com>
3269
3270         PR gold/12324
3271         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3272         for R_X86_64_32 and R_X86_64_PC32.
3273         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3274         ver_matching_def_pic.o.
3275         (ver_matching_def_pic.o): New target.
3276
3277 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3278
3279         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3280         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3281         Move definition before File_read::View member definitions.
3282         (File_read::View::~View): Initialize and hold lock before
3283         updating current_mapped_bytes.
3284
3285 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3286
3287         * dwarf_reader.cc: Remove outdated comment.
3288         * gold-threads.cc: Fix typo in error message.
3289         * archive.cc: Fix typos in comments.
3290         * archive.h: Likewise.
3291         * arm-reloc-property.cc: Likewise.
3292         * arm-reloc-property.h: Likewise.
3293         * arm-reloc.def: Likewise.
3294         * arm.cc: Likewise.
3295         * attributes.h: Likewise.
3296         * cref.cc: Likewise.
3297         * ehframe.cc: Likewise.
3298         * fileread.h: Likewise.
3299         * gold.h: Likewise.
3300         * i386.cc: Likewise.
3301         * icf.cc: Likewise.
3302         * incremental.h: Likewise.
3303         * int_encoding.cc: Likewise.
3304         * layout.h: Likewise.
3305         * main.cc: Likewise.
3306         * merge.h: Likewise.
3307         * object.cc: Likewise.
3308         * object.h: Likewise.
3309         * options.cc: Likewise.
3310         * readsyms.cc: Likewise.
3311         * reduced_debug_output.cc: Likewise.
3312         * reloc.cc: Likewise.
3313         * script-sections.cc: Likewise.
3314         * sparc.cc: Likewise.
3315         * symtab.h: Likewise.
3316         * target-reloc.h: Likewise.
3317         * target.cc: Likewise.
3318         * target.h: Likewise.
3319         * timer.cc: Likewise.
3320         * timer.h: Likewise.
3321         * x86_64.cc: Likewise.
3322
3323 2010-12-09  Cary Coutant  <ccoutant@google.com>
3324
3325         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3326         stack.
3327         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3328         parameter; change all callers.
3329         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3330         * options.h (warn_execstack): New option.
3331
3332 2010-12-07  Doug Kwan  <dougkwan@google.com>
3333
3334         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3335         like function call relocations.
3336
3337 2010-12-07  Ian Lance Taylor  <iant@google.com>
3338
3339         * archive.cc (Archive::get_elf_object_for_member): Permit
3340         punconfigured to be NULL.
3341         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3342         (Archive::include_member): Pass NULL to get_elf_object_for_member
3343         if we searched for the archive and this is the first included
3344         object.
3345
3346 2010-12-01  Ian Lance Taylor  <iant@google.com>
3347
3348         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3349         track_relocs_type_ field.
3350         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3351         Set track_relocs_type_.
3352         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3353         contents when using RELA relocs.
3354         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3355         reloc_map_.
3356         * reloc.cc (Track_relocs::next_addend): New function.
3357         * reloc.h (class Track_relocs): Declare next_addend.
3358
3359 2010-12-01  Ian Lance Taylor  <iant@google.com>
3360
3361         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3362         virtual destructor.
3363
3364 2010-12-01  Ian Lance Taylor  <iant@google.com>
3365
3366         * README: Update compilers known to work and fail.
3367
3368 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3369
3370         * configure.in: For --enable-gold, handle value `default' instead of
3371         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3372         not the default.
3373         * configure: Regenerate.
3374
3375 2010-11-18  Doug Kwan  <dougkwan@google.com>
3376
3377         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3378         and right_alignment to be zero.  Store result alignment only if it is
3379         greater than existing alignment.
3380
3381 2010-11-16  Cary Coutant  <ccoutant@google.com>
3382
3383         PR gold/12220
3384         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3385         Check for ".zdebug_line".
3386
3387 2010-11-16  Doug Kwan  <dougkwan@google.com>
3388             Cary Coutant  <ccoutant@google.com>
3389
3390         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3391         by reference; adjust all callers.
3392         * output.cc (Output_segment::set_section_addresses): Adjust references
3393         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3394         list is empty.
3395         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3396         end at page boundary.
3397
3398 2010-11-16  Cary Coutant  <ccoutant@google.com>
3399
3400         PR gold/12220
3401         * layout.cc (Layout::choose_output_section): Transform names of
3402         compressed sections even when using a script with a SECTIONS clause.
3403         (Layout::output_section_name): Remove code to transform
3404         compressed debug section names.
3405         * output.cc (Output_section::add_input_section): Use uncompressed
3406         section size when tracking input sections.
3407
3408 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3409
3410         * symtab.h (Symbol::NON_PIC_REF): Remove.
3411         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3412         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3413         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3414         (Symbol::use_plt_offset): Take a flags argument and pass it
3415         directly to needs_dynamic_reloc.  Restrict check for undefined
3416         weak symbols to function calls.
3417         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3418         (Target_arm::Scan::global): Use it.
3419         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3420         (Target_arm::Relocate::relocate): Likewise.
3421         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3422         parameter with an r_type parameter.  Use get_reference_flags
3423         to get the flags.
3424         (Target_arm::Relocate::relocate): Update accordingly.
3425         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3426         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3427         (Target_i386::Scan::global): Likewise.
3428         (Target_i386::Relocate::relocate): Likewise.
3429         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3430         parameter with an r_type parameter.  Use get_reference_flags
3431         to get the flags.
3432         (Target_i386::Relocate::relocate): Update accordingly.
3433         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3434         (Target_powerpc::Scan::global): Use it.
3435         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3436         (Target_powerpc::Relocate::relocate): Likewise.
3437         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3438         (Target_sparc::Scan::global): Use it.
3439         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3440         (Target_sparc::Relocate::relocate): Likewise.
3441         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3442         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3443         (Target_x86_64::Scan::global): Likewise.
3444         (Target_x86_64::Relocate::relocate): Likewise.
3445
3446 2010-11-08  Doug Kwan  <dougkwan@google.com>
3447             Cary Coutant  <ccoutant@google.com>
3448
3449         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3450         (Arm_exidx_merge_section::section_contents_): New data member.
3451         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3452         (Arm_input_section::~Arm_input_section): De-allocate memory.
3453         (Arm_input_section::original_contents_): New data member.
3454         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3455         in parameters instead of calling Object::section_contents without
3456         locking.
3457         (Arm_output_section::group_section): New parameter TASK.  Pass it
3458         to callees that need locking objects.
3459         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3460         to lock EXIDX input sections.  Fix a formatting issue.  Call
3461         Arm_exidx_merged_section::build_contents to create merged section
3462         contents.
3463         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3464         to lock object of stub table owner.
3465         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3466         TEXT_SIZE to initialize data member TEXT_SIZE_.
3467         (Arm_exidx_input_section::addralign): Fix typo in comment.
3468         (Arm_exidx_input_section::text_size): New method.
3469         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3470         that require locking objects.  Lock objects before scanning for stubs
3471         and updating local symbols.
3472         (Arm_input_section<big_endian>::init): Copy contents of original
3473         input section.
3474         (Arm_input_section<big_endian>::do_write): Use saved contents of
3475         original input section instead of calling Object::section_contents
3476         without locking.
3477         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3478         size without calling Object::section_size().
3479         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3480         for size.  Allocate a buffer for merged EXIDX entries.
3481         (Arm_exidx_merged_section::build_contents): New method.
3482         (Arm_exidx_merged_section::do_write): Move merge section contents
3483         building code to Arm_exidx_merged_section::build_contetns.  Write
3484         out contetns in buffer instead of building it on the fly.
3485         (Arm_relobj::make_exidx_input_section): Also pass text section size
3486         to Arm_exidx_input_section constructor.
3487         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3488         (Arm_dynobj::do_read_symbols): Fix memory leak.
3489         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3490         * target.h: (class Task): Add forward declaration.
3491         (Target::relax): Add new parameter TASK and pass it to
3492         Target::do_relax().
3493         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3494
3495 2010-11-05  Cary Coutant  <ccoutant@google.com>
3496
3497         PR gold/10708
3498         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3499         object when reading from the file.
3500         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3501         second layout pass.
3502         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3503         when reading section contents.
3504         (get_section_contents): Likewise.
3505         (icf::find_identical_sections): Likewise.
3506         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3507         object when reading from the file.
3508         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3509         the object when doing deferred section layout.
3510
3511 2010-11-03  Nick Clifton  <nickc@redhat.com>
3512
3513         PR gold/12001
3514         * script.h (class Symbol_assignment: name): New member.  Returns
3515         the name of the symbol.
3516         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3517         Returns true if the given symbol name is on the list of
3518         assignments wating to be processed.
3519         * archive.cc (should_incldue_member): If the symbol is undefined,
3520         check to see if it is on the list of symbols pending assignment.
3521
3522 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3523
3524         * script-sections.cc (Script_sections::find_memory_region): Check
3525         for a NULL output section pointer.
3526
3527 2010-10-29  Doug Kwan  <dougkwan@google.com>
3528
3529         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3530         Output_section::add_relaxed_input_section.
3531         * output.cc (Output_section::add_relaxed_input_section): Add new
3532         arguments LAYOUT and NAME.  Set section order index.
3533         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3534         Copy section order index.
3535         * output.h (Output_section::add_relaxed_input_section): Add new
3536         arguments LAYOUT and NAME.
3537
3538 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3539
3540         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3541         NATIVE_OR_CROSS_LINKER.
3542         * testsuite/Makefile.in: Regenerate.
3543
3544 2010-10-20  Doug Kwan  <dougkwan@google.com>
3545
3546         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3547         without SHF_LINK_ORDER flags.
3548         * layout.cc (Layout::choose_output_section): Do not filter
3549         SHF_LINK_ORDER flag in a relocatable link.
3550
3551 2010-10-17  Cary Coutant  <ccoutant@google.com>
3552
3553         * output.h (Output_segment::set_section_addresses): Change function
3554         signature.  Update all callers.
3555         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3556         sections.
3557         (Output_segment::set_section_addresses): Align after last TLS
3558         section.  Add padding before last relro section instead of after.
3559
3560 2010-10-17  Doug Kwan  <dougkwan@google.com>
3561
3562         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3563         GOT output section to be writable.
3564
3565 2010-10-14  Cary Coutant  <ccoutant@google.com>
3566
3567         * debug.h (DEBUG_INCREMENTAL): New flag.
3568         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3569         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3570         mode.
3571         * incremental.cc (report_command_line): Ignore all forms of
3572         --incremental.
3573         * layout.cc (Layout::Layout): Check parameters for incremental link
3574         mode.
3575         * options.cc (General_options::parse_incremental): New function.
3576         (General_options::parse_no_incremental): New function.
3577         (General_options::parse_incremental_full): New function.
3578         (General_options::parse_incremental_update): New function.
3579         (General_options::incremental_mode_): New data member.
3580         (General_options::finalize): Check incremental_mode_.
3581         * options.h (General_options): Update help text for --incremental.
3582         Add --no-incremental, --incremental-full, --incremental-update.
3583         (General_options::Incremental_mode): New enum type.
3584         (General_options::incremental_mode): New function.
3585         (General_options::incremental_mode_): New data member.
3586         * parameters.cc (Parameters::incremental_mode_): New data member.
3587         (Parameters::set_options): Set incremental_mode_.
3588         (Parameters::set_incremental_full): New function.
3589         (Parameters::incremental): New function.
3590         (Parameters::incremental_update): New function.
3591         (set_parameters_incremental_full): New function.
3592         * parameters.h (Parameters::set_incremental_full): New function.
3593         (Parameters::incremental): New function.
3594         (Parameters::incremental_update): New function.
3595         (Parameters::incremental_mode_): New data member.
3596         (set_parameters_incremental_full): New function.
3597         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3598         incremental link mode.
3599         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3600         (Sized_relobj::do_relocate_sections): Likewise.
3601         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3602         option.
3603         * testsuite/Makefile.in: Regenerate.
3604         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3605
3606 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3607
3608         * script-sections.h (class Script_sections): Make
3609         Sections_elements typedef public.
3610         * script-sections.cc (class Sort_output_sections): Add elements_
3611         field.  Add constructor which sets it; change all callers.
3612         (Sort_output_sections::is_before): New function.
3613         (Sort_output_sections::operator()): Call is_before.
3614         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3615         conditional.
3616         * testsuite/script_test_10.sh: New test. Test script section
3617         order.
3618         * testsuite/script_test_10.t: Likewise.
3619         * testsuite/script_test_10.s: Likewise.
3620         * testsuite/Makefile.am: Wrap the cross linker tests and the
3621         common tests into NATIVE_OR_CROSS_LINKER.
3622         (check_SCRIPTS): Add script_test_10.sh.
3623         (check_DATA): Add script_test_10.stdout.
3624         (script_test_10.o, script_test_10): New targets.
3625         (script_test_10.stdout): New target.
3626         * configure, testsuite/Makefile.in: Regenerate.
3627
3628 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3629
3630         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3631         error for the deprecated relocations.
3632         (Target_arm::Scan::global): Likewise.
3633         (Target_arm::Relocate::relocate): Likewise.
3634
3635 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3636
3637         * fileread.cc (Input_file::find_file): Initialize *found_name
3638         and *namep when using the fallback search for case 4.
3639
3640 2010-10-11  Cary Coutant  <ccoutant@google.com>
3641
3642         * options.h (class General_options): Redefine -z lazy as an alias for
3643         the negation of -z now.
3644
3645 2010-10-11  Ian Lance Taylor  <iant@google.com>
3646
3647         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3648         binding.
3649
3650 2010-10-06  Nick Clifton  <nickc@redhat.com>
3651
3652         * script-sections.cc(class Memory_region): Remove
3653         current_lma_offset_ field.  Rename current_vma_offset_ to
3654         current_offset_.  Add last_section_ field.
3655         (Memory_region::get_current_vma_address): Rename to
3656         get_current_address.
3657         (Memory_region::get_current_lma_address): Delete.
3658         (Memory_region::increment_vma_offset): Rename to
3659         increment_offset.
3660         (Memory_region::increment_lma_offset): Delete.
3661         (Memory_region::attributes_compatible): New method.  Returns
3662         true if the provided section is compatible with the region.
3663         (Memory_region::get_last_section): New method.  Returns the last
3664         section to use the region.
3665         (Memory_region::set_last_section): New method.  Stores the last
3666         section to use the region.
3667         (Script_sections::block_in_region): New method.  Returns true if
3668         a block of memory is contained within a region.
3669         (Script_sections::find_memory_region): New method.  Locates a
3670         memory region to be used to set a VMA or LMA address.
3671         (Output_section_definition::set_section_addresses): Add code to
3672         check for addresses set by memory regions.
3673         (Output_segment::set_section_addresses): Remove memory region
3674         walking code.
3675         (Script_sections::create_segment): Add a warning if a header
3676         segment is created outside of any region.
3677         * script-sections.h (class Script_sections): Add prototypes for
3678         find_memory_region and block_in_region methods.
3679         * testsuite/memory_test.s: Use .long instead of .word.
3680         * testsuite/memory_test.t: Add some more output sections.
3681         * testsuite/memory_test.sh: Update expected output.
3682
3683 2010-10-02  Doug Kwan  <dougkwan@google.com>
3684
3685         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3686         defintion to symtab.h
3687         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3688         declaration to defintion.
3689
3690 2010-10-01  Nick Clifton  <nickc@redhat.com>
3691
3692         * expression.cc (eval): Replace dummy argument with NULL.
3693         (eval_maybe_dot): Check for a NULL result section pointer.
3694         (Symbol_expression::value): Likewise.
3695         (Dot_expression::value): Likewise.
3696         (BINARY_EXPRESSION): Likewise.
3697         (Max_expression::value): Likewise.
3698         (Min_expression::value): Likewise.
3699         (Absolute_expression::value): Likewise.
3700         (Addr_expression::value_from_output_section): Likewise.
3701         (Loaddddr_expression::value_from_output_section): Likewise.
3702         (Segment_start_expression::value): Likewise.
3703         * script-sections.cc
3704         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3705         argument with NULL.
3706         (Sections_elememt_dot_assignment::set_section_addresses):
3707         Likewise.
3708         (Output_data_expression::do_write_to_buffer): Likewise.
3709         (Output_section_definition::finalize_symbols): Likewise.
3710         (Output_section_definition::set_section_addresses): Likewise.
3711
3712 2010-09-30  Doug Kwan  <dougkwan@google.com>
3713
3714         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3715
3716 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3717
3718         * target.h (Target::can_icf_inline_merge_sections): New virtual
3719         function.
3720         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3721         virtual function.
3722         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3723         virtual function.
3724         * icf.cc (get_section_contents): Inline merge sections only when
3725         target allows it.
3726
3727 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3728
3729         * configure: Regenerate.
3730
3731 2010-09-17  Ian Lance Taylor  <iant@google.com>
3732
3733         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3734         * testsuite/Makefile.am (memory_test.o): New target.
3735         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3736         memory_test.t.
3737         * testsuite/Makefile.in: Rebuild.
3738
3739 2010-09-17  Doug Kwan  <dougkwan@google.com>
3740
3741         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3742         defintion if relocation uses GOT entries of the symbol.
3743         * testsuite/icf_safe_test.sh: Fix test.
3744         * testsuite/icf_safe_so_test.sh: Fix test.
3745
3746 2010-09-16  Cary Coutant  <ccoutant@google.com>
3747
3748         * script_sections.cc (class Memory_region): Remove "NULL" from
3749         vector initializations.
3750
3751 2010-09-15  Cary Coutant  <ccoutant@google.com>
3752
3753         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3754         Resolve forwarding symbols.
3755
3756 2010-09-15  Doug Kwan  <dougkwan@google.com>
3757
3758         * gold/testsuite/script_test_3.t: Add ARM special sections.
3759         * gold/testsuite/script_test_4.t: Same.
3760         * gold/testsuite/script_test_5.t: Same.
3761         * gold/testsuite/script_test_6.t: Same.
3762         * gold/testsuite/script_test_7.t: Same.
3763         * gold/testsuite/script_test_7.t: Same.
3764         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3765
3766 2010-09-14  Cary Coutant  <ccoutant@google.com>
3767
3768         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3769         (Target_x86_64::Relocate::relocate_tls): Replace check for
3770         saw_tls_block_reloc_ with test for executable section.
3771
3772 2010-09-12  Cary Coutant  <ccoutant@google.com>
3773
3774         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3775         position-independent executables to shared libraries need dynamic
3776         relocations.
3777         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3778         position-independent executables.
3779         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3780         * testsuite/Makefile.in: Regenerate.
3781
3782 2010-09-10  Nick Clifton  <nickc@redhat.com>
3783
3784         PR gold/11997
3785         * testsuite/memory_test.t: Discard any sections that are not
3786         needed.
3787
3788 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3789
3790         PR gold/11996
3791         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3792         "This::" to work around a bug in gcc 4.2.
3793
3794         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3795
3796 2010-09-09  Rafael Espindola  <espindola@google.com>
3797
3798         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3799         sections with different PF_X flags in the same segment.
3800         (Layout::find_first_load_seg): Search all segments to find the first
3801         one.
3802         * options.h (rosegment): New.
3803
3804 2010-09-08  Rafael Espindola  <espindola@google.com>
3805
3806         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3807
3808 2010-09-08  Doug Kwan  <dougkwan@google.com>
3809
3810         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3811         (Arm_relobj::do_relocate_sections): Add new parameter for output
3812         file to match the parent.
3813         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3814         of local symbols instead of input values.  Update code to track
3815         changes in gold::relocate_section.
3816         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3817         (Sized_relobj::compute_final_local_value_internal): New methods.
3818         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3819         body into private version of Sized_relobj::compute_final_local_value.
3820         Call the inline method.
3821         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3822         merged symbol value if there is one.
3823         (Symbol_value::has_output_value): New method defintiion.
3824         (Sized_relobj::Compute_final_local_value_status): New enum type.
3825         (Sized_relobj::compute_final_local_value): New methods.
3826         (Sized_relobj::compute_final_local_value_internal): New methods.
3827         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3828         and arm_cortex_a8.sh.
3829         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3830         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3831         New tests.
3832         * Makefile.in: Regenerate.
3833         * testsuite/arm_bl_out_of_range.s: Update test.
3834         * testsuite/thumb_bl_out_of_range.s: Ditto.
3835         * testsuite/thumb_blx_out_of_range.s: Ditto.
3836         * testsuite/arm_branch_out_of_range.sh: New file.
3837         * testsuite/arm_cortex_a8.sh: Ditto.
3838         * testsuite/arm_cortex_a8_b.s: Ditto.
3839         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3840         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3841         * testsuite/arm_cortex_a8_bl.s: Ditto.
3842         * testsuite/arm_cortex_a8_blx.s: Ditto.
3843         * testsuite/arm_cortex_a8_local.s: Ditto.
3844         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3845         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3846
3847 2010-09-08  Rafael Espindola  <espindola@google.com>
3848
3849         * Makefile.am (memory_test.stdout): Run readelf with -W.
3850         * Makefile.in: Regenerate.
3851         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3852         64 bit output.
3853
3854 2010-09-08  Rafael Espindola  <espindola@google.com>
3855
3856         * script-sections.cc (Script_sections::add_memory_region): Convert
3857         field precision to int.
3858         * script.cc (script_set_section_region, script_set_section_region):
3859         Convert field precision to int.
3860
3861 2010-09-08  Rafael Espindola  <espindola@google.com>
3862
3863         * arm.cc (do_finalize_sections): Create the __exidx_start and
3864         __exdix_end symbols even when the section is missing.
3865
3866 2010-09-08  Nick Clifton  <nickc@redhat.com>
3867
3868         * README: Remove claim that MEMORY is not supported.
3869         * expression.cc (script_exp_function_origin)
3870         (script_exp_function_length): Move from here to ...
3871         * script.cc: ... here.
3872         (script_set_section_region, script_add_memory)
3873         (script_parse_memory_attr, script_include_directive): New
3874         functions.
3875         * script-sections.cc
3876         (class Memory_region): New class.
3877         (class Output_section_definition): Add set_memory_region,
3878         set_section_vma, set_section_lma and get_section_name methods.
3879         (class Script_Sections): Add add_memory_region,
3880         find_memory_region, find_memory_region_origin,
3881         find_memory_region_length and set_memory_region methods.
3882         Have set_section_addresses method walk the list of set memory
3883         regions.
3884         Extend the print methos to display memory regions.
3885         * script-sections.h: Add prototypes for new methods.
3886         Add enum for MEMORY region attributes.
3887         * yyscript.y: Add support for parsing MEMORY regions.
3888         * script-c.h: Add prototypes for new functions.
3889         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3890         * testsuite/Makefile.in: Regenerate.
3891         * testsuite/memory_test.sh: New script.
3892         * testsuite/memory_test.s: New assembler source file.
3893         * testsuite/memory_test.t: New linker script.
3894
3895 2010-08-27  Doug Kwan  <dougkwan@google.com>
3896
3897         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3898         reference override an existing dynamic weak reference.
3899         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3900         * testsuite/Makefile.in: Regenerate.
3901         * testsuite/dyn_weak_ref.sh: New file.
3902         * testsuite/dyn_weak_ref_1.c: Ditto.
3903         * testsuite/dyn_weak_ref_2.c: Ditto.
3904
3905 2010-08-27  Ian Lance Taylor  <iant@google.com>
3906
3907         * incremental.h (class Incremental_input_entry): Add virtual
3908         destructor.
3909
3910 2010-08-27  Ian Lance Taylor  <iant@google.com>
3911
3912         * testsuite/start_lib_test_3.c: Mark t3 as used.
3913
3914 2010-08-27  Nick Clifton  <nickc@redhat.com>
3915
3916         * options.cc (version_script): Fix small typo in previous
3917         whitespace tidyup.
3918
3919 2010-08-25  Nick Clifton  <nickc@redhat.com>
3920
3921         * archive.cc: Formatting fixes: Remove whitespace between
3922         typename and following asterisk.  Remove whitespace between
3923         function name and opening parenthesis.
3924         * archive.h: Likewise.
3925         * arm.cc: Likewise.
3926         * attributes.cc: Likewise.
3927         * attributes.h: Likewise.
3928         * common.cc: Likewise.
3929         * copy-relocs.cc: Likewise.
3930         * dirsearch.h: Likewise.
3931         * dynobj.cc: Likewise.
3932         * ehframe.cc: Likewise.
3933         * ehframe.h: Likewise.
3934         * expression.cc: Likewise.
3935         * fileread.cc: Likewise.
3936         * fileread.h: Likewise.
3937         * gc.h: Likewise.
3938         * gold-threads.cc: Likewise.
3939         * gold.cc: Likewise.
3940         * i386.cc: Likewise.
3941         * icf.h: Likewise.
3942         * incremental-dump.cc: Likewise.
3943         * incremental.cc: Likewise.
3944         * layout.cc: Likewise.
3945         * layout.h: Likewise.
3946         * main.cc: Likewise.
3947         * merge.cc: Likewise.
3948         * merge.h: Likewise.
3949         * object.cc: Likewise.
3950         * object.h: Likewise.
3951         * options.cc: Likewise.
3952         * options.h: Likewise.
3953         * output.cc: Likewise.
3954         * output.h: Likewise.
3955         * plugin.cc: Likewise.
3956         * plugin.h: Likewise.
3957         * powerpc.cc: Likewise.
3958         * reloc.cc: Likewise.
3959         * script-c.h: Likewise.
3960         * script-sections.cc: Likewise.
3961         * script.cc: Likewise.
3962         * stringpool.cc: Likewise.
3963         * symtab.cc: Likewise.
3964         * symtab.h: Likewise.
3965         * target.cc: Likewise.
3966         * timer.cc: Likewise.
3967         * timer.h: Likewise.
3968         * version.cc: Likewise.
3969         * x86_64.cc: Likewise.
3970
3971 2010-08-24  Nick Clifton  <nickc@redhat.com>
3972
3973         PR 11899
3974         * layout.cc (segment_precedes): Sort segments by their physical
3975         addresses, if they have been set.
3976
3977 2010-08-23  Cary Coutant  <ccoutant@google.com>
3978
3979         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3980         symbols data.
3981         (Lib_group::include_member): Unlock object after deleting its
3982         symbols data.
3983         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3984         the bug fixed here.
3985
3986 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3987             Cary Coutant  <ccoutant@google.com>
3988
3989         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3990         constructor, and set_blocker.
3991         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3992         readsyms_blocker_.
3993         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3994         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3995         * testsuite/Makefile.am (start_lib_test): New test case.
3996         * testsuite/Makefile.in: Regenerate.
3997         * testsuite/start_lib_test_main.c: New file.
3998         * testsuite/start_lib_test_1.c: New file.
3999         * testsuite/start_lib_test_2.c: New file.
4000         * testsuite/start_lib_test_3.c: New file.
4001
4002 2010-08-19  Ian Lance Taylor  <iant@google.com>
4003
4004         * Makefile.in: Rebuild with automake 1.11.1.
4005         * aclocal.m4: Likewise.
4006         * testsuite/Makefile.in: Likewise.
4007
4008 2010-08-19  Ian Lance Taylor  <iant@google.com>
4009
4010         PR 10893
4011         * i386.cc (class Output_data_plt_i386): Update declarations.
4012         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4013         local_ifuncs_ fields.
4014         (Target_i386::do_plt_section_for_global): New function.
4015         (Target_i386::do_plt_section_for_local): New function.
4016         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4017         parameter; change all callers.  Initialize global_ifuncs_ and
4018         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4019         __rel_iplt_end.
4020         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4021         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4022         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4023         symbols.
4024         (Target_i386::make_plt_section): New function, broken out of
4025         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4026         (Target_i386::make_plt_entry): Call make_plt_section.
4027         (Target_i386::make_local_ifunc_plt_entry): New function.
4028         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4029         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4030         R_386_IRELATIVE to switch.
4031         (Target_i386::Scan::global): Likewise.
4032         (Target_i386::Relocate::relocate): Likewise.
4033         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4034         switch.
4035         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4036         (Target_x86_64::do_plt_section_for_global): New function.
4037         (Target_x86_64::do_plt_section_for_local): New function.
4038         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4039         parameter; change all callers.  If doing a static link define
4040         __rela_iplt_start and __rela_iplt_end.
4041         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4042         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4043         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4044         to point to .plt.
4045         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4046         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4047         switch.
4048         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4049         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4050         R_X86_64_IRELATIVE to switch.
4051         (Target_x86_64::Scan::global): Likewise.
4052         (Target_x86_64::Relocate::relocate): Likewise.
4053         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4054         switch.
4055         * target.h (class Target): Add plt_section_for_global and
4056         plt_section_for_local functions.  Add do_plt_section_for_global
4057         and do_plt_section_for_local virtual functions.
4058         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4059         clarifying comments.
4060         (Symbol::use_plt_offset): Handle IFUNC symbol.
4061         * object.cc (Sized_relobj::Sized_relobj): Initialize
4062         local_plt_offsets_.
4063         (Sized_relobj::local_has_plt_offset): New function.
4064         (Sized_relobj::local_plt_offset): New function.
4065         (Sized_relobj::set_local_plt_offset): New function.
4066         (Sized_relobj::do_count): Handle IFUNC symbol.
4067         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4068         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4069         is_ifunc_symbol functions.
4070         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4071         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4072         local_plt_offsets_ field.
4073         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4074         * output.h (class Output_section_data): Add non-const
4075         output_section function.
4076         (class Output_data_got): Update declarations.
4077         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4078         Add use_plt_offset parameter to global and local constructors.
4079         Change all callers.  Change local_sym_index_ field to 31 bits.
4080         Change GSYM_CODE and CONSTANT_CODE accordingly.
4081         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4082         doing a static link don't set sh_link field.
4083         (Output_data_got::Got_entry::write): Use PLT offset if
4084         appropriate.
4085         (Output_data_got::add_global_plt): New function.
4086         (Output_data_got::add_local_plt): New function.
4087         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4088         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4089         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4090         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4091         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4092         IFUNC conditional.
4093         * testsuite/ifunc-sel.h: New file.
4094         * testsuite/ifuncmain1.c: New file.
4095         * testsuite/ifuncmain1vis.c: New file.
4096         * testsuite/ifuncmod1.c: New file.
4097         * testsuite/ifuncdep2.c: New file.
4098         * testsuite/ifuncmain2.c: New file.
4099         * testsuite/ifuncmain3.c: New file.
4100         * testsuite/ifuncmod3.c: New file.
4101         * testsuite/ifuncmain4.c: New file.
4102         * testsuite/ifuncmain5.c: New file.
4103         * testsuite/ifuncmod5.c: New file.
4104         * testsuite/ifuncmain6pie.c: New file.
4105         * testsuite/ifuncmod6.c: New file.
4106         * testsuite/ifuncmain7.c: New file.
4107         * configure, testsuite/Makefile.in: Rebuild.
4108
4109 2010-08-18  Ian Lance Taylor  <iant@google.com>
4110
4111         * incremental.cc
4112         (Output_section_incremental_inputs::write_input_files): Add cast
4113         to avoid signed/unsigned comparison warning.
4114         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4115
4116 2010-08-12  Cary Coutant  <ccoutant@google.com>
4117
4118         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4119
4120 2010-08-13  Ian Lance Taylor  <iant@google.com>
4121
4122         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4123
4124 2010-08-12  Cary Coutant  <ccoutant@google.com>
4125             Doug Kwan  <dougkwan@google.com>
4126
4127         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4128         defintion overrides non-weak undef, remember that the original undef
4129         is not weak.
4130         * symtab.cc (Symbol_table::sized_write_global): For undef without
4131         an original weak binding, set binding to global in output.
4132         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4133         * testsuite/Makefile.in: Regenerate.
4134         * testsuite/strong_ref_weak_def.sh: New file.
4135         * testsuite/strong_ref_weak_def_1.c: Ditto.
4136         * testsuite/strong_ref_weak_def_2.c: Ditto.
4137
4138 2010-08-12  Cary Coutant  <ccoutant@google.com>
4139
4140         * testsuite/incremental_test.sh: Rewrite.
4141         * testsuite/incremental_test_1.c: Rewrite.
4142         * testsuite/incremental_test_2.c: Rewrite.
4143
4144 2010-08-12  Cary Coutant  <ccoutant@google.com>
4145
4146         * arm.cc (Target_arm::got_size): Add const.
4147         (Target_arm::got_entry_count): New function.
4148         (Target_arm::plt_entry_count): New function.
4149         (Target_arm::first_plt_entry_offset): New function.
4150         (Target_arm::plt_entry_size): New function.
4151         (Output_data_plt_arm::entry_count): New function.
4152         (Output_data_plt_arm::first_plt_entry_offset): New function.
4153         (Output_data_plt_arm::get_plt_entry_size): New function.
4154         * i386.cc (Target_i386::got_size): Add const.
4155         (Target_i386::got_entry_count): New function.
4156         (Target_i386::plt_entry_count): New function.
4157         (Target_i386::first_plt_entry_offset): New function.
4158         (Target_i386::plt_entry_size): New function.
4159         (Output_data_plt_i386::entry_count): New function.
4160         (Output_data_plt_i386::first_plt_entry_offset): New function.
4161         (Output_data_plt_i386::get_plt_entry_size): New function.
4162         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4163         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4164         * incremental.cc: Include target.h.
4165         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4166         parameter.  Adjust all callers.  Find incremental_got_plt section.
4167         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4168         section.
4169         (Output_section_incremental_inputs::set_final_data_size): Calculate
4170         size of incremental_got_plt section.
4171         (Output_section_incremental_inputs::do_write): Write the
4172         incremental_got_plt section.
4173         (Got_plt_view_info): New struct.
4174         (Local_got_offset_visitor): New class.
4175         (Global_got_offset_visitor): New class.
4176         (Global_symbol_visitor_got_plt): New class.
4177         (Output_section_incremental_inputs::write_got_plt): New function.
4178         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4179         Add parameter.  Adjust all callers.
4180         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4181         (Incremental_inputs::got_plt_section): New function.
4182         (Incremental_inputs::got_plt_section_): New data member.
4183         (Incremental_got_plt_reader): New class.
4184         * layout.cc (Layout::create_incremental_info_sections): Add the
4185         incremental_got_plt section.
4186         * object.h (Got_offset_list::get_list): New function.
4187         (Got offset_list::for_all_got_offsets): New function.
4188         (Sized_relobj::local_got_offset_list): New function.
4189         * powerpc.cc (Target_powerpc::got_size): Add const.
4190         (Target_powerpc::got_entry_count): New function.
4191         (Target_powerpc::plt_entry_count): New function.
4192         (Target_powerpc::first_plt_entry_offset): New function.
4193         (Target_powerpc::plt_entry_size): New function.
4194         (Output_data_plt_powerpc::entry_count): New function.
4195         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4196         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4197         * sparc.cc (Target_sparc::got_size): Add const.
4198         (Target_sparc::got_entry_count): New function.
4199         (Target_sparc::plt_entry_count): New function.
4200         (Target_sparc::first_plt_entry_offset): New function.
4201         (Target_sparc::plt_entry_size): New function.
4202         (Output_data_plt_sparc::entry_count): New function.
4203         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4204         (Output_data_plt_sparc::get_plt_entry_size): New function.
4205         * symtab.h (Symbol::got_offset_list): New function.
4206         (Symbol_table::for_all_symbols): New function.
4207         * target.h (Sized_target::got_entry_count): New function.
4208         (Sized_target::plt_entry_count): New function.
4209         (Sized_target::plt_entry_size): New function.
4210         * x86_64.cc (Target_x86_64::got_size): Add const.
4211         (Target_x86_64::got_entry_count): New function.
4212         (Target_x86_64::plt_entry_count): New function.
4213         (Target_x86_64::first_plt_entry_offset): New function.
4214         (Target_x86_64::plt_entry_size): New function.
4215         (Output_data_plt_x86_64::entry_count): New function.
4216         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4217         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4218
4219 2010-08-12  Cary Coutant  <ccoutant@google.com>
4220
4221         * archive.cc: Include incremental.h.
4222         (Archive::Archive): Initialize incremental_info_.
4223         (Archive::include_member): Record archive members in incremental info.
4224         (Add_archive_symbols::run): Record begin and end of an archive in
4225         incremental info.
4226         (Lib_group::include_member): Record objects in incremental info.
4227         * archive.h (Incremental_archive_entry): Forward declaration.
4228         (Archive::set_incremental_info): New member function.
4229         (Archive::incremental_info): New member function.
4230         (Archive::Unused_symbol_iterator): New class.
4231         (Archive::unused_symbols_begin): New member function.
4232         (Archive::unused_symbols_end): New member function.
4233         (Archive::incremental_info_): New data member.
4234         * incremental-dump.cc (find_input_containing_global): New function.
4235         (dump_incremental_inputs): Dump new incremental info sections.
4236         * incremental.cc: Include symtab.h.
4237         (Output_section_incremental_inputs): New class.
4238         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4239         new incremental info sections.
4240         (Sized_incremental_binary::do_check_inputs): Likewise.
4241         (Incremental_inputs::report_archive): Remove.
4242         (Incremental_inputs::report_archive_begin): New function.
4243         (Incremental_inputs::report_archive_end): New function.
4244         (Incremental_inputs::report_object): New function.
4245         (Incremental_inputs::finalize_inputs): Remove.
4246         (Incremental_inputs::report_input_section): New function.
4247         (Incremental_inputs::report_script): Rewrite.
4248         (Incremental_inputs::finalize): Do nothing but finalize string table.
4249         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4250         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4251         (Incremental_inputs::create_data_sections): New function.
4252         (Incremental_inputs::relocs_entsize): New function.
4253         (Output_section_incremental_inputs::set_final_data_size): New function.
4254         (Output_section_incremental_inputs::do_write): New function.
4255         (Output_section_incremental_inputs::write_header): New function.
4256         (Output_section_incremental_inputs::write_input_files): New function.
4257         (Output_section_incremental_inputs::write_info_blocks): New function.
4258         (Output_section_incremental_inputs::write_symtab): New function.
4259         * incremental.h (Incremental_script_entry): Forward declaration.
4260         (Incremental_object_entry): Forward declaration.
4261         (Incremental_archive_entry): Forward declaration.
4262         (Incremental_inputs): Forward declaration.
4263         (Incremental_inputs_header_data): Remove.
4264         (Incremental_inputs_header): Remove.
4265         (Incremental_inputs_header_write): Remove.
4266         (Incremental_inputs_entry_data): Remove.
4267         (Incremental_inputs_entry): Remove.
4268         (Incremental_inputs_entry_write): Remove.
4269         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4270         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4271         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4272         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4273         Likewise.
4274         (Incremental_input_entry): New class.
4275         (Incremental_script_entry): New class.
4276         (Incremental_object_entry): New class.
4277         (Incremental_archive_entry): New class.
4278         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4279         (Incremental_inputs::report_inputs): Remove.
4280         (Incremental_inputs::report_archive): Remove.
4281         (Incremental_inputs::report_archive_begin): New function.
4282         (Incremental_inputs::report_archive_end): New function.
4283         (Incremental_inputs::report_object): Change prototype.
4284         (Incremental_inputs::report_input_section): New function.
4285         (Incremental_inputs::report_script): Change prototype.
4286         (Incremental_inputs::get_reloc_count): New function.
4287         (Incremental_inputs::set_reloc_count): New function.
4288         (Incremental_inputs::create_data_sections): New function.
4289         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4290         (Incremental_inputs::inputs_section): New function.
4291         (Incremental_inputs::symtab_section): New function.
4292         (Incremental_inputs::relocs_section): New function.
4293         (Incremental_inputs::get_stringpool): Add const.
4294         (Incremental_inputs::command_line): Add const.
4295         (Incremental_inputs::inputs): Remove.
4296         (Incremental_inputs::command_line_key): New function.
4297         (Incremental_inputs::input_file_count): New function.
4298         (Incremental_inputs::input_files): New function.
4299         (Incremental_inputs::relocs_entsize): New function.
4300         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4301         (Incremental_inputs::finalize_inputs): Remove.
4302         (Incremental_inputs::Input_info): Remove.
4303         (Incremental_inputs::lock_): Remove.
4304         (Incremental_inputs::inputs_): Change type.
4305         (Incremental_inputs::inputs_map_): Remove.
4306         (Incremental_inputs::current_object_entry_): New data member.
4307         (Incremental_inputs::inputs_section_): New data member.
4308         (Incremental_inputs::symtab_section_): New data member.
4309         (Incremental_inputs::relocs_section_): New data member.
4310         (Incremental_inputs::reloc_count_): New data member.
4311         (Incremental_inputs_reader): New class.
4312         (Incremental_symtab_reader): New class.
4313         (Incremental_relocs_reader): New class.
4314         * layout.cc (Layout::finalize): Move finalization of incremental info
4315         and creation of incremental info sections to follow finalization of
4316         symbol table.  Set offsets for postprocessing sections.
4317         (Layout::create_incremental_info_sections): Call
4318         Incremental_inputs::create_data_sections.  Add incremental symtab
4319         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4320         sections to layout after input sections.
4321         * layout.h (struct Timespec): Forward declaration.
4322         (Layout::incremental_inputs): Add const.
4323         (Layout::create_incremental_info_sections): Add parameter.
4324         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4325         * object.cc: Include incremental.h.
4326         (Relobj::finalize_incremental_relocs): New function.
4327         (Sized_relobj::do_layout): Record input sections in incremental info.
4328         * object.h (Object::output_section): New function.
4329         (Object::output_section_offset): Moved from Relobj.
4330         (Object::get_incremental_reloc_base): New function.
4331         (Object::get_incremental_reloc_count): New function.
4332         (Object::do_output_section): New function.
4333         (Object::do_output_section_offset): Moved from Relobj.
4334         (Object::do_get_incremental_reloc_base): New function.
4335         (Object::do_get_incremental_reloc_count): New function.
4336         (Object::Object): Initialize new data members.
4337         (Relobj::output_section): Renamed do_output_section and moved to
4338         protected.
4339         (Relobj::output_section_offset): Moved to Object.
4340         (Relobj::do_get_incremental_reloc_base): New function.
4341         (Relobj::do_get_incremental_reloc_count): New function.
4342         (Relobj::allocate_incremental_reloc_counts): New function.
4343         (Relobj::count_incremental_reloc): New function.
4344         (Relobj::finalize_incremental_relocs): New function.
4345         (Relobj::next_incremental_reloc_index): New function.
4346         (Relobj::reloc_counts_): New data member.
4347         (Relobj::reloc_bases_): New data member.
4348         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4349         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4350         (Sized_relobj::incremental_relocs_scan): New function.
4351         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4352         (Sized_relobj::incremental_relocs_write): New function.
4353         (Sized_relobj::incremental_relocs_write_reltype): New function.
4354         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4355         incremental link.
4356         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4357         archives and object files elsewhere.
4358         (Add_symbols::run): Report object files here.
4359         (Finish_group::run): Report end of archive at end of group.
4360         * reloc.cc: Include layout.h, incremental.h.
4361         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4362         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4363         (Sized_relobj::incremental_relocs_scan): New function.
4364         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4365         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4366         (Sized_relobj::incremental_relocs_write): New function.
4367         (Sized_relobj::incremental_relocs_write_reltype): New function.
4368         * script.cc (read_input_script): Rewrite test for incremental link.
4369         Change call to Incremental_inputs::report_script.
4370         * symtab.h (Symbol_table::first_global_index): New function.
4371         (Symbol_table::output_count): New function.
4372
4373 2010-08-12  Doug Kwan  <dougkwan@google.com>
4374
4375         * arm.cc (Target_arm::merge_object_attributes): Check command line
4376         options --no-wchar-size-warning and --no-enum-size-warning.
4377         * options.h (General_options): Add ld-compatible options
4378         --no-enum-size-warning and --no-wchar-size-warning.
4379
4380 2010-08-04  Ian Lance Taylor  <iant@google.com>
4381
4382         * x86_64.cc (Target_x86_64::Scan::local): Use
4383         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4384         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4385         (Target_x86_64::Scan::global): Likewise.
4386         (Target_x86_64::Relocate::relocate): Likewise.
4387         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4388         Likewise.
4389
4390 2010-08-03  Cary Coutant  <ccoutant@google.com>
4391
4392         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4393         to reserve space in merged_strings vector. Keep total input size
4394         for stats.
4395         (Output_merge_string::do_print_merge_stats): Print total input size.
4396         * merge.h (Output_merge_string): Add input_size_ field.
4397         * stringpool.cc (Stringpool_template::string_length): Move
4398         implementations out of Stringpool_template class and place in
4399         stringpool.h.
4400         * stringpool.h (string_length): Move out of Stringpool_template.
4401
4402 2010-08-03  Ian Lance Taylor  <iant@google.com>
4403
4404         PR 11712
4405         * layout.cc (relaxation_loop_body): If address of load segment is
4406         set, adjust address to include headers if possible.
4407
4408 2010-08-03  Ian Lance Taylor  <iant@google.com>
4409
4410         * version.cc (version_string): Bump to 1.10.
4411
4412 2010-08-03  Ian Lance Taylor  <iant@google.com>
4413
4414         PR 11805
4415         * layout.h (enum Output_section_order): Define.
4416         (class Layout): Update declarations.
4417         * layout.cc (Layout::get_output_section): Add order parameter.
4418         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4419         is_first_non_relro parameters.  Change all callers.
4420         (Layout::choose_output_section): Likewise.
4421         (Layout::add_output_section_data): Likewise.
4422         (Layout::make_output_section): Likewise.  Set order.
4423         (Layout::default_section_order): New function.
4424         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4425         * output.cc (Output_section::Output_section): Initialize order_.
4426         Don't initialize deleted fields.
4427         (Output_segment::Output_segment): Don't initialize deleted
4428         fields.
4429         (Output_segment::add_output_section_to_load): New function
4430         replacing add_output_section.  Change all callers to call this or
4431         add_output_section_to_nonload.
4432         (Output_segment::add_output_section_to_nonload): New function.
4433         (Output_segment::remove_output_section): Rewrite.
4434         (Output_segment::add_initial_output_data): Likewise.
4435         (Output_segment::has_any_data_sections): Likewise.
4436         (Output_segment::is_first_section_relro): Likewise.
4437         (Output_segment::maximum_alignment): Likewise.
4438         (Output_segment::has_dynamic_reloc): New function replacing
4439         dynamic_reloc_count.  Change all callers.
4440         (Output_segment::has_dynamic_reloc_list): New function replacing
4441         dynamic_reloc_count_list.  Change all callers.
4442         (Output_segment::set_section_addresses): Rewrite.
4443         (Output_segment::set_offset): Rewrite.
4444         (Output_segment::find_first_and_last_list): Remove.
4445         (Output_segment::set_tls_offsets): Rewrite.
4446         (Output_segment::first_section_load_address): Likewise.
4447         (Output_segment::output_section_count): Likewise.
4448         (Output_segment::section_with_lowest_load_address): Likewise.
4449         (Output_segment::write_section_headers): Likewise.
4450         (Output_segment::print_sections_to_map): Likewise.
4451         * output.h (class Output_data): Remove dynamic_reloc_count_
4452         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4453         (Output_data::add_dynamic_reloc): Rewrite.
4454         (Output_data::has_dynamic_reloc): New function.
4455         (Output_data::dynamic_reloc_count): Remove.
4456         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4457         is_last_relro_, is_first_non_relro_, is_interp_,
4458         is_dynamic_linker_section_ fields.  Add order and set_order
4459         functions.  Remove is_relro_local, set_is_relro_local,
4460         is_last_relro, set_is_last_relro, is_first_non_relro,
4461         set_is_first_non_relro functions, is_interp, set_is_interp,
4462         is_dynamic_linker_section, and set_is_dynamic_linker_section
4463         functions.
4464         (class Output_segment): Change Output_data_list from std::list to
4465         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4466         output_bss_ fields.  Update declarations.
4467
4468 2010-08-02  Ian Lance Taylor  <iant@google.com>
4469
4470         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4471         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4472         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4473
4474 2010-08-02  Ian Lance Taylor  <iant@google.com>
4475
4476         PR 11855
4477         * script.cc (Script_options::Script_options): Initialize
4478         symbol_definitions_ and symbol_references_.
4479         (Script_options::add_symbol_assignment): Update
4480         symbol_definitions_ and symbol_references_.
4481         (Script_options::add_symbol_reference): New function.
4482         (script_symbol): New function.
4483         * script.h (class Script_options): Add symbol_definitions_ and
4484         symbol_references_ fields.
4485         (Script_options::referenced_const_iterator): New type.
4486         (Script_options::referenced_begin): New function.
4487         (Script_options::referenced_end): New function.
4488         (Script_options::is_referenced): New function.
4489         (Script_options::any_unreferenced): New function.
4490         * script-c.h (script_symbol): Declare.
4491         * yyscript.y (exp): Call script_symbol.
4492         * symtab.cc: Include "script.h".
4493         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4494         Change all callers.  Check symbols referenced by scripts.
4495         (Symbol_table::add_undefined_symbols_from_command_line): Add
4496         layout parameter.  Change all callers.
4497         (Symbol_table::do_add_undefined_symbols_from_command_line):
4498         Likewise.  Break out loop body.  Check symbols referenced by
4499         scripts.
4500         (Symbol_table::add_undefined_symbol_from_command_line): New
4501         function broken out of
4502         do_add_undefined_symbols_from_command_line.
4503         * symtab.h (class Symbol_table): Update declarations.
4504         * archive.cc: Include "layout.h".
4505         (Archive::should_include_member): Add layout parameter.  Change
4506         all callers.  Check for symbol mentioned in expression.
4507         * archive.h (class Archive): Update declaration.
4508         * object.cc (Sized_relobj::do_should_include_member): Add layout
4509         parameter.
4510         * object.h (Object::should_include_member): Add layout parameter.
4511         Change all callers.
4512         (Object::do_should_include_member): Add layout parameter.
4513         (class Sized_relobj): Update declaration.
4514         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4515         parameter.
4516         * dynobj.h (class Sized_dynobj): Update declaration.
4517         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4518         layout parameter.
4519         * plugin.h (class Sized_pluginobj): Update declaration.
4520
4521 2010-08-02  Ian Lance Taylor  <iant@google.com>
4522
4523         PR 11866
4524         * output.cc (Output_segment::set_offset): Search for the first and
4525         last sections rather than assuming that the list is in order.
4526         (Output_segment::find_first_and_last_list): New function.
4527         * output.h (class Output_segment): Update declarations.
4528         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4529         (relro_strip_test_SOURCES): New variable.
4530         (relro_strip_test_DEPENDENCIES): New variable.
4531         (relro_strip_test_LDFLAGS): New variable.
4532         (relro_strip_test_LDADD): New variable.
4533         (relro_strip_test.so): New target.
4534
4535 2010-08-02  Ian Lance Taylor  <iant@google.com>
4536
4537         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4538         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4539         (Target_i386::got_tlsdesc_section): New function.
4540         (Target_i386::got_section): Create space for GOT entries for
4541         TLSDESC relocations.
4542         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4543         R_386_TLS_GOTDESC.
4544         (Target_i386::Scan::global): Likewise.
4545         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4546         using TLSDESC GOT.
4547         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4548         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4549         (Target_x86_64::got_tlsdesc_section): New function.
4550         (Target_x86_64::got_section): Create space for GOT entries for
4551         TLSDESC relocations.
4552         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4553         R_386_TLS_GOTDESC.
4554         (Target_x86_64::Scan::global): Likewise.
4555         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4556         using TLSDESC GOT.
4557
4558 2010-08-02  Ian Lance Taylor  <iant@google.com>
4559
4560         * testsuite/final_layout.sh: Use dc to convert from hex to
4561         decimal.
4562
4563 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4564
4565         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4566         paramter to the call to gold::gc_process_relocs.
4567         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4568         paramter to the call to gold::gc_process_relocs.
4569         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4570         parameter to the call to gold::gc_process_relocs.
4571         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4572         template parameter to the call to gold::gc_process_relocs.
4573         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4574         paramter to the call to gold::gc_process_relocs.
4575         * gc.h (get_embedded_addend_size): New function.
4576         (gc_process_relocs): Save the size of the reloc for use by ICF.
4577         * icf.cc (get_section_contents): Get the addend from the text section
4578         for SHT_REL relocation sections.
4579         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4580         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4581         * int_encoding.h (read_from_pointer): New overloaded function.
4582         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4583         * testsuite/icf_sht_rel_addend_test.sh: New file.
4584         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4585         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4586
4587 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4588
4589         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4590         * Makefile.in: Regenerate.
4591         * testsuite/Makefile.in: Regenerate.
4592
4593 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4594
4595         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4596         * gold/testsuite/debug_msg.cc: Likewise.
4597         * gold/testsuite/odr_violation1.cc
4598         * gold/testsuite/odr_violation2.cc
4599
4600 2010-07-21  Cary Coutant  <ccoutant@google.com>
4601
4602         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4603         string, and length fields.
4604         (Output_merge_string::Merged_strings_list): New type.
4605         (Output_merge_string::Merged_strings_lists): New typedef.
4606         (Output_merge_string): Replace merged_strings_ with
4607         merged_strings_lists_.
4608         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4609         Merged_strings_list per input object and section.  Don't store pointer
4610         to the string.  Don't store length with each merged string entry.
4611         (Output_merge_string::finalize_merged_data): Loop over list of merged
4612         strings lists.  Recompute length of each merged string.
4613
4614 2010-07-15  Cary Coutant  <ccoutant@google.com>
4615
4616         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4617         here.
4618
4619 2010-07-14  Ian Lance Taylor  <iant@google.com>
4620
4621         * descriptors.cc (Descriptors::open): Report correct name in error
4622         message.
4623
4624 2010-07-13  Doug Kwan  <dougkwan@google.com>
4625
4626         * arm.cc (Arm_input_section::Arm_input_section): For a
4627         SHT_ARM_EXIDX section, always keeps the input sections.
4628         (Arm_input_section::set_exidx_section_link): New method.
4629         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4630         has_errors_ to false.
4631         (Arm_exidx_input_section::has_errors,
4632         Arm_exidx_input_section::set_has_errors): New methods.
4633         (Arm_exidx_input_section::has_errors_): New data member.
4634         (Arm_relobj::get_exidx_shndx_list): New method.
4635         (Arm_output_section::append_text_sections_to_list): Do not skip
4636         section without SHF_EXECINSTR.
4637         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4638         errors.
4639         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4640         section header.  Make error messages more verbose.  Check for
4641         a non-executable section linked to an EXIDX section.
4642         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4643         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4644         check that there is no deferred EXIDX section if we exit early.
4645         Instead of not making an EXIDX section in case of an error, make one
4646         and set the has_errors flag of it.
4647         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4648         in a relocatable link.
4649         (Target_arm::do_relax): Look for the EXIDX output section instead of
4650         assuming that it is called .ARM.exidx.
4651         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4652         section list.  Do not check for SHF_EXECINSTR section flags but
4653         skip any input section with errors.
4654         * output.cc (Output_section::Output_section): Initialize
4655         always_keeps_input_sections_ to false.
4656         (Output_section::add_input_section): Check for
4657         always_keeps_input_sections_.
4658         *  output.h (Output_section::always_keeps_input_sections,
4659         Output_section::set_always_keeps_input_sections): New methods.
4660         (Output_section::always_keeps_input_sections): New data member.
4661
4662 2010-07-13  Rafael Espindola  <espindola@google.com>
4663
4664         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4665         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4666
4667 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4668             Ian Lance Taylor  <iant@google.com>
4669
4670         * output.h (Output_section_lookup_maps::add_merge_section):
4671         Correct check of whether value was inserted.
4672         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4673         (Output_section_lookup_maps::add_relaxed_input_section):
4674         Likewise.
4675         * arm.cc (Target_arm::got_section): Remove used local os.
4676         * i386.cc (Target_i386::got_section): Likewise.
4677         * x86_64.cc (Target_x86_64::got_section): Likewise.
4678         * sparc.cc (Target_sparc::got_section): Likewise.
4679         (Target_sparc::relocate): Remove unused local have_got_offset.
4680         * powerpc.cc (Target_powerpc::relocate): Likewise.
4681
4682 2010-07-13  Ian Lance Taylor  <iant@google.com>
4683
4684         * compressed_output.cc (zlib_decompress): Fix signature in
4685         !HAVE_ZLIB_H case.
4686
4687         * archive.cc (Archive::include_member): Unlock an external member
4688         of a thin archive.  Don't bother to delete an object we know is
4689         NULL.
4690
4691 2010-07-12  Cary Coutant  <ccoutant@google.com>
4692
4693         * compressed_output.cc (zlib_decompress): New function.
4694         (get_uncompressed_size): New function.
4695         (decompress_input_section): New function.
4696         * compressed_output.h (get_uncompressed_size): New function.
4697         (decompress_input_section): New function.
4698         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4699         Handle compressed debug sections.
4700         * layout.cc (is_compressed_debug_section): New function.
4701         (Layout::output_section_name): Map compressed section names to
4702         canonical names.
4703         * layout.h (is_compressed_debug_section): New function.
4704         (is_debug_info_section): Recognize compressed debug sections.
4705         * merge.cc: Include compressed_output.h.
4706         (Output_merge_data::do_add_input_section): Handle compressed
4707         debug sections.
4708         (Output_merge_string::do_add_input_section): Handle compressed
4709         debug sections.
4710         * object.cc: Include compressed_output.h.
4711         (Sized_relobj::Sized_relobj): Initialize new data members.
4712         (build_compressed_section_map): New function.
4713         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4714         * object.h (Object::section_is_compressed): New method.
4715         (Object::do_section_is_compressed): New method.
4716         (Sized_relobj::Compressed_section_map): New type.
4717         (Sized_relobj::do_section_is_compressed): New method.
4718         (Sized_relobj::compressed_sections_): New data member.
4719         * output.cc (Output_section::add_input_section): Handle compressed
4720         debug sections.
4721         * reloc.cc: Include compressed_output.h.
4722         (Sized_relobj::write_sections): Handle compressed debug sections.
4723
4724 2010-07-08  Cary Coutant  <ccoutant@google.com>
4725
4726         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4727         weak when resolving to a dynamic def.
4728         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4729         for weak undef/dynamic def cases. Adjust callers.
4730         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4731         undef_binding_weak_.
4732         (Symbol_table::sized_write_globals): Adjust symbol binding.
4733         (Symbol_table::sized_write_symbol): Add binding parameter.
4734         * symtab.h (Symbol::set_undef_binding): New method.
4735         (Symbol::is_undef_binding_weak): New method.
4736         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4737         (Symbol_table::should_override): Add new parameter.
4738         (Symbol_table::sized_write_symbol): Add new parameter.
4739
4740         * testsuite/weak_undef_file1.cc: Add new test case.
4741         * testsuite/weak_undef_file2.cc: Fix header comment.
4742         * testsuite/weak_undef_test.cc: Add new test case.
4743
4744 2010-06-29  Doug Kwan  <dougkwan@google.com>
4745
4746         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4747         Initialize USE_SYMBOL_.
4748         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4749         definition.
4750         (Arm_reloc_property::uses_symbol_): New data member declaration.
4751         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4752         uses symbol value and symbol is undefined but not weakly undefined.
4753
4754 2010-06-28  Rafael Espindola  <espindola@google.com>
4755
4756         * plugin.cc (Plugin::load): Use dlerror.
4757
4758 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4759
4760         * symtab.cc (detect_odr_violations): When reporting an ODR
4761         violation, report an object where the symbol is defined.
4762
4763 2010-06-25  Doug Kwan  <dougkwan@google.com>
4764
4765         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4766         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4767         definition.
4768         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4769         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4770         target hook to detect function points.
4771         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4772         * icf.h (Icf::check_section_for_function_pointers): Change type of
4773         parameter SECTION_NAME to const reference to std::string.  Use
4774         target hook to determine if section may have unsafe pointers.
4775         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4776         method definition.
4777
4778 2010-06-21  Rafael Espindola  <espindola@google.com>
4779
4780         * fileread.cc (Input_file::find_fie): New
4781         (Input_file::open): Use Input_file::find_fie.
4782         * fileread.h (Input_file::find_fie): New
4783         * plugin.cc (set_extra_library_path): New.
4784         (Plugin::load): Add set_extra_library_path to the transfer vector.
4785         (Plugin_manager::set_extra_library_path): New.
4786         (Plugin_manager::add_input_file): Use the extra search path if set.
4787         (set_extra_library_path(): New.
4788         * plugin.h (Plugin_manager): Add set_extra_library_path and
4789         extra_search_path_.
4790
4791 2010-06-19  Cary Coutant  <ccoutant@google.com>
4792
4793         * layout.cc (gdb_sections): Add .debug_types.
4794         (lines_only_debug_sections): Likewise.
4795
4796 2010-06-18  Rafael Espindola  <espindola@google.com>
4797
4798         * plugin.cc (add_input_file,add_input_library)
4799         (Plugin_manager::add_input_file): Make filename arguments const.
4800         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4801         const.
4802
4803 2010-06-16  Doug Kwan  <dougkwan@google.com>
4804
4805         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4806         .ARM.attributes section if we have not merged any input
4807         attributes sections.
4808
4809 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4810
4811         * arm.cc: Allow combining objects with no EABI version
4812         information.
4813
4814 2010-06-15  Rafael Espindola  <espindola@google.com>
4815
4816         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4817
4818 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4819
4820         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4821         (struct iovec): Correct !HAVE_READV definition.
4822
4823 2010-06-10  Cary Coutant  <ccoutant@google.com>
4824
4825         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4826         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4827         reloc sections.
4828         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4829
4830         PR 11683
4831         * symtab.h (Symbol::is_placeholder): New member function.
4832         * target-reloc.h (relocate_section): Check for placeholder symbols.
4833
4834         * testsuite/Makefile.am (plugin_test_8): New test.
4835         (plugin_test_9): New test.
4836         * testsuite/Makefile.in: Regenerate.
4837
4838 2010-06-09  Nick Clifton  <nickc@redhat.com>
4839
4840         * yyscript.y (input_list_element): Allow strings prefixed with
4841         the '-' character.  Treat these as libraries.
4842         * script.cc (script_add_library): New function.  Adds a library
4843         specified by "-l<name>" found in an input script.
4844         * script-c.h: Add prototype for script_add_library.
4845
4846 2010-06-07  Doug Kwan  <dougkwan@google.com>
4847
4848         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4849         Restrict stub-group size to be within long conditional branch
4850         range when working around cortex-A8 erratum.
4851
4852 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4853
4854         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4855         #ifdef typo.
4856
4857 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4858
4859         PR gold/11658
4860         * output.cc
4861         (Output_section::Input_section_sort_entry::compare_section_ordering):
4862         Change to return non-zero correctly.
4863         (Output_section::Input_section_sort_section_order_index_compare
4864         ::operator()): Change to fix ambiguity in comparisons.
4865
4866 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4867
4868         * gold.h (is_wildcard_string): New function.
4869         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4870         (Layout::layout_eh_frame): Ditto.
4871         (Layout::find_section_order_index): New method.
4872         (Layout::read_layout_from_file): New method.
4873         * layout.h (Layout::find_section_order_index): New method.
4874         (Layout::read_layout_from_file): New method.
4875         (Layout::input_section_position_): New private member.
4876         (Layout::input_section_glob_): New private member.
4877         * main.cc (main): Call read_layout_from_file here.
4878         * options.h (--section-ordering-file): New option.
4879         * output.cc (Output_section::input_section_order_specified_): New
4880         member.
4881         (Output_section::Output_section): Initialize new member.
4882         (Output_section::add_input_section): Add new parameter.
4883         Keep input sections when --section-ordering-file is used.
4884         (Output_section::set_final_data_size): Sort input sections when
4885         section ordering file is specified.
4886         (Output_section::Input_section_sort_entry): Add new parameter.
4887         Check sorting type.
4888         (Output_section::Input_section_sort_entry::compare_section_ordering):
4889         New method.
4890         (Output_section::Input_section_sort_compare::operator()): Change to
4891         consider section_order_index.
4892         (Output_section::Input_section_sort_init_fini_compare::operator()):
4893         Change to consider section_order_index.
4894         (Output_section::Input_section_sort_section_order_index_compare
4895         ::operator()): New method.
4896         (Output_section::sort_attached_input_sections): Change to sort
4897         according to section order when specified.
4898         (Output_section::add_input_section<32, true>): Add new parameter.
4899         (Output_section::add_input_section<64, true>): Add new parameter.
4900         (Output_section::add_input_section<32, false>): Add new parameter.
4901         (Output_section::add_input_section<64, false>): Add new parameter.
4902         * output.h (Output_section::add_input_section): Add new parameter.
4903         (Output_section::input_section_order_specified): New
4904         method.
4905         (Output_section::set_input_section_order_specified): New method.
4906         (Input_section::Input_section): Initialize section_order_index_.
4907         (Input_section::section_order_index): New method.
4908         (Input_section::set_section_order_index): New method.
4909         (Input_section::section_order_index_): New member.
4910         (Input_section::Input_section_sort_section_order_index_compare): New
4911         struct.
4912         (Output_section::input_section_order_specified_): New member.
4913         * script-sections.cc (is_wildcard_string): Delete and move modified
4914         method to gold.h.
4915         (Output_section_element_input::Output_section_element_input): Modify
4916         call to is_wildcard_string.
4917         (Output_section_element_input::Input_section_pattern
4918         ::Input_section_pattern): Ditto.
4919         (Output_section_element_input::Output_section_element_input): Ditto.
4920         * testsuite/Makefile.am (final_layout): New test case.
4921         * testsuite/Makefile.in: Regenerate.
4922         * testsuite/final_layout.cc: New file.
4923         * testsuite/final_layout.sh: New file.
4924
4925 2010-06-01  Rafael Espindola  <espindola@google.com>
4926
4927         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4928
4929 2010-06-01  Rafael Espindola  <espindola@google.com>
4930
4931         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4932         visibility of symbols.
4933
4934 2010-05-27  Doug Kwan  <dougkwan@google.com>
4935
4936         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4937         from start of output section instead of address for a local symbol
4938         in a merged or relaxed section when doing a relocatable link.
4939
4940 2010-05-26  Rafael Espindola  <espindola@google.com>
4941
4942        PR 11604
4943         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4944         adding sections the garbage collector removed.
4945         * gold/testsuite/Makefile.am: Add test.
4946         * gold/testsuite/Makefile.in: Regenerate.
4947         * gold/testsuite/plugin_test_7.sh: New.
4948         * gold/testsuite/plugin_test_7_1.c: New.
4949         * gold/testsuite/plugin_test_7_2.c: New.
4950
4951 2010-05-26  Rafael Espindola  <espindola@google.com>
4952
4953         * script-sections.cc (Output_section_definition::set_section_addresses):
4954         Check for --section-start.
4955
4956 2010-05-26  Doug Kwan  <dougkwan@google.com>
4957
4958         * arm.cc (Arm_scan_relocatable_relocs): New class.
4959         (Target_arm::relocate_special_relocatable): New method.
4960         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4961         (Arm_relocate_functions::thumb_branch_common): Same.
4962         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4963         instead of Default_scan_relocatable_relocs.
4964         * target-reloc.h (relocate_for_relocatable): Let target handle
4965         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4966         * target.h (Sized_target::relocate_special_relocatable): New method.
4967
4968 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4969
4970         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4971
4972 2010-05-23  Doug Kwan  <dougkwan@google.com>
4973
4974         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4975         instead of a cast.
4976         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4977         with a direct branch, not a conditional branch, to a stub.
4978         * merge.cc (Output_merge_base::record_input_section): New method
4979         defintion.
4980         (Output_merge_data::do_add_input_section): Record input section if
4981         keeps-input-sections flag is set.
4982         (Output_merge_string::do_add_input_section): Ditto.
4983         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4984         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4985         INPUT_SECTIONS_.
4986         (Output_merge_base::keeps_input_sections,
4987         Output_merge_base::set_keeps_input_sections,
4988         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4989         method definitions.
4990         (Output_merge_base::Input_sections): New type declaration.
4991         (Output_merge_base::input_sections_begin,
4992         Output_merge_base::input_sections_end,
4993         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4994         (Output_merge_base::bool keeps_input_sections_,
4995         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4996         Output_merge_base::input_sections_): New data members.
4997         (Output_merge_data::do_set_keeps_input_sections): New method
4998         defintion.
4999         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5000         * output.cc (Output_section::Input_section::relobj): Move method
5001         defintion from class declaration to here and handle merge sections.
5002         (Output_section::Input_section::shndx): Ditto.
5003         (Output_section::Output_section): Remove initializations of removed
5004         data members and initialize new data member LOOKUP_MAPS_.
5005         (Output_section::add_input_section): Set keeps-input-sections flag
5006         for a newly created merge output section as appropriate.  Adjust code
5007         to use Output_section_lookup_maps class.
5008         (Output_section::add_relaxed_input_section): Adjst code for lookup
5009         maps code refactoring.
5010         (Output_section::add_merge_input_section): Add a new parameter
5011         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5012         class.  If adding input section to a newly created merge output
5013         section fails, remove the new merge section.
5014         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5015         Adjust code for use of the Output_section_lookup_maps class.
5016         (Output_section::find_merge_section): Ditto.
5017         (Output_section::build_lookup_maps): New method defintion.
5018         (Output_section::find_relaxed_input_section): Adjust code to use
5019         Output_section_lookup_maps class.
5020         (Output_section::get_input_sections): Export merge sections.  Adjust
5021         code to use Output_section_lookup_maps class.
5022         (Output_section:::add_script_input_section): Adjust code to use
5023         Output_section_lookup_maps class.  Update lookup maps for merge
5024         sections also.
5025         (Output_section::discard_states): Use Output_section_lookup_maps.
5026         (Output_section::restore_states): Same.
5027         * output.h (Merge_section_properties): Move class defintion out of
5028         Output_section.
5029         (Output_section_lookup_maps): New class.
5030         (Output_section::Input_section::is_merge_section): New method
5031         defintion.
5032         (Output_section::Input_section::relobj): Move defintion out of class
5033         defintion.  Declare method only.
5034         (Output_section::Input_section::shndx): Ditto.
5035         (Output_section::Input_section::output_merge_base): New method defintion.
5036         (Output_section::Input_section::u2_.pomb): New union field.
5037         (Output_section::Merge_section_by_properties_map,
5038         Output_section::Output_section_data_by_input_section_map,
5039         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5040         Remove types.
5041         (Output_section::add_merge_input_section): Add new parameter
5042         KEEPS_INPUT_SECTIONS.
5043         (Output_section::build_lookup_maps): New method declaration.
5044         (Output_section::merge_section_map_,
5045         Output_section::merge_section_by_properties_map_,
5046         Output_section::relaxed_input_section_map_,
5047         Output_section::is_relaxed_input_section_map_valid_): Remove data
5048         members.
5049         (Output_section::lookup_maps_): New data member.
5050
5051 2010-05-21  Doug Kwan  <dougkwan@google.com>
5052
5053         PR gold/11619
5054         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5055         avoid a compilation error.
5056
5057 2010-05-19  Rafael Espindola  <espindola@google.com>
5058
5059         * script-sections.cc (Output_section_definition::allocate_to_segment):
5060         Update the phdrs_list even when the output section is NULL.
5061         * testsuite/Makefile.am: Add test.
5062         * testsuite/Makefile.in: Regenerate.
5063         * testsuite/script_test_9.cc: New.
5064         * testsuite/script_test_9.sh: New.
5065         * testsuite/script_test_9.t: New.
5066
5067 2010-05-19  Doug Kwan  <dougkwan@google.com>
5068
5069         * arm.cc (Arm_input_section::original_size): New method.
5070         (Arm_input_section::do_addralign): Add a cast.
5071         (Arm_input_section::do_output_offset): Remove static cast.
5072         (Arm_input_section::original_addralign,
5073          Arm_input_section::original_size_): Change type to uint32_t.
5074         (Arm_input_section::init): Add safe casts for section alignment
5075         and size.
5076         (Arm_input_section::set_final_data_size): Do not set address and
5077         offset of stub table.
5078         (Arm_output_section::fix_exidx_coverage): Change use of of
5079         Output_section::Simple_input_section to that of
5080         Output_section::Input_section.
5081         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5082         except for the first pass.
5083         * output.cc (Output_section::get_input_sections): Change type of
5084         input_sections to std::list<Input_section>.
5085         (Output_section::add_script_input_section): Rename from
5086         Output_section::add_simple_input_section.  Change type of SIS
5087         parameter from Simple_input_section to Input_section.
5088         * output.h (Output_section::Simple_input_section): Remove class.
5089         (Output_section::Input_section): Change class visibility to public.
5090         (Output_section::Input_section::addralign): Use stored alignments
5091         for special input sections if set.
5092         (Output_section::Input_section::set_addralign): New method.
5093         (Output_section::get_input_sections): Change parameter type from
5094         list of Simple_input_section to list of Input_section.
5095         (Output_section::add_script_input_section): Rename from
5096         Output_section::add_simple_input_section. Change first parameter's
5097         type from Simple_input_section to Input_section and remove the
5098         second and third parameters.
5099         * script-sections.cc (Input_section::Input_section_list): Change
5100         type to list of Output_section::Input_section/
5101         (Input_section_info::Input_section_info): Change parameter type of
5102         INPUT_SECTION to Output_section::Input_section.
5103         (Input_section_info::input_section): Change return type.
5104         (Input_section_info::input_section_): Change type to
5105         Output_section::Input_section.
5106         (Output_section_element_input::set_section_addresses): Adjust code
5107         to use Output_section::Input_section instead of
5108         Output_section::Simple_input_section.  Adjust code for renaming
5109         of Output_section::add_simple_input_section.
5110         (Orphan_output_section::set_section_addresses): Ditto.
5111
5112 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5113
5114         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5115         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5116
5117 2010-05-18  Rafael Espindola  <espindola@google.com>
5118
5119         * options.cc (General_options::finalize): Handle -nostdlib.
5120         * options.h (nostdlib): New option.
5121         * script.cc (script_add_search_dir): Handle -nostdlib.
5122
5123 2010-05-12  Doug Kwan  <dougkwan@google.com>
5124
5125         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5126         attributes section only if there no attributes section after merging.
5127         (Target_arm::merge_object_attributes): Move value of
5128         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5129         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5130         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5131         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5132         and arm_attr_merge_7.stdout.
5133         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5134         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5135         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5136         arm_attr_merge_7b.o): New rules.
5137         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5138         arm_attr_merge_7
5139         * testsuite/Makefile.in: Regenerate.
5140         * testsuite/arm_attr_merge.sh: New file.
5141         * testsuite/arm_attr_merge_[67][ab].s: Same.
5142
5143 2010-05-05  Nick Clifton  <nickc@redhat.com>
5144
5145         * po/es.po: Updated Spanish translation.
5146
5147 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5148
5149         * Makefile.am (install-exec-local): Properly install gold as
5150         default cross linker.
5151         * Makefile.in: Regenerated.
5152
5153 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5154             Nick Clifton  <nickc@redhat.com>
5155
5156         * configure.ac (install_as_default): Define and set to false
5157         unless --enable-gold or --enable-gold=both/gold has been
5158         specified.
5159         * configure: Regenerate.
5160
5161         * Makefile.am (install-exec-local): Install the executable as
5162         'ld.gold'.  If install_as_default is true then also install it as
5163         'ld'.
5164         * Makefile.in: Regenerated.
5165
5166 2010-04-24  Ian Lance Taylor  <iant@google.com>
5167
5168         * layout.cc (Layout::layout_reloc): In relocatable link don't
5169         combine reloc sections for grouped sections.
5170
5171 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5172
5173         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5174         sections that are not ordinary to icf.
5175         * icf.cc (get_section_contents): Handle relocation pointing to section
5176         with no object or shndx information.
5177         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5178         * testsuite/Makefile.in: Regenerate.
5179         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5180         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5181
5182 2010-04-22  Ian Lance Taylor  <iant@google.com>
5183
5184         * expression.cc (Expression::Expression_eval_info): Add
5185         result_alignment_pointer field.
5186         (Expression::eval_with_dot): Add result_alignment_pointer
5187         parameter.  Change all callers.
5188         (Expression::eval_maybe_dot): Likewise.
5189         (class Binary_expression): Add alignment_pointer parameter to
5190         left_value and right_value.  Change all callers.
5191         (BINARY_EXPRESSION): Set result alignment.
5192         (class Trinary_expression): Add alignment_pointer parameter to
5193         arg2_value and arg3_value.  Change all callers.
5194         (Trinary_cond::value): Set result alignment.
5195         (Max_expression::value, Min_expression::value): Likewise.
5196         (Align_expression::value): Likewise.
5197         * script-sections.cc (class Sections_element): Add dot_alignment
5198         parameter to set_section_addresses virtual function.  Update
5199         instantiations.
5200         (class Output_section_element): Likewise.
5201         (Script_sections::create_segments): Add dot_alignment parameter.
5202         Change all callers.
5203         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5204         (Script_sections::set_phdrs_clause_addresses): Likewise.
5205         * script-sections.h: Update declarations.
5206         * script.h: Update declarations.
5207         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5208         min_p_align.
5209         * testsuite/script_test_3.t: Set large alignment.
5210         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5211         segment has expected alignment.
5212
5213 2010-04-22  Nick Clifton  <nickc@redhat.com>
5214
5215         * po/gold.pot: Updated by the Translation project.
5216         * po/vi.po: Updated Vietnamese translation.
5217
5218 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5219
5220         * testsuite/Makefile.am (check_PROGRAMS): Add
5221         icf_virtual_function_folding_test.
5222         * testsuite/Makefile.in: Regenerated.
5223
5224 2010-04-15  Andrew Haley  <aph@redhat.com>
5225
5226         * options.h (merge_exidx_entries): New option.
5227         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5228         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5229         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5230         (Target_arm::merge_exidx_entries): New function.
5231         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5232         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5233         to Arm_exidx_fixup constructor.
5234         Add new arg, merge_exidx_entries.
5235         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5236         Arm_output_section::fix_exidx_coverage.
5237
5238 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5239
5240         * icf.cc (get_section_contents): Check for preemptible functions.
5241         Ignore addend when appropriate.
5242         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5243         section folded.
5244         (add_from_relobj): Check for section folded.
5245         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5246         * symtab.h (should_add_dynsym_entry): Add new parameter.
5247         * target-reloc.h (scan_relocs): Check for section folded.
5248         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5249         Check reloc types for function pointers in shared objects.
5250         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5251         case.
5252         (icf_preemptible_functions_test): New test case.
5253         (icf_string_merge_test): New test case.
5254         * testsuite.Makefile.in: Regenerate.
5255         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5256         bar_glob.  Refactor code.
5257         * testsuite/icf_preemptible_functions_test.cc: New file.
5258         * testsuite/icf_preemptible_functions_test.sh: New file.
5259         * testsuite/icf_string_merge_test.cc: New file.
5260         * testsuite/icf_string_merge_test.sh: New file.
5261         * testsuite/icf_virtual_function_folding_test.cc: New file.
5262         * testsuite/icf_virtual_function_folding_test.sh: New file.
5263
5264 2010-04-14  Doug Kwan  <dougkwan@google.com>
5265
5266         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5267         for local symbol recounting if we remove a section due to ICF.
5268         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5269         there are no regular objects in input.
5270
5271 2010-04-13  Doug Kwan  <dougkwan@google.com>
5272
5273         * arm.cc (Arm_input_section::set_final_data_size): Compute
5274         accurate final data size instead of using current data size.
5275
5276 2010-04-09  Doug Kwan  <dougkwan@google.com>
5277
5278         * layout.cc (Layout::choose_output_section): Handle script section
5279         types.
5280         (Layout::make_output_section_for_script): Add section type parameter.
5281         Handle script section types.
5282         * layout.h (Layout::make_output_section_for_script): Add section
5283         type parameter.
5284         * output.cc (Output_section::Output_section): Initialize data member
5285         is_noload_.
5286         (Output_section::do_reset_address_and_file_offset): Do not set address
5287         to 0 if section is a NOLOAD section.
5288         * output.h (Output_section::is_noload): New method.
5289         (Output_section::set_is_noload): Ditto.
5290         (Output_section::is_noload_): New data member.
5291         * script-c.h (Script_section_type): New enum type.
5292         (struct Parser_output_section_header): Add new file section_type.
5293         * script-sections.cc (Sections_element::output_section_name): Add
5294         parameter for returning script section type.
5295         (Output_section_definition::output_section_name): Ditto.
5296         (Output_section_definition::section_type)P; New method.
5297         (Output_section_definiton::script_section_type_name): Ditto.
5298         (Output_section_definition::script_section_type_): New data member.
5299         (Output_section_definition::Output_section_definition): Initialize
5300         data member Output_section_definition::script_section_type_.
5301         (Output_section_definition::create_sections): Pass script section type
5302         to Layout::make_output_section_for_script.
5303         (Output_section_definition::output_section_name): Return script
5304         section type to caller.
5305         (Output_section_definition::set_section_address): Do not advance
5306         dot value and load address if section type is NOLOAD.  Set address
5307         of NOLOAD sections regardless of section flags.
5308         (Output_section_definition::print): Print section type if it is
5309         not SCRIPT_SECTION_TYPE_NONE.
5310         (Output_section_definition::section_type): New method.
5311         (Output_section_definition::script_section_type_name): Ditto.
5312         (Script_sections::output_section_name): Add new parameter
5313         PSECTION_TYPE for returning script section type.  Pass it to
5314         section elements.  Handle discard sections.
5315         (Sort_output_sections::operator()): Handle NOLOAD sections.
5316         * script-sections.h (Script_sections::Section_type): New enum type.
5317         (Script_sections::output_section_name): Add a new parameter for
5318         returning script section type.
5319         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5320         INFO and NOLOAD.
5321         * yyscript.y (union): Add new field SECTION_TYPE.
5322         (COPY, DSECT, INFO, NOLOAD): New tokens.
5323         (opt_address_and_section_type): Change type to output_section_header.
5324         (section_type): New non-terminal
5325         (section_header): Handle section type.
5326         (opt_address_and_section_type): Return section type value.
5327
5328 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5329
5330         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5331         * testsuite/plugin_common_test_2.c (foo): Likewise.
5332
5333 2010-04-08  Doug Kwan  <dougkwan@google.com>
5334
5335         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5336         Output_merge_data.
5337         * output.cc (Output_section::add_merge_input_section): Simplify
5338         code and return status of Output_merge_base::add_input_section.
5339         Update merge section map only if Output_merge_base::add_input_section
5340         returns true.
5341
5342 2010-04-07  Doug Kwan  <dougkwan@google.com>
5343
5344         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5345         if section is marked as containing instructions but has no mapping
5346         symbols.
5347         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5348         correct section index.
5349         (Arm_relobj::find_linked_text_section): Ditto.
5350
5351 2010-04-07  Cary Coutant  <ccoutant@google.com>
5352
5353         * archive.cc (include_member): Destroy Read_symbols_data object before
5354         releasing file.
5355         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5356         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5357         (Read_symbols_data::~Read_symbols_data) New destructor.
5358         (Section_relocs::Section_relocs) New constructor.
5359         (Section_relocs::~Section_relocs) New destructor.
5360         (Read_relocs_data::Read_relocs_data) New constructor.
5361         (Read_relocs_data::~Read_relocs_data) New destructor.
5362         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5363         pointers to NULL after deleting.
5364
5365 2010-04-07  Doug Kwan  <dougkwan@google.com>
5366
5367         * arm.cc: Replace "endianity" with "endianness" in comments.
5368         (Arm_exidx_cantunwind): Ditto.
5369         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5370         (Arm_relobj::merge_flags_and_attributes): New method.
5371         (Arm_relobj::merge_flags_and_attributes_): New data member.
5372         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5373         (Arm_relobj::scan_sections_for_stubs): Ditto.
5374         (Arm_relobj::do_read_symbols): Check to see if we really want to
5375         merge processor-specific flags and attributes.  Exit early if
5376         an object is empty except for section names and the undefined symbol.
5377         (Target_arm::do_finalize_sections): Move check for ELF format to
5378         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5379         attributes from a regular object only when we have determined that
5380         it is aapropriate.  Do not create an .ARM.attributes section in
5381         output if there is no regular input object.
5382         (Target_arm::merge_processor_specific_flags): Check
5383         --warn-mismatch before printing any error.
5384         (Target_arm::merge_object_attributes): Ditto.
5385         * gold.cc (queue_middle_tasks): Handle the case in which there is
5386         no regular object in input.
5387         * options.cc (General_options::parse_EB): New method.
5388         (General_options::parse_EL): Same.
5389         (General_options::General_options): Initialize endianness_.
5390         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5391         New options.
5392         (General_options::Endianness): New enum.
5393         (General_options::endianness): New method.
5394         (General_options::endianness_): New data member.
5395         * parameters.cc (Parameters::set_options): Check target endianness.
5396         (Parameters::set_target_once): Ditto.
5397         (Parameters::check_target_endianness): New method.
5398         (parameters_force_valid_target): If either -EL or -EB is specified,
5399         use it to define endianness of default target.
5400         * parameters.h (Parameters::check_target_endianness): New method
5401         declaration.
5402         * target.h (class Target): Change "endianity" to "endianness"
5403         in comments.
5404
5405 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5406
5407         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5408         * configure: Regenerate.
5409         * Makefile.in: Regenerate.
5410         * testsuite/Makefile.in: Regenerate.
5411
5412 2010-04-06  Cary Coutant  <ccoutant@google.com>
5413
5414         gcc PR lto/42757
5415         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5416         prevailing definitions of common symbols.
5417         * testsuite/plugin_test_6.sh: New test case.
5418         * testsuite/plugin_common_test_1.c: New test case.
5419         * testsuite/plugin_common_test_2.c: New test case.
5420         * testsuite/Makefile.am (plugin_test_6): New test case.
5421         * testsuite/Makefile.in: Regenerate.
5422
5423 2010-04-06  Nick Clifton  <nickc@redhat.com>
5424
5425         * po/vi.po: New Vietnamese translation.
5426
5427 2010-03-30  Doug Kwan  <dougkwan@google.com>
5428
5429         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5430
5431 2010-03-25  Doug Kwan  <dougkwan@google.com>
5432
5433         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5434         to avoid a conversion warning on a 32-bit host.
5435
5436 2010-03-24  Ian Lance Taylor  <iant@google.com>
5437
5438         * testsuite/script_test_3.t: Add a TLS segment.
5439         * testsuite/Makefile.am (check_PROGRAMS): Add
5440         tls_phdrs_script_test.
5441         (tls_phdrs_script_test_SOURCES): Define.
5442         (tls_phdrs_script_test_DEPENDENCIES): Define.
5443         (tls_phdrs_script_test_LDFLAGS): Define.
5444         (tls_phdrs_script_test_LDADD): Define.
5445         * testsuite/Makefile.in: Rebuild.
5446
5447 2010-03-23  Cary Coutant  <ccoutant@google.com>
5448
5449         * fileread.cc (find_or_make_view): Fix comment.
5450
5451 2010-03-23  Ian Lance Taylor  <iant@google.com>
5452
5453         * script-sections.cc (class Orphan_section_placement): Define
5454         PLACE_TLS and PLACE_TLS_BSS.
5455         (Orphan_section_placement::Orphan_section_placement): Initialize
5456         new places.
5457         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5458         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5459         (tls_script_test_SOURCES): Define.
5460         (tls_script_test_DEPENDENCIES): Define.
5461         (tls_script_test_LDFLAGS): Define.
5462         (tls_script_test_LDADD): Define.
5463         * testsuite/Makefile.in: Rebuild.
5464
5465 2010-03-22  Doug Kwan  <dougkwan@google.com>
5466
5467         * arm.cc (Arm_relocate_functions::abs8,
5468         Arm_relocate_functions::abs16): Use correct check for overflow
5469         specified in the ARM ELF specs.
5470         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5471         target of a BLX instruction specially.
5472         (Reloc_stub::stub_type_for_reloc): Ditto.
5473         (Relocate::relocate): Use symbolic names instead of numeric relocation
5474         codes to report error.
5475         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5476         workaround.
5477         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5478         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5479         thumb2_blx_out_of_range.stdout
5480         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5481         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5482         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5483         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5484         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5485         thumb2_blx_in_range, thumb2_blx_in_range.o,
5486         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5487         thumb2_blx_out_of_range.o): New rules.
5488         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5489         thumb2_blx_in_range and thumb2_blx_out_of_range.
5490         * testsuite/Makefile.in: Regenerate.
5491         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5492         * testsuite/thumb_blx_in_range.s: New file.
5493         * testsuite/thumb_blx_out_of_range.s: New file.
5494
5495 2010-03-22  Rafael Espindola  <espindola@google.com>
5496
5497         * archive.cc (Should_include): Move to archive.h.
5498         (should_include_member): Make it a member of Archive.
5499         (Lib_group): New.
5500         (Add_lib_group_symbols): New.
5501         * archive.h: Include options.h.
5502         (Archive_member): Moved from Archive.
5503         (Should_include): Moved from archive.cc.
5504         (Lib_group): New.
5505         (Add_lib_group_symbols): New.
5506         * dynobj.cc (do_should_include_member): New.
5507         * dynobj.h (do_should_include_member): New.
5508         * gold.cc (queue_initial_tasks): Update call to queue.
5509         * main.cc (main): Print lib group stats.
5510         * object.cc (do_should_include_member): New.
5511         * object.h: Include archive.h.
5512         (Object::should_include_member): New.
5513         (Object::do_should_include_member): New.
5514         (Sized_relobj::do_should_include_member): New.
5515         * options.cc (General_options::parse_start_lib): New.
5516         (General_options::parse_end_lib): New.
5517         (Input_arguments::add_file): Handle lib groups.
5518         (Input_arguments::start_group): Check we are not in a lib.
5519         (Input_arguments::start_lib): New.
5520         (Input_arguments::end_lib): New.
5521         * options.h (General_options): Add start_lib and end_lib.
5522         (Input_argument::lib_): New.
5523         (Input_argument::lib): New.
5524         (Input_argument::is_lib): New.
5525         (Input_file_lib): New.
5526         (Input_arguments::in_lib_): New.
5527         (Input_arguments::in_lib): New.
5528         (Input_arguments::start_lib): New.
5529         (Input_arguments::end_lib_): New.
5530         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5531         in unused members as preempted.
5532         (Sized_pluginobj::do_should_include_member): New.
5533         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5534         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5535         return the blocker.
5536         (Read_symbols::do_whole_lib_group): New.
5537         (Read_symbols::do_lib_group): New.
5538         (Read_symbols::do_read_symbols): Handle lib groups.
5539         (Read_symbols::get_name): Handle lib groups.
5540         * readsyms.h (Read_symbols): Add an archive member pointer.
5541         (Read_symbols::do_whole_lib_group): New.
5542         (Read_symbols::do_lib_group): New.
5543         (Read_symbols::member_): New.
5544         * script.cc (read_input_script): Update call to queue_soon.
5545
5546 2010-03-19  Doug Kwan  <dougkwan@google.com>
5547
5548         * arm.cc (Stub_table::Stub_table): Initialize new data members
5549         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5550         (Stub_table::add_reloc_stub): Assign stub offset and update
5551         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5552         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5553         New data members.
5554         (Stub_table::update_data_size_and_addralign): Use
5555         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5556         instead of going over all reloc stubs.
5557         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5558         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5559         Stringpool_template::offset_ to size of Stringpool_char.
5560         (Stringpool_template::new_key_offset): Remove code to initialize
5561         Stringpool_template::offset_.
5562         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5563         Stringpool_template::offset_ to zero.
5564
5565 2010-03-15  Doug Kwan  <dougkwan@google.com>
5566
5567         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5568         offset_.
5569         (Stringpool_template::new_key_offset): New method.
5570         (Stringpool_template::add_string): Assign offsets when adding new
5571         strings.
5572         (Stringpool_template::set_string_offsets): Do not set string offsets
5573         when not optimizing.
5574         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5575         member size_.
5576         (Chunked_vector::clear): Clear size_.
5577         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5578         (Chunked_vector::size): Return size_.
5579         (Chunked_vector::push_back): Use size_ to find insert position.
5580         (Chunked_vector::size_): New data member.
5581         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5582         (Stringpool_template::new_key_offset): New method declaration.
5583         (Stringpool_template::offset_): New data member.
5584
5585 2010-03-15   Rafael Espindola  <espindola@google.com>
5586
5587         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5588         Add_symbols' constructor.
5589         * readsyms.h (Add_symbols): Remove the input_group member.
5590
5591 2010-03-10  Ian Lance Taylor  <iant@google.com>
5592
5593         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5594         target to ask whether a reference to a symbol requires a stack
5595         split.
5596         * target.h (Target::is_call_to_non_split): New function.
5597         (Target::do_is_call_to_non_split): Declare virtual function.
5598         * target.cc: Include "symtab.h".
5599         (Target::do_is_call_to_non_split): New function.
5600         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5601
5602 2010-03-10  Cary Coutant  <ccoutant@google.com>
5603
5604         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5605         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5606         (File_read::open[2]): Add whole_file_view_ to list of views.
5607         (File_read::make_view): Remove test of whole_file_view_.
5608         (File_read::find_or_make_view): Create whole_file_view_ if
5609         necessary.
5610         (File_read::clear_views): Replace bool parameter with enum;
5611         adjust all callers.  Don't delete views with permanent data;
5612         do delete cached views and views from archives if
5613         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5614         if clearing the corresponding view.
5615         * fileread.h (File_read::Clear_views_mode): New enum.
5616         (File_read::View::is_permanent_view): New method.
5617         (File_read::clear_views): Replace bool parameter
5618         with enum; adjust all callers.
5619         * options.h (General_options): Change keep_files_mapped option;
5620         add map_whole_files.
5621         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5622         releasing the file.
5623         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5624         the file.
5625
5626 2010-03-10  David S. Miller  <davem@davemloft.net>
5627
5628         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5629
5630 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5631
5632         * icf.cc (get_section_contents): Add '@' marker after processing the
5633         merge reloc.
5634
5635 2010-03-08  Doug Kwan  <dougkwan@google.com>
5636
5637         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5638         due to a conversion warning.
5639         (Arm_relobj::update_output_local_symbol_count): Check for local
5640         symbol with unset output index.
5641
5642 2010-03-05  Ian Lance Taylor  <iant@google.com>
5643
5644         * options.h (class General_options): Add --spare-dynamic-tags.
5645         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5646         --spare-dynamic-tags.
5647
5648 2010-03-05  Ian Lance Taylor  <iant@google.com>
5649
5650         * incremental.cc: Include "libiberty.h".
5651
5652 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5653
5654         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5655         function, is_info_ member.
5656         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5657         (Versions::Versions): Update caller.
5658         (Versions::define_base_version): Likewise.
5659         (Versions::add_def): Likewise.
5660
5661 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5662
5663         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5664         (Scan::possible_function_pointer_reloc): New function.
5665         (Scan::local_reloc_may_be_function_pointer): Change to call
5666         possible_function_pointer_reloc.
5667         (Scan::global_reloc_may_be_function_pointer): Ditto.
5668         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5669         relocations in ".data.rel.ro._ZTV" section.
5670         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5671         * testsuite/icf_safe_so_test.cc: Ditto.
5672         * testsuite/icf_safe_test.cc: Ditto.
5673         * testsuite/icf_safe_test.sh: Ditto.
5674
5675 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5676             Ian Lance Taylor  <iant@google.com>
5677
5678         * target-reloc.h (relocate_section): Check the symbol table index
5679         for -1U before setting the local symbol index.
5680         (scan_relocatable_relocs): If copying the relocation, record that
5681         the local symbol is required.
5682         * object.h (Symbol_value::is_output_symtab_index_set): New
5683         function.
5684         (Symbol_value::may_be_discarded_from_output_symtab): New
5685         function.
5686         (Symbol_value::has_output_symtab_entry): New function.
5687         (Symbol_value::needs_output_symtab_entry): Remove.
5688         (Symbol_value::output_symtab_index): Make sure the symbol index is
5689         set.
5690         (Symbol_value::set_output_symtab_index): Make sure the symbol
5691         index is not set.  Make sure the new index is valid.
5692         (Symbol_value::set_must_have_output_symtab_entry): New function.
5693         (Symbol_value::has_output_dynsym_entry): New function.
5694         (Symbol_value::set_output_dynsym_index): Make sure the new index
5695         is valid.
5696         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5697         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5698         local symbol if permitted.
5699         (Sized_relobj::do_finalize_local_symbols): Call
5700         is_output_symtab_index_set rather than needs_output_symtab_entry.
5701         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5702         rather than needs_output_symtab_entry.  Call
5703         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5704         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5705         is_output_symtab_index_set rather than needs_output_symtab_entry.
5706         * testsuite/discard_locals_relocatable_test.c: New file.
5707         * testsuite/discard_locals_test.sh: Test -r.
5708         * testsuite/Makefile.am (check_DATA): Add
5709         discard_locals_relocatable_test1.syms,
5710         discard_local_relocatable_test2.syms.
5711         (MOSTLYCLEANFILES): Likewise.  Also add
5712         discard_locals_relocatable_test1.lout and
5713         discard_locals_relocatable_test2.out.
5714         (discard_locals_relocatable_test1.syms): New target.
5715         (discard_locals_relocatable_test.o): New target.
5716         (discard_locals_relocatable_test1.out): New target.
5717         (discard_locals_relocatable_test2.syms): New target.
5718         (discard_locals_relocatable_test2.out): New target.
5719         (various): Add missing ../ld-new dependencies.
5720         * testsuite/Makefile.in: Rebuild.
5721
5722 2010-03-03  Nick Clifton  <nickc@redhat.com>
5723
5724         * po/fi.po: New Finnish translation.
5725
5726 2010-03-01  Doug Kwan  <dougkwan@google.com>
5727
5728         * layout.cc (Layout::Layout): Force section types of .init_array*,
5729         .preinit_array* and .fini_array* sections.
5730         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5731         Fix check of return value of std::string::find.().
5732         (Output_section::Input_section_sort_compare::operator()): Remove
5733         comment about .init_array.
5734         (Output_section::Input_section_sort_init_fini_compare::operator()):
5735         New method.
5736         (Output_section::sort_attached_input_sections): Handle .init_array
5737         and .fini_array specially.
5738         * output.h (Output_section::Inut_section_sort_compare): Update
5739         comment.
5740         (Output_section::Input_section_sort_init_fini_compare): New struct.
5741
5742 2010-02-26  Doug Kwan  <dougkwan@google.com>
5743
5744         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5745         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5746         * testsuite/debug_msg.sh: Avoid matching source line number for
5747         use of global variable undef_int.
5748
5749 2010-02-26  Doug Kwan  <dougkwan@google.com>
5750
5751         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5752         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5753         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5754         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5755         * options.cc (General_options::General_options): Initialize member
5756         fix_v4bx_.
5757         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5758         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5759         and rm_no_fix_v4bx.stdout
5760         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5761         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5762         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5763         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5764         and arm_no_fix_v4bx.
5765         * Makefile.in: Regenerate.
5766         * testsuite/arm_fix_v4bx.s: New file.
5767         * testsuite/arm_fix_v4bx.sh: Ditto.
5768
5769 2010-02-24  Doug Kwan  <dougkwan@google.com>
5770
5771         * arm.cc (Target_arm::got_section): Make the .got section the first
5772         non RELRO section in the data segment.
5773         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5774         suffixes of section names.
5775
5776 2010-02-24  Doug Kwan  <dougkwan@google.com>
5777
5778         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5779         flags and attributes merging if an input file is a binary file.
5780         * fileread.cc (Input_file::open): Record format of original file.
5781         * fileread.h (Input_file::Format): New enum type.
5782         (Input_file::Input_file): Initialize data member format_.
5783         (Input_file::format): New method definition.
5784         (Input_file::format_):: New data member.
5785
5786 2010-02-24  Doug Kwan  <dougkwan@google.com>
5787
5788         * arm.cc (Arm_output_data_got): New class.
5789         (ARM_TCB_SIZE): New constant
5790         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5791         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5792         If user uses a script with a SECTIONS clause, issue only a warning
5793         for a misplaced EXIDX input section.  Otherwise, issue an error.
5794         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5795         garbage collection.
5796         (Target_arm::got_mode_index_entry): Handle static linking.
5797         (Target_arm::Scan::local): Ditto.
5798         (Target_arm::Scan::global): Ditto.
5799         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5800         all incorrectly implemented relocations.
5801         (Target_arm::fix_exidx_coverage): Pass layout to
5802         Arm_output_section::fix_exidx_coverage.
5803         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5804         from ".ARM.exidx." and ".ARM.extab.".
5805
5806 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5807
5808         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5809         section if it does not already exist.
5810         * attributes.cc (Attributes_section_data::Attributes_section_data):
5811         Don't crash if size is zero.
5812
5813 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5814             Ian Lance Taylor  <iant@google.com>
5815
5816         * gold.cc (queue_middle_tasks): If no input files were opened,
5817         exit.
5818         * workqueue.h (Task_function::Task_function): Assert that there is
5819         a blocker.
5820
5821 2010-02-22  Doug Kwan  <dougkwan@google.com>
5822
5823         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5824         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5825         types to avoid warnings due to different uint64_t implementations
5826         on different hosts.
5827
5828 2010-02-21  Doug Kwan  <dougkwan@google.com>
5829
5830         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5831         handling of the maximum backward branch offset.
5832         (Arm_relocate_functions::thumb_branch_common): Ditto.
5833         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5834         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5835         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5836         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5837         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5838         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5839         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5840         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5841         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5842         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5843         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5844         thumb2_bl_out_of_range.o): New rules.
5845         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5846         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5847         thumb2_bl_out_of_range
5848         * testsuite/Makefile.in: Regenerate.
5849         * testsuite/arm_bl_in_range.s: New file.
5850         * testsuite/arm_bl_out_of_range.s: Ditto.
5851         * testsuite/arm_branch_in_range.sh: Ditto.
5852         * testsuite/arm_branch_range.t: Ditto.
5853         * testsuite/thumb2_branch_range.t: Ditto.
5854         * testsuite/thumb_bl_in_range.s: Ditto.
5855         * testsuite/thumb_bl_out_of_range.s: Ditto.
5856         * testsuite/thumb_branch_range.t: Ditto.
5857
5858 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5859
5860         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5861         Add reloc offset information.
5862         * icf.cc (get_section_contents): Change iterators to point to the new
5863         vectors. Add reloc offset information to the contents.
5864         * icf.h (Icf::Sections_reachable_info): New typedef.
5865         (Icf::Sections_reachable_list): New typedef.
5866         (Icf::Offset_info): New typedef.
5867         (Icf::Reloc_info): New struct typedef.
5868         (Icf::Reloc_info_list): New typedef.
5869         (Icf::symbol_reloc_list): Delete method.
5870         (Icf::addend_reloc_list): Delete method.
5871         (Icf::section_reloc_list): Delete method.
5872         (Icf::reloc_info_list): New method.
5873         (Icf::reloc_info_list_): New member.
5874
5875 2010-02-19  Doug Kwan  <dougkwan@google.com>
5876
5877         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5878         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5879         * arm.cc (Arm_relocation_functions): New forward declaration.
5880         (Target_arm::Target_arm): Initialize new data members
5881         got_mod_index_offset_ and tls_base_symbol_defined_.
5882         (Target_arm::Relocate::relocate_tls): New method.
5883         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5884          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5885         New methods.
5886         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5887         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5888         (Target_arm::got_mod_index_offset_,
5889         Target_arm::tls_base_symbol_defined_): New data members.
5890         (Target_arm::Scan::local, Target::Scan::global,
5891         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5892         relocations.
5893
5894 2010-02-18  Doug Kwan  <dougkwan@google.com>
5895
5896         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5897         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5898         text section as a parameter becuase some broken tools may not set
5899         the link in section header.
5900         (Target_arm::has_got_section): New method.
5901         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5902         without any mapping symbol as data only.  Remove warning.
5903         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5904         link in its section header, try to discover the link by inspecting the
5905         REL31 relocation at the beginning of the section.
5906         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5907         in error message.
5908         (Target_arm::Scan::global): Treat any reference to the symbol
5909         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5910
5911 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5912
5913         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5914         (Scan::global_reloc_may_be_function_pointer): New function.
5915         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5916         (Scan::global_reloc_may_be_function_pointer): New function.
5917         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5918         (Scan::global_reloc_may_be_function_pointer): New function.
5919         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5920         (Scan::global_reloc_may_be_function_pointer): New function.
5921         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5922         (Scan::global_reloc_may_be_function_pointer): New function.
5923         (Scan::possible_function_pointer_reloc): New function.
5924         (Target_x86_64::can_check_for_function_pointers): New function.
5925         * gc.h (gc_process_relocs): Scan relocation types to determine if
5926         function pointers were taken for targets that support it.
5927         * icf.cc (Icf::find_identical_sections): Include functions for
5928         folding in safe ICF whose pointer is not taken.
5929         * icf.h (Secn_fptr_taken_set): New typedef.
5930         (fptr_section_id_): New member.
5931         (section_has_function_pointers): New function.
5932         (set_section_has_function_pointers): New function.
5933         (check_section_for_function_pointers): New function.
5934         * options.h: Fix comment for safe ICF option.
5935         * target.h (can_check_for_function_pointers): New function.
5936         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5937         Modify icf_safe_test for X86-64.
5938         * testsuite/Makefile.in: Regenerate.
5939         * testsuite/icf_safe_so_test.cc: New file.
5940         * testsuite/icf_safe_so_test.sh: New file.
5941         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5942         (main): Change to take pointer to function kept_func_3.
5943         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5944         folding is done correctly for X86-64.
5945
5946 2010-02-12  David S. Miller  <davem@davemloft.net>
5947
5948         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5949         is_symbolless parameter.
5950         (Output_reloc<SHT_REL>::is_symbolless): New.
5951         (Output_reloc<SHT_REL>::is_symbolless_): New.
5952         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5953         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5954         (Output_reloc<SHT_RELA>::is_symbolless): New.
5955         (Output_data_reloc::add_global): Handle is_symbolless.
5956         (Output_data_reloc::add_global_relative): Likewise.
5957         (Output_data_reloc::add_local): Likewise.
5958         (Output_data_reloc::add_local_relative): Likewise.
5959         (Output_data_reloc::add_symbolless_global_addend): New.
5960         (Output_data_reloc::add_symbolless_local_addend): New.
5961         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5962         is_symbolless.
5963         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5964         instead of ->is_relative_
5965         (Output_reloc::write): Likewise.
5966         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5967         (Output_reloc::write_rel): Simplify.
5968
5969         * sparc.cc (Target_sparc::Scan::local): Use
5970         ->add_symbolless_local_addend as needed.
5971         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5972         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5973         based upon relocation offset.
5974
5975 2010-02-11  Doug Kwan  <dougkwan@google.com>
5976
5977         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5978         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5979         beginning of function.
5980         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5981         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5982         parameter is_32bit in calls to should_apply_static_reloc.
5983         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5984         (check_DATA): Add arm_abs_global.stdout.
5985         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5986         arm_abs_global.stdout): New rules.
5987         (MOSTLLYCLEANFILES): Add arm_abs_global
5988         * Makefile.in: Regenerate.
5989         * testsuite/arm_abs_global.s: New file.
5990         * testsuite/arm_abs_global.sh: Ditto.
5991         * testsuite/arm_abs_lib.s: Ditto.
5992
5993 2010-02-11  Ian Lance Taylor  <iant@google.com>
5994
5995         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5996         Read_relocs task.
5997         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5998         Allocate_commons_task first.
5999         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6000         task, rather than symtab_lock_.
6001         (Gc_process_relocs::~Gc_process_relocs): New function.
6002         (Gc_process_relocs::is_runnable): Check this_blocker_.
6003         (Gc_process_relocs::locks): Use next_blocker_ rather than
6004         blocker_.
6005         (Scan_relocs::~Scan_relocs): New function.
6006         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6007         symtab_lock_.
6008         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6009         next_blocker_.
6010         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6011         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6012         constructor accordingly.
6013         (class Gc_process_relocs): Likewise.
6014         (class Scan_relocs): Likewise.
6015         * common.h (class Allocate_commons_task): Remove symtab_lock_
6016         field, and corresponding constructor parameter.
6017         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6018         symtab_lock_.
6019         (Allocate_commons_task::locks): Likewise.
6020
6021 2010-02-11  Ian Lance Taylor  <iant@google.com>
6022
6023         * gold-threads.h (class Once): Define.
6024         (class Initialize_lock): Rewrite as child of Once.
6025         * gold-threads.cc (class Once_initialize): Define.
6026         (once_pointer_control): New static variable.
6027         (once_pointer, once_arg): New static variables.
6028         (c_run_once): New static function.
6029         (Once::Once, Once::run_once, Once::internal_run): New functions.
6030         (class Initialize_lock_once): Remove.
6031         (initialize_lock_control): Remove.
6032         (initialize_lock_pointer): Remove.
6033         (initialize_lock_once): Remove.
6034         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6035         (Initialize_lock::initialize): Rewrite.
6036         (Initialize_lock::do_run_once): New function.
6037         * archive.cc (Archive::interpret_header): Only clear name if it is
6038         not already empty.
6039         * fileread.cc: Include "gold-threads.h"
6040         (file_counts_lock): New static variable.
6041         (file_counts_initialize_lock): Likewise.
6042         (File_read::release): Only increment counts when using --stats.
6043         Use a lock around the increment.
6044         * parameters.cc (class Set_parameters_target_once): Define.
6045         (set_parameters_target_once): New static variable.
6046         (Parameters::Parameters): Move here from parameters.h.
6047         (Parameters::set_target): Rewrite.
6048         (Parameters::set_target_once): New function.
6049         (Parameters::clear_target): Move here and rewrite.
6050         * parameters.h (class Parameters): Update declarations.  Add
6051         set_parameters_target_once_ field.
6052         (Parameters::Parameters): Move to parameters.cc.
6053         (Parameters::clear_target): Likewise.
6054         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6055         task.
6056         (Start_group::~Start_group): New function.
6057         (Start_group::is_runnable): New function.
6058         (Start_group::locks, Start_group::run): New functions.
6059         (Finish_group::run): Change saw_undefined to size_t.
6060         * readsyms.h (class Start_group): Define.
6061         (class Finish_group): Change saw_undefined_ field to size_t.
6062         (Finish_group::Finish_group): Remove saw_undefined and
6063         this_blocker parameters.  Change all callers.
6064         (Finish_group::set_saw_undefined): New function.
6065         (Finish_group::set_blocker): New function.
6066         * symtab.h (class Symbol_table): Change saw_undefined to return
6067         size_t.  Change saw_undefined_ field to size_t.
6068         * target-select.cc (Set_target_once::do_run_once): New function.
6069         (Target_selector::Target_selector): Initialize set_target_once_
6070         field.  Don't initialize lock_ and initialize_lock_ fields.
6071         (Target_selector::instantiate_target): Rewrite.
6072         (Target_selector::set_target): New function.
6073         * target-select.h (class Set_target_once): Define.
6074         (class Target_selector): Update declarations.  Make
6075         Set_target_once a friend.  Remove lock_ and initialize_lock_
6076         fields.  Add set_target_once_ field.
6077
6078 2010-02-10  Ian Lance Taylor  <iant@google.com>
6079
6080         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6081         queueing any tasks.
6082         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6083         (queue_middle_tasks): Add all blockers before queueing any tasks.
6084         (queue_final_tasks): Likewise.
6085         * token.h (Task_token::add_blockers): New function.
6086         * object.h (Input_objects::number_of_relobjs): New function.
6087
6088 2010-02-10  Ian Lance Taylor  <iant@google.com>
6089
6090         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6091         shared, not if not position independent.
6092         * x86_64.cc (Relocate::relocate_tls): Likewise.
6093         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6094         (tls_pie_pic_test): New target.
6095         * testsuite/Makefile.in: Rebuild.
6096
6097         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6098         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6099         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6100         * testsuite/Makefile.in: Rebuild.
6101
6102 2010-02-09  David S. Miller  <davem@davemloft.net>
6103
6104         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6105         R_SPARC_RELATIVE using ->add_local_relative().
6106         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6107
6108         * output.h (Output_data_dynamic::add_section_size): New method
6109         that takes two Output_data objects.
6110         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6111         entry param.  Handle it in initializers.
6112         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6113         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6114         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6115         arg.
6116         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6117         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6118         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6119         for dynrel_includes_plt.
6120         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6121         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6122         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6123         before .rela.plt
6124         (Target_sparc::do_finalize_sections): Update to pass true for
6125         dynrel_includes_plt.
6126         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6127         output before .rela.plt
6128         (Target_powerpc::do_finalize_sections): Update to pass true for
6129         dynrel_includes_plt when 32-bit.
6130
6131 2010-02-08  Doug Kwan  <dougkwan@google.com>
6132
6133         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6134         method.
6135         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6136         Arm_relobj::scan_section_for_cortex_a8_stubs,
6137         Arm_relobj::do_relocation_section): Instead of calling
6138         Output_section::output_address, use faster
6139         Arm_relobj::simple_input_section_output_address.
6140
6141 2010-02-08  David S. Miller  <davem@davemloft.net>
6142
6143         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6144         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6145         relocation helper function.
6146
6147         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6148         just like R_SPARC_GOT{10,13,22}.
6149         (Target_sparc::Scan::local): Likewise.
6150         (Target_sparc::Relocate:relocate): Likewise.
6151
6152 2010-02-06  Ian Lance Taylor  <iant@google.com>
6153
6154         * configure.ac: Rewrite targetobjs duplicate removal code to use
6155         only shell constructs.
6156         * configure: Rebuild.
6157
6158 2010-02-05  Doug Kwan  <dougkwan@google.com>
6159
6160         PR 11247
6161         * arm.cc (Arm_relobj::section_is_scannable): New method.
6162         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6163         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6164
6165 2010-02-04  Doug Kwan  <dougkwan@google.com>
6166
6167         PR 11247
6168         * arm-reloc-property.cc (cstdio): Include.
6169         * configure.ac (targetobjs): Remove duplicates.
6170         * configure: Regenerate.
6171         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6172         big and little endian version for a given address size.
6173
6174 2010-02-03  Doug Kwan  <dougkwan@google.com>
6175
6176         * arm-reloc-property.cc
6177         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6178         definition.
6179         * arm-reloc-property.h
6180         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6181         New method definition.
6182         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6183         declaration.
6184         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6185         overflow to N.
6186         (GOT_PREL): Change implemented to Y.
6187         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6188         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6189         (Arm_relocate_functions::movw_abs_nc): Remove method.
6190         (Arm_relocate_functions::movt_abs): Ditto.
6191         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6192         (Arm_relocate_functions::thm_movt_abs): Ditto.
6193         (Arm_relocate_functions::movw_rel_nc): Ditto.
6194         (Arm_relocate_functions::movw_rel): Ditto.
6195         (Arm_relocate_functions::movt_rel): Ditto.
6196         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6197         (Arm_relocate_functions:thm_movw_rel): Ditto.
6198         (Arm_relocate_functions:thm_movt_rel): Ditto.
6199         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6200         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6201         New method definitions.
6202         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6203         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6204         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6205         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6206         (Target_arm::Relocate::relocate): Check for non-static or
6207         unimplemented relocation code and exit early.  Change calls to
6208         Target_arm::reloc_uses_thumb_bit and
6209         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6210         instead.  Refactor code to handle similar relocations to increase
6211         code sharing.  Remove check for unsupported relocation code in switch
6212         statement.
6213         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6214         relocation property table to find out size.  Change error message to
6215         print out the name of a relocation code instead of the numeric value.
6216         (Target_arm::scan_reloc_for_stub): Use relocation property table
6217         instead of calling Target_arm::reloc_uses_thumb_bit().
6218
6219 2010-02-02  Doug Kwan  <dougkwan@google.com>
6220
6221         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6222         types of relaxed input section.
6223
6224 2010-02-02  Doug Kwan  <dougkwan@google.com>
6225
6226         * Makefile.am (HFILES): Add arm-reloc-property.h.
6227         (DEFFILES): New.
6228         (TARGETSOURCES): Add arm-reloc-property.cc
6229         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6230         (libgold_a_SOURCES): $(DEFFILES)
6231         * Makefile.in: Regenerate.
6232         * arm-reloc-property.cc: New file.
6233         * arm-reloc-property.h: New file.
6234         * arm-reloc.def: New file.
6235         * arm.cc: Update comments.
6236         (arm-reloc-property.h): New included header.
6237         (arm_reloc_property_table): New global variable.
6238         (Target_arm::do_select_as_default_target): New method definition.
6239         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6240         arm-reloc-property to targ_extra_obj.
6241         * parameters.cc (set_parameters_target): Call
6242         Target::select_as_default_target().
6243         * target.h (Target::select_as_default_target): New method definition.
6244         (Target::do_select_as_default_target): Same.
6245
6246 2010-02-01  Doug Kwan  <dougkwan@google.com>
6247
6248         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6249         first_output_text_section_.
6250         (Arm_exidx_fixup::first_output_text_section): New method definition.
6251         (Arm_exidx_fixup::first_output_text_section_): New data member.
6252         (Arm_exidx_fixup::process_exidx_section): Record the first text
6253         output section seen.
6254         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6255         and entsize in output section header.
6256
6257 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6258
6259         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6260         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6261         (Arm_relocate_functions::thm_alu11): New Method.
6262         (Arm_relocate_functions::thm_pc8): New Method.
6263         (Arm_relocate_functions::thm_pc12): New Method.
6264         (Target_arm::Scan::local): Handle the relocations.
6265         (Target_arm::Scan::global): Likewise.
6266         (Target_arm::Relocate::relocate): Likewise.
6267         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6268
6269 2010-01-29  Doug Kwan  <dougkwan@google.com>
6270
6271         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6272         of relocation types as ld.
6273
6274 2010-01-29  Doug Kwan  <dougkwan@google.com>
6275
6276         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6277         to public.
6278         (Arm_relocate_functions::thumb_branch_common): Ditto.
6279         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6280         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6281         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6282         Arm_relocate_functions::jump24): Remove.
6283         (Target_arm::Relocate::relocate): Adjust code to call
6284         Arm_relocation_functions::arm_branch_common and
6285         Arm_relocation_functions::thumb_branch_common instead of their removed
6286         wrappers.  Merge switch-cases together to reduce source code size.
6287
6288 2010-01-29  Doug Kwan  <dougkwan@google.com>
6289
6290         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6291         output_local_symbol_count_needs_update_.
6292         (Arm_relobj::output_local_symbol_count_needs_update,
6293          Arm_relobj::set_output_local_symbol_count_needs_update,
6294          Arm_relobj::update_output_local_symbol_count): New methods.
6295         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6296         member.
6297         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6298         of pointed function as in a R_ARM_PREL31 relocation.
6299         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6300         for output local symbol count updating.
6301         (Target_arm::do_relax): Update output local symbol counts in objects
6302         if necessary.
6303         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6304
6305 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6306
6307         * arm.cc: Added support for the ARM relocations:
6308         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6309         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6310         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6311         movw_prel_nc).
6312         (Arm_relocate_functions::movw_rel): New method.
6313         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6314         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6315         thm_movw_prel_nc).
6316         (Arm_relocate_functions::thm_movw_rel): New method.
6317         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6318         thm_movt_prel).
6319         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6320         relocations.
6321         (Target_arm::Scan::global): Likewise.
6322         (Target_arm::Relocate::relocate): Likewise.
6323         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6324         Likewise.
6325
6326 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6327
6328         * arm.cc: Added support for ARM group relocations.
6329         (Target_arm::reloc_needs_sym_origin): New method.
6330         (Arm_relocate_functions::calc_grp_kn): New method.
6331         (Arm_relocate_functions::calc_grp_residual): New method.
6332         (Arm_relocate_functions::calc_grp_gn): New method.
6333         (Arm_relocate_functions::arm_grp_alu): New Method.
6334         (Arm_relocate_functions::arm_grp_ldr): New Method.
6335         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6336         (Arm_relocate_functions::arm_grp_ldc): New Method.
6337         (Target_arm::Scan::local): Handle the ARM group relocations.
6338         (Target_arm::Scan::global): Likewise.
6339         (Target_arm::Relocate::relocate): Likewise.
6340         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6341         Likewise.
6342
6343 2010-01-26  Doug Kwan  <dougkwan@google.com>
6344
6345         * arm.cc (set): Include.
6346         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6347         pointer type.
6348         (Arm_output_section::Text_section_list): New type.
6349         (Arm_output_section::append_text_sections_to_list): New method.
6350         (Arm_output_section::fix_exidx_coverage): Ditto.
6351         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6352         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6353         Relobj::set_section_offset() instead of
6354         Sized_relobj::invalidate_section_offset().
6355         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6356         parameter for section headers. Ignore relocation sections for
6357         unallocated sections and EXIDX sections.
6358         (Target_arm::fix_exidx_coverage): New method.
6359         (Target_arm::output_section_address_less_than): New type.
6360         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6361         linked text section instead of the EXIDX section.
6362         (Arm_output_section::create_stub_group): Add an assertion to check
6363         that this is not an EXIDX output section.
6364         (Arm_output_section::append_text_sections_to_list): New method.
6365         (Arm_output_section::fix_exidx_coverage): Ditto.
6366         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6367         Arm_relobj::section_needs_reloc_stub_scanning.
6368         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6369         first pass.
6370         (Target_arm::fix_exidx_coverage): New method.
6371         * object.h (Relobj::set_output_section): New method.
6372         (Sized_relobj::invalidate_section_offset): Remove method.
6373         (Sized_relobj::do_invalidate_section_offset): Remove method.
6374         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6375
6376 2010-01-25  Doug Kwan  <dougkwan@google.com>
6377
6378         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6379         Fix warning due to signed and unsigned comparison on a 32-bit host.
6380
6381 2010-01-22  Doug Kwan  <dougkwan@google.com>
6382
6383         * arm.cc (Target_arm::do_relax): Record an output section for section
6384         offset adjustment it contains any stub table that has changed.
6385         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6386         offsets in an output section if necessary.
6387         * output.cc (Output_section::Output_section): Initialize
6388         section_offsets_need_adjustments_.
6389         (Output_section::add_input_section_for_script): Renamed to
6390         Output_section::add_simple_input_section.
6391         (Output_section::save_states): Add a comment.
6392         (Output_section::discard_states): New method defintion.
6393         (Output_section::adjust_section_offsets): Same.
6394         * output.h (Output_section::add_input_section_for_script): Renamed to
6395         Output_section::add_simple_input_section.
6396         (Output_section::discard_states): New method declaration.
6397         (Output_section::adjust_section_offsets): Same.
6398         (Output_section::section_offsets_need_adjustment,
6399         Output_section::set_section_offsets_need_adjustment): New method
6400         definitions.
6401         (Output_section::section_offsets_need_adjustment_): New data member.
6402         * script-sections.cc
6403         (Output_section_element_input::set_section_address): Adjust code for
6404         renaming of Output_section::add_input_section_for_script.
6405         (Orphan_output_section::set_section_address): Same.
6406
6407 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6408
6409         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6410         Fix_v4bx enum values .
6411         * gold/options.h (General_options): New option definitions.
6412         (General_options::fix_v4bx): New method.
6413         (General_options::Fix_v4bx): New enum.
6414         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6415         (General_options::parse_fix_v4bx_interworking): New method.
6416
6417 2010-01-22  Doug Kwan  <dougkwan@google.com>
6418
6419         * arm.cc (Arm_exidx_fixup): New class.
6420
6421 2010-01-21  Doug Kwan  <dougkwan@google.com>
6422
6423         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6424         classes.
6425         (Arm_exidx_section_offset_map): New type.
6426
6427 2010-01-21  Doug Kwan  <dougkwan@google.com>
6428
6429         * arm.cc (Arm_exidx_input_section): New class.
6430         (Arm_relobj::exidx_input_section_by_link,
6431         Arm_relobj::exidx_input_section_by_shndx,
6432         Arm_relobj::make_exidx_input_section): New methods.
6433         (read_arm_attributes_section): Remove.
6434         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6435         information about them.
6436         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6437         to here.
6438
6439 2010-01-20  Doug Kwan  <dougkwan@google.com>
6440
6441         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6442         Input_section_specifier to Section_id.
6443         (Target_arm::new_arm_input_section: Adjust code for change of key
6444         type.
6445         (Target_arm::find_arm_input_section): Ditto.
6446         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6447         (Section_id): Remove.
6448         (Garbage_collection::Section_id_hash): Remove.
6449         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6450         (Section_id): Remove.
6451         (Icf::Section_id_hash): Remove.
6452         * object.h (Section_id, Const_section_id, Section_id_hash,
6453         Const_section_id_hash): New type definitions.
6454         * output.cc (Output_section::add_relaxed_input_section): Change to
6455         use Const_section_id instead of Input_section_specifier as key type.
6456         (Output_section::add_merge_input_section): Ditto.
6457         (Output_section::build_relaxation_map): Change to use Section_id
6458         instead of Input_section_specifier as key type.
6459         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6460         Ditto.
6461         (Output_section::convert_input_sections_to_relaxed_sections): Change
6462         to use Const_section_id instead of Input_section_specifier as key type.
6463         (Output_section::find_merge_section): Ditto.
6464         (Output_section::find_relaxed_input_section): Ditto.
6465         * output.h (Input_section_specifier): Remove class.
6466         (Output_section::Output_section_data_by_input_section_map): Change
6467         key type to Const_section_id.
6468         (Output_section::Output_relaxed_input_section_by_input_section_map):
6469         Ditto.
6470         (Output_section::Relaxation_map): Change key type to Section_id.
6471
6472 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6473
6474         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6475         (class Arm_v4bx_stub): New class.
6476         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6477         (Stub_factory::make_arm_v4bx_stub): New method.
6478         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6479         (Stub_table::empty): Handle v4bx stubs.
6480         (Stub_table::add_arm_v4bx_stub): New method.
6481         (Stub_table::find_arm_v4bx_stub): New method.
6482         (Arm_relocate_functions::v4bx): New method.
6483         (Target_arm::fix_v4bx): New method.
6484         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6485         (Stub_table::relocate_stubs): Likewise.
6486         (Stub_table::do_write): Likewise.
6487         (Stub_table::update_data_size_and_addralign): Likewise.
6488         (Stub_table::finalize_stubs):  Likewise.
6489         (Target_arm::Scan::local): Likewise.
6490         (Target_arm::Scan::global): Likewise.
6491         (Target_arm::do_finalize_sections): Likewise.
6492         (Target_arm::Relocate::relocate): Likewise.
6493         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6494         Likewise.
6495         (Target_arm::scan_reloc_for_stub): Likewise.
6496         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6497
6498 2010-01-19  Ian Lance Taylor  <iant@google.com>
6499
6500         * output.cc (Output_section_headers::do_sized_write): Write large
6501         segment count to sh_info field.
6502         (Output_file_header::do_sized_write): For large segment count,
6503         write PN_XNUM to e_phnum field.
6504
6505 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6506
6507         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6508         (Arm_relocate_functions::thm_jump8): New function.
6509         (Arm_relocate_functions::thm_jump11): New function.
6510         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6511         R_ARM_THM_JUMP11.
6512         (Target_arm::Scan::global): Likewise.
6513         (Target_arm::Relocate::relocate): Likewise.
6514         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6515         Likewise.
6516
6517 2010-01-14  Doug Kwan  <dougkwan@google.com>
6518
6519         * arm.cc (map, utility): Include headers.
6520         (Target_arm::apply_cortex_a8_workaround): New method.
6521         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6522         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6523         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6524         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6525         the --[no-]fix-cortex-a8 command line options.
6526         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6527         (Target_arm::relocate_stub): Use addend in instruction template.
6528         * options.h (DEFINE_bool): Set the user-set flag.
6529         (General_options): Add --[no-]-fix-cortex options.
6530         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6531         : Update fast look-up map after conversion.
6532
6533 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6534
6535         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6536         in the first pass of do_layout.
6537
6538 2010-01-13  Doug Kwan  <dougkwan@google.com>
6539
6540         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6541         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6542         apparent compiler problem of not folding static constant integral
6543         data members of elfcpp::Elf_sizes<32>.
6544
6545 2010-01-13  Doug Kwan  <dougkwan@google.com>
6546
6547         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6548         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6549         Arm_relobj::scan_section_for_cortex_a8_erratum,
6550         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6551         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6552         sections to scan for relocation stubs into a new method
6553         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6554         relocation and Cortex-A8 stub scanning.
6555         (Target_arm::do_relax): Force stubs to be after stubbed sections
6556         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6557         the beginning of a new relaxation pass.  Update a comment.
6558         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6559
6560 2010-01-12  Ian Lance Taylor  <iant@google.com>
6561
6562         * target-reloc.h (visibility_error): New inline function.
6563         (relocate_section): Call visibility_error.
6564         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6565         (MOSTLYCLEANFILES): Likewise.
6566         (protected_4_pic.o, protected_3.err): New targets.
6567         * testsuite/protected_4.cc: New file.
6568
6569 2010-01-12  Doug Kwan  <dougkwan@google.com>
6570
6571         * arm.cc (Cortex_a8_reloc): New class.
6572         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6573         and cortex_a8_relocs_info_.
6574         (Target_arm::fix_cortex_a8): New method definition.
6575         (Target_arm::Cortex_a8_relocs_info): New type.
6576         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6577         New data member declarations.
6578         (Target_arm::scan_reloc_for_stub): Record information about
6579         relocations for THUMB branches that might be exempted from the
6580         Cortex-A8 workaround.
6581         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6582         at the beginning of a relaxation pass.
6583
6584 2010-01-12  Doug Kwan  <dougkwan@google.com>
6585
6586         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6587         (Arm_relobj::Mapping_symbol_position,
6588          Arm_reloj::Mapping_symbol_position_less,
6589          Arm_relobj::Mapping_symbols_info): New types.
6590         (Target_arm::is_mapping_symbol_name): New method definition.
6591         (Arm_relobj::do_count_local_symbols): Save information about mapping
6592         symbols.
6593
6594 2010-01-11  Doug Kwan  <dougkwan@google.com>
6595
6596         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6597         Arm_relocate_functions::thumb32_branch_upper,
6598         Arm_relocate_functions::thumb32_branch_lower,
6599         Arm_relocate_functions::thumb32_cond_branch_offset,
6600         Arm_relocate_functions::thumb32_cond_branch_upper,
6601         Arm_relocate_functions::thumb32_cond_branch_lower,
6602         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6603         branch offset encoding.
6604         (Arm_relocate_functions::thumb_branch_common): Use new branch
6605         offset encoding methods to avoid code duplication.
6606         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6607         (Stub_addend_reader::operator()): Use new branch encoding method
6608         to avoid code duplication.
6609
6610 2010-01-11  Doug Kwan  <dougkwan@google.com>
6611
6612         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6613         (Target_arm::do_finalize_sections): Define special EXIDX section
6614         symbols only if referenced.
6615         * gc.h (Garbage_collection::add_reference): New method.
6616         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6617         code duplication.
6618
6619 2010-01-11  Ian Lance Taylor  <iant@google.com>
6620
6621         * script.cc (Version_script_info::build_expression_list_lookup):
6622         Change complaing about duplicate wildcard match from error to
6623         warning.
6624
6625         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6626         of 2009-12-30.
6627         (Version_script_info::Version_script_info): Initialize globs_,
6628         default_version_, default_is_global_, and exact_.  Don't
6629         initialize globals_ or locals_.
6630         (Version_script_info::build_lookup_tables): Build local symbols
6631         first.
6632         (Version_script_info::unquote): New function.
6633         (Version_script_info::add_exact_match): New function.
6634         (Version_script_info::build_expression_list_lookup): Remove lookup
6635         parameter.  Add is_global parameter.  Change all callers.  Handle
6636         wildcard pattern specially.  Unquote pattern.  Call
6637         add_exact_match.
6638         (Version_script_info::get_name_to_match): New function.
6639         (Version_script_info::get_symbol_version): New function.
6640         (Version_script_info::get_symbol_version_helper): Remove.
6641         (Version_script_info::check_unmatched_names): Call unquote.
6642         * script.h (class Version_script_info): Change get_symbol_version
6643         to be non-inline and add is_global parameter; change all callers.
6644         Rewrite symbol_is_local.  Update declarations.  Define struct
6645         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6646         Remove globals_ and locals_ members.  Add exact_, globs_,
6647         default_version_, is_global_.
6648         (Version_script_info::Glob): Remove pattern, add expression and
6649         is_global.  Update constructor.  Change all callers.
6650         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6651         default version.
6652         (Versions::symbol_section_contents): If a symbol is undefined, or
6653         defined in a dynamic object, set the version index to
6654         VER_NDX_LOCAL.
6655         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6656         symbol_is_local.
6657         (Symbol_table::add_from_pluginobj): Likewise.
6658         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6659
6660 2010-01-11  Doug Kwan  <dougkwan@google.com>
6661
6662         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6663         (incremental_dump_LDADD): Add linking option for libintl.
6664         * Makefile.in: Regenerate.
6665
6666 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6667
6668         PR gold/11144
6669         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6670         instead of -Ds.
6671         * testsuite/Makefile.in: Regenerated.
6672
6673 2010-01-10  Doug Kwan  <dougkwan@google.com>
6674
6675         * options.h (DEFINE_var): Use parentheses around argument varname__
6676         in macro body to avoid any unintended subsequent substitutions.
6677
6678 2010-01-10  Ian Lance Taylor  <iant@google.com>
6679
6680         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6681         candidates before doing symbol resolution.
6682
6683         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6684         ODR candidates if only one is weak.
6685
6686 2010-01-08  Ian Lance Taylor  <iant@google.com>
6687
6688         * script.cc (Version_script_info::build_expression_list_lookup):
6689         Don't warn about ambiguous version, just record the ambiguity.
6690         (Version_script_info::get_symbol_version_helper): Give error if
6691         version is ambiguous.
6692
6693 2010-01-08  Doug Kwan  <dougkwan@google.com>
6694
6695         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6696           prev_data_size_ and prev_addralign_.  Remove initializer for
6697           deleted data member has_been_changed_.
6698           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6699           to determine if the table is empty.
6700           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6701           Remove.
6702           (Stub_table::add_reloc_stub): Define method in class definition
6703           instead of just declaring it there.
6704           (Stub_table::add_cortex_a8_stub): New method definition.
6705           (Stub_table::update_data_size_and_addralign): Ditto.
6706           (Stub_table::finalize_stubs): Ditto.
6707           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6708           (Stub_table::do_addralign_): Return address alignment in the
6709           (Stub_table::do_reset_address_and_file_offset): Define method in
6710           class definition instead of declaring it there.  Set current data
6711           size to be the data size of the previous pass.
6712           (Stub_table::set_final_data_size): Use current data size as the
6713           final data size.
6714           (Stub_table::relocate_stub): Change parameter type of stub from
6715           Reloc_stub pointer to Stub pointer.
6716           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6717           (Stub_table::Cortex_a8_stub_list): New typedef.
6718           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6719            Stub_table::prev_addralign_): New data member.
6720           (Arm_relobj::Arm_relobj): Initialize data member
6721           section_has_cortex_a8_workaround_.
6722           (Arm_relobj::section_has_cortex_a8_workaround,
6723            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6724            definitions.
6725           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6726           declarations.
6727           (Target_arm::relocate_stub): Change parameter type of stub from
6728           Reloc_stub pointer to Stub pointer.
6729           (Insn_template::size, Insn_template::alignment): Handle
6730           THUMB16_SPECIAL_TYPE.
6731           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6732            Stub_table::update_data_size_and_addralign,
6733            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6734           definitions.
6735           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6736           (Stub_table::do_write): Ditto.
6737           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6738
6739 2010-01-08  Ian Lance Taylor  <iant@google.com>
6740
6741         PR 11108
6742         * symtab.h (class Symbol): Remove fields is_target_special_ and
6743         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6744         (Symbol::is_defined_in_discarded_section): New function.
6745         (Symbol::set_is_defined_in_discarded_section): New function.
6746         (Symbol::has_plt_offset): Rewrite.
6747         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6748         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6749         Don't initialize is_target_special_ or has_plt_offset_.
6750         Initialize is_defined_in_discarded_section_.
6751         (Symbol_table::add_from_relobj): If appropriate, set
6752         is_defined_in_discarded_section.
6753         * resolve.cc (Symbol::override_base_with_special): Don't test
6754         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6755         * target-reloc.h (relocate_section): Do special handling for
6756         symbols defined in discarded sections for global symbols as well
6757         as local symbols.
6758
6759 2010-01-08  Ian Lance Taylor  <iant@google.com>
6760
6761         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6762         the SHT_SYMTAB case.
6763
6764 2010-01-08  Ian Lance Taylor  <iant@google.com>
6765
6766         * object.cc (Sized_relobj::do_layout): Don't get confused if
6767         layout_eh_frame returns NULL.
6768
6769 2010-01-08  Ian Lance Taylor  <iant@google.com>
6770
6771         PR 11084
6772         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6773         dynamic symbol table, use the normal symbol table.
6774         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6775         symbol table.
6776
6777 2010-01-08  Ian Lance Taylor  <iant@google.com>
6778
6779         PR 11072
6780         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6781         sections.
6782
6783 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6784
6785         * version.cc (print_version): Change to "Copyright 2010".
6786
6787 2010-01-08  Ian Lance Taylor  <iant@google.com>
6788
6789         PR 10287
6790         PR 11063
6791         * i386.cc (class Target_i386): Change return type of plt_section
6792         to be non-const.
6793         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6794         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6795         tls_desc_rel_ field.
6796         (Output_data_plt_i386::rel_tls_desc): New function.
6797         (Target_i386::rel_tls_desc_section): New function.
6798         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6799         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6800         R_386_TLS_DESC reloc in rel_tls_desc_section.
6801         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6802         Define struct Tlsdesc_info.
6803         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6804         (Target_x86_64::do_reloc_symbol_index): New function.
6805         (Target_x86_64::add_tlsdesc_info): New function.
6806         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6807         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6808         tlsdesc_rel_ field.
6809         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6810         all callers.
6811         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6812         (Target_x86_64::rela_tlsdesc_section): New function.
6813         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6814         handling.
6815         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6816         (Target_x86_64::do_reloc_addend): New function.
6817         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6818         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6819         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6820         (Output_reloc::type): New function.
6821         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6822         (Output_reloc::is_target_specific): New function.
6823         (Output_reloc::target_arg): New function.
6824         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6825         absolute relocs and target specific relocs.
6826         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6827         add_target_specific.
6828         (class Output_data_reloc) [SHT_RELA]: Likewise.
6829         * output.cc (Output_reloc::Output_reloc): Add four new versions
6830         for absolute relocs and target specific relocs.
6831         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6832         (Output_reloc::get_symbol_index): Likewise.
6833         (Output_reloc::local_section_offset): Check that local_sym_index_
6834         is not TARGET_CODE or 0.
6835         (Output_reloc::symbol_value): Likewise.
6836         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6837         reloc.
6838         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6839         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6840         functions.
6841         * layout.cc (add_target_dynamic_tags): Use output section for
6842         DT_PLTRELSZ and DT_JMPREL.
6843
6844 2010-01-07  Ian Lance Taylor  <iant@google.com>
6845
6846         PR 11061
6847         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6848         function.
6849         (class Output_data_reloc_generic): Define.
6850         (class Output_data_reloc_base): Change base class to
6851         Output_data_reloc_generic.  Change add() method to call
6852         bump_relative_reloc_count for a relative reloc.  Remove
6853         sort_relocs_ field.
6854         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6855         to sort_relocs().
6856         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6857         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6858         appropriate.
6859         * layout.h (class Layout): Update declaration.
6860
6861 2010-01-07  Ian Lance Taylor  <iant@google.com>
6862
6863         * output.h (class Output_data): Add const version of
6864         output_section and do_output_section.
6865         (class Output_section_data): Add const version of
6866         do_output_section.
6867         (class Output_section): Likewise.
6868         * layout.cc (Layout::add_target_dynamic_tags): New function.
6869         * layout.h (class Layout): Update declarations.
6870         * arm.cc (Target_arm::do_finalize_sections): Use
6871         add_target_dynamic_tags.
6872         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6873         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6874         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6875         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6876
6877 2010-01-07  Ian Lance Taylor  <iant@google.com>
6878
6879         PR 11042
6880         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6881         object as needed.
6882
6883 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6884             Ian Lance Taylor  <iant@google.com>
6885
6886         PR 11019
6887         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6888         Xindex::read_symtab_xindex.
6889
6890 2010-01-07  Doug Kwan  <dougkwan@google.com>
6891
6892         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6893         (Insn_template::thumb16_bcond_insn): New method declaration.
6894         (Insn_template): Fix spelling.
6895         (Stub::thumb16_special): New method declaration.
6896         (Stub::do_write): Define virtual method which was previously pure
6897         virtual.
6898         (Stub::do_thumb16_special): New method declaration.
6899         (Stub::do_fixed_endian_write): New template member.
6900         (Reloc_stub::do_write): Remove.
6901         (Reloc_stub::do_fixed_endian_write): Remove.
6902         (Cortex_a8_stub): New class definition.
6903         (Stub_factory::make_cortex_a8_stub): New method definition.
6904         (Stub_factory::Stub_factory): Add missing static storage class
6905         qualifier for elf32_arm_stub_a8_veneer_blx.
6906
6907 2010-01-07  Ian Lance Taylor  <iant@google.com>
6908
6909         PR 10980
6910         * options.h (class General_options): Add --warn-unresolved-symbols
6911         and --error-unresolved-symbols.
6912         * errors.cc (Errors::undefined_symbol): Implement
6913         --warn-unresolved-symbols.
6914
6915         * options.h (class General_options): Add -z text and -z textoff.
6916         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6917
6918 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6919
6920         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6921         (Garbage_collection::cident_sections): New function.
6922         (Garbage_collection::add_cident_section): New function.
6923         (Garbage_collection::cident_sections_): New member.
6924         (gc_process_relocs): Add references to sections whose names are C
6925         identifiers.
6926         * gold.h (cident_section_start_prefix): New constant.
6927         (cident_section_stop_prefix): New constant.
6928         (is_cident): New function.
6929         * layout.cc (Layout::define_section_symbols): Replace string constants
6930         with the newly defined constants.
6931         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6932         C identifiers.
6933         * testsuite/Makefile.am: Add gc_orphan_section_test.
6934         * testsuite/Makefile.in: Regenerate.
6935         * testsuite/gc_orphan_section_test.cc: New file.
6936         * testsuite/gc_orphan_section_test.sh: New file.
6937
6938 2010-01-06  Ian Lance Taylor  <iant@google.com>
6939
6940         PR 10980
6941         * options.h (class General_options): Add --warn-shared-textrel.
6942         * layout.cc (Layout::finish_dynamic_section): Implement
6943         --warn-shared-textrel.
6944
6945         PR 10980
6946         * options.h (class General_options): Add --warn-multiple-gp.
6947
6948 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6949
6950         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6951         $(THREADSLIB) and $(LIBDL).
6952         * Makefile.in: Rebuild.
6953
6954 2010-01-06  Ian Lance Taylor  <iant@google.com>
6955
6956         PR 10980
6957         * options.cc (General_options::parse_section_start): New function.
6958         (General_options::section_start): New function.
6959         (General_options::General_options): Initialize all members.
6960         * options.h: Include <map>
6961         (class General_options): Add --section-start.  Add section_starts_
6962         member.
6963         * layout.cc (Layout::attach_allocated_section_to_segment): If
6964         --section-start was used, set the address of the segment.  Remove
6965         local sort_sections.
6966         (Layout::relaxation_loop_body): If the address of the load segment
6967         has been set by --section-start, don't use it.
6968         * output.h (Output_segment::update_flags_for_output_section): New
6969         function.
6970         * output.cc (Output_segment::add_output_section): Call
6971         update_flags_for_output_section.
6972
6973 2010-01-05  Ian Lance Taylor  <iant@google.com>
6974
6975         PR 10980
6976         * options.h (class General_options): Add --undefined-version.
6977         * script.cc (struct Version_expression): Add was_matched_by_symbol
6978         field.
6979         (Version_script_info::matched_symbol): New function.
6980         (Version_script_info::get_symbol_version_helper): Call
6981         matched_symbol.
6982         (Version_script_info::check_unmatched_names): New function.
6983         * script.h (class Version_script_info): Update declarations.
6984         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6985
6986         * options.h (class General_options): Use DEFINE_bool_alias for
6987         allow_multiple_definition.
6988         * resolve.cc (Symbol_table::should_override): Don't test
6989         allow_multiple_definition.
6990
6991         PR 10980
6992         * options.h (class General_options): Add --cref.
6993         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6994         until after printing cref table.
6995         * cref.cc: Include "symtab.h".
6996         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6997         (Cref_table_compare::operator()): New function.
6998         (Cref_inputs::gather_cref): New function.
6999         (filecol): New static const.
7000         (Cref_inputs::print_cref): New function.
7001         (Cref::print_cref): New function.
7002         * cref.h: Include <cstdio>.
7003         (class Cref): Update declarations.
7004         * mapfile.h (Mapfile::file): New function.
7005         * object.h (class Object): Define Symbols.  Declare virtual
7006         do_get_global_symbols.
7007         (Object::get_global_symbols): New function.
7008         * object.cc (Input_objects::add_object): Pass object to cref_ if
7009         --cref.
7010         (Input_objects::archive_start): Likewise.
7011         (Input_objects::archive_stop): Likewise.
7012         (Input_objects::print_cref): New function.
7013         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7014         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7015         --cref.
7016         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7017         function.
7018         * plugin.h (class Sized_pluginobj): Update declarations.
7019
7020 2010-01-05  Ian Lance Taylor  <iant@google.com>
7021
7022         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7023         to is_default_version.  Rename insdef to insdefault.
7024         (Symbol_table::add_from_relobj): Rename def to is_default_version
7025         and local to is_forced_local.
7026         (Symbol_table::add_from_pluginobj): Likewise.
7027         (Symbol_table::add_from_dynobj): Likewise.
7028         (Symbol_table::define_special_symbol): Rename insdef to
7029         insdefault.
7030
7031 2010-01-04  Ian Lance Taylor  <iant@google.com>
7032
7033         PR 10980
7034         * options.h (class General_options): Add
7035         --allow-multiple-definition and -z muldefs.
7036         * resolve.cc (Symbol_table::should_override): Don't warn about a
7037         multiple symbol definition if --allow-multiple-definition or -z
7038         muldefs.
7039
7040         PR 10980
7041         * options.h (class General_options): Add --add-needed and
7042         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7043         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7044         error if --copy-dt-needed-entries aka --add-needed is used and
7045         would cause a change in behaviour.
7046
7047         PR 10980
7048         * options.h (class General_options): Add -G as a short version of
7049         --shared.  Add no-op options -assert, -g, and -i.
7050
7051 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7052
7053         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7054         check for .text or .gnu.linkonce.t sections.
7055         * icf.cc (Icf::find_identical_sections): Ditto.
7056         Change the detection for mangled function name within the section
7057         name.
7058         * icf.h (is_section_foldable_candidate): New function.
7059
7060 2009-12-30  Ian Lance Taylor  <iant@google.com>
7061
7062         PR 10980
7063         * options.h (class General_options): Permit two dashes with
7064         --retain-symbols-file.
7065
7066 2009-12-30  Ian Lance Taylor  <iant@google.com>
7067
7068         PR 10979
7069         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7070         don't put the file header and segment headers in the text
7071         segment.
7072
7073         PR 10979
7074         * common.cc (Sort_commons::operator()): Stabilize sort when both
7075         entries are NULL.
7076         (Symbol_table::do_allocate_commons_list): When allocating common
7077         symbols, skip a symbol which is no longer common.
7078         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7079         an object before checking its type.
7080         * testsuite/common_test_2.c: New file.
7081         * testsuite/common_test_3.c: New file.
7082         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7083         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7084         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7085         (common_test_2_pic.o, common_test_2.so): New targets.
7086         (common_test_3_pic.o, common_test_3.so): New targets.
7087         * testsuite/Makefile.in: Rebuild.
7088
7089         PR 10979
7090         * script.cc (read_input_script): If we see a new SECTIONS clause,
7091         and we have added an input section, give an error.
7092         * layout.h (class Layout): Add have_added_input_section function.
7093         Add have_added_input_section_ field.
7094         * layout.cc (Layout::Layout): Initialize
7095         have_added_input_section_.
7096         (Layout::layout): Set have_added_input_section_.
7097         (Layout::layout_eh_frame): Likewise.
7098
7099 2009-12-30  Ian Lance Taylor  <iant@google.com>
7100
7101         PR 10931
7102         * options.h (class General_options): Add --sort-common option.
7103         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7104         * common.cc (Sort_common): Add sort_order parameter to
7105         constructor.  Add sort_order_ field.
7106         (Sort_commons::operator): Check sort_order_.
7107         (Symbol_table::allocate_commons): Determine the sort order.
7108         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7109         Change all callers.
7110         (Symbol_table::do_allocate_commons_list): Likewise.
7111
7112 2009-12-30  Ian Lance Taylor  <iant@google.com>
7113
7114         PR 10916
7115         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7116         symbols from this object, don't change the visibility of an
7117         undefined symbol.
7118         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7119
7120 2009-12-30  Ian Lance Taylor  <iant@google.com>
7121
7122         PR 10861
7123         * script.h (class Version_script_info): Define Language enum.
7124         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7125         new fields globals_, locals_, and is_finalized_.
7126         * script.cc: Various formatting fixes.
7127         (class Parser_closure): Change language_stack_ from a vector of
7128         std::string to one of Version_script_info::Language.  Adjust all
7129         uses accordingly.
7130         (class Lazy_demangler): Remove.
7131         (struct Version_expression): Change language from std::string to
7132         Version_script_info::Language.
7133         (Version_script_info::Version_script_info): New function.
7134         (Version_script_info::~Version_script_info): Don't call clear.
7135         (Version_script_info::finalize): New function.
7136         (Version_script_info::build_lookup_tables): New function.
7137         (Version_script_info::build_expression_list_lookup): New
7138         function.
7139         (Version_script_info::get_symbol_version_helper): Rewrite to use
7140         lookup tables.
7141         (Version_script_info::print_expression_list): Adjust to use
7142         Version_script_info::Language.
7143         (script_push_lex_into_version_mode): Check that the version script
7144         has not been finalized.
7145         (version_script_push_lang): Change language string to
7146         Version_script_info::Language.
7147         * options.cc (Command_line::version_script): New function.
7148         * options.h (class General_options): Add finalize_dynamic_list
7149         function.  Change version_script from declaration to definition.
7150         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7151         * testsuite/version_script.map: Remove duplicate def of foo.
7152         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7153         version_script.map.
7154         * testsuite/Makefile.in: Rebuild.
7155
7156 2009-12-30  Ian Lance Taylor  <iant@google.com>
7157
7158         PR 10843
7159         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7160         if the input symbol index is 0, make the output symbol index 0.
7161
7162 2009-12-30  Ian Lance Taylor  <iant@google.com>
7163
7164         PR 10670
7165         * options.h (class General_options): Add -x/--discard-all.
7166         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7167         --discard-all.  If the local symbol needs a dynamic entry, check
7168         that before handling --discard-locals.
7169
7170 2009-12-30  Ian Lance Taylor  <iant@google.com>
7171
7172         PR 10450
7173         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7174         flags to PF_R.
7175         (Output_segment::add_output_section): Don't change the flags if
7176         the type is PT_TLS.
7177
7178         PR 10450
7179         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7180         GNU hash table if they need a dynamic value.  Otherwise, don't add
7181         them if they are defined in a dynamic object or are forced local.
7182
7183 2009-12-29  Ian Lance Taylor  <iant@google.com>
7184
7185         PR 10450
7186         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7187         .gnu.hash table for a 32-bit target.
7188
7189         PR 10450
7190         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7191         regular and a dynamic object only needs a dynamic symbol table
7192         entry if it is externally visible.
7193
7194         PR 10450
7195         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7196         constructor.  Add global_offset_table_ field.
7197         (Target_i386::got_section): Set global_offset_table_.
7198         (Target_i386::do_finalize_sections): Set global_offset_table_
7199         size.
7200         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7201         in constructor.  Add global_offset_table_ field.
7202         (Target_x86_64::got_section): Set global_offset_table_.
7203         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7204         size.
7205
7206         * layout.cc (Layout::Layout): Initialize increase_relro_.
7207         (Layout::get_output_section): Add is_relro, is_last_relro, and
7208         is_first_non_relro parameters.  Change all callers.
7209         (Layout::choose_output_section): Likewise.
7210         (Layout::add_output_section_data): Likewise.
7211         (Layout::make_output_section): Likewise.
7212         (Layout::set_segment_offsets): Clear increase_relro when using a
7213         linker script.
7214         * layout.h (class Layout): Add increase_relro method.  Add
7215         increase_relro_ field.  Update declarations.
7216         * output.cc (Output_section::Output_section): Initialize
7217         is_last_relro_ and is_first_non_relro_.
7218         (Output_segment::add_output_section): Group relro sections is
7219         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7220         (Output_segment::maximum_alignment): Remove relro handling.
7221         (Output_segment::set_section_addresses): Add increase_relro
7222         parameter.  Change all callers.  Add initial alignment to align
7223         relro sections on separate page.  Remove old relro handling.
7224         (Output_segment::set_section_list_addresses): Remove in_relro
7225         parameter.  Change all callers.
7226         (Output_segment::set_offset): Add increase parameter.  Change all
7227         callers.  Remove old relro handling.
7228         * output.h (class Output_section): Add new methods: is_last_relro,
7229         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7230         Add is_last_relro_ and is_first_non_relro_ fields.
7231         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7232         Create separate .got.plt section.  Call increase_relro.
7233         * x86_64.cc (Target_x86_64::got_section): Likewise.
7234         * testsuite/relro_script_test.t: Add .got.plt.
7235
7236         PR 10450
7237         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7238         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7239         (Layout::finalize): Call set_dynamic_symbol_size.
7240         (Layout::set_dynamic_symbol_size): New function.
7241         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7242         set_dynamic_symbol_size.
7243
7244         PR 10450
7245         * output.h (class Output_section): Add is_entsize_zero_ field.
7246         * output.cc (Output_section::Output_section): Initialize
7247         is_entsize_zero_.
7248         (Output_section::set_entsize): If two different entsizes are
7249         requested, force it to zero.
7250         (Output_section::add_input_section): Set flags for .debug_str
7251         before updating section flags.  Set entsize.
7252         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7253         and SHF_STRING if all input sections have those flags.
7254
7255 2009-12-29   Rafael Espindola  <espindola@google.com>
7256
7257         * main.cc (main): Fix the sys time reporting.
7258         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7259         reporting.
7260
7261 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7262
7263         * options.cc (General_options::parse_version): Allow -v to exit
7264         without an error if there is nothing to link.
7265
7266 2009-12-29  Ian Lance Taylor  <iant@google.com>
7267
7268         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7269         using a version of gcc before 4.1.
7270         * configure: Rebuild.
7271
7272 2009-12-28  Chris Demetriou  <cgd@google.com>
7273
7274         * attributes.cc (Output_attributes_section_data::do_write): Use
7275         std::vector::front rather than std::vector::data.
7276
7277 2009-12-28  Ian Lance Taylor  <iant@google.com>
7278
7279         * symtab.h (class Symbol_table): Add enum Defined.
7280         * resolve.cc (Symbol_table::should_override): Add defined
7281         parameter.  Change all callers.  Test whether object is NULL
7282         before calling a method on it.
7283         (Symbol_table::report_resolve_problem): Add defined parameter.
7284         Change all callers.
7285         (Symbol_table::should_override_with_special): Likewise.
7286         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7287         parameter.  Change all callers.
7288         (Symbol_table::do_define_in_output_data): Likewise.
7289         (Symbol_table::define_in_output_segment): Likewise.
7290         (Symbol_table::do_define_in_output_segment): Likewise.
7291         (Symbol_table::define_as_constant): Likewise.
7292         (Symbol_table::do_define_as_constant): Likewise.
7293         * script.h (class Symbol_assignment): Add is_defsym parameter to
7294         constructor; change all callers.
7295         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7296         parameter.  Change all callers.  Add is_defsym_ field.
7297         (class Parser_closure): Add parsing_defsym parameter to
7298         constructor; change all callers.  Add parsing_defsym accessor
7299         function.  Add parsing_defsym_ field.
7300
7301 2009-12-28  Ian Lance Taylor  <iant@google.com>
7302
7303         * gold.cc (queue_middle_tasks): Fix formatting.
7304         * object.cc (Relobj::is_section_name_included): Likewise.
7305
7306 2009-12-23  Ian Lance Taylor  <iant@google.com>
7307
7308         * i386.cc (Target_i386::do_calls_non_split): Recognize
7309         -fsplit-stack prologue for a function with a static chain.
7310         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7311         -fsplit-stack prologue when using %r11.
7312
7313 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7314
7315         * options.cc (General_options::parse_version): Make -v continue and do
7316         the link like GNU ld does.
7317
7318 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7319
7320         * Makefile.am (CCFILES): Add timer.cc.
7321         (HFILES): Add timer.h.
7322         * configure.ac: Check for sysconf and times.
7323         * main.cc: include timer.h.
7324         (main): Use Timer instead of get_run_time.
7325         * timer.cc: New.
7326         * timer.h: New.
7327         * workqueue.cc: include timer.h.
7328         (Workqueue::find_and_run_task):
7329         Report user, sys and wall time.
7330         * Makefile.in: Regenerate.
7331         * config.in: Regenerate.
7332         * configure: Regenerate.
7333
7334 2009-12-16  Doug Kwan  <dougkwan@google.com>
7335
7336         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7337         sections.
7338         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7339         relaxed input sections.
7340         * output.cc (Output_section::find_relaxed_input_section): Change
7341         return type to Output_relaxed_input_section pointer.  Adjust code
7342         for new type of relaxed_input_section_map_.
7343         * output.h (Output_section::find_relaxed_input_section): Change
7344         return type to Output_relaxed_input_section pointer.
7345         (Output_section::Output_relaxed_input_section_by_input_section_map):
7346         New type.
7347         (Output_section::relaxed_input_section_map_): Change type to
7348         Output_section::Output_relaxed_input_section_by_input_section_map.
7349         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7350         input section.
7351
7352 2009-12-15  Ian Lance Taylor  <iant@google.com>
7353
7354         * layout.cc (Layout::create_shstrtab): Only write out after input
7355         sections if we are compressing debug sections.
7356
7357 2009-12-15  Ian Lance Taylor  <iant@google.com>
7358
7359         * archive.cc (Archive::add_symbols): Only look up a symbol without
7360         a version if there is, in fact, a version.
7361
7362 2009-12-14  Ian Lance Taylor  <iant@google.com>
7363
7364         Revert -Wshadow changes, all changes from:
7365         2009-12-11  Doug Kwan  <dougkwan@google.com>
7366         2009-12-11  Nick Clifton  <nickc@redhat.com>
7367         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7368
7369 2009-12-11  Doug Kwan  <dougkwan@google.com>
7370
7371         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7372         due to -Wshadow.
7373         * attributes.cc (Object_attribute::size): Ditto.
7374         (Attributes_section_data::size): Ditto.
7375         (Attributes_section_data::Attributes_section_data): Ditto.
7376         (Output_attributes_section_data::do_write): Ditto.
7377         * attributes.h (Object_attribute::set_type): Ditto.
7378         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7379
7380 2009-12-11  Nick Clifton  <nickc@redhat.com>
7381
7382         * archive.cc: Fix shadowed variable warnings.
7383         * arm.cc: Likewise.
7384         * compressed_output.cc: Likewise.
7385         * compressed_output.h: Likewise.
7386         * configure: Likewise.
7387         * dwarf_reader.cc: Likewise.
7388         * dynobj.cc: Likewise.
7389         * dynobj.h: Likewise.
7390         * ehframe.cc: Likewise.
7391         * ehframe.h: Likewise.
7392         * errors.cc: Likewise.
7393         * expression.cc: Likewise.
7394         * fileread.cc: Likewise.
7395         * fileread.h: Likewise.
7396         * freebsd.h: Likewise.
7397         * i386.cc: Likewise.
7398         * icf.cc: Likewise.
7399         * incremental.h: Likewise.
7400         * layout.cc: Likewise.
7401         * layout.h: Likewise.
7402         * mapfile.cc: Likewise.
7403         * merge.cc: Likewise.
7404         * merge.h: Likewise.
7405         * object.cc: Likewise.
7406         * object.h: Likewise.
7407         * options.h: Likewise.
7408         * output.cc: Likewise.
7409         * output.h: Likewise.
7410         * parameters.cc: Likewise.
7411         * plugin.cc: Likewise.
7412         * powerpc.cc: Likewise.
7413         * reduced_debug_output.cc: Likewise.
7414         * reduced_debug_output.h: Likewise.
7415         * reloc.cc: Likewise.
7416         * reloc.h: Likewise.
7417         * resolve.cc: Likewise.
7418         * script-sections.cc: Likewise.
7419         * script.cc: Likewise.
7420         * script.h: Likewise.
7421         * sparc.cc: Likewise.
7422         * symtab.cc: Likewise.
7423         * symtab.h: Likewise.
7424         * target-select.cc: Likewise.
7425         * target-select.h: Likewise.
7426         * token.h: Likewise.
7427         * workqueue.cc: Likewise.
7428         * workqueue.h: Likewise.
7429         * x86_64.cc: Likewise.
7430
7431 2009-12-10  Doug Kwan  <dougkwan@google.com>
7432
7433         * arm.cc (attributes.h): New include.
7434         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7435         (Arm_relobj::~Arm_relobj): Delete object pointed by
7436         attributes_section_data_.
7437         (Arm_relobj::attributes_section_data): New method definition.
7438         (Arm_relobj::attributes_section_data_): New data member declaration.
7439         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7440         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7441         attributes_section_data_.
7442         (Arm_dynobj::attributes_section_data): New method definition.
7443         (Arm_dynobj::attributes_section_data_): New data member declaration.
7444         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7445         initialization value of may_use_blx_ to false.
7446         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7447         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7448         object attributes to compute results instead of hard-coding.
7449         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7450         Target_arm::get_secondary_compatible_arch,
7451         Target_arm::set_secondary_compatible_arch
7452         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7453         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7454         New method declarations.
7455         (Target_arm::get_aeabi_object_attribute): New method definition.
7456         (Target_arm::attributes_section_data_): New data member declaration.
7457         (read_arm_attributes_section): New template definition.
7458         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7459         (Arm_dynobj::do_read_symbols): Ditto.
7460         (Target_arm::do_finalize_sections): Merge attributes sections from
7461         input.  Check for BLX use after attributes section merging.
7462         Fix __exidx_start and __exidx_end visibility.  Create an
7463         .ARM.attributes section if necessary.
7464         (Target_arm::get_secondary_compatible_arch,
7465         Target_arm::set_secondary_compatible_arch,
7466         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7467         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7468         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7469         New method definitions.
7470
7471 2009-12-09  Ian Lance Taylor  <iant@google.com>
7472
7473         * plugin.cc (Plugin::load): Don't cast from void* to a function
7474         pointer.
7475
7476 2009-12-09  Ian Lance Taylor  <iant@google.com>
7477
7478         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7479         information fields.
7480
7481 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7482
7483         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7484         Replace two_file_shared_1.so with two_file_shared_2.so.
7485         * testsuite/Makefile.in: Regenerated.
7486
7487 2009-12-08  Doug Kwan  <dougkwan@google.com>
7488
7489         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7490         (HFILES): Add attributes.h and int_encoding.h.
7491         * Makefile.in: Regenerate.
7492         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7493         function definitions to int_encoding.cc
7494         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7495         prototypes to int_encoding.h
7496         * reduced_debug_output.cc (int_encoding.h): New include.
7497         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7498         function definitions to int_encoding.cc
7499         (insert_into_vector, read_from_pointer): Move template definitions to
7500         int_encoding.h
7501         * attributes.cc: New file.
7502         * attributes.h: New file.
7503         * int_encoding.cc: New file.
7504         * int_encoding.h: New file.
7505
7506 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7507
7508         PR gold/11055
7509         * incremental-dump.cc (dump_incremental_inputs): New.
7510         (main): Use dump_incremental_inputs.
7511
7512 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7513
7514         PR gold/10893
7515         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7516         checking elfcpp::STT_FUNC.
7517         (Target_i386::Relocate::relocate): Likewise.
7518         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7519
7520         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7521         symbols from shared libraries into normal FUNC symbols.
7522
7523         * symtab.h (Symbol): Add is_func and use it.
7524
7525 2009-12-05  Doug Kwan  <dougkwan@google.com>
7526
7527         * arm.cc (Target_arm::arm_info): Initialize new fields
7528         attributes_section and attributes_vendor.
7529         * i386.cc (Target_i386::i386_info): Same.
7530         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7531         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7532         fields attributes_section and attributes_vendor.
7533         * sparc.cc (Target_sparc::sparc_info): Same.
7534         * target.h (Target::attributes_section, Target::attributes_vendor,
7535         Target::is_attributes_section, Target::attribute_arg_type,
7536         Target::attributes_order): New method definitions.
7537         (Target::Target_info::attributes_section,
7538         Target::Target_info::attributes_vendor): New fields.
7539         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7540         virtual method definitions.
7541         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7542         attributes_section and attributes_vendor.
7543         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7544
7545 2009-12-05  Doug Kwan  <dougkwan@google.com>
7546
7547         * arm.cc: Update comments about interworking and stub generation.
7548         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7549         considered as non-PIC.
7550         (Arm_relocate_functions::base_abs): Fix formatting.
7551         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7552         of function to use GOT entry address instead of offset.
7553         (Target_arm::Scan::global): Issue an error if a symbol would need a
7554         PLT does not get one because it is untyped.  Remove code to create
7555         dynamic symbols for relative branches.
7556         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7557         takes unsigned integer instead of boolean.
7558
7559 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7560
7561         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7562         (two_file_test_LDADD): Likewise.
7563         (common_test_1_LDADD): Likewise.
7564         (exception_test_LDADD) Likewise.
7565         (weak_test_LDADD): Likewise.
7566         (many_sections_test_LDADD): Likewise.
7567         (initpri1_LDADD): Likewise.
7568         (script_test_1_LDADD): Likewise.
7569         (script_test_2_LDADD): Likewise.
7570         (justsyms_LDADD): Likewise.
7571         (binary_test_LDADD): Likewise.
7572         (large_LDADD): Likewise.
7573         * testsuite/Makefile.in: Regenerated.
7574
7575 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7576
7577         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7578         (Symbol_table::override_with_special): Likewise.
7579         (Symbol_table::add_from_object): Likewise.
7580
7581 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7582
7583         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7584         Don't set the data_offset twice.
7585
7586 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7587
7588         * testsuite/Makefile.in: Regenerate.
7589
7590 2009-12-03  Doug Kwan  <dougkwan@google.com>
7591
7592         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7593         (Target_arm::do_finalize_sections): Add parameter for symbol table
7594         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7595         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7596         parameter for symbol table pointer.
7597         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7598         an additional parameter for a pointer to symbol table.
7599         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7600         parameter for a symbol table pointer.
7601         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7602         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7603         Ditto.
7604         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7605         parameter for a symbol table pointer.
7606
7607 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7608
7609         * incremental.cc (Incremental_inputs_header)
7610         (Incremental_inputs_header_write, Incremental_inputs_entry)
7611         (Incremental_inputs_entry_write): Move ...
7612         * incremental.h (Incremental_inputs_header)
7613         (Incremental_inputs_header_write, Incremental_inputs_entry)
7614         (Incremental_inputs_entry_write): here.
7615
7616 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7617
7618         * incremental.cc (make_sized_incremental_binary): Set the target.
7619         Error if it is incompatible.
7620         * output.h (Output_file): Add filename method.
7621
7622 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7623
7624         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7625         from the get_* methods.
7626
7627 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7628
7629         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7630         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7631         Write 0 for the data_offset of scripts.
7632
7633 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7634
7635         * testsuite/Makefile.am: Add the incremental_test.sh test.
7636         * testsuite/incremental_test.sh: New.
7637         * testsuite/incremental_test_1.c: New.
7638         * testsuite/incremental_test_2.c: New.
7639
7640 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7641
7642        * incremental-dump.cc (main): Fix typos.
7643
7644 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7645
7646         PR gold/11025
7647         * incremental-dump.cc (main): Use llu to print 64 bit values.
7648
7649 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7650             H.J. Lu  <hongjiu.lu@intel.com>
7651
7652         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7653         $(LIBDL).
7654         (incremental_dump_LDADD): Likewise.
7655         * Makefile.in: Regenerated.
7656
7657 2009-11-25  Doug Kwan  <dougkwan@google.com>
7658
7659         Revert:
7660
7661         2009-11-25  Doug Kwan  <dougkwan@google.com>
7662
7663                 * arm.cc (Target_arm::Target_arm): Move method definition
7664                 outside of class definition.  Add code to handle
7665                 --target1-rel, --target1-abs and --target2= options.
7666                 (Target_arm::get_reloc_reloc_type): Change method to be
7667                 non-static and const.
7668                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7669                 New data member declaration.
7670                 (Target_arm::Scan::local, Target_arm::Scan::global,
7671                 Target_arm::Relocate::relocate,
7672                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7673                 Adjust call to Target_arm::get_real_reloc_type.
7674                 (Target_arm::get_real_reloc_type): Use command line options
7675                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7676                 * options.h (--target1-rel, --target1-abs, --target2): New
7677                 ARM-only options.
7678
7679 2009-11-25  Doug Kwan  <dougkwan@google.com>
7680
7681         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7682         class definition.  Add code to handle --target1-rel, --target1-abs
7683         and --target2= options.
7684         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7685         and const.
7686         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7687         member declaration.
7688         (Target_arm::Scan::local, Target_arm::Scan::global,
7689         Target_arm::Relocate::relocate,
7690         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7691         call to Target_arm::get_real_reloc_type.
7692         (Target_arm::get_real_reloc_type): Use command line options to
7693         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7694         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7695         options.
7696
7697 2009-11-25  Doug Kwan  <dougkwan@google.com>
7698
7699         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7700         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7701         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7702         formatting.
7703         (Arm_relocate_functions::thm_call): Replace body with a call to
7704         Arm_relocate_functions::thumb_branch_common.
7705         (Arm_relocate_functions::thm_jump24,
7706         Arm_relocate_functions::thm_xpc22): New method definitions.
7707         (Arm_relocate_functions::thumb_branch_common): New method definition.
7708         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7709         operator.
7710         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7711         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7712
7713 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7714
7715         * Makefile.am: Build incremental-dump
7716         * Makefile.in: Regenerate.
7717         * incremental-dump.cc: New.
7718         * incremental.cc (Incremental_inputs_header_data,
7719         Incremental_inputs_entry_data): Move to incremental.h
7720         * incremental.h: (Incremental_inputs_header_data,
7721         Incremental_inputs_entry_data): Move from incremental.cc
7722
7723 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7724
7725         * incremental.cc (Incremental_inputs_header,
7726         Incremental_inputs_header_write, Incremental_inputs_entry,
7727         Incremental_inputs_entry_write): Add a typedef with the data type.
7728
7729 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7730
7731         * incremental.cc (Incremental_inputs_header,
7732         Incremental_inputs_header_write, Incremental_inputs_entry,
7733         Incremental_inputs_entry_write): Update comment about which
7734         type has the filed descriptions.
7735
7736 2009-11-15  Doug Kwan  <dougkwan@google.com>
7737
7738         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7739         (Arm_relocate_functions::arm_branch_common): Change method defintion
7740         in class definition to a method declaration and update list of formal
7741         parameters.
7742         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7743         Arm_relocation_functions::jump24): Adjust call to
7744         Arm_relocate_functions::arm_branch_common.  Update list of formal
7745         parameters.
7746         (Arm_relocate_functions::xpc25): New method definition.
7747         (Arm_relocate_functions::arm_branch_common): Move method defintion
7748         out from class definition.  Use stubs for mode-switching and extending
7749         branch ranges.
7750         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7751         specially.  Change code to enable use of stubs in ARM branches.
7752
7753 2009-11-10  Doug Kwan  <dougkwan@google.com>
7754
7755         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7756         in method declaration.
7757         (Target_arm::relocate_stub): New method declaration.
7758         (Target_arm::default_target): Change to return a pointer instead of
7759         a const reference.
7760         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7761         Target_arm::default_target.
7762         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7763         method definition.
7764         (Target_arm::relocate_section): Adjust view.
7765         (Target_arm::relocate_stub): New method definition.
7766
7767 2009-11-10  Doug Kwan  <dougkwan@google.com>
7768
7769         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7770         a format warning.
7771         * incremental.cc (open_incremental_binary): Initialized local
7772         variables to avoid warnings.
7773         * object.cc (make_elf_object): Ditto.
7774         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7775         a format warning.
7776
7777 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7778
7779         PR gold/10930
7780         * testsuite/plugin_test.c: Include "config.h".
7781
7782 2009-11-09  Doug Kwan  <dougkwan@google.com>
7783
7784         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7785         (arm_symbol_value): Remove.
7786         (Arm_relocate_functions::arm_branch_common,
7787         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7788         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7789         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7790         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7791         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7792         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7793         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7794         Arm_relocate_functions::thm_mobw_abs_nc,
7795         Arm_relocate_functions::thm_mov_abs,
7796         Arm_relocate_functions::movw_prel_nc,
7797         Arm_relocate_functions::thm_movt_abs,
7798         Arm_relocate_functions::movt_prel,
7799         Arm_relocate_functions::thm_movw_prel_nc,
7800         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7801         (Target_arm::Relocate::relocate): Only decompose address into two
7802         parts if relocation type uses the thumb-bit and pass the actual
7803         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7804         calls to methods in Arm_relocate_functions for this change.
7805
7806 2009-11-08  Ian Lance Taylor  <iant@google.com>
7807
7808         PR 10925
7809         * reloc.cc: Instantiate
7810         Sized_relobj::initialize_input_to_output_maps and
7811         Sized_relobj:free_input_to_output_maps.
7812
7813 2009-11-06  Ian Lance Taylor  <iant@google.com>
7814
7815         PR 10876
7816         * defstd.cc (in_segment): Set only_if_ref true for "end".
7817
7818 2009-11-06  Doug Kwan  <dougkwan@google.com>
7819
7820         * arm.cc (class Reloc_stub): Correct a comment.
7821         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7822         (Target_arm::scan_section_for_stubs): New method declaration.
7823         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7824         Change methods from private to protected.
7825         (Target_arm::do_may_relax): New method definition.
7826         (Target_arm::do_relax, Target_arm::group_sections,
7827         Target_arm::scan_reloc_for_stub,
7828         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7829         (Target_arm::arm_input_section_map_): New data member declaration.
7830         (Target_arm::scan_reloc_for_stub,
7831         Target_arm::scan_reloc_section_for_stubs,
7832         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7833         Target_arm::do_relax): New method definitions.
7834
7835 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7836
7837         * configure.ac: Check for (struct stat)::st_mtim
7838         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7839         * config.in: Regenerate.
7840         * configure: Regenerate.
7841
7842 2009-11-05  Ian Lance Taylor  <iant@google.com>
7843
7844         PR 10910
7845         * output.cc (Output_segment::add_output_section): Add missing
7846         return statement.
7847
7848 2009-11-04  Ian Lance Taylor  <iant@google.com>
7849
7850         PR 10880
7851         * object.h (class Object): Add is_needed and set_is_needed
7852         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7853         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7854         defined in a dynamic object and referenced by a regular object,
7855         set is_needed for the dynamic object.
7856         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7857         if the file is marked with as_needed and it is not needed.
7858
7859 2009-11-04  Ian Lance Taylor  <iant@google.com>
7860
7861         PR 10887
7862         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7863         tags if data is discarded by linker script.
7864         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7865         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7866         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7867         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7868
7869 2009-11-04  Ian Lance Taylor  <iant@google.com>
7870
7871         * layout.cc (Layout::get_output_section): Add is_interp and
7872         is_dynamic_linker_section parameters.  Change all callers.
7873         (Layout::choose_output_section): Likewise.
7874         (Layout::make_output_section): Likewise.
7875         (Layout::add_output_section_data): Add is_dynamic_linker_section
7876         parameter.  Change all callers.
7877         * layout.h (class Layout): Update declarations.
7878         * output.h (class Output_section): Add is_interp, set_is_interp,
7879         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7880         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7881         generate_code_fills_at_write_ to a bitfield.
7882         * output.cc (Output_section::Output_sections): Initialize new
7883         fields.
7884         (Output_segment::add_output_section): Add do_sort parameter.
7885         Change all callers.
7886
7887 2009-11-03  Ian Lance Taylor  <iant@google.com>
7888
7889         PR 10860
7890         * options.h (class General_options): Add --warn-common.
7891         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7892         merging two common symbols.
7893         (Symbol_table::should_override): Handle --warn-common when merging
7894         a common symbol with a defined symbol.  Use report_resolve_problem
7895         for multiple definitions.
7896         (Symbol_table::report_resolve_problem): New function.
7897         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7898
7899 2009-11-03  Doug Kwan  <dougkwan@google.com>
7900
7901         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7902         stub_factory_.
7903         (Target_arm::stub_factory): New method definition.
7904         (Target_arm::new_arm_input_section,
7905         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7906         Target_arm::reloc_uses_thumb_bit): New method declarations.
7907         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7908         New type definitions.
7909         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7910         member declarations.
7911         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7912         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7913         New method definitions.
7914
7915 2009-11-03  Ian Lance Taylor  <iant@google.com>
7916
7917         * options.h (class General_options): Add --warn_constructors.
7918
7919 2009-11-03  Ian Lance Taylor  <iant@google.com>
7920
7921         PR 10893
7922         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7923         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7924
7925 2009-11-03  Ian Lance Taylor  <iant@google.com>
7926
7927         PR 10895
7928         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7929         --msgid-bugs-address.
7930         (install-pdf): New target.
7931         (install-data_yes): Look up one directory to find mkinstalldirs.
7932
7933 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7934
7935         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7936         tree.
7937
7938 2009-10-30  Doug Kwan  <dougkwan@google.com>
7939
7940         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7941
7942 2009-10-30  Doug Kwan  <dougkwan@google.com>
7943
7944         * arm.cc (Stub_addend_reader): New struct template definition
7945         and partial specializations.
7946         (Stub_addend_reader::operator()): New method definition for a
7947         partially specialized template.
7948
7949 2009-10-30  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Arm_relobj::processor_specific_flags): New method
7952         definition.
7953         (Arm_relobj::do_read_symbols): New method declaration.
7954         (Arm_relobj::processor_specific_flags_): New data member declaration.
7955         (Arm_dynobj): New class definition.
7956         (Target_arm::do_finalize_sections): Add input_objects parameter.
7957         (Target_arm::do_adjust_elf_header): New method declaration.
7958         (Target_arm::are_eabi_versions_compatible,
7959         (Target_arm::merge_processor_specific_flags): New method declaration.
7960         (Target_arm::do_make_elf_object): New overloaded method definitions
7961         and declaration.
7962         (Arm_relobj::do_read_symbols): New method definition.
7963         (Arm_dynobj::do_read_symbols): Ditto.
7964         (Target_arm::do_finalize_sections): Add input_objects parameters.
7965         Merge processor-specific flags from all input objects.
7966         (Target_arm::are_eabi_versions_compatible,
7967         Target_arm::merge_processor_specific_flags,
7968         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7969         New method definitions.
7970         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7971         Input_objects pointer type parameter.
7972         * layout.cc (Layout::finalize): Pass input objects to target's.
7973         finalize_sections function.
7974         * output.cc (Output_file_header::do_sized_write): Set ELF file
7975         header's processor-specific flags.
7976         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7977         Input_objects pointer type parameter.
7978         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7979         * target.h (Input_objects): New forward class declaration.
7980         (Target::processor_specific_flags,
7981         Target::are_processor_specific_flags_sect): New method definitions.
7982         (Target::finalize_sections): Add input_objects parameter.
7983         (Target::Target): Initialize processor_specific_flags_ and
7984         are_processor_specific_flags_set_.
7985         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7986         parameter.
7987         (Target::set_processor_specific_flags): New method definition.
7988         (Target::processor_specific_flags_,
7989         Target::are_processor_specific_flags_set_): New data member
7990         declarations.
7991         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7992         Input_objects pointer type parameter.
7993
7994 2009-10-30  Doug Kwan  <dougkwan@google.com>
7995
7996         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7997
7998 2009-10-28  Ian Lance Taylor  <iant@google.com>
7999
8000         * object.h (class Relobj): Drop options parameter from
8001         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8002         do_scan_relocs, do_relocate.  Change all callers.
8003         (class Sized_relobj): Drop options parameters from
8004         do_gc_process_relocs, do_scan_relocs, do_relocate,
8005         do_relocate_sections, relocate_sections, emit_relocs_scan,
8006         emit_relocs_scan_reltype.  Change all callers.
8007         (struct Relocate_info): Remove options field and all references to
8008         it.
8009         * reloc.h (class Read_relocs): Remove options constructor
8010         parameter and options_ field.  Change all callers.
8011         (class Gc_process_relocs, class Scan_relocs): Likewise.
8012         (class Relocate_task): Likewise.
8013         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8014         all callers.
8015         (scan_relocatable_relocs): Likewise.
8016         * target.h (class Sized_target): Remove options parameter from
8017         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8018         all callers.
8019         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8020         callers.
8021         * arm.cc: Update functions to remove options parameters.
8022         * i386.cc: Likewise.
8023         * powerpc.cc: Likewise.
8024         * sparc.cc: Likewise.
8025         * x86_64.cc: Likewise.
8026         * testsuite/testfile.cc: Likewise.
8027
8028 2009-10-28  Doug Kwan  <dougkwan@google.com>
8029
8030         * arm.cc (Arm_relobj): New class definition.
8031         (Arm_relobj::scan_sections_for_stubs,
8032         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8033         New method definitions.
8034
8035 2009-10-28  Cary Coutant  <ccoutant@google.com>
8036
8037         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8038         (Plugin::cleanup_done_): New member.
8039         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8040         (Plugin_manager::cleanup_done_): Remove.
8041         (Plugin_manager::add_input_file): Edit error message.
8042         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8043         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8044
8045 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8046
8047         * fileread.cc: (File_read::View::~View): Use the new
8048         data_ownership_ filed.
8049         (File_read::~File_read): Dispose the new whole_file_view_.
8050         (File_read::open): Mmap the whole file if needed.
8051         (File_read::open): Use whole_file_view_ instead of contents_.
8052         (File_read::find_view): Use whole_file_view_ if applicable.
8053         (File_read::do_read): Use whole_file_view_ instead of contents_.
8054         (File_read::make_view): Use whole_file_view_ instead of contents_,
8055         update File_read::View::View call.
8056         (File_read::find_or_make_view): Update File_read::View::View
8057         call.
8058         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8059         remove contents_
8060         (File_read::View::Data_ownership): New enum.
8061         (File_read::View::View): Replace bool mapped_ with Data_ownership
8062         argument.
8063         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8064         (File_read::View::data_ownership_): New field.
8065         (File_read::contents_): Remove (replaced by whole_file_view_).
8066         (File_read::whole_file_view_): New field.
8067         * options.h (class General_options): Add --keep-files-mapped.
8068
8069 2009-10-27  Cary Coutant  <ccoutant@google.com>
8070
8071         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8072         * testsuite/Makefile.am (plugin_test_5): New test case.
8073         * testsuite/Makefile.in: Regenerate.
8074
8075 2009-10-25  Doug Kwan  <dougkwan@google.com>
8076
8077         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8078         from private to protected to allow access by child class.
8079         (Sized_relobj::do_relocate_sections): New method declaration.
8080         (Sized_relobj::relocate_sections): Virtualize.
8081         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8082         Sized_relobj::relocate_sections.  Instantiate template explicitly
8083         for different target sizes and endianity.
8084
8085 2009-10-24  Doug Kwan  <dougkwan@google.com>
8086
8087         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8088         (Arm_input_section::as_arm_input_section): New method.
8089         (Arm_output_section): New class definition.
8090         (Arm_output_section::create_stub_group,
8091         Arm_output_section::group_sections): New method definitions.
8092
8093 2009-10-22  Doug Kwan  <dougkwan@google.com>
8094
8095         * arm.cc (Arm_input_section): New class definition.
8096         (Arm_input_section::init, Arm_input_section:do_write,
8097         Arm_input_section::set_final_data_size,
8098         Arm_input_section::do_reset_address_and_file_offset): New method
8099         definitions.
8100
8101 2009-10-21  Doug Kwan  <dougkwan@google.com>
8102
8103         * arm.cc (Stub_table, Arm_input_section): New forward class
8104         declarations.
8105         (Stub_table): New class defintion.
8106         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8107         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8108         New method definition.
8109
8110 2009-10-21  Doug Kwan  <dougkwan@google.com>
8111
8112         * arm.cc: Update copyright comments.
8113         (Target_arm): New forward class template declaration.
8114         (Arm_address): New type.
8115         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8116         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8117         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8118         constants.
8119         (Insn_template): Same.
8120         (DEF_STUBS): New macro.
8121         (Stub_type): New enum type.
8122         (Stub_template): New class definition.
8123         (Stub): Same.
8124         (Reloc_stub): Same.
8125         (Stub_factory): Same.
8126         (Target_arm::Target_arm): Initialize may_use_blx_ and
8127         should_force_pic_veneer_.
8128         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8129         Target_arm::should_force_pic_veneer,
8130         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8131         Target_arm::using_thumb_only, Target_arm:;default_target): New
8132         method defintions.
8133         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8134         New data member declarations.
8135         (Insn_template::size, Insn_template::alignment): New method defintions.
8136         (Stub_template::Stub_template): New method definition.
8137         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8138         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8139         (Stub_factory::Stub_factory): New method definition.
8140         * gold.h (string_hash): New template.
8141         * output.h (Input_section_specifier::hash_value): Use
8142         gold::string_hash.
8143         (Input_section_specifier::string_hash): Remove.
8144         * stringpool.cc (Stringpool_template::string_hash): Use
8145         gold::string_hash.
8146
8147 2009-10-20  Doug Kwan  <dougkwan@google.com>
8148
8149         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8150         symbols of relaxed input sections.
8151         * output.h (Output_section::find_relaxed_input_section): Make
8152         method public.
8153
8154 2009-10-16  Doug Kwan  <dougkwan@google.com>
8155
8156         * dynobj.cc (Versions::Versions): Initialize version_script_.
8157         Only insert base version symbol definition for a shared object
8158         if version script defines any version versions.
8159         (Versions::define_base_version): New method definition.
8160         (Versions::add_def): Check that base version is not needed.
8161         (Versions::add_need): Define base version lazily.
8162         * dynobj.h (Versions::define_base_version): New method declaration.
8163         (Versions::needs_base_version_): New data member declaration.
8164         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8165         (check_DATA): Add no_version_test.stdout.
8166         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8167         New make rules.
8168         * testsuite/Makefile.in: Regenerate.
8169         * testsuite/no_version_test.c: New file.
8170         * testsuite/no_version_test.sh: Ditto.
8171
8172 2009-10-16  Doug Kwan  <dougkwan@google.com>
8173
8174         * expression.cc (class Segment_start_expression): New class definition.
8175         (Segment_start_expression::value): New method definition.
8176         (script_exp_function_segment_start): Return a new
8177         Segment_start_expression.
8178         * gold/script-c.h (script_saw_segment_start_expression): New function
8179         prototype.
8180         * script-sections.cc (Script_sections::Script_sections): Initialize
8181         SAW_SEGMENT_START_EXPRESSION_ to false.
8182         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8183         and -Tbbs options to specify section addresses if given in
8184         command line and no SEGMENT_START expression is seen in a script.
8185         * script-sections.h (Script_sections::saw_segment_start_expression,
8186         Script_sections::set_saw_segment_start_expression): New method
8187         definition.
8188         (Script_sections::saw_segment_start_expression_): New data member
8189         declaration.
8190         * script.cc (script_saw_segment_start_expression): New function.
8191         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8192         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8193         script_test_7.sh and script_test_8.sh.
8194         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8195         script_test_8.stdout.
8196         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8197         (script_test_6, script_test_6.stdout, script_test_7,
8198         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8199         * Makefile.in: Regenerate.
8200         * testsuite/script_test_6.sh: New file.
8201         * testsuite/script_test_6.t: Same.
8202         * testsuite/script_test_7.sh: Same.
8203         * testsuite/script_test_7.t: Same.
8204         * testsuite/script_test_8.sh: Same.
8205
8206 2009-10-16  Doug Kwan  <dougkwan@google.com>
8207
8208         * output.cc (Output_segment::set_section_list_address): Cast
8209         expressions to unsigned long long type to avoid format warnings.
8210
8211 2009-10-15  Ian Lance Taylor  <iant@google.com>
8212
8213         * script.cc (Script_options::add_symbol_assignment): Always add a
8214         dot assignment to script_sections_.
8215         * script-sections.cc (Script_sections::add_dot_assignment):
8216         Initialize if necessary.
8217
8218         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8219         program headers with no load segment if there is a linker script.
8220
8221         * layout.cc (Layout::set_segment_offsets): Align the file offset
8222         to the segment aligment for -N or -n with no load segment.
8223         * output.cc (Output_segment::add_output_section): Don't crash if
8224         the first section is a TLS section.
8225         (Output_segment::set_section_list_addresses): Print an error
8226         message if the address moves backward in a linker script.
8227         * script-sections.cc
8228         (Output_section_element_input::set_section_addresses): Don't
8229         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8230         (Orphan_output_section::set_section_addresses): Likewise.
8231
8232 2009-10-15  Doug Kwan  <dougkwan@google.com>
8233
8234         * layout.cc (Layout::finish_dynamic_section): Generate tags
8235         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8236         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8237         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8238
8239 2009-10-14  Ian Lance Taylor  <iant@google.com>
8240
8241         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8242         fields.
8243         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8244         data_shdr fields of relinfo.
8245         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8246         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8247         R_386_TLS_LDO_32, adjust based on section flags.
8248         (Target_i386::Relocate::fix_up_ldo): Remove.
8249
8250 2009-10-13  Ian Lance Taylor  <iant@google.com>
8251
8252         Add support for -pie.
8253         * options.h (class General_options): Add -pie and
8254         --pic-executable.
8255         (General_options::output_is_position_independent): Test -pie.
8256         (General_options::output_is_executable): Return true if not shared
8257         and not relocatable.
8258         (General_options::output_is_pie): Remove.
8259         * options.cc (General_options::finalize): Reject incompatible uses
8260         of -pie.
8261         * gold.cc (queue_middle_tasks): A -pie link is not static.
8262         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8263         * symtab.cc (Symbol::final_value_is_known): Return false if
8264         output_is_position_independent.
8265         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8266         output_is_position_independent.
8267         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8268         output_is_position_independent.
8269         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8270         output_is_position_independent.
8271         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8272         two_file_pie_test.
8273         (basic_pie_test.o, basic_pie_test): New targets.
8274         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8275         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8276         (two_file_pie_test): New target.
8277         * testsuite/Makefile.in: Rebuild.
8278         * README: Remove note saying that -pie is not supported.
8279
8280 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8281
8282         * options.h (class General_options): Add -init and -fini.
8283         * layout.cc (Layout::finish_dynamic_section): Emit
8284         given init and fini functions.
8285
8286 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8287
8288         * gc.h (gc_process_relocs): Check if icf is enabled using new
8289         function.
8290         * gold.cc (queue_initial_tasks): Likewise.
8291         (queue_middle_tasks): Likewise.
8292         * object.cc (do_layout): Likewise.
8293         * symtab.cc (is_section_folded): Likewise.
8294         * main.cc (main): Likewise.
8295         * reloc.cc (Read_relocs::run): Likewise.
8296         (Sized_relobj::do_scan_relocs): Likewise.
8297         * icf.cc (is_function_ctor_or_dtor): New function.
8298         (Icf::find_identical_sections): Check if function is ctor or dtor when
8299         safe icf is chosen.
8300         * options.h (General_options::icf): Change option to be an enum.
8301         (Icf_status): New enum.
8302         (icf_enabled): New method.
8303         (icf_safe_folding): New method.
8304         (set_icf_status): New method.
8305         (icf_status_): New variable.
8306         * (options.cc) (General_options::finalize): Set icf_status_.
8307         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8308         icf_test and icf_keep_unique_test to use the --icf enum flag.
8309         * testsuite/icf_safe_test.sh: New file.
8310         * testsuite/icf_safe_test.cc: New file.
8311
8312 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8313
8314         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8315         includes to gc.h and icf.h.
8316         * arm.cc: Include gc.h.
8317         * gold.cc: Likewise.
8318         * i386.cc: Likewise.
8319         * powerpc.cc: Likewise.
8320         * sparc.cc: Likewise.
8321         * x86_64.cc: Likewise.
8322         * gc.h: Include icf.h.
8323
8324 2009-10-11  Ian Lance Taylor  <iant@google.com>
8325
8326         * plugin.cc: Include "gold.h" before other header files.
8327
8328 2009-10-10  Chris Demetriou  <cgd@google.com>
8329
8330         * options.h (Input_file_argument::Input_file_type): New enum.
8331         (Input_file_argument::is_lib_): Replace with...
8332         (Input_file_argument::type_): New member.
8333         (Input_file_argument::Input_file_argument): Take Input_file_type
8334         'type' rather than boolean 'is_lib' as second argument.
8335         (Input_file_argument::is_lib): Use type_.
8336         (Input_file_argument::is_searched_file): New function.
8337         (Input_file_argument::may_need_search): Handle is_searched_file.
8338         * options.cc (General_options::parse_library): Support -l:filename.
8339         (General_options::parse_just_symbols): Update for Input_file_argument
8340         changes.
8341         (Command_line::process): Likewise.
8342         * archive.cc (Archive::get_file_and_offset): Likewise.
8343         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8344         * script.cc (read_script_file, script_add_file): Likewise.
8345         * fileread.cc (Input_file::Input_file): Likewise.
8346         (Input_file::will_search_for): Handle is_searched_file.
8347         (Input_file::open): Likewise.
8348         * readsyms.cc (Read_symbols::get_name): Likewise.
8349         * testsuite/Makefile.am (searched_file_test): New test.
8350         * testsuite/Makefile.in: Regenerate.
8351         * testsuite/searched_file_test.cc: New file.
8352         * testsuite/searched_file_test_lib.cc: New file.
8353
8354 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8355             Ian Lance Taylor  <iant@google.com>
8356
8357         * descriptor.cc: Include <cstdio> and "binary-io.h".
8358         (Descriptors::open): Open the files in binary mode always.
8359         * script.cc (Lex::get_token): Treat \r as whitespace.
8360
8361 2009-10-09  Ian Lance Taylor  <iant@google.com>
8362
8363         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8364
8365 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8366             Ian Lance Taylor  <iant@google.com>
8367
8368         * configure.ac: Check for readv function also.
8369         * fileread.cc (readv): Define if not HAVE_READV.
8370         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8371         does not exist.
8372         * config.in: Regenerate.
8373         * configure: Regenerate.
8374
8375 2009-10-09  Doug Kwan  <dougkwan@google.com>
8376
8377         * layout.cc (Layout::make_output_section): Call target hook to make
8378         ordinary output section.
8379         (Layout::finalize): Adjust parameter list of call the
8380         Target::may_relax().
8381         * layout.h (class Layout::section_list): New method.
8382         * merge.h (Output_merge_base::entsize): Change visibility to public.
8383         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8384         New methods.
8385         (Output_merge_string::do_is_string): New method.
8386         * object.cc (Sized_relobj::do_setup): renamed from
8387         Sized_relobj::set_up.
8388         * object.h (Sized_relobj::adjust_shndx,
8389         Sized_relobj::initializ_input_to_output_maps,
8390         Sized_relobj::free_input_to_output_maps): Change visibilities to
8391         protected.
8392         (Sized_relobj::setup): Virtualize.
8393         (Sized_relobj::do_setup): New method declaration.
8394         (Sized_relobj::invalidate_section_offset,
8395         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8396         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8397         * options.cc (parse_int): New function.
8398         * options.h (parse_int): New declaration.
8399         (DEFINE_int): New macro.
8400         (stub_group_size): New option.
8401         * output.cc (Output_section::Output_section): Initialize memebers
8402         merge_section_map_, merge_section_by_properties_map_,
8403         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8404         (Output_section::add_input_section): Handled deferred code-fill
8405         generation and remove an old comment.
8406         (Output_section::add_relaxed_input_section): New method definition.
8407         (Output_section::add_merge_input_section): Use merge section by
8408         properties map to speed to search.  Update merge section maps
8409         as appropriate.
8410         (Output_section::build_relaxation_map): New method definition.
8411         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8412         Same.
8413         (Output_section::relax_input_section): Renamed to
8414         Output_section::convert_input_sections_to_relaxed_sections and change
8415         interface to take a vector of pointers to relaxed sections.
8416         (Output_section::find_merge_section,
8417         Output_section::find_relaxed_input_section): New method definitions.
8418         (Output_section::is_input_address_mapped,
8419         Output_section::output_offset, Output_section::output_address):
8420         Use output section data maps to speed up searching.
8421         (Output_section::find_starting_output_address): Add comments.
8422         (Output_section::do_write,
8423         Output_section::write_to_postprocessing_buffer): Do code-fill
8424         generation as appropriate.
8425         (Output_section::get_input_sections): Invalidate relaxed input section
8426         map.
8427         (Output_section::restore_states): Adjust type of checkpoint .
8428         Invalidate relaxed input section map.
8429         * output.h (Output_merge_base): New class declaration.
8430         (Input_section_specifier): New class defintion.
8431         (class Output_relaxed_input_section) Change base class to
8432         Output_section_data_build.
8433         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8434         base class initializer.
8435         (Output_section::add_relaxed_input_section): New method declaration.
8436         (Output_section::Input_section): Change visibility to protected.
8437         (Output_section::Input_section::relobj,
8438         Output_section::Input_section::shndx): Handle relaxed input sections.
8439         Output_section::input_sections) Change visibility to protected.  Also
8440         define overload to return a non-const pointer.
8441         (Output_section::Merge_section_properties): New class defintion.
8442         (Output_section::Merge_section_by_properties_map,
8443         Output_section::Output_section_data_by_input_section_map,
8444         Output_section::Relaxation_map): New types.
8445         (Output_section::relax_input_section): Rename method to
8446         Output_section::convert_input_sections_to_relaxed_sections and change
8447         interface to take a vector of relaxed section pointers.
8448         (Output_section::find_merge_section,
8449         Output_section::find_relaxed_input_section,
8450         Output_section::build_relaxation_map,
8451         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8452         New method declarations.
8453         (Output_section::merge_section_map_
8454         Output_section::merge_section_by_properties_map_,
8455         Output_section::relaxed_input_section_map_,
8456         Output_section::is_relaxed_input_section_map_valid_,
8457         Output_section::generate_code_fills_at_write_): New data members.
8458         * script-sections.cc
8459         (Output_section_element_input::set_section_addresses): Call
8460         current_data_size and addralign methods of relaxed input sections.
8461         (Orphan_output_section::set_section_addresses): Call current_data_size
8462         and addralign methods of relaxed input sections.
8463         * symtab.cc (Symbol_table::compute_final_value): Extract template
8464         from the body of Symbol_table::sized_finalize_symbol.
8465         (Symbol_table::sized_finalized_symbol): Call
8466         Symbol_table::compute_final_value.
8467         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8468         (Symbol_table::compute_final_value): New templated method declaration.
8469         * target.cc (Target::do_make_output_section): New method defintion.
8470         * target.h (Target::make_output_section): New method declaration.
8471         (Target::relax): Add more parameters for input objects, symbol table
8472         and layout.  Adjust call to do_relax.
8473         (Target::do_make_output_section): New method declaration.
8474         (Target::do_relax): Add parameters for input objects, symbol table
8475         and layout.
8476
8477 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8478
8479         * pread.c: Include stdio.h.
8480
8481 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8482
8483         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8484         defined.
8485
8486 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8487
8488         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8489         Change read_shndx type to unsigned int.
8490         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8491         int.
8492         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8493         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8494         Change read_shndx type to unsigned int.
8495         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8496         int.
8497         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8498         * layout.cc (Layout::create_symtab_sections): Cast the result of
8499         local_symcount * symsize to off_t in the gold_assert.
8500
8501 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8502
8503         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8504         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8505         R_ARM_BASE_ABS.
8506         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8507         (Arm_relocate_functions::thm_abs5): New function.
8508         (Arm_relocate_functions::abs12): New function.
8509         (Arm_relocate_functions::abs16): New function.
8510         (Arm_relocate_functions::base_abs): New function.
8511         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8512         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8513         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8514         R_ARM_BASE_ABS.
8515         (Scan::global): Likewise.
8516         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8517         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8518         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8519         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8520         R_ARM_BASE_ABS.
8521
8522 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8523
8524         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8525         (Arm_relocate_functions::movt_prel): New function.
8526         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8527         (Arm_relocate_functions::thm_movt_prel): New function.
8528         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8529         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8530         (Scan::global, Relocate::relocate): Likewise.
8531         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8532
8533 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8534
8535         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8536         Incremental_checker.
8537         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8538         unsigned int.
8539         (class Incremental_inputs_header): New class.
8540         (Incremental_inputs_header_writer): Edit comment.
8541         (Incremental_inputs_entry): New class.
8542         (Incremental_inputs_entry_writer): Edit comment.
8543         (Sized_incremental_binary::do_find_incremental_inputs_section):
8544         Add *strtab_shndx parameter, fill it.
8545         (Sized_incremental_binary::do_check_inputs): New method.
8546         (Incremental_checker::can_incrementally_link_output_file): Use
8547         Sized_incremental_binary::check_inputs.
8548         (Incremental_inputs::report_command_line): Save command line in
8549         command_line_.
8550         * incremental.h:
8551         (Incremental_binary::find_incremental_inputs_section): New
8552         method.
8553         (Incremental_binary::do_find_incremental_inputs_section): Add
8554         strtab_shndx parameter.
8555         (Incremental_binary::do_check_inputs): New pure virtual method.
8556         (Sized_incremental_binary::do_check_inputs): Declare.
8557         (Incremental_checker::Incremental_checker): Add incremental_inputs
8558         parameter, use it to initialize incremental_inputs_.
8559         (Incremental_checker::incremental_inputs_): New field.
8560         (Incremental_checker::command_line): New method.
8561         (Incremental_checker::inputs): New method.
8562         (Incremental_checker::command_line_): New field.
8563
8564 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8565
8566         * incremental.cc: Include <cstdarg> and "target-select.h".
8567         (vexplain_no_incremental): New function.
8568         (explain_no_incremental): New function.
8569         (Incremental_binary::error): New method.
8570         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8571         method.
8572         (make_sized_incremental_binary): New function.
8573         (open_incremental_binary): New function.
8574         (can_incrementally_link_file): Add checks if output is ELF and has
8575         inputs section.
8576         * incremental.h: Include "elfcpp_file.h" and "output.h".
8577         (Incremental_binary): New class.
8578         (Sized_incremental_binary): New class.
8579         (open_incremental_binary): Declare.
8580         * object.cc (is_elf_object): Use
8581         elfcpp::Elf_recognizer::is_elf_file.
8582         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8583         * output.h (Output_file::filesize): New method.
8584
8585 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8586
8587         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8588         New function.
8589         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8590         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8591         function.
8592         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8593         function.
8594         (Arm_relocate_functions::movw_abs_nc): New function.
8595         (Arm_relocate_functions::movt_abs): New function.
8596         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8597         (Arm_relocate_functions::thm_movt_abs): New function.
8598         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8599         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8600         (Scan::global): Likewise.
8601         (Relocate::relocate): Likewise.
8602         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8603
8604 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8605
8606         * arm.cc (Arm_relocate_functions::got_prel) New function.
8607         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8608         (Relocate::relocate): Likewise.
8609         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8610
8611 2009-10-06  Ian Lance Taylor  <iant@google.com>
8612
8613         * options.h (class General_options): Define
8614         split_stack_adjust_size parameter.
8615         * object.h (class Object): Add uses_split_stack_ and
8616         has_no_split_stack_ fields.  Add uses_split_stack and
8617         has_no_split_stack accessor functions.  Declare
8618         handle_split_stack_section.
8619         (class Reloc_symbol_changes): Define.
8620         (class Sized_relobj): Define Function_offsets.  Declare
8621         split_stack_adjust, split_stack_adjust_reltype, and
8622         find_functions.
8623         * object.cc (Object::handle_split_stack_section): New function.
8624         (Sized_relobj::do_layout): Call handle_split_stack_section.
8625         * dynobj.cc (Sized_dynobj::do_layout): Call
8626         handle_split_stack_section.
8627         * reloc.cc (Sized_relobj::relocate_sections): Call
8628         split_stack_adjust for executable sections in split_stack
8629         objects.  Pass reloc_map to relocate_section.
8630         (Sized_relobj::split_stack_adjust): New function.
8631         (Sized_relobj::split_stack_adjust_reltype): New function.
8632         (Sized_relobj::find_functions): New function.
8633         * target-reloc.h: Include "object.h".
8634         (relocate_section): Add reloc_symbol_changes parameter.  Change
8635         all callers.
8636         * target.h (class Target): Add calls_non_split method.  Declare
8637         do_calls_non_split virtual method.  Declare match_view and
8638         set_view_to_nop.
8639         * target.cc: Include "elfcpp.h".
8640         (Target::do_calls_non_split): New function.
8641         (Target::match_view): New function.
8642         (Target::set_view_to_nop): New function.
8643         * gold.cc (queue_middle_tasks): Give an error if mixing
8644         split-stack and non-split-stack objects with -r.
8645         * i386.cc (Target_i386::relocate_section): Add
8646         reloc_symbol_changes parameter.
8647         (Target_i386::do_calls_non_split): New function.
8648         * x86_64.cc (Target_x86_64::relocate_section): Add
8649         reloc_symbol_changes parameter.
8650         (Target_x86_64::do_calls_non_split): New function.
8651         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8652         parameter.
8653         * powerpc.cc (Target_powerpc::relocate_section): Add
8654         reloc_symbol_changes parameter.
8655         * sparc.cc (Target_sparc::relocate_section): Add
8656         reloc_symbol_changes parameter.
8657         * configure.ac: Call AM_CONDITIONAL for the default target.
8658         * configure: Rebuild.
8659         * testsuite/Makefile.am (TEST_AS): New variable.
8660         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8661         (check_DATA): Add split_i386 and split_x86_64 files.
8662         (SPLIT_DEFSYMS): Define.
8663         (split_i386_[1234n].o): New targets.
8664         (split_i386_[124]): New targets.
8665         (split_i386_[1234r].stdout): New targets.
8666         (split_x86_64_[1234n].o): New targets.
8667         (split_x86_64_[124]): New targets.
8668         (split_x86_64_[1234r].stdout): New targets.
8669         (MOSTLYCLEANFILES): Add new executables.
8670         * testsuite/split_i386.sh: New file.
8671         * testsuite/split_x86_64.sh: New file.
8672         * testsuite/split_i386_1.s: New file.
8673         * testsuite/split_i386_2.s: New file.
8674         * testsuite/split_i386_3.s: New file.
8675         * testsuite/split_i386_4.s: New file.
8676         * testsuite/split_i386_n.s: New file.
8677         * testsuite/split_x86_64_1.s: New file.
8678         * testsuite/split_x86_64_2.s: New file.
8679         * testsuite/split_x86_64_3.s: New file.
8680         * testsuite/split_x86_64_4.s: New file.
8681         * testsuite/split_x86_64_n.s: New file.
8682         * testsuite/testfile.cc (Target_test): Update relocation_section
8683         function.
8684         * testsuite/Makefile.in: Rebuild.
8685
8686 2009-10-06  Ian Lance Taylor  <iant@google.com>
8687
8688         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8689         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8690         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8691         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8692         the address on ldo_addrs_.
8693         (Target_i386::Relocate::fix_up_ldo): New function.
8694
8695 2009-10-06   Rafael Espindola  <espindola@google.com>
8696
8697         * plugin.cc (add_input_library): New.
8698         (Plugin::load): Add add_input_library to tv.
8699         (Plugin_manager::add_input_file): Add the is_lib argument.
8700         (add_input_file): Update call to Plugin_manager::add_input_file.
8701         (add_input_library): New.
8702         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8703
8704 2009-09-30  Doug Kwan  <dougkwan@google.com>
8705
8706         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8707         symbol and call Symbol::may_need_copy_reloc to determine if
8708         a copy reloc is needed.
8709         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8710         nocopyreloc is given in command line.
8711         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8712         given in command line.
8713         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8714         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8715         of the removed Target_i386::may_need_copy_reloc.
8716         * options.h (copyreloc): New option with default value false.
8717         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8718         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8719         instead of the removed Target_powerpc::may_need_copy_reloc.
8720         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8721         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8722         instead of the removed Target_sparc::may_need_copy_reloc.
8723         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8724         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8725         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8726         instead of the removed Target_x86_64::may_need_copy_reloc.
8727
8728 2009-09-30  Ian Lance Taylor  <iant@google.com>
8729
8730         * object.h (class Object): Remove target_ field, and target,
8731         sized_target, and set_target methods.
8732         (Object::sized_target): Remove.
8733         (class Sized_relobj): Update declarations.  Remove sized_target.
8734         * object.cc (Sized_relobj::setup): Remove target parameter.
8735         Change all callers.
8736         (Input_objects::add_object): Don't do anything with the target.
8737         (make_elf_sized_object): Add punconfigured parameter.  Change all
8738         callers.  Set or test parameter target.
8739         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8740         Change all callers.
8741         * parameters.cc (Parameters::set_target): Change parameter type to
8742         be non-const.
8743         (Parameters::default_target): Remove.
8744         (set_parameters_target): Change parameter type to be non-const.
8745         (parameters_force_valid_target): New function.
8746         (parameters_clear_target): New function.
8747         * parameters.h (class Parameters): Update declarations.  Remove
8748         default_target method.  Add sized_target and clear_target
8749         methods.  Change target_ to be non-const.
8750         (set_parameters_target): Update declaration.
8751         (parameters_force_valid_target): Declare.
8752         (parameters_clear_target): Declare.
8753         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8754         as NULL if we aren't searching.
8755         (Add_symbols::run): Don't check for compatible target.
8756         * fileread.cc (Input_file::open_binary): Call
8757         parameters_force_valid_target.
8758         * gold.cc (queue_middle_tasks): Likewise.
8759         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8760         set_target on object.
8761         * dynobj.h (class Sized_dynobj): Update declarations.
8762         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8763         make_elf_object returns NULL.
8764         (Archive::include_member): Don't check whether object target is
8765         compatible.
8766         * output.cc (Output_section::add_input_section): Get target from
8767         parameters.
8768         (Output_section::relax_input_section): Likewise.
8769         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8770         parameters.
8771         (Sized_relobj::do_scan_relocs): Likewise.
8772         (Sized_relobj::relocate_sections): Likewise.
8773         * resolve.cc (Symbol_table::resolve): Likewise.
8774         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8775         parameter.  Change all callers.
8776         (Symbol_table::add_from_object): Get target from parameters.
8777         (Symbol_table::add_from_relobj): Don't check object target.
8778         (Symbol_table::add_from_dynobj): Likewise.
8779         (Symbol_table::define_special_symbol): Get target from
8780         parameters.
8781         * symtab.h (class Symbol_table): Update declaration.
8782         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8783         parameter.  Change all callers.  Clear parameter target.
8784         (Binary_test): Test target here.
8785         * testsuite/object_unittest.cc (gold_testsuite): Remove
8786         target_test_pointer parameter.  Change all callers.
8787         (Object_test): Test target here.
8788
8789 2009-09-26  Ian Lance Taylor  <iant@google.com>
8790
8791         * testsuite/initpri1.c: Don't try to use constructor priorities if
8792         compiling with gcc before 4.3.
8793
8794 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8795
8796         * testsuite/retain_symbols_file_test.sh (check_present): Change
8797         output file name to retain_symbols_file_test.stdout.
8798         (check_absent): Likewise.
8799
8800 2009-09-18  Craig Silverstein  <csilvers@google.com>
8801
8802         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8803         * options.cc: Include <cerrno> and <fstream>.
8804         (General_options::finalize): Parse -retain-symbols-file tag.
8805         * options.h: New flag.
8806         (General_options): New method should_retain_symbol, new
8807         variable symbols_to_retain.
8808         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8809         should_retain_symbol map.
8810         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8811         * testsuite/Makefile.in: Regenerate.
8812         * testsuite/retain_symbols_file_test.sh: New file.
8813
8814 2009-09-18  Nick Clifton  <nickc@redhat.com>
8815
8816         * po/es.po: Updated Spanish translation.
8817
8818 2009-09-17  Doug Kwan  <dougkwan@google.com>
8819
8820         * debug.h (DEBUG_RELAXATION): New constant.
8821         (DEBUG_ALL): Add DEBUG_RELAXATION.
8822         (debug_string_to_enum): Add relaxation debug option.
8823         * layout.cc
8824         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8825         Layout::Relaxation_debug_check::read_sections,
8826         Layout::Relaxation_debug_check::read_sections): New method definitions.
8827         (Layout::Layout): Initialize data members
8828         record_output_section_data_from_scrips_,
8829         script_output_section_data_list_ and relaxation_debug_check_.
8830         (Layout::save_segments, Layout::restore_segments,
8831         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8832         Layout::relaxation_loop_body): New method definitions.
8833         (Layout::finalize): Support relaxation.  Move section layout code to
8834         Layout::relaxation_loop_body.
8835         (Layout::set_asection_address_from_script): Move code for orphan
8836         section placement out.
8837         (Layout::place_orphan_sections_in_script): New method definition.
8838         * layout.h (Output_segment_headers, Output_file_header):
8839         New forward class declarations.
8840         (Layout::~Layout): Define.
8841         (Layout::new_output_section_data_from_script): New method definition.
8842         (Layout::place_orphan_sections_in_script): New method declaration.
8843         (Layout::Segment_states): New type declaration.
8844         (Layout::save_segments, Layout::restore_segments,
8845         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8846         Layout::relaxation_loop_body): New method declarations.
8847         (Layout::Output_section_data_list): New type declaration.
8848         (Layout::Relaxation_debug_check): New class definition.
8849         (Layout::record_output_section_data_from_script_,
8850         Layout::script_output_section_data_list_, Layout::segment_states_,
8851         Layout::relaxation_debug_check_): New data members.
8852         * output.cc: (Output_section_headers::do_size): New method definition.
8853         (Output_section_headers::Output_section_headers): Move size
8854         computation to Output_section_headers::do_size.
8855         (Output_segment_headers::do_size): New method definition.
8856         (Output_file_header::Output_file_header): Move size computation to
8857         Output_file_header::do_size and call it.
8858         (Output_file_header::do_size): New method definition.
8859         (Output_data_group::Output_data_group): Adjust call to
8860         Output_section_data.
8861         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8862         (Output_symtab_xindex::do_write): Add array bound check.
8863         (Output_section::Input_section::print_to_mapfile): Handle
8864         RELAXED_INPUT_SECTION_CODE.
8865         (Output_section::Output_section): Initialize data member checkpoint_.
8866         (Output_section::~Output_section): Delete checkpoint object pointed
8867         by checkpoint_.
8868         (Output_section::add_input_section): Always add an Input_section if
8869         relaxing.
8870         (Output_section::add_merge_input_section): Add assert.
8871         (Output_section::relax_input_section): New method definition.
8872         (Output_section::set_final_data_size): Set load address to zero for
8873         an unallocated section.
8874         (Output_section::do_address_and_file_offset_have_reset_values):
8875         New method definition.
8876         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8877         Handle relaxed input section.
8878         (Output_section::sort_attached_input_sections): Checkpoint input
8879         section list lazily.
8880         (Output_section::get_input_sections): Change type of input_sections to
8881         list of Simple_input_section pointers.  Checkpoint input section list
8882         lazily.  Also handle relaxed input sections.
8883         (Output_section::add_input_section_for_script): Take a reference to
8884         a Simple_input_section object instead of Relobj pointer and section
8885         index as parameter.  Handle relaxed input sections.
8886         (Output_section::save_states, Output_section::restore_states): New
8887         method definitions.
8888         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8889         (Output_data::is_data_size_fixed): New method definition.
8890         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8891         if it is fixed.
8892         (Output_data::address_and_file_offset_have_reset_values): New method
8893         definition.
8894         (Output_data::do_address_and_file_offset_have_reset_values): New method
8895         definition.
8896         (Output_data::set_data_size): Check that data size is not fixed.
8897         (Output_data::fix_data_size): New method definition.
8898         (Output_data::is_data_size_fixed_): New data member.
8899         (Output_section_headers::set_final_data_size): New method definition.
8900         (Output_section_headers::do_size): New method declaration.
8901         (Output_segment_headers::set_final_data_size): New method definition.
8902         (Output_segment_headers::do_size): New method declaration.
8903         (Output_file_header::set_final_data_size)::New method definition.
8904         (Output_file_header::do_size)::New method declaration.
8905         (Output_section_data::Output_section_data): Add new parameter
8906         is_data_size_fixed and use it to fix data size.
8907         (Output_data_const::Output_data_const): Adjust call to base class
8908         constructor and fix data size.
8909         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8910         base class constructor and fix data size.
8911         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8912         base class constructor and fix data size.
8913         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8914         class constructor and fix data size.
8915         (Output_data_group::set_final_data_size): New method definition.
8916         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8917         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8918         class constructor and fix data size.
8919         (Output_relaxed_input_section): New class definition.
8920         (Output_section::Simple_input_section): New class definition.
8921         (Output_section::get_input_sections): Adjust parameter list.
8922         (Output_section::add_input_section_for_script): Same.
8923         (Output_section::save_states, Output_section::restore_states,
8924         Output_section::do_address_and_file_offset_have_reset_values,
8925         (Output_section::Input_section::Input_section): Handle
8926         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8927         Output_relaxed_input_section.
8928         (Output_section::Input_section::is_input_section,
8929         Output_section::Input_section::set_output_section): Handle relaxed
8930         input section.
8931         (Output_section::Input_section::is_relaxed_input_section,
8932         Output_section::Input_section::output_section_data,
8933         Output_section::Input_section::relaxed_input_section): New method
8934         definitions.
8935         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8936         value.
8937         (Output_section::Input_section::u1_): Update comments.
8938         (Output_section::Input_section::u2_): Add new union member poris.
8939         (Output_section::Checkpoint_output_section): New classs definition.
8940         (Output_section::relax_input_section): New method declaration.
8941         (Output_section::checkpoint_): New data member.
8942         (Output_segment): Update comments.
8943         (Output_segment::Output_segment): Un-privatize copy constructor.
8944         (Output_segment::operator=): Un-privatize.
8945         * script-sections.cc (Output_section_element::Input_section_list):
8946         Change element type to Output_section::Simple_input_section.
8947         (Output_section_element_dot_assignment::set_section_addresses):
8948         Register output section data for relaxation clean up.
8949         (Output_data_exression::Output_data_expression): Adjust call to base
8950         constructor to fix data size.
8951         (Output_section_element_data::set_section_addresses): Register
8952         Output_data_expression object for relaxation clean up.
8953         (struct Input_section_info): Replace Relobj pointer and section index
8954         pair with Output_section::Simple_input_section and Convert struct to a
8955         class.
8956         (Input_section_sorter::operator()): Adjust access to
8957         Input_section_info data member to use accessors.
8958         (Output_section_element_input::set_section_addresses): Use layout
8959         parameter.  Adjust code to use Output_section::Simple_input_section
8960         and Input_secction_info classes.  Register filler for relaxation
8961         clean up.
8962         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8963         and section index pair with Output_section::Simple_input_section
8964         class.  Adjust code accordingly.
8965         (Phdrs_element::release_segment): New method definition.
8966         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8967         segment list.
8968         (Script_sections::release_segments): New method definition.
8969         * gold/script-sections.h (Script_sections::release_segments): New
8970         method declaration.
8971         * gold/target.h (Target::may_relax, Target::relax,
8972         Target::do_may_relax, Target::do_relax): New method definitions.
8973
8974 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8975
8976         * arm.cc (has_signed_unsigned_overflow): New function.
8977         (Arm_relocate_functions::abs8): New function.
8978         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8979         (Target_arm::Scan::global): Likewise.
8980         (Target_arm::relocate::relocate): Likewise.
8981         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8982         Likewise.
8983
8984 2009-09-16  Cary Coutant  <ccoutant@google.com>
8985
8986         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8987         * testsuite/Makefile.in: Regenerate.
8988
8989 2009-09-11  Nick Clifton  <nickc@redhat.com>
8990
8991         * po/gold.pot: Updated by the Translation project.
8992
8993 2009-09-08  Cary Coutant  <ccoutant@google.com>
8994
8995         * output.cc (Output_file::open): Add execute permission to empty file.
8996         * testsuite/Makefile.am (permission_test): New test.
8997         * testsuite/Makefile.in: Regenerate.
8998
8999 2009-09-02  Ian Lance Taylor  <iant@google.com>
9000
9001         * output.cc (Output_file::resize): Call map_no_anonymous rather
9002         than map.
9003
9004 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9005
9006         * gold.cc: Include "incremental.h".
9007         (queue_initial_tasks): Call Incremental_checker methods.
9008         * incremental.cc: Include "output.h".
9009         (Incremental_checker::can_incrementally_link_output_file): New
9010         method.
9011         * incremental.h (Incremental_checker): New class.
9012
9013         * output.cc (Output_file::open_for_modification): New method.
9014         (Output_file::map_anonymous): Changed return type to bool.  Record
9015         map in base_ field.
9016         (Output_file::map_no_anonymous): New method, broken out of map.
9017         (Output_file::map): Use map_no_anonymous and map_anonymous.
9018         * output.h (class Output_file): Update declarations.
9019
9020 2009-08-24  Cary Coutant  <ccoutant@google.com>
9021
9022         * options.h (Command_line::Pre_options): New class.
9023         (Command_line::pre_options): New member.
9024         * options.cc (gold::options::ready_to_register): New variable.
9025         (One_option::register_option): Do nothing if not registering options.
9026         Assert if same short option registered twice.
9027         (General_options::General_options): Turn off option registration when
9028         done constructing.
9029         (Command_line::Pre_options::Pre_options): New constructor.
9030
9031 2009-08-24  Cary Coutant  <ccoutant@google.com>
9032
9033         * options.h (General_options::no_keep_memory): Remove incorrect
9034         short option.
9035
9036 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9037
9038         * Makefile.am (am__skiplex, am__skipyacc): New.
9039         * Makefile.in: Regenerate.
9040
9041 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9042
9043         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9044         (INCLUDES): ... this.
9045         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9046         (AM_CPPFLAGS): Renamed from ...
9047         (INCLUDE): ... this.
9048         * Makefile.in, testsuite/Makefile.in: Regenerate.
9049
9050         * Makefile.in: Regenerate.
9051         * aclocal.m4: Likewise.
9052         * config.in: Likewise.
9053         * configure: Likewise.
9054         * testsuite/Makefile.in: Likewise.
9055
9056         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9057         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9058         * Makefile.in: Regenerate.
9059         * testsuite/Makefile.in: Regenerate.
9060
9061 2009-08-19  Cary Coutant  <ccoutant@google.com>
9062
9063         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9064         symbols in shared libraries overridden by hidden or internal symbols
9065         in the main program.
9066
9067 2009-08-19  Chris Demetriou  <cgd@google.com>
9068
9069         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9070         checking source file names in error messages.
9071
9072 2009-08-18  Doug Kwan  <dougkwan@google.com>
9073
9074         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9075         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9076         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9077         an elfcpp::Ehdr as parameter.
9078         * object.cc (Object::set_target): Remove the version that looks up
9079         a target and sets it.
9080         (Sized_relobj::setup): Take a Target object instead of
9081         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9082         (make_elf_sized_object): Find target and ask target to
9083         make an ELF object.
9084         * object.h: (Object::set_target): Remove the version that looks up
9085         a target and sets it.
9086         (Sized_relobj::setup): Take a Target object instead of
9087         an elfcpp:Ehdr as parameter.
9088         * target.cc: Include dynobj.h.
9089         (Target::do_make_elf_object_implementation): New.
9090         (Target::do_make_elf_object): New.
9091         * target.h (Target::make_elf_object): New template declaration.
9092         (Target::do_make_elf_object): New method declarations.
9093         (Target::do_make_elf_object_implementation): New template declaration.
9094
9095 2009-08-14  Ian Lance Taylor  <iant@google.com>
9096
9097         * gold.h (FUNCTION_NAME): Define.
9098         (gold_unreachable): Use FUNCTION_NAME.
9099
9100 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9101
9102         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9103         symbol in the --keep-unique list is not found.
9104
9105 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9106
9107         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9108         been maked as --keep-unique.
9109         (Icf::unfold_section): New function.
9110         * icf.h (Icf::unfold_section): New function.
9111         * options.h (General_options::keep_unique): New option.
9112         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9113         * testsuite/Makefile.in: Regenerate.
9114         * testsuite/icf_keep_unique_test.sh: New file.
9115         * testsuite/icf_keep_unique_test.cc: New file.
9116
9117 2009-08-12  Cary Coutant  <ccoutant@google.com>
9118
9119         PR 10471
9120         * resolve.cc (Symbol_table::resolve): Check for references from
9121         dynamic objects to hidden and internal symbols.
9122         * testsuite/Makefile.am (hidden_test.sh): New test.
9123         * testsuite/Makefile.in: Regenerate.
9124         * testsuite/hidden_test.sh: New script.
9125         * testsuite/hidden_test_1.c: New test source.
9126         * testsuite/hidden_test_main.c: New test source.
9127
9128 2009-08-11  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc: Update comments.
9131         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9132         segment to locate the .ARM.exidx section if present.
9133
9134 2009-08-09  Doug Kwan  <dougkwan@google.com>
9135
9136         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9137         patch.
9138
9139 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9140         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9141         compiler warnings.
9142
9143 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9144
9145         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9146         valid tls_segment only for non-debug-section relocations.
9147         * testsuite/Makefile.am: Add gc_tls_test.
9148         * testsuite/Makefile.in: Regenerate.
9149         * testsuite/gc_tls_test.cc: New file.
9150         * testsuite/gc_tls_test.sh: New file.
9151
9152 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9153
9154         * icf.cc: New file.
9155         * icf.h: New file.
9156         * Makefile.am (CCFILES): Add icf.cc.
9157         (HFILES): Add icf.h
9158         * Makefile.in: Regenerate.
9159         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9160         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9161         section, symbol and addend information for the relocs.
9162         * gold.cc (queue_middle_tasks): Call identical code folding.
9163         * gold.h: Add defines for multimap.
9164         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9165         to the call of finalize_local_symbols.
9166         * main.cc (main): Create object of class Icf.
9167         * object.cc (Sized_relobj::do_layout): Allow this function to be
9168         called twice during icf.
9169         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9170         to sections marked as identical by icf.
9171         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9172         when available.
9173         (Sized_relobj::do_section_entsize): New function.
9174         * object.h (Object::section_entsize): New function.
9175         (Object::do_section_entsize): New pure virtual function.
9176         (Relobj::finalize_local_symbols): Add new parameter.
9177         (Relobj::do_section_entsize): New function.
9178         * options.h (General_options::icf): New option.
9179         (General_options::icf_iterations): New option.
9180         (General_options::print_icf_sections): New option.
9181         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9182         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9183         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9184         icf.
9185         * symtab.cc (Symbol_table::is_section_folded): New function.
9186         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9187         to sections marked as identical by icf.
9188         * symtab.h (Symbol_table::set_icf): New function.
9189         (Symbol_table::icf): New function.
9190         (Symbol_table::is_section_folded): New function.
9191         (Symbol_table::icf_): New data member.
9192         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9193         * testsuite/Makefile.am: Add commands to build icf_test.
9194         * testsuite/Makefile.in: Regenerate.
9195         * testsuite/icf_test.sh: New file.
9196         * testsuite/icf_test.cc: New file.
9197
9198 2009-07-24  Chris Demetriou  <cgd@google.com>
9199
9200         * layout.cc (is_compressible_debug_section): Fix incorrect
9201         comment about compressed section names.
9202
9203 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9204
9205         PR 10419
9206         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9207
9208 2009-07-16  Ian Lance Taylor  <iant@google.com>
9209
9210         PR 10400
9211         * layout.h: #include <map>.
9212         (class Kept_section): Change from struct to class.  Add accessors
9213         and setters.  Add section size to Comdat_group mapping.  Change
9214         Comdat_group to std::map.  Add is_comdat_ field.  Add
9215         linkonce_size field in union.
9216         (class Layout): Update declaration of find_or_add_kept_section.
9217         Don't declare find_kept_object.
9218         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9219         parameter.  Add object, shndx, is_comdat, and is_group_name
9220         parameters.  Change all callers.  Adjust for new Kept_section.
9221         (Layout::find_kept_object): Remove.
9222         * object.cc (Sized_relobj::include_section_group): Update use of
9223         Kept_section.  Rename secnum to shndx.  Only record
9224         Kept_comdat_section if sections are the same size.
9225         (Sized_relobj::include_linkonce_section): Update use of
9226         Kept_section.  Only record Kept_comdat_section if sections are the
9227         same size.  Set size of linkonce section.
9228         (Sized_relobj::map_to_kept_section): Update call to
9229         get_kept_comdat_section.
9230         * object.h (class Sized_relobj): Rename fields in
9231         Kept_comdat_section to drop trailing underscores; change object
9232         field to Relobj*.  Change Kept_comdat_section_table to store
9233         struct rather than pointer.
9234         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9235         Add kept_object and kept_shndx parameters.  Change all callers.
9236         (Sized_relobj::get_kept_comdat_section): Change return type to
9237         bool.  Add kept_object and kept_shndx parameters.  Change all
9238         callers.
9239         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9240         Layout::find_or_add_kept_section.
9241
9242 2009-07-09  Ian Lance Taylor  <iant@google.com>
9243
9244         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9245         Reserve space in the hash table.
9246
9247 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9248
9249         * fileread.cc (File_read::get_mtime): New method.
9250         * fileread.h (Timespec): New structure.
9251         (File_read::get_mtime): New method.
9252         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9253         Renamed from timestamp_nsec.
9254         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9255         Elf_Xword.
9256         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9257         timestamp_nsec.
9258         (Incremental_inputs::report_archive): Save mtime; style fix.
9259         (Incremental_inputs::report_obejct): Save mtime; style fix.
9260         (Incremental_inputs::report_script): Save mtime; style fix.
9261         (Incremental_inputs::finalize_inputs): Style fix.
9262         (Incremental_inputs::finalize): Style fix.
9263         (Incremental_inputs::create_input_section_data): Store inputs
9264         mtime.
9265         * incremental.h (Incremental_inputs::report_script): Add mtime
9266         argument.
9267         (Incremental_inputs::Input_info::Input_info): Intialize only one
9268         union member.
9269         (Incremental_inputs::Input_info::archive): Move to nameless
9270         union.
9271         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9272         (Incremental_inputs::Input_info::script): Move to nameless union.
9273         (Incremental_inputs::mtime): New field.
9274         * script.cc (read_input_script): Pass file mtime to
9275         Incremental_input.
9276         * script.h (Script_info::inputs): Style fix.
9277
9278 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9279
9280         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9281         instead of 32.
9282
9283 2009-06-24  Ian Lance Taylor  <iant@google.com>
9284
9285         PR 10156
9286         * layout.cc (Layout::choose_output_section): If we find an
9287         existing section, update the flags.
9288         (Layout::create_notes): New function, broken out of
9289         Layout::finalize.
9290         (Layout::finalize): Don't create note sections.
9291         (Layout::create_note): Don't crash if linker script discards
9292         section.
9293         (Layout::create_gold_note): Likewise.
9294         (Layout::create_build_id): Likewise.  Don't set
9295         after_input_sections on the section.
9296         (Layout::create_executable_stack_info): Remove target parameter.
9297         Change caller.
9298         * layout.h (class Layout): Declare create_notes.  Update
9299         declaration of create_executable_stack_info.
9300         * gold.cc (queue_middle_tasks): Call create_notes.
9301         * output.cc (Output_section::update_flags_for_input_section): Move
9302         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9303         invalid.
9304         * output.h (Output_data::mark_address_invalid): New function.
9305         (class Output_section): Only declare, not define,
9306         update_flags_for_input_section.  Remove set_flags.
9307
9308 2009-06-24  Ian Lance Taylor  <iant@google.com>
9309
9310         * script-sections.cc (Output_section_definition::
9311         set_section_addresses): Rename shadowing local load_address to
9312         laddr.
9313
9314 2009-06-24  Ian Lance Taylor  <iant@google.com>
9315
9316         PR 10244
9317         * reloc.cc (relocate_sections): Skip empty relocation sections.
9318
9319 2009-06-23  Ian Lance Taylor  <iant@google.com>
9320
9321         PR 10156
9322         * layout.cc (Layout::create_note): Use choose_output_section
9323         rather than make_output_section.
9324
9325 2009-06-23  Ian Lance Taylor  <iant@google.com>
9326
9327         PR 10237
9328         * options.cc (General_options::parse_V): Set printed_version_.
9329         (General_options::General_options): Initialize printed_version_.
9330         * options.h (class General_options): Add printed_version_ field.
9331         * gold.cc (queue_initial_tasks): If there are no input files,
9332         don't give a fatal error if we printed the version information.
9333         (queue_middle_tasks): If using -r with a shared object, give a
9334         fatal error rather than an ordinary error.
9335
9336 2009-06-23  Ian Lance Taylor  <iant@google.com>
9337
9338         PR 10219
9339         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9340         (Layout::make_output_section): Set have_stabstr_section_ if we see
9341         a .stab*str section.
9342         (Layout::finalize): Call link_stabs_sections.
9343         (Layout::link_stabs_sections): New file.
9344         * layout.h (class Layout): Add have_stabstr_section_ field.
9345         Declare link_stabs_sections.
9346
9347 2009-06-23  Doug Kwan  <dougkwan@google.com>
9348
9349         * Makefile.am (libgold_a_LIBADD): New.
9350         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9351         * Makefile.in: Regenerate.
9352         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9353         * configure: Regenerate.
9354         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9355         * fileread.cc: Include sys/state.h
9356         * gold.h: Declare memmem and strndup if found missing.
9357         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9358
9359 2009-06-23  Ian Lance Taylor  <iant@google.com>
9360
9361         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9362         * configure: Rebuild.
9363
9364 2009-06-23  Ian Lance Taylor  <iant@google.com>
9365
9366         PR 10147
9367         * object.cc (Object::section_contents): Don't try to get a view if
9368         the section has length zero.
9369         (Object::handle_gnu_warning_section): If the section is empty, use
9370         the name of the section as the warning.
9371
9372 2009-06-23  Ian Lance Taylor  <iant@google.com>
9373
9374         PR 10133
9375         * stringpool.h (class Stringpool_template): Add optimize_ field.
9376         (Stringpool_template::set_optimize): New function.
9377         * stringpool.cc (Stringpool_template::Stringpool_template):
9378         Initialize optimize_ field.
9379         (Stringpool_template::set_string_offsets): Test local optimize
9380         fild rather than parameter.
9381         * layout.cc (Layout::Layout): Call set_optimize on the section
9382         name stringpool.
9383
9384 2009-06-22  Ian Lance Taylor  <iant@google.com>
9385
9386         PR 10030
9387         * yyscript.y: Parse TARGET.
9388         * script.cc (script_set_target): New function.
9389         * script-c.h (script_set_target): Declare.
9390         * options.cc (General_options::string_to_object_format): Rename
9391         from string_to_object_format in anonymous namespace.  Change
9392         callers.
9393         * options.h (class General_options): Declare
9394         string_to_object_format.
9395
9396 2009-06-22  Ian Lance Taylor  <iant@google.com>
9397
9398         * script-sections.cc (Script_sections::create_segments): Don't put
9399         program headers in a PT_LOAD segment if -n or -N.
9400
9401 2009-06-22  Ian Lance Taylor  <iant@google.com>
9402
9403         PR 10141
9404         * options.h (class General_options): Add -z lazy and -z now.  Sort
9405         -z options into alphabetical order.
9406         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9407
9408 2009-06-21  Ian Lance Taylor  <iant@google.com>
9409
9410         * layout.cc (Layout::make_output_section): Call
9411         Target::new_output_section.
9412         (Layout::attach_allocated_section_to_segment): Put large section
9413         sections in a separate load segment with the large segment flag
9414         set.
9415         (Layout::segment_precedes): Sort large data segments after other
9416         load segments.
9417         (align_file_offset): New static function.
9418         (Layout::set_segment_offsets): Use align_file_offset.
9419         * output.h (class Output_section): Add is_small_section_ and
9420         is_large_section_ fields.
9421         (Output_section::is_small_section): New function.
9422         (Output_section::set_is_small_section):  New function.
9423         (Output_section::is_large_section): New function.
9424         (Output_section::set_is_large_section): New function.
9425         (Output_section::is_large_data_section): New function.
9426         (class Output_segment): Add is_large_data_segment_ field.
9427         (Output_segment::is_large_data_segment): New function.
9428         (Output_segment::set_is_large_data_segment): New function.
9429         * output.cc (Output_section::Output_section): Initialize new
9430         fields.
9431         (Output_segment::Output_segment): Likewise.
9432         (Output_segment::add_output_section): Add assertion that large
9433         data sections always go in large data segments.  Force small data
9434         sections to the end of the list of data sections.  Force small BSS
9435         sections to the start of the list of BSS sections.  For large BSS
9436         sections to the end of the list of BSS sections.
9437         * symtab.h (class Symbol): Declare is_common_shndx.
9438         (Symbol::is_defined): Check Symbol::is_common_shndx.
9439         (Symbol::is_common): Likewise.
9440         (class Symbol_table): Define enum Commons_section_type.  Update
9441         declarations.  Add small_commons_ and large_commons_ fields.
9442         * symtab.cc (Symbol::is_common_shndx): New function.
9443         (Symbol_table::Symbol_table): Initialize new fields.
9444         (Symbol_table::add_from_object): Put small and large common
9445         symbols in the right list.
9446         (Symbol_table::sized_finalized_symbol): Check
9447         Symbol::is_common_shndx.
9448         (Symbol_table::sized_write_globals): Likewise.
9449         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9450         common symbol lists.  Don't call do_allocate_commons_list if the
9451         list is empty.
9452         (Symbol_table::do_allocate_commons_list): Remove is_tls
9453         parameter.  Add comons_section_type parameter.  Change all
9454         callers.  Handle small and large common symbols.
9455         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9456         Symbol::is_common_shndx.
9457         * resolve.cc (symbol_to_bits): Likewise.
9458         * target.h (Target::small_common_shndx): New function.
9459         (Target::small_common_section_flags): New function.
9460         (Target::large_common_shndx): New function.
9461         (Target::large_common_section_flags): New function.
9462         (Target::new_output_section): New function.
9463         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9464         small_common_section_flags, and large_common_section_flags
9465         fields.
9466         (Target::do_new_output_section): New virtual function.
9467         * arm.cc (Target_arm::arm_info): Initialize new fields.
9468         * i386.cc (Target_i386::i386_info): Likewise.
9469         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9470         Likewise.
9471         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9472         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9473         (Target_x86_64::do_new_output_section): New function.
9474         * configure.ac: Define conditional MCMODEL_MEDIUM.
9475         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9476         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9477         (large_LDFLAGS): Define.
9478         * testsuite/large.c: New file.
9479         * testsuite/testfile.cc (Target_test::test_target_info):
9480         Initialize new fields.
9481         * configure, testsuite/Makefile.in: Rebuild.
9482
9483 2009-06-05  Doug Kwan  <dougkwan@google.com>
9484
9485         * Makefile.am (CCFILES): Add target.cc.
9486         * Makefile.in: Regenerate.
9487         * i386.cc (class Target_i386): Define new virtual method to
9488         override do_is_local_label_name in parent.
9489         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9490         local symbols if --discard-locals or -X is given.
9491         * options.h (class General_options): Declare new options
9492         '--discard-locals' and '-X' for discarding locals.
9493         * target.h (class Target): Define new methods is_local_label_name.
9494         Declare new virtual method do_is_local_label_name.
9495         * target.cc: New file.
9496         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9497         (check_SCRIPTS): Add discard_locals_test.sh.
9498         (check_DATA): Add discard_local_tests.syms.
9499         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9500         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9501         * testsuite/Makefile.in: Regenerate.
9502         * testsuite/discard_locals_test.c: New file.
9503         * testsuite/discard_locals_test.sh: Same.
9504
9505 2009-06-05  Doug Kwan  <dougkwan@google.com>
9506
9507         * object.cc (Sized_relobj::Sized_relobj): Initialize
9508         discarded_eh_frame_shndx_ to -1U.
9509         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9510         section.
9511         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9512         a discarded .eh_frame section.
9513         (Sized_relobj::do_finalize_local_symbols): Ditto.
9514         * object.h (class Sized_relobj): Declare new member
9515         discarded_eh_frame_shndx_.
9516         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9517         (local_labels_test.o, local_labels_test): New rules.
9518         * testsuite/Makefile.in: Regenerate.
9519
9520 2009-06-04  Doug Kwan  <dougkwan@google.com>
9521
9522         * layout.cc (Layout::section_name_mapping): Add mapping for
9523         special ARM sections.
9524
9525 2009-06-03  Doug Kwan  <dougkwan@google.com>
9526
9527         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9528         (utils::has_overflow): Same.
9529
9530 2009-06-03  Ian Lance Taylor  <iant@google.com>
9531
9532         * layout.cc (Layout::section_name_mapping): New array, replacing
9533         Layout::linkonce_mapping.
9534         (Layout::section_name_mapping_count): New variable, replacing
9535         Layout::linkonce_mapping_count.
9536         (Layout::linkonce_output_name): Remove.
9537         (Layout::output_section_name): Rewrite.
9538         * layout.h (class Layout): Rename Linkonce_mapping to
9539         Section_name_mapping, linkonce_mapping to section_name_mapping,
9540         linkonce_mapping_count to section_name_mapping_count.  Don't
9541         declare linkonce_output_name.
9542
9543 2009-06-03  Doug Kwan  <dougkwan@google.com>
9544
9545         * gold/arm.cc (namespace utils): New.
9546         (Target_arm::reloc_is_non_pic): Define new method.
9547         (class Arm_relocate_functions): New.
9548         (Target_arm::Relocate::relocate): Handle relocation types used by
9549         Android.
9550
9551 2009-06-03  Ian Lance Taylor  <iant@google.com>
9552
9553         * arm.cc (Target_arm::scan::global): Use || instead of |.
9554
9555 2009-06-02  Doug Kwan  <dougkwan@google.com>
9556
9557         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9558         issued_non_pic_error_.
9559         (class Target_arm::Scan): Declare new method check_non_pic.
9560         Define new method symbol_needs_plt_entry.
9561         Declare new data member issued_non_pic_error_.
9562         (class Target_arm::Relocate): Declare new method
9563         should_apply_static_reloc.
9564         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9565         (Target_arm::Scan::check_non_pic): Define new method.
9566         (Target_arm::Scan::local): Handle a small subset of reloc types used
9567         by Android.
9568         (Target_arm::Scan::local): Same.
9569         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9570
9571 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9572
9573         * incremental.cc (Incremental_inputs::report_command_line): Filter
9574         out --incremental-* options.
9575
9576 2009-05-29  Doug Kwan  <dougkwan@google.com>
9577
9578         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9579         template class.
9580         (class Target_arm): Update comment.
9581         (Target_arm::Target_arm): Initialize new data members GOT_,
9582         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9583         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9584         and Target_arm::rel_dyn_section.
9585         Declare new_enum Target_arm::Got_type.
9586         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9587         and DYNBSS_.
9588         Update commments for member do_dynsym_value.
9589         (Target_arm::got_size, Target_arm::plt_section,
9590         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9591         new methods inside class defintion.
9592         (Target_arm::got_section): Define new method.
9593         (Target_arm::rel_dyn_section): Same.
9594         (Output_data_plt_arm): New template class.
9595         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9596         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9597         (Output_data_plt_arm::add_entry): Same.
9598         (Output_data_plt_arm::first_plt_entry): Define new
9599         static data member for PLT instruction template.
9600         (Output_data_plt_arm::plt_entry): Same.
9601         (Output_data_plt_arm::do_write): Define new method.
9602         (Target_arm::make_plt_entry): Same.
9603         (Target_arm::do_finalize_sections): Same.
9604         (Target_arm::do_dynsym_value): Same.
9605
9606 2009-05-28  Doug Kwan  <dougkwan@google.com>
9607
9608         * Makefile.am (TARGETSOURCES): Add arm.cc.
9609         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9610         * Makefile.in: Regenerate.
9611         * arm.cc: New file.
9612         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9613
9614 2009-05-26  Doug Kwan  <dougkwan@google.com>
9615
9616         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9617         (General_options::check_excluded_libs): Strip off directories in
9618         archive name before matching like GNU ld does.
9619         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9620         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9621         (exclude_libs_test_LDFLAGS): Add linker option
9622         -Wl,--exclude-libs,libexclude_libs_test_3
9623         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9624         an explicit archive without using -l.
9625         (alt/libexclude_libs_test_3.a): New make rule.
9626         * testsuite/Makefile.in: Regenerate.
9627         * testsuite/exclude_libs_test.c : Declare lib3_default().
9628         (main): Call it.
9629         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9630         * exclude_libs_test_3.c: New file.
9631
9632 2009-05-26  Nick Clifton  <nickc@redhat.com>
9633
9634         * po/id.po: New Indonesian translation.
9635         * po/gold.pot: Updated template file.
9636
9637 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9638
9639         * testsuite/Makefile.am: Add -ffunction-sections to compile
9640         gc_comdat_test files.  Add -Wl,--gc-sections to build
9641         gc_comdat_test.
9642         * testsuite/Makefile.in: Regenerate.
9643         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9644
9645 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9646
9647         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9648         kept comdat section was garbage collected.
9649         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9650         * testsuite/Makefile.in: Regenerate.
9651         * testsuite/gc_comdat_test.sh: New file.
9652         * testsuite/gc_comdat_test_1.cc: New file.
9653         * testsuite/gc_comdat_test_2.cc: New file.
9654
9655 2009-05-19  Doug Kwan  <dougkwan@google.com>
9656
9657         * archive.cc (Archive::Archive): Move constructor from archive.h
9658         to here.  Initialize no_export_.
9659         (Archive::get_elf_object_for_member): Set no_export flag of object.
9660         * archive.h (Archive::Archive): Move constructor body to
9661         archive.cc.
9662         (Archive::no_export): New method.
9663         (Archive::no_export_): New field.
9664         * object.h (Object::Object): Initialize no_export_ to false.
9665         (Object::no_export, Object::set_no_export): New methods.
9666         (Object::no_export_): New field.
9667         * options.cc (General_options::parse_exclude_libs): New method.
9668         (General_options::check_excluded_libs) Same.
9669         * options.h (exclude_libs): New option.
9670         (General_options::check_excluded_libs): New method declaration.
9671         (General_options::excluded_libs_): New field.
9672         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9673         default or protected visibility if an object has no-export flag set.
9674         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9675         (check_SCRIPTS): Add exclude_libs_test.sh.
9676         (check_DATA): Add exclude_libs_test.syms.
9677         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9678         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9679         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9680         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9681         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9682         libexclude_libs_test_2.a): New rules.
9683         * testsuite/Makefile.in: Regenerate.
9684         * testsuite/exclude_libs_test.c: New file.
9685         * testsuite/exclude_libs_test.sh: Ditto.
9686         * testsuite/exclude_libs_test_1.c: Ditto.
9687         * testsuite/exclude_libs_test_2.c: Ditto.
9688
9689 2009-05-15  Ian Lance Taylor  <iant@google.com>
9690
9691         * configure.ac: Check for declarations for cases where libiberty.h
9692         checks HAVE_DECL_xxx.
9693         * configure, config.in: Rebuild.
9694
9695 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9696
9697         * gold.h (Incremental_argument_list): Remove (invalid) forward
9698         declaration.
9699         * incremental.cc (Incremental_inputs::report_achive): New method.
9700         (Incremental_inputs::report_object): New method.
9701         (Incremental_inputs::report_script): New method.
9702         (Incremental_inputs::finalize_inputs): New method.
9703         (Incremental_inputs::finalize): Call finalize_inputs().
9704         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9705         Create inputs entries.
9706         * incremental.h (Incremental_input_type): New enum.
9707         (Incremental_inputs::Incremental_input): Initialize new fields.
9708         (Incremental_inputs::report_inputs): New method.
9709         (Incremental_inputs::report_achive): New method.
9710         (Incremental_inputs::report_object): New method.
9711         (Incremental_inputs::report_script): New method.
9712         (Incremental_inputs::finalize_inputs): New method.
9713         (Incremental_inputs::Input_info): New struct.
9714         (Incremental_inputs::Input_info_map): New typedef.
9715         (Incremental_inputs::lock_): New field.
9716         (Incremental_inputs::Inputs_): New field.
9717         (Incremental_inputs::Inputs_map): New field.
9718         * main.cc (main): Call Incremental_input::report_inputs.
9719         * options.h (Input_argument_list): Typedef moved from
9720         Input_arguments.
9721         (Input_file_group::Files): Remove, use ::Input_argument_list.
9722         (Input_file_group::Input_argument_list): Remove, use
9723         ::Input_argument_list.
9724         * plugin.cc (Plugin_manager::add_input_file): Add error in
9725         incremental build.
9726         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9727         functions.
9728         * script.cc (read_input_script): Call
9729         Incremental_input::report_script.
9730         * script.h (Script_info): New class.
9731
9732 2009-04-27  Ian Lance Taylor  <iant@google.com>
9733
9734         * x86_64.cc (do_adjust_output_section): Set entsize to
9735         plt_entry_size.
9736
9737 2009-04-23  Elliott Hughes  <enh@google.com>
9738
9739         * output.cc (Output_file::close): After short writes, continue
9740         writing from the correct offset in the buffer being written.
9741
9742 2009-04-23  Chris Demetriou  <cgd@google.com>
9743
9744         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9745         * configure: Regenerate.
9746         * config.in: Regenerate.
9747         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9748         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9749
9750 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9751
9752         * incremental.cc (Incremental_inputs_header_data): Renamed from
9753         Incremental_input_header_data.
9754         (Incremental_inputs_header_data::data_size): New field.
9755         (Incremental_inputs_header_data::put_input_file_count): Renamed
9756         from input_file_count.
9757         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9758         from command_line_offset.
9759         (Incremental_inputs_header_data::put_reserved): Renamed from
9760         put_reserved.
9761         (Incremental_inputs_entry_data): Renamed from
9762         Incremental_input_entry_data.
9763         (Incremental_inputs_entry_data::data_size): New field.
9764         (Incremental_inputs::report_command_line): New method.
9765         (Incremental_inputs::finalize): New method.
9766         (Incremental_inputs::create_incremental_inputs_data): New method.
9767         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9768         * incremental.h: New file.
9769         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9770        (Layout::finalize): Create incremental inputs section in
9771         incremental builds.
9772        (Layout::create_incremental_info_sections): New method.
9773         * layout.h (Layout::incremental_inputs): New method.
9774        (Layout::create_incremental_info_sections): New method.
9775        (Layout::incremental_inputs_): New field.
9776         * main.cc (main): Notify Incremental_input of the command line.
9777
9778 2009-04-01  Ian Lance Taylor  <iant@google.com>
9779             Mikolaj Zalewski  <mikolajz@google.com>
9780
9781         * gold.h (reserve_unordered_map): Define, three versions, one for
9782         each version of Unordered_map.
9783         * layout.cc (Layout::Layout): Remove options parameter.  Add
9784         number_of_input_files parameter.  Don't initialize options_.
9785         Initialize number_of_input_files_ and resized_signatures_.  Move
9786         sections_are_attached_.
9787         (Layout::layout_group): Reserve space for group_signatures_.
9788         (Layout::find_or_add_kept_section): Change name parameter to be a
9789         reference.  Resize signatures_ map when it gets large enough.
9790         (Layout::layout_eh_frame): Use parameters->options() instead of
9791         this->options_.
9792         (Layout::make_output_section): Likewise.
9793         (Layout::attach_allocated_section_to_segment): Likewise.
9794         (Layout::finalize, Layout::create_executable_stack): Likewise.
9795         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9796         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9797         * layout.h (class Layout): Update declarations.  Remove options_
9798         field.  Add number_of_input_files_ and resized_signatures_
9799         fields.  Move sections_are_attached_ field.
9800         * main.cc (main): Pass number of input files to Layout
9801         constructor.  Don't pass options.
9802
9803 2009-03-30  Ian Lance Taylor  <iant@google.com>
9804
9805         * ffsll.c (ffsll): Correct implementation.
9806
9807 2009-03-27  Ian Lance Taylor  <iant@google.com>
9808
9809         * ffsll.c: New file.
9810         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9811         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9812         * ftruncate.c (ftruncate): Declare before definition.
9813         * mremap.c (mremap): Likewise.
9814         * pread.c (pread): Likewise.
9815         * configure, Makefile.in, config.in: Rebuild.
9816
9817         * mremap.c: New file.
9818         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9819         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9820         (mremap): Declare if HAVE_MREMAP is not defined.
9821         * configure, Makefile.in, config.in: Rebuild.
9822
9823 2009-03-27  Cary Coutant  <ccoutant@google.com>
9824
9825         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9826         position independent.
9827         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9828         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9829
9830 2009-03-24  Cary Coutant  <ccoutant@google.com>
9831
9832         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9833         an executable.
9834         (needs_dynamic_reloc): Likewise.
9835
9836 2009-03-24  Ian Lance Taylor  <iant@google.com>
9837
9838         * yyscript.y (file_cmd): Recognize EXTERN.
9839         (extern_name_list, extern_name_list_body): New nonterminals.
9840         * script.cc (script_add_extern): Define.
9841         * script-c.h (script_add_extern): Declare.
9842
9843 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9844
9845         * object.cc (is_elf_object): Define.
9846         * object.h (is_elf_object): Declare.
9847         * archive.cc (Archive::get_elf_object_for_member): Call
9848         is_elf_object.
9849         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9850
9851 2009-03-24  Elliott Hughes  <enh@google.com>
9852
9853         * output.cc (Output_file::map_anonymous): Define.
9854         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9855         try an anonymous one.  Report the size if the mmap fails.
9856         * output.h (class Output_file): Declare map_anonymous.
9857
9858 2009-03-24  Ian Lance Taylor  <iant@google.com>
9859
9860         * target-select.cc (instantiate_target): Don't acquire the lock if
9861         the instantiated_target_ field has already been set.
9862
9863 2009-03-23  Ian Lance Taylor  <iant@google.com>
9864
9865         * gold-threads.h (class Initialize_lock): Define.
9866         * gold-threads.cc (class Initialize_lock_once): Define.
9867         (initialize_lock_control): New static variable.
9868         (initialize_lock_pointer): New static variable.
9869         (initialize_lock_once): New static function.
9870         (Initialize_lock::Initialize_lock): Define.
9871         (Initialize_lock::initialize): Define.
9872         * target-select.h: Include "gold-threads.h".
9873         (class Target_selector): Add lock_ and initialize_lock_ fields.
9874         Don't define instantiate_target, just declare it.
9875         * target-select.cc (Target_selector::Target_selector): Initialize
9876         new fields.
9877         (Target_selector::instantiate_target): Define.
9878         * descriptors.h: Include "gold-threads.h".
9879         (class Descriptors): Add initialize_lock_ field.
9880         * descriptors.cc (Descriptors::Descriptors): Initialize new
9881         field.
9882         (Descriptors::open): Use initialize_lock_ field
9883         * errors.h (class Errors): Add initialize_lock_ field.
9884         * errors.cc (Errors::Errors): Initialize new field.
9885         (Errors::initialize_lock): Use initialize_lock_ field.
9886         * powerpc.cc (class Target_selector_powerpc): Remove
9887         instantiated_target_ field.  In do_recognize call
9888         instantiate_target rather than do_instantiate_target.  In
9889         do_instantiate_target just allocate a new target.
9890         * sparc.cc (class Target_selector_sparc): Likewise.
9891
9892         * freebsd.h: New file.
9893         * i386.cc: Include "freebsd.h".
9894         (Target_i386): Derive from Target_freebsd rather than
9895         Sized_target.
9896         (Target_selector_i386): Derive from Target_selector_freebsd rather
9897         than Target_selector.
9898         * x86_64.cc: Include "freebsd.h".
9899         (Target_x86_64): Derive from Target_freebsd rather than
9900         Sized_target.
9901         (Target_selector_x86_64): Derive from Target_selector_freebsd
9902         rather than Target_selector.
9903         * target.h (class Target): Add adjust_elf_header and
9904         do_adjust_elf_header.
9905         * output.cc (Output_file_header:: do_sized_write): Call target
9906         adjust_elf_header routine.
9907         * configure.tgt: Set targ_osabi.
9908         * configure.ac: Define GOLD_DEFAULT_OSABI.
9909         * parameters.cc (Parameters::default_target): Pass
9910         GOLD_DEFAULT_OSABI to select_target.
9911         * target-select.h (class Target_selector): Make instantiate_target
9912         protected rather than private.
9913         * Makefile.am (HFILES): Add freebsd.h.
9914         * configure, Makefile.in, config.in: Rebuild.
9915
9916         * merge.cc (do_add_input_section): Correct pend value.  Change
9917         message about last entry not being null terminated from error to
9918         warning.
9919
9920 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9921
9922         * incremental.cc: New file.
9923         * Makefile.am (CCFILES): Add incremental.cc.
9924         * Makefile.in: Rebuild.
9925
9926 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9927
9928         * layout.cc (Layout::output_section_name): Preserve names
9929         of '.note.' sections.
9930
9931 2009-03-19  Ian Lance Taylor  <iant@google.com>
9932
9933         * descriptors.cc (Descriptors::open): Check that the options are
9934         valid before using them.
9935
9936 2009-03-18  Ian Lance Taylor  <iant@google.com>
9937
9938         * script-sections.h: Include <list>.
9939         (class Script_sections): Change Sections_elements from std::vector
9940         to std::list.  Typedef public Elements_iterator.  Add
9941         orphan_section_placement_, data_segment_align_start_, and
9942         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9943         field.
9944         * script-sections.cc (class Orphan_section_placement): New class.
9945         (class Sections_element): Add virtual functions is_relro and
9946         orphan_section_init.  Remove virtual function place_orphan_here.
9947         (class Output_section_definition): Add is_relro and
9948         orphan_section_init.  Remove place_orphan_here.
9949         (class Orphan_output_section): Likewise.
9950         (Script_sections::Script_sections): Update for field changes.
9951         (Script_sections::data_segment_align): Set saw_data_segment_align_
9952         and data_segment_align_start_, not data_segment_align_index.
9953         (Script_sections::data_segment_relro_end): Check
9954         saw_data_segment_align_.  Use data_segment_align_start_ rather
9955         than data_segment_align_index_.
9956         (Script_sections::place_orphan): Rewrite to use
9957         Orphan_section_placement.
9958
9959 2009-03-17  Ian Lance Taylor  <iant@google.com>
9960
9961         * archive.cc (Archive::add_symbols): Check for a version attached
9962         to the symbol name in the archive map.
9963         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9964         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9965         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9966         (ver_test_11.a): New target.
9967         * testsuite/Makefile.in: Rebuild.
9968
9969         * configure.ac: Check for chsize and posix_fallocate.  Replace
9970         ftruncate.
9971         * ftruncate.c: New file, from gnulib.
9972         * output.cc (posix_fallocate): Define dummy version if not
9973         HAVE_POSIX_FALLOCATE.
9974         (Output_file::map): Call posix_fallocate rather than lseek and
9975         write.
9976         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9977         * configure, Makefile.in, config.in: Rebuild.
9978
9979 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9980
9981         * layout.h (Layout::create_note): Add section_name parameter.
9982         * layout.cc (Layout::create_note): Likewise.
9983         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9984
9985 2009-03-17  Ian Lance Taylor  <iant@google.com>
9986
9987         * descriptors.cc: Include "options.h".
9988         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9989         (Descriptors::open): Always use O_CLOEXEC when opening a new
9990         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9991         then set FD_CLOEXEC.
9992
9993         * sparc.cc (class Target_sparc): Add has_got_section.
9994         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9995         make sure we have a GOT section.
9996
9997         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9998         (Target_sparc::Scan::local): Likewise.
9999         (Target_sparc::Scan::global): Likewise.
10000         (Target_sparc::Relocate::relocate): Likewise.
10001         (Target_sparc::Relocate::relocate_tls): Likewise.
10002
10003         * symtab.cc (Symbol_table::define_default_version): New function,
10004         broken out of add_from_object.
10005         (Symbol_table::add_from_object): Call define_default_version.
10006         (Symbol_table::define_special_symbol): Add resolve_oldsym
10007         parameter.  Change all callers.  If the version for a symbol comes
10008         from a version script, resolve it with the symbol with the same
10009         name with no version.  Also add the symbol without a version if
10010         appropriate.
10011         (do_define_in_output_data): If resolving with oldsym, don't delete
10012         sym.
10013         (do_define_in_output_segment): Likewise.
10014         (do_define_as_constant): Likewise.
10015         * symtab.h (class Symbol_table): Update declarations.
10016
10017 2009-03-13  Ian Lance Taylor  <iant@google.com>
10018
10019         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10020         (Read_symbols::requeue): New function.
10021         (Read_symbols::do_read_symbols): If make_elf_object fails because
10022         the target type is not configured, and the file was searched for,
10023         issue a warning and retry with the next directory.
10024         (Add_symbols::run): If the file has an incompatible format, and
10025         it was searched for, requeue the Read_symbols task.  On error,
10026         release the object.
10027         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10028         dirindex parameter to constructor.  Change all callers.  Declare
10029         incompatible_warning and requeue.
10030         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10031         input_argument_ and input_group_ fields.  Add them to
10032         constructor.  Change all callers.
10033         (class Read_script): Add dirindex_ field.  Add it to constructor.
10034         Change all callers.
10035         * archive.cc (Archive::setup): Remove input_objects parameter.
10036         Change all callers.
10037         (Archive::get_file_and_offset): Likewise.
10038         (Archive::read_all_symbols): Likewise.
10039         (Archive::read_symbols): Likewise.
10040         (Archive::get_elf_object_for_member): Remove input_objects
10041         parameter.  Add punconfigured parameter.  Change all callers.
10042         (Archive::add_symbols): Change return type to bool.  Check return
10043         value of include_member.
10044         (Archive::include_all_members): Likewise.
10045         (Archive::include_member): Change return type to bool.  Return
10046         false if first included object has incompatible target.  Set
10047         included_member_ field.
10048         (Add_archive_symbols::run): If add_symbols returns false, requeue
10049         Read_symbols task.
10050         * archive.h (class Archive): Add included_member_ field.
10051         Initialize it in constructor.  Add input_file and searched_for
10052         methods.  Update declarations.
10053         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10054         input_argument_ fields.  Add them to constructor.  Change all
10055         callers.
10056         * script.cc: Include "target-select.h".
10057         (class Parser_closure): Add skip_on_incompatible_target_ and
10058         found_incompatible_target_ fields.  Add
10059         skip_on_incompatible_target parameter to constructor.  Change all
10060         callers.  Add methods skip_on_incompatible_target,
10061         clear_skip_on_incompatible_target, found_incompatible_target, and
10062         set_found_incompatible_target.
10063         (read_input_script): Add dirindex parameter.  Change all callers.
10064         If parser finds an incompatible target, requeue Read_symbols
10065         task.
10066         (script_set_symbol): Clear skip_on_incompatible_target in
10067         closure.
10068         (script_add_assertion, script_parse_option): Likewise.
10069         (script_start_sections, script_add_phdr): Likewise.
10070         (script_check_output_format): New function.
10071         * script.h (read_input_script): Update declaration.
10072         * script-c.h (script_check_output_format): Declare.
10073         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10074         (ignore_cmd): Remove OUTPUT_FORMAT.
10075         * fileread.cc (Input_file::Input_file): Add explicit this.
10076         (Input_file::will_search_for): New function.
10077         (Input_file::open): Add pindex parameter.  Change all callers.
10078         * fileread.h (class Input_file): Add input_file_argument method.
10079         Declare will_search_for.  Update declarations.
10080         * object.cc (make_elf_object): Add punconfigured parameter.
10081         Change all callers.
10082         * object.h (class Object): Make input_file public.  Add
10083         searched_for method.
10084         (make_elf_object): Update declaration.
10085         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10086         restart search.
10087         * dirsearch.h (class Dirsearch): Update declaration.
10088         * options.h (class General_options): Add --warn-search-mismatch.
10089         * parameters.cc (Parameters::is_compatible_target): New function.
10090         * parameters.h (class Parameters): Declare is_compatible_target.
10091         * workqueue.cc (Workqueue::add_blocker): New function.
10092         * workqueue.h (class Workqueue): Declare add_blocker.
10093
10094         * fileread.cc (Input_file::open): Remove options parameter.
10095         Change all callers.
10096         (Input_file::open_binary): Likewise.
10097         * script.cc (read_input_script): Likewise.
10098         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10099         options parameter from constructor.  Change all callers.
10100         (class Read_script): Likewise.
10101         * fileread.h (class Input_file): Update declarations.
10102         * script.h (read_input_script): Update declaration.
10103
10104 2009-03-10  Nick Clifton  <nickc@redhat.com>
10105
10106         * po/es.po: New Spanish translation.
10107
10108 2009-03-06  Cary Coutant  <ccoutant@google.com>
10109
10110         * options.cc (parse_short_option): Keep dash_z from registering itself.
10111
10112 2009-03-03  Ian Lance Taylor  <iant@google.com>
10113
10114         PR 9918
10115         * target-reloc.h (relocate_section): Pass output_section to
10116         relocate.
10117         * i386.cc (Target_i386::should_apply_static_reloc): Add
10118         output_section parameter.  Change all callers.
10119         (Target_i386::Relocate::relocate): Add output_section parameter.
10120         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10121         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10122         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10123         * testsuite/two_file_shared.sh: New script.
10124         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10125         (check_DATA): Add two_file_shared.dbg.
10126         (two_file_shared.dbg): New target.
10127         * testsuite/Makefile.in: Rebuild.
10128
10129 2009-03-01  Ian Lance Taylor  <iant@google.com>
10130
10131         * configure.ac: Check for byteswap.h.
10132         * configure: Rebuild.
10133         * config.in: Rebuild.
10134
10135 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10136
10137         * layout.cc (Layout::find_or_add_kept_section): New function.
10138         (Layout::add_comdat): Removed.
10139         * layout.h (struct Kept_section): Move out of class Layout.
10140         Remove trailing underscores from field names.  Add group_sections
10141         field.  Rename group_ field to is_group.  Change all uses.
10142         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10143         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10144         comdat_groups_ field.
10145         (Sized_relobj::include_section_group): Use
10146         find_or_add_kept_section and Kept_section::group_sections.
10147         (Sized_relobj::include_linkonce_section): Likewise.
10148         * object.cc (class Sized_relobj): Don't define Comdat_group or
10149         Comdat_group_table.  Remove find_comdat_group and
10150         add_comdat_group.  Remove comdat_groups_ field.
10151         * plugin.cc (include_comdat_group): Use
10152         Layout::find_or_add_kept_section.
10153
10154 2009-02-28  Ian Lance Taylor  <iant@google.com>
10155
10156         * README: --gc-sections and map files are now supported.  Document
10157         some build requirements.
10158
10159         PR 6992
10160         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10161         relocatable link set the value of the section symbol to zero.
10162         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10163         relocatable link don't include the section address in the local
10164         symbol value.
10165
10166 2009-02-27  Ian Lance Taylor  <iant@google.com>
10167
10168         PR 6811
10169         * options.h (class Search_directory): Add is_system_directory.
10170         (class General_options): Declare is_in_system_directory.
10171         * options.cc (get_relative_sysroot): Make static.
10172         (get_default_sysroot): Make static.
10173         (General_optoins::is_in_system_directory): New function.
10174         * fileread.cc (Input_file::is_in_system_directory): New function.
10175         * fileread.h (class Input_file): Declare is_in_system_directory.
10176         * object.h (class Object): Add is_in_system_directory.
10177         (class Input_objects): Remove system_library_directory_ field.
10178         * object.cc (Input_objects::add_object): Don't set
10179         system_library_directory_.
10180         (input_objects::found_in_system_library_directory): Remove.
10181         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10182         parameter.  Change all callers.
10183         (Symbol_table::sized_write_globals): Likewise.
10184         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10185         Call Object::is_in_system_directory.
10186         * symtab.h (class Symbol_table): Update declarations.
10187
10188         PR 5990
10189         * descriptors.h (Open_descriptor): Add is_on_stack field.
10190         * descriptors.cc (Descriptors::open): If the descriptor is on the
10191         top of the stack, remove it.  Initialize is_on_stack field.
10192         (Descriptors::release): Only add pod to stack if it is not on the
10193         stack already.
10194         (Descriptors::close_some_descriptor): Clear stack_next and
10195         is_on_stack fields.
10196
10197         PR 7091
10198         * output.cc (Output_section::find_starting_output_address): Rename
10199         from starting_output_address; add PADDR parameter; change return
10200         type.
10201         * output.h (class Output_section): Declare
10202         find_starting_output_address instead of starting_output_address.
10203         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10204         section symbol for which we can't find a merge section.
10205
10206         PR 9836
10207         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10208         hidden or internal, force the symbol to be local.
10209         * resolve.cc (Symbol::override_visibility): Define.
10210         (Symbol::override_base): Use override_visibility.
10211         (Symbol_table::resolve): Likewise.
10212         (Symbol::override_base_with_special): Likewise.
10213         (Symbol_table::override_with_special): If the visibility is hidden
10214         or internal, force the symbol to be local.
10215         * symtab.h (class Symbol): Add set_visibility and
10216         override_visibility.
10217         * testsuite/ver_test_1.sh: New file.
10218         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10219         (check_DATA): Add ver_test_1.syms.
10220         (ver_test_1.syms): New target.
10221         * testsuite/Makefile.in: Rebuild.
10222
10223 2009-02-25  Cary Coutant  <ccoutant@google.com>
10224
10225         * layout.cc (Layout::choose_output_section): Don't rename sections
10226         when using a linker script that has a SECTIONS clause.
10227         * Makefile.in: Regenerate.
10228
10229         * testsuite/Makefile.am (script_test_5.sh): New test case.
10230         * testsuite/Makefile.in: Regenerate.
10231         * testsuite/script_test_5.cc: New file.
10232         * testsuite/script_test_5.sh: New file.
10233         * testsuite/script_test_5.t: New file.
10234
10235 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10236
10237         * archive.cc (Archive::include_member): Update calls to add_symbols.
10238         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10239         the Layout argument.
10240         * dynobj.h (do_add_symbols): Add the Layout argument.
10241         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10242         Layout argument.
10243         * object.h (Object::add_symbols): Add the Layout argument.
10244         (Object::do_add_symbols): Add the Layout argument.
10245         (Sized_relobj::do_add_symbols): Add the Layout argument.
10246         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10247         Unify the two versions.
10248         (Add_plugin_symbols): Remove.
10249         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10250         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10251         (Add_plugin_symbols): Remove.
10252         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10253         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10254         (Add_symbols::run): Make it work with Pulginobj.
10255
10256 2009-02-06  Ian Lance Taylor  <iant@google.com>
10257
10258         * object.cc (Sized_relobj::do_layout): Make info message start
10259         with lower case letter.
10260
10261 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10262
10263         * binary.cc: Fix file comment.
10264
10265         * options.h (enum Incremental_disposition): Define.
10266         (class General_options): Add new options: --incremental,
10267         --incremental_changed, --incremental_unchanged,
10268         --incremental_unknown.  Add incremental_disposition_ and
10269         implicit_incremental_ fields.
10270         (General_options::incremental_disposition): New function.
10271         (class Position_dependent_options): Add incremental_disposition
10272         option.
10273         (Position_dependent_options::copy_from_options): Set incremental
10274         dispositions.
10275         * options.cc (General_options::parse_incremental_changed): New
10276         function.
10277         (General_options::parse_incremental_unchanged): New function.
10278         (General_options::parse_incremental_unknown): New function.
10279         (General_options::General_options): Initialize new fields
10280         incremental_disposition_ and implicit_incremental_.
10281         (General_options::finalize): Check for uasge of --incremental-*
10282         without --incremental.
10283
10284 2009-02-06  Chris Demetriou  <cgd@google.com>
10285
10286         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10287         pointer and to report location as the file name associated with
10288         the symbol.
10289         (gold_undefined_symbol_at_location): New function to replace the
10290         old gold_undefined_symbol functionality.
10291         * target-reloc.h (relocate_section): Update to use
10292         gold_undefined_symbol_at_location.
10293         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10294         Call gold_undefined_symbol function rather than gold_error.
10295         * errors.h (Errors::undefined_symbol): Take location as a
10296         string, rather than calculating it from a relocation.
10297         * errors.cc (Errors::fatal): Print "fatal error:" before the
10298         formatted message.
10299         (Errors::error, Errors::error_at_location): Print "error: "
10300         before the formatted message.
10301         (Errors::undefined_symbol): Take location as a string, rather
10302         than calculating it from a relocation.
10303         (gold_undefined_symbol_at_location): New function akin to
10304         old gold_undefined_symbol, calculates location from relocation.
10305         (gold_undefined_symbol): Change to take only a Symbol pointer
10306         and to report location as the file name associated with the symbol.
10307         * testsuite/debug_msg.sh: Update for changed error messages.
10308         * testsuite/undef_symbol.sh: Likewise.
10309
10310 2009-02-04  Duncan Sands  <baldrick@free.fr>
10311
10312         PR 9812
10313         * reduced_debug_output.h
10314         (Output_reduced_debug_abbrev_section::failed): Use format for
10315         gold_warning.
10316         (Output_reduced_debug_info_section::faild): Likewise.
10317
10318 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10319
10320         * script.cc (Lazy_demangler): New class.
10321         (Version_script_info::get_symbol_version_helper): Demangle a
10322         symbol only once.
10323
10324 2009-01-29  Cary Coutant  <ccoutant@google.com>
10325
10326         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10327         to __tls_get_addr.
10328         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10329
10330 2009-01-28  Ian Lance Taylor  <iant@google.com>
10331
10332         * version.cc (version_string): Bump to 1.9.
10333
10334         * gold.h: Include <cstring> and <stdint.h>.
10335         * version.cc: Include <cstdio>.
10336         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10337         warning.
10338         * reduced_debug_output.cc (insert_into_vector): Rename from
10339         Insert_into_vector; change all callers.  Use Swap_unaligned to
10340         avoid aliasing issue; remove union since it is unnecessary.
10341
10342 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10343
10344         * Makefile.am (CCFILES): Add gc.cc.
10345         (HFILES): Add gc.h.
10346         * Makefile.in: Regenerate.
10347         * gold.cc (Gc_runner): New class.
10348         (queue_initial_tasks): Call garbage collection related tasks
10349         when corresponding options are invoked.
10350         (queue_middle_gc_tasks): New function.
10351         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10352         processed early before laying out sections during garbage collection.
10353         * gold.h (queue_middle_gc_tasks): New function.
10354         (is_prefix_of): Move from "layout.cc".
10355         * i386.cc (Target_i386::gc_process_relocs): New function.
10356         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10357         * main.cc (main): Create object of class "Garbage_collection".
10358         * object.cc (Relobj::copy_symbols_data): New function.
10359         (Relobj::is_section_name_included): New function.
10360         (Sized_relobj::do_layout): Allow this function to be called twice
10361         during garbage collection and defer layout of section during the
10362         first call.
10363         * object.h (Relobj::get_symbols_data): New function.
10364         (Relobj::is_section_name_included): New function.
10365         (Relobj::copy_symbols_data): New function.
10366         (Relobj::set_symbols_data): New function.
10367         (Relobj::get_relocs_data): New function.
10368         (Relobj::set_relocs_data): New function.
10369         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10370         (Relobj::gc_process_relocs): New function.
10371         (Relobj::do_gc_process_relocs): New pure virtual function.
10372         (Relobj::sd_): New data member.
10373         (Sized_relobj::is_output_section_offset_invalid): New function.
10374         (Sized_relobj::do_gc_process_relocs): New function.
10375         * options.h (General_options::gc_sections): Modify to not be a no-op.
10376         (General_options::print_gc_sections): New option.
10377         * plugin.cc (Plugin_finish::run): Remove function call to
10378         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10379         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10380         * reloc.cc (Read_relocs::run): Add task to process relocs and
10381         determine unreferenced sections when doing garbage collection.
10382         (Gc_process_relocs): New class.
10383         (Sized_relobj::do_gc_process_relocs): New function.
10384         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10385         sections that are garbage collected.
10386         * reloc.h (Gc_process_relocs): New class.
10387         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10388         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10389         symbols whose corresponding sections are garbage collected.
10390         (Symbol_table::Symbol_table): Add new parameter for the garbage
10391         collection object.
10392         (Symbol_table::gc_mark_undef_symbols): New function.
10393         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10394         (Symbol_table::gc_mark_dyn_syms): New function.
10395         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10396         as garbage.
10397         (Symbol_table::add_from_object): Likewise.
10398         (Symbol_table::add_from_relobj): When building shared objects, do not
10399         treat externally visible symbols as garbage.
10400         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10401         table information for static and relocatable links.
10402         * symtab.h (Symbol_table::set_gc): New function.
10403         (Symbol_table::gc): New function.
10404         (Symbol_table::gc_mark_undef_symbols): New function.
10405         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10406         (Symbol_table::gc_mark_dyn_syms): New function.
10407         (Symbol_table::gc_): New data member.
10408         * target.h (Sized_target::gc_process_relocs): New pure virtual
10409         function.
10410         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10411         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10412
10413 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10414
10415         * options.h (General_options::gc_sections): Define as a no-op for now.
10416         (General_options::no_keep_memory): Ditto.
10417         (General_options::Bshareable): Define.
10418         * options.cc (General_options::finalize): Honor -Bshareable.
10419
10420 2009-01-20  Andreas Schwab  <schwab@suse.de>
10421
10422         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10423         read the value in the contents, since we don't use it.  Use the
10424         template endianness when writing.
10425         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10426
10427 2009-01-19  Andreas Schwab  <schwab@suse.de>
10428
10429         * configure.tgt (powerpc64-*): Fix targ_obj.
10430
10431 2009-01-15  Ian Lance Taylor  <iant@google.com>
10432
10433         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10434         local symbols when stripping all symbols.
10435
10436 2009-01-14  Cary Coutant  <ccoutant@google.com>
10437
10438         * output.cc (Output_reloc): Add explicit instantiations.
10439
10440 2009-01-14  Cary Coutant  <ccoutant@google.com>
10441
10442         * archive.cc (Archive::get_elf_object_for_member): Remove call
10443         to File_read::claim_for_plugin.
10444         * descriptors.cc (Descriptors::open): Remove reference to
10445         is_claimed.
10446         (Descriptors::claim_for_plugin): Remove.
10447         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10448         (Descriptors::is_claimed): Remove.
10449         (claim_descriptor_for_plugin): Remove.
10450         * fileread.cc (File_read::claim_for_plugin): Remove.
10451         * fileread.h (File_read::claim_for_plugin): Remove.
10452         (File_read::descriptor): Reopen descriptor if necessary.
10453         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10454         (Plugin_manager::all_symbols_read): Add task parameter. Change
10455         all callers.
10456         (Plugin_manager::get_input_file): New function.
10457         (Plugin_manager::release_input_file): New function.
10458         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10459         corresponding data member.
10460         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10461         and pass to base constructor. Change all callers.
10462         (get_input_file, release_input_file): New functions.
10463         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10464         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10465         (Plugin_manager::all_symbols_read): Add task parameter.
10466         (Plugin_manager::get_input_file): New function.
10467         (Plugin_manager::release_input_file): New function.
10468         (Plugin_manager::task_): New data member.
10469         (Pluginobj::Pluginobj): Add filesize parameter.
10470         (Pluginobj::filename): New function.
10471         (Pluginobj::descriptor): New function.
10472         (Pluginobj::filesize): New function.
10473         (Pluginobj::filesize_): New data member.
10474         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10475         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10476         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10477
10478         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10479         with archive libraries.
10480         * testsuite/Makefile.in: Regenerate.
10481         * testsuite/plugin_test.c (struct sym_info): New type.
10482         (get_input_file, release_input_file): New static variables.
10483         (onload): Capture new transfer vector entries.
10484         (claim_file_hook): Stop reading at end of file according to filesize.
10485         Factor out parsing of readelf output into separate function.
10486         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10487         APIs and get the source file name from the symbol table.  Convert
10488         source file name to corresponding object file name.  Print info
10489         message when adding new input files.
10490         (parse_readelf_line): New function.
10491         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10492         * testsuite/plugin_test_2.sh: Likewise.
10493         * testsuite/plugin_test_3.sh: Likewise.
10494         * testsuite/plugin_test_4.sh: New test case.
10495
10496 2009-01-07  Ian Lance Taylor  <iant@google.com>
10497
10498         * version.cc (version_string): Bump to 1.8.
10499
10500 2008-12-23  Cary Coutant  <ccoutant@google.com>
10501
10502         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10503         * plugin.cc (Plugin_manager::finish): Rename as
10504         layout_deferred_objects.  Move cleanup to separate function.
10505         (Plugin_manager::cleanup): New function.
10506         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10507         separately.
10508         * plugin.h (Plugin_manager::finish): Rename as
10509         layout_deferred_objects.
10510         (Plugin_manager::cleanup): New function.
10511         (Plugin_manager::cleanup_done): New field.
10512
10513 2008-12-23  Cary Coutant  <ccoutant@google.com>
10514
10515         * plugin.cc (is_visible_from_outside): New function.
10516         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10517         so we don't return "IR only" status for exported symbols or -r links.
10518
10519         * testsuite/Makefile.am (plugin_test_3): New test case.
10520         * testsuite/Makefile.in: Regenerate.
10521         * testsuite/plugin_test_3.sh: New file.
10522
10523 2008-12-22  Cary Coutant  <ccoutant@google.com>
10524
10525         * object.cc (Sized_relobj::layout_section): New function.
10526         (Sized_relobj::do_layout): Defer layout of input sections until after
10527         plugin has provided replacement files.
10528         (Sized_relobj::do_layout_deferred_sections): New function.
10529         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10530         (Relobj::layout_deferred_sections): New function.
10531         (Relobj::do_layout_deferred_sections): New function.
10532         (Sized_relobj::do_layout_deferred_sections): New function.
10533         (Sized_relobj::layout_section): New function.
10534         (Sized_relobj::Deferred_layout): New structure.
10535         (Sized_relobj::deferred_layout_): New field.
10536         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10537         Change all callers.  Layout deferred sections.
10538         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10539         references.
10540         (Plugin_hook::run): Move code from do_plugin_hook inline.
10541         (Plugin_hook::do_plugin_hook): Remove.
10542         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10543         (Plugin_manager::finish): Renamed, was cleanup.
10544         (Plugin_manager::should_defer_layout): New function.
10545         (Plugin_manager::add_deferred_layout_object): New function.
10546         (Plugin_manager::Deferred_layout_list): New type.
10547         (Plugin_manager::deferred_layout_objects_): New field.
10548         (Plugin_hook::do_plugin_hook): Remove.
10549
10550 2008-12-17  Ian Lance Taylor  <iant@google.com>
10551
10552         * options.h (class General_options): Add --no case for
10553         --export-dynamic.
10554
10555 2008-12-16  Cary Coutant  <ccoutant@google.com>
10556
10557         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10558         vector.
10559         (Plugin_manager::claim_file): Create plugin object even if
10560         plugin did not call the add_symbols callback.
10561         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10562         asking for more symbols than were added.
10563         * testsuite/Makefile.am (plugin_test_1): Add test case with
10564         no global symbols.
10565         (empty.syms): New target.
10566         * testsuite/Makefile.in: Regenerate.
10567         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10568         message. Don't call add_symbols if no globals.
10569         (all_symbols_read_hook): Don't provide replacement for empty
10570         claimed file.
10571
10572 2008-12-12  Ian Lance Taylor  <iant@google.com>
10573
10574         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10575         r_type == 0 for a local symbol with r_sym == 0.
10576         (scan_relocatable_relocs): Pass r_sym to
10577         local_non_section_strategy.
10578         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10579         r_sym parameter.
10580
10581         * configure.ac: Update test for TLS descriptors: they are
10582         supported as of glibc 2.9.
10583         * configure: Rebuild.
10584
10585 2008-12-11  Ian Lance Taylor  <iant@google.com>
10586
10587         PR 7091
10588         * target-reloc.h (Default_scan_relocatable_relocs): For each
10589         function, map r_type == 0 to RELOC_DISCARD.
10590
10591 2008-12-10  Cary Coutant  <ccoutant@google.com>
10592
10593         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10594         object to override a kept COMDAT group from a plugin object.
10595
10596 2008-12-09  Ian Lance Taylor  <iant@google.com>
10597
10598         PR 7088
10599         * yyscript.y (file_cmd): Handle INPUT.
10600
10601         * testsuite/initpri1.c: Change all declarations to be full
10602         prototypes by adding void, to avoid compiler warnings.
10603
10604 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10605
10606         * options.cc (General_options::parse_plugin_opt): New.
10607         (General_options::add_plugin): The argument now is just the filename.
10608         (General_options::add_plugin_option): New.
10609         * options.h (plugin_opt): New.
10610         (add_plugin): Change argument name.
10611         (add_plugin_option): New.
10612         * plugin.cc (Plugin::load): Don't parse the plugin option.
10613         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10614         (Plugin::add_option): New.
10615         (Plugin::args_): Change type.
10616         (Plugin::filename_): New.
10617         (Plugin_manager::add_plugin_option): New.
10618         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10619         * testsuite/Makefile.in: Regenerate.
10620
10621 2008-12-05  Cary Coutant  <ccoutant@google.com>
10622
10623         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10624         Handle --strip-lto-sections option.
10625         * options.h (strip_lto_sections): New option.
10626
10627 2008-12-01  Cary Coutant  <ccoutant@google.com>
10628
10629         * plugin.cc (ld_plugin_message): Change format parameter to const.
10630         Fix mismatch between new[] and delete.
10631
10632 2008-11-14  Cary Coutant  <ccoutant@google.com>
10633
10634         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10635         instead of -1U.
10636
10637 2008-11-05  Craig Silverstein  <csilvers@google.com>
10638
10639         * options.cc (General_options::parse_dynamic_list): New function.
10640         * options.h (General_options): New flags dynamic_list,
10641         dynamic_list_data, dynamic_list_cpp_new, and
10642         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10643         (General_options::in_dynamic_list): New function.
10644         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10645         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10646         (Lex::can_continue_name): Likewise.
10647         (yylex): Likewise.
10648         (read_script_file): New parameter script_options.
10649         (read_dynamic_list): New function.
10650         (Script_options::define_dynamic_list): New function.
10651         (dynamic_list_keyword_parsecodes): New variable.
10652         (dynamic_list_keywords): New variable.
10653         * script.h (Script_options::define_dynamic_list): New function
10654         prototype.
10655         (read_dynamic_list): New function prototype.
10656         * symtab.cc (strprefix): New macro.
10657         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10658         dynamic_list_data, dynamic_list_cpp_new, and
10659         dynamic_list_cpp_typeinfo.
10660         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10661         (dynamic_list_expr): New rule.
10662         (dynamic_list_nodes): Likewise.
10663         (dynamic_list_node): Likewise.
10664         * testsuite/Makefile.am (dynamic_list): New test.
10665         * testsuite/Makefile.in: Regenerated.
10666         * testsuite/dynamic_list.t: New file.
10667         * testsuite/dynamic_list.sh: New file.
10668
10669 2008-11-05  Craig Silverstein  <csilvers@google.com>
10670
10671         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10672         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10673         (t11_last): Likewise.
10674         * testsuite/ver_test_6.c (main): Likewise.
10675
10676 2008-10-07  Cary Coutant  <ccoutant@google.com>
10677
10678         * options.c (General_options::finalize): Add check for -static and
10679         -shared.
10680         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10681         is not empty.
10682
10683 2008-10-02  Cary Coutant  <ccoutant@google.com>
10684
10685         * plugin.cc (make_sized_plugin_object): Fix conditional
10686         compilation to work when not all targets are enabled.
10687
10688 2008-09-29  Cary Coutant  <ccoutant@google.com>
10689
10690         * archive.cc (Archive::get_file_and_offset): Use filename instead
10691         of name to get library path.
10692         (Archive::include_member): Unlock external member of a thin archive.
10693
10694         * testsuite/Makefile.am (TEST_AR): New variable.
10695         (thin_archive_test_1): New test.
10696         (thin_archive_test_2): New test.
10697         * testsuite/Makefile.in: Regenerate.
10698         * testsuite/thin_archive_main.cc: New file.
10699         * testsuite/thin_archive_test_1.cc: New file.
10700         * testsuite/thin_archive_test_2.cc: New file.
10701         * testsuite/thin_archive_test_3.cc: New file.
10702         * testsuite/thin_archive_test_4.cc: New file.
10703
10704 2008-09-29  Cary Coutant  <ccoutant@google.com>
10705
10706         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10707         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10708         instead of -1U.
10709         (Sized_relobj::do_finalize_local_symbols): Likewise.
10710         (Sized_relobj::map_to_kept_section): Likewise.
10711         * object.h (Sized_relobj::invalid_address): New constant.
10712         (Sized_relobj::do_output_section_offset): Check for invalid_address
10713         and return -1ULL.
10714         * output.cc (Output_reloc::local_section_offset): Use constant
10715         invalid_address instead of -1U.
10716         (Output_reloc::get_address): Likewise.
10717         (Output_section::output_address): Change -1U to -1ULL.
10718         * output.h (Output_reloc::invalid_address): New constant.
10719         * reloc.cc (Sized_relobj::write_sections): Use constant
10720         invalid_address instead of -1U.
10721         (Sized_relobj::relocate_sections): Likewise.
10722         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10723         values for merge sections.
10724         * target-reloc.h (relocate_for_relocatable): Use constant
10725         invalid_address instead of -1U.
10726
10727 2008-09-19  Cary Coutant  <ccoutant@google.com>
10728
10729         Add plugin functionality for link-time optimization (LTO).
10730         * configure.ac (plugins): Add --enable-plugins option.
10731         * configure: Regenerate.
10732         * config.in: Regenerate.
10733         * Makefile.am (LIBDL): New variable.
10734         (CCFILES): Add plugin.cc.
10735         (HFILES): Add plugin.h.
10736         (ldadd_var): Add LIBDL.
10737         * Makefile.in: Regenerate.
10738
10739         * archive.cc: Include "plugin.h".
10740         (Archive::setup): Don't preread archive symbols when using a plugin.
10741         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10742         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10743         files.
10744         (Archive::include_member): Add symbols from plugin objects.
10745         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10746         * descriptors.cc (Descriptors::open): Check for file descriptors
10747         abandoned by plugins.
10748         (Descriptors::claim_for_plugin): New function.
10749         * descriptors.h (Descriptors::claim_for_plugin): New function.
10750         (Open_descriptor::is_claimed): New field.
10751         (claim_descriptor_for_plugin): New function.
10752         * fileread.cc (File_read::claim_for_plugin): New function.
10753         * fileread.h (File_read::claim_for_plugin): New function.
10754         (File_read::descriptor): New function.
10755         * gold.cc: Include "plugin.h".
10756         (queue_initial_tasks): Add task to call plugin hooks for generating
10757         new object files.
10758         * main.cc: Include "plugin.h".
10759         (main): Load plugin libraries.
10760         * object.h (Pluginobj): Declare.
10761         (Object::pluginobj): New function.
10762         (Object::do_pluginobj): New function.
10763         (Object::set_target): New function.
10764         * options.cc: Include "plugin.h".
10765         (General_options::parse_plugin): New function.
10766         (General_options::General_options): Initialize plugins_ field.
10767         (General_options::add_plugin): New function.
10768         * options.h (Plugin_manager): Declare.
10769         (General_options): Add --plugin option.
10770         (General_options::has_plugins): New function.
10771         (General_options::plugins): New function.
10772         (General_options::add_plugin): New function.
10773         (General_options::plugins_): New field.
10774         * plugin.cc: New file.
10775         * plugin.h: New file.
10776         * readsyms.cc: Include "plugin.h".
10777         (Read_symbols::do_read_symbols): Check for archive before checking
10778         for ELF file.  Call plugin hooks to claim files.
10779         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10780         from a real object file; force override when processing replacement
10781         files.
10782         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10783         (Symbol::init_base_object): Likewise.
10784         (Symbol::init_base_output_data): Likewise.
10785         (Symbol::init_base_output_segment): Likewise.
10786         (Symbol::init_base_constant): Likewise.
10787         (Symbol::init_base_undefined): Likewise.
10788         (Symbol::output_section): Assert that object is not a plugin.
10789         (Symbol_table::add_from_pluginobj): New function.
10790         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10791         undefined.
10792         (Symbol_table::sized_write_globals): Likewise.
10793         (Symbol_table::add_from_pluginobj): Instantiate template.
10794         * symtab.h (Sized_pluginobj): Declare.
10795         (Symbol::in_real_elf): New function.
10796         (Symbol::set_in_real_elf): New function.
10797         (Symbol::in_real_elf_): New field.
10798         (Symbol_table::add_from_pluginobj): New function.
10799
10800         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10801         (LIBDL): New variable.
10802         (LDADD): Add LIBDL.
10803         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10804         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10805         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10806         (MOSTLYCLEANFILES): Likewise.
10807         * testsuite/Makefile.in: Regenerate.
10808         * testsuite/plugin_test.c: New file.
10809         * testsuite/plugin_test_1.sh: New file.
10810         * testsuite/plugin_test_2.sh: New file.
10811
10812 2008-09-16  Ian Lance Taylor  <iant@google.com>
10813
10814         * target-reloc.h (relocate_section): Check whether a symbol is
10815         defined by the ABI before reporting an undefined symbol error.
10816         * target.h (Target::is_defined_by_abi): Make parameter const.
10817         (Target::do_is_defined_by_abi): Likewise.
10818         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10819         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10820         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10821         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10822         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10823         * testsuite/Makefile.in: Rebuild.
10824
10825         * fileread.cc (make_view): Add casts to avoid warning.
10826
10827 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10828
10829         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10830         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10831
10832 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10833
10834         * options.h (General_options::output_is_executable): New.
10835         (General_options::output_is_pie): New.
10836         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10837         for shared libraries.
10838         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10839
10840 2008-09-11  Chris Demetriou  <cgd@google.com>
10841
10842         * options.h (origin): New -z option.
10843         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10844         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10845         in DT_FLAGS_1.
10846
10847 2008-09-05  Cary Coutant  <ccoutant@google.com>
10848
10849         * fileread.cc (File_read::make_view): Add check for attempt to map
10850         beyond end of file.
10851
10852 2008-09-05  Cary Coutant  <ccoutant@google.com>
10853
10854         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10855         explicit instantiations.
10856
10857 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10858
10859         PR gold/6858
10860         * options.cc (General_options::finalize): Allow undefined symbols
10861         in shlibs if linking -shared.
10862
10863         PR gold/6859
10864         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10865         symbols as not needing a dynsym entry.
10866
10867 2008-08-20  Craig Silverstein  <csilvers@google.com>
10868
10869         * fileread.cc (File_read::open): Do not lock the file unless it
10870         was successfully opened.
10871
10872 2008-08-14  Cary Coutant  <ccoutant@google.com>
10873
10874         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10875         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10876         * testsuite/tls_test.cc (struct int128): 128-bit struct
10877         for testing TLS relocs with non-zero addend.
10878         (v12): New TLS variable.
10879         (t12): New test.
10880         (t_last): Add check for v12.
10881         * testsuite/tls_test.h (t12): New function.
10882         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10883
10884 2008-08-13  Ian Lance Taylor  <iant@google.com>
10885
10886         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10887         set tls_segment_ or relro_segment_.
10888         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10889         when appropriate.
10890         * output.h (Output_section::clear_is_relro): New function.
10891         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10892         sections specially even when output_data_ is empty.
10893         (Output_segment::maximum_alignment): When first section is relro,
10894         only force alignment for PT_LOAD segments.
10895         * script.cc (script_data_segment_align): New function.
10896         (script_data_segment_relro_end): New function.
10897         * script-c.h (script_data_segment_align): Declare.
10898         (script_data_segment_relro_end): Declare.
10899         * script-sections.h (class Script_sections): Declare
10900         data_segment_align and data_segment_relro_end.  Add fields
10901         segment_align_index_ and saw_relro_end_.
10902         * script-sections.cc (class Sections_element): Add set_is_relro
10903         virtual function.  Add new bool* parameter to place_orphan_here.
10904         Add get_output_section virtual function.
10905         (class Output_section_definition): Add set_is_relro.  Add new
10906         bool* parameter to place_orphan_here.  Add get_output_section.
10907         Add is_relro_ field.
10908         (Output_section_definition::Output_section_definition): Initialize
10909         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10910         and is_relro_ fields.
10911         (Output_section_definition::place_orphan_here): Add is_relro
10912         parameter.
10913         (Output_section_definition::set_section_addresses): Set relro for
10914         output section.
10915         (Output_section_definition::alternate_constraint): Likewise.
10916         (class Orphan_output_section): Add new bool* parameter to
10917         place_orphan_here.  Add get_output_section.
10918         (Orphan_output_section::place_orphan_here): Add is_relro
10919         parameter.
10920         (Script_sections::Script_sections): Initialize
10921         data_segment_align_index_ and saw_relro_end_.
10922         (Script_sections::data_segment_align): New function.
10923         (Script_sections::data_segment_relro_end): New function.
10924         (Script_sections::place_orphan): Set or clear is_relro.
10925         (Script_sections::set_section_addresses): Force alignment of first
10926         TLS section.
10927         * yyscript.y (exp): Call script_data_segment_align and
10928         script_data_segment_relro_end.
10929         * testsuite/relro_script_test.t: New file.
10930         * testsuite/relro_test.cc (using_script): Declare.
10931         (t1, t2): Test using_script.
10932         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10933         (relro_script_test_SOURCES): Define.
10934         (relro_script_test_DEPENDENCIES): Define.
10935         (relro_script_test_LDFLAGS): Define.
10936         (relro_script_test_LDADD): Define.
10937         (relro_script_test.so): New target.
10938         * testsuite/Makefile.in: Rebuild.
10939
10940 2008-08-06  Cary Coutant <ccoutant@google.com>
10941
10942         * archive.cc (Archive::total_archives, Archive::total_members)
10943         (Archive::total_members_loaded): New variables.
10944         (Archive::setup): Add parameter.  Add option to preread
10945         archive symbols.
10946         (Archive::read_armap): Add counter.
10947         (Archive::get_file_and_offset): New function.
10948         (Archive::get_elf_object_for_member): New function.
10949         (Archive::read_all_symbols): New function.
10950         (Archive::read_symbols): New function.
10951         (Archive::add_symbols): Add counters.
10952         (Archive::include_all_members): Use armap to find members if it's
10953         already built.
10954         (Archive::include_member): Skip reading symbols if already read.
10955         Factored code into Archive::get_file_and_offset and
10956         Archive::get_elf_object_for_member.  Changed call to
10957         Mapfile::report_include_archive_member.
10958         (Archive::print_stats): New function.
10959         * archive.h: Declare Object and Read_symbols_data classes.
10960         (Archive::Archive): Add initializers for new members.
10961         (Archive::setup): Add parameter.
10962         (Archive::print_stats): New function.
10963         (Archive::total_archives, Archive::total_members)
10964         (Archive::total_members_loaded): New variables.
10965         (Archive::get_file_and_offset): New function.
10966         (Archive::get_elf_object_for_member): New function.
10967         (Archive::read_all_symbols): New function.
10968         (Archive::read_symbols): New function.
10969         (Archive::Archive_member): New class.
10970         (Archive::members_): New member.
10971         (Archive::num_members_): New member.
10972         * main.cc: Include archive.h.
10973         (main): Call Archive::print_stats.
10974         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10975         archive parameter; member_name is now the fully-decorated name.
10976         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10977         * options.h: (General_options): Add --preread-archive-symbols option.
10978         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10979         Archive::setup.
10980
10981 2008-08-04  Ian Lance Taylor  <iant@google.com>
10982
10983         * symtab.h (Symbol::use_plt_offset): New function.
10984         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10985         * powerpc.cc (Relocate::relocate): Likewise.
10986         * sparc.cc (Relocate::relocate): Likewise.
10987         * x86_64.cc (Relocate::relocate): Likewise.
10988         * testsuite/weak_plt.sh: New test.
10989         * testsuite/weak_plt_main.cc: New test.
10990         * testsuite/weak_plt_shared.cc: New test.
10991         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10992         (check_PROGRAMS): Add weak_plt.
10993         (check_DATA): Add weak_plt_shared.so.
10994         (weak_plt_main_pic.o, weak_plt): New targets.
10995         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10996         * testsuite/Makefile.in: Rebuild.
10997
10998         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10999         gcctestdir/ld.
11000         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11001         * testsuite/Makefile.in: Rebuild.
11002
11003 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11004
11005         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11006         * Makefile.in: Regenerate.
11007         * po/POTFILES.in: Regenerate.
11008
11009 2008-07-29  Ian Lance Taylor  <iant@google.com>
11010
11011         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11012         symbols before other symbols.
11013         * testsuite/script_test_2.cc (test_addr): Declare.
11014         (test_addr_alias): Declare.
11015         (main): Check that test_addr and test_addr_alias have the right
11016         values.
11017         * testsuite/script_test_2.t: Define test_addr_alias and
11018         test_addr.
11019
11020 2008-07-24  Ian Lance Taylor  <iant@google.com>
11021
11022         PR 5990
11023         * descriptors.cc: New file.
11024         * descriptors.h: New file.
11025         * gold-threads.h (class Hold_optional_lock): New class.
11026         * fileread.cc: Include "descriptors.h".
11027         (File_read::~File_read): Release descriptor rather than closing
11028         it.
11029         (File_read::open) [file]: Call open_descriptor rather than open.
11030         Set is_descriptor_opened_.
11031         (File_read::open) [memory]: Assert that descriptor is not open.
11032         (File_read::reopen_descriptor): New function.
11033         (File_read::release): Release descriptor.
11034         (File_read::do_read): Make non-const.  Reopen descriptor.
11035         (File_read::read): Make non-const.
11036         (File_read::make_view): Reopen descriptor.
11037         (File_read::do_readv): Likewise.
11038         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11039         Update declarations.
11040         * layout.cc: Include "descriptors.h".
11041         (Layout::create_build_id): Use open_descriptor rather than open.
11042         * output.cc: Include "descriptors.h".
11043         (Output_file::open): Use open_descriptor rather than open.
11044         * archive.cc (Archive::const_iterator): Change Archive to be
11045         non-const.
11046         (Archive::begin, Archive::end): Make non-const.
11047         (Archive::count_members): Likewise.
11048         * archive.h (class Archive): Update declarations.
11049         * object.h (Object::read): Make non-const.
11050         * Makefile.am (CCFILES): Add descriptors.cc.
11051         (HFILES): Add descriptors.h.
11052         * Makefile.in: Rebuild.
11053
11054         PR 6716
11055         * gold.h: Always include <clocale>.  Add Solaris workarounds
11056         following code in binutils/sysdep.h.
11057
11058         PR 6048
11059         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11060         this->eh_frame_hdr_ is NULL before using it.
11061
11062         * dynobj.cc (Versions::Versions): Update comment.
11063
11064         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11065         the base version name.
11066
11067         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11068         array size plus one.
11069         (Stringpool_template::set_string_offsets): Subtract one from key
11070         before using it as an array index.
11071         (Stringpool_template::get_offset_with_length): Likewise.
11072         (Stringpool_template::write_to_buffer): Likewise.
11073         * stringpool.h (Stringpool_template::get_offset_from_key):
11074         Likewise.
11075
11076 2008-07-23  Ian Lance Taylor  <iant@google.com>
11077
11078         PR 6658
11079         * object.h (Merged_symbol_value::value): Do our best to handle a
11080         negative addend.
11081
11082         PR 6647
11083         * script.cc (Version_script_info::get_versions): Don't add empty
11084         version tag to return value.
11085         (Version_script_info::get_symbol_version_helper): Change return
11086         type to bool.  Add pversion parameter.  Change all callers.
11087         (script_register_vers_node): Don't require a non-NULL tag.
11088         * script.h (class Version_script_info): Update declarations.
11089         (Version_script_info::get_symbol_version): Change return type to
11090         bool.  Add version parameter.  Change all callers.
11091         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11092         handling.  Handle an empty version from a version script.
11093         (Symbol_table::define_special_symbol): Likewise.
11094         * testsuite/ver_test_10.script: New file.
11095         * testsuite/ver_test_10.sh: New file.
11096         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11097         (check_DATA): Add ver_test_10.syms.
11098         (ver_test_10.syms, ver_test_10.so): New target.
11099         * testsuite/Makefile.in: Rebuild.
11100
11101 2008-07-23  Simon Baldwin  <simonb@google.com>
11102
11103         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11104         to zero for undefined symbols from dynamic libraries.
11105
11106 2008-07-23  Ian Lance Taylor  <iant@google.com>
11107
11108         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11109         Change all callers.
11110         * symtab.h (class Symbol_table): Update declaration.
11111         * testsuite/ver_test_9.cc: New file.
11112         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11113         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11114         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11115         (ver_test_9.so, ver_test_9.o): New targets.
11116         * testsuite/Makefile.in: Rebuild.
11117
11118 2008-07-22  Ian Lance Taylor  <iant@google.com>
11119
11120         * options.h (class General_options): Define --check-sections.
11121         * layout.cc (Layout::set_segment_offsets): Handle
11122         --check-sections.
11123
11124         * options.h (class General_options): Define -n/--nmagic and
11125         -N/--omagic.
11126         * options.cc (General_options::finalize): For -n/--nmagic or
11127         -N/--omagic, set -static.
11128         * layout.cc (Layout::attach_allocated_section_to_segment): If
11129         -N/--omagic, don't put read-only and read-write sections in
11130         different segments.
11131         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11132         finding a read-only segment.
11133         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11134         don't set the minimum segment alignment to the common page size,
11135         and don't set the file offset to the address modulo the page size.
11136         * script-sections.cc (Script_sections::create_segments): If
11137         -n/--omagic, don't put read-only and read-write sections in
11138         different segments.
11139
11140         * cref.cc: New file.
11141         * cref.h: New file.
11142         * options.h (class General_options): Add --print-symbol-counts.
11143         * main.cc (main): Issue defined symbol report if requested.
11144         * archive.cc (Archive::interpret_header): Make into a const member
11145         function.
11146         (Archive::add_symbols): Call Input_objects::archive_start and
11147         archive_stop.
11148         (Archive::const_iterator): Define new class.
11149         (Archive::begin, Archive::end): New functions.
11150         (Archive::include_all_members): Rewrite to use iterator.
11151         (Archive::count_members): New function.
11152         * archive.h (class Archive): Update declarations.
11153         (Archive::filename): New function.
11154         * object.cc: Include "cref.h".
11155         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11156         (Sized_relobj::do_get_global_symbol_counts): New function.
11157         (Input_objects::add_object): Add object to cross-referencer.
11158         (Input_objects::archive_start): New function.
11159         (Input_objects::archive_stop): New function.
11160         (Input_objects::print_symbol_counts): New function.
11161         * object.h: Declare Cref and Archive.
11162         (Object::get_global_symbol_counts): New function.
11163         (Object::do_get_global_symbol_counts): New pure virtual function.
11164         (class Sized_relobj): Add defined_count_ field.  Update
11165         declarations.
11166         (class Input_objects): Add cref_ field.  Update constructor.
11167         Update declarations.
11168         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11169         defined_count_.
11170         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11171         symbol counts.
11172         (Sized_dynobj::do_get_global_symbol_counts): New function.
11173         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11174         defined_count_.  Update declarations.  Define Symbols typedef.
11175         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11176         parameter.  Change all callers.
11177         (Symbol_table::add_from_dynobj): Add sympointers and defined
11178         parameters.  Change all callers.
11179         * symtab.h (class Symbol_table): Update declarations.
11180         * Makefile.am (CCFILES): Add cref.cc.
11181         (HFILES): Add cref.h.
11182         * Makefile.in: Rebuild.
11183
11184 2008-07-22  Simon Baldwin  <simonb@google.com>
11185
11186         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11187         to zero when writing undefined symbols.
11188
11189 2008-07-22  Ian Lance Taylor  <iant@google.com>
11190
11191         * output.cc (Output_section::add_input_section): Don't try to
11192         merge empty merge sections.
11193
11194 2008-07-21  Craig Silverstein  <csilvers@google.com>
11195
11196         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11197         Include symbol version in error message.
11198
11199 2008-07-20  Chris Demetriou  <cgd@google.com>
11200
11201         * configure.ac (gold_cv_c_random_seed): New configured variable.
11202         (RANDOM_SEED_CFLAGS): New substituted variable.
11203         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11204         * configure: Rebuild.
11205         * Makefile.in: Likewise.
11206         * testsuite/Makefile.in: Likewise.
11207
11208 2008-07-18  Ian Lance Taylor  <iant@google.com>
11209
11210         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11211         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11212         * testsuite/ver_test_main.cc (main): Call t4.
11213         (t4, t4_2a): Define.
11214         * testsuite/ver_test_2.cc (t4_2): Define.
11215         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11216         * testsuite/ver_test_4.cc (t4_2a): Define.
11217         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11218         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11219
11220 2008-07-17  Ian Lance Taylor  <iant@google.com>
11221
11222         * dynobj.cc (Versions::add_def): If we give an error about a
11223         missing version, go ahead and create the version anyhow.
11224
11225 2008-07-10  Ian Lance Taylor  <iant@google.com>
11226
11227         Handle output sections with more than 0x7fffffff bytes.
11228         * object.h (class Relobj): Change map_to_output_ to
11229         output_sections_, and just keep a section pointer.  Change all
11230         uses.  Move comdat group support to Sized_relobj.
11231         (Relobj::is_section_specially_mapped): Remove.
11232         (Relobj::output_section): Remove poff parameter.  Change all
11233         callers.
11234         (Relobj::output_section_offset): New function.
11235         (Relobj::set_section_offset): Rewrite.
11236         (Relobj::map_to_output): Remove.
11237         (Relobj::output_sections): New function.
11238         (Relobj::do_output_section_offset): New pure virtual function.
11239         (Relobj::do_set_section_offset): Likewise.
11240         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11241         group support from Relobj.  Update declarations.
11242         (Sized_relobj::get_output_section_offset): New function.
11243         (Sized_relobj::do_output_section_offset): New function.
11244         (Sized_relobj::do_set_section_offset): New function.
11245         * object.cc (Relobj::output_section_address): Remove.
11246         (Sized_relobj::Sized_relobj): Initialize new fields.
11247         (Sized_relobj::include_section_group): Cast find_kept_object to
11248         Sized_relobj.
11249         (Sized_relobj::include_linkonce_section): Likewise.
11250         (Sized_relobj::do_layout): Use separate arrays for output section
11251         and output offset.
11252         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11253         output_sections.
11254         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11255         output_sections and section_offsets.
11256         (Sized_relobj::write_local_symbols): Likewise.
11257         (map_to_kept_section): Compute output address directly.
11258         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11259         output_sections and section_offsets.
11260         (Sized_relobj::write_sections): Likewise.
11261         (Sized_relobj::relocate_sections): Likewise.
11262         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11263         * output.h (class Output_reloc): Update declarations.  Change
11264         u2_.relobj to Sized_relobj*.
11265         (class Output_data_reloc): Change add functions to use
11266         Sized_relobj*.
11267         * output.cc (Output_reloc::Output_reloc): Change relobj to
11268         Sized_relobj*.
11269         (Output_reloc::local_section_offset): Change return type to
11270         Elf_Addr.  Use get_output_section_offset.
11271         (Output_reloc::get_address): Likewise.
11272         (Output_section::is_input_address_mapped): Don't call
11273         is_section_specially_mapped.
11274         (Output_section::output_offset): Likewise.
11275         (Output_section::output_address): Likewise.
11276         (Output_section::starting_output_address): Likewise.
11277         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11278         parameter to Sized_relobj*.
11279         (Copy_relocs::need_copy_reloc): Likewise.
11280         (Copy_relocs::save): Likewise.
11281         * copy-relocs.h (class Copy_relocs): Update declarations.
11282         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11283         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11284         * target-reloc.h (relocate_for_relocatable): Change
11285         offset_in_output_section type to Elf_Addr.  Change code that uses
11286         it as well.
11287         * layout.cc (Layout::layout): Always set *off.
11288         * mapfile.cc (Mapfile::print_input_section): Use
11289         output_section_offset.
11290         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11291         Sized_relobj*.
11292         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11293         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11294         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11295
11296 2008-07-03  Ian Lance Taylor  <iant@google.com>
11297
11298         * layout.cc (Layout::include_section): Do not discard unrecognized
11299         SHT_STRTAB sections.
11300
11301 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11302
11303         * script.cc (Lex::can_continue_name): Make '?' allowable in
11304         version-script names.
11305         * testsuite/version_script.map: Change glob pattern to use '?'
11306
11307 2008-06-30  Manish Singh  <yosh@gimp.org>
11308
11309         PR 6585
11310         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11311         Correct typo.
11312
11313 2008-06-30  Ian Lance Taylor  <iant@google.com>
11314
11315         PR 6660
11316         PR 6682
11317         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11318         versions]: Don't try to read the value in the contents, since we
11319         don't use it.  Use the template endianness when writing.
11320
11321 2008-06-25  Cary Coutant  <ccoutant@google.com>
11322
11323         * fileread.cc (File_read::make_view): Assert on zero-length view.
11324         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11325         symbol table when there are no symbols to read.
11326
11327 2008-06-23  Craig Silverstein  <csilvers@google.com>
11328
11329         * version.cc (version_string): Bump to 1.7
11330
11331 2008-06-18  Craig Silverstein  <csilvers@google.com>
11332
11333         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11334         constant 0xFFFF to type Valtype.
11335         (Powerpc_relocate_functions::rel16_ha): Likewise.
11336
11337 2008-06-17  Ian Lance Taylor  <iant@google.com>
11338
11339         * output.h (Output_section::Input_section): Initialize p2align_ to
11340         zero for Output_section_data constructors.
11341         (Output_section::Input_section::addralign): If not an input
11342         section, return the alignment of the Output_section_data.
11343         * testsuite/copy_test.cc: New file.
11344         * testsuite/copy_test_1.cc: New file.
11345         * testsuite/copy_test_2.cc: New file.
11346         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11347         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11348         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11349         (copy_test_1_pic.o, copy_test_1.so): New targets.
11350         (copy_test_2_pic.o, copy_test_2.so): New targets.
11351         * testsuite/Makefile.in: Rebuild.
11352
11353         * script-sections.cc (Script_sections::place_orphan): Initialize
11354         local variable exact.
11355
11356 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11357
11358         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11359
11360 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11361             David S. Miller  <davem@davemloft.net>
11362
11363         * powerpc.cc: New file.
11364         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11365         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11366         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11367         * Makefile.in: Rebuild.
11368
11369 2008-06-09  Ian Lance Taylor  <iant@google.com>
11370
11371         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11372         <exception>.
11373         (throwing, orig_terminate): New static variables.
11374         (terminate_handler): New static function.
11375         (t2): Set terminate handler.
11376
11377 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11378
11379         PR 6584
11380         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11381         alignment.
11382
11383 2008-05-30  Cary Coutant  <ccoutant@google.com>
11384
11385         * archive.cc (Archive::include_all_members) Correct to step
11386         over symbol table and extended name table in thin archives.
11387
11388 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11389
11390         PR 6407
11391         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11392         calculation.
11393
11394 2008-05-28  Caleb Howe  <cshowe@google.com>
11395
11396         * reduced_debug_output.cc: New file.
11397         * reduced_debug_output.h: New file.
11398         * options.h (class General_options): Add --strip-debug-non-line.
11399         * options.cc (General_options::finalize): Add strip_debug_non_line
11400         to the strip heirarchy.
11401         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11402         fields.
11403         * layout.cc: Include "reduced_debug_output.h".
11404         (Layout::Layout): Initialize new fields.
11405         (line_only_debug_sections): New static array.
11406         (is_lines_only_debug_sections): New static inline function.
11407         (Layout::include_section): Handle --strip-debug-non-line.
11408         (Layout::make_output_section): If --strip-debug-non-line, build
11409         new output sections for .debug_abbrev and .debug_info.
11410         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11411         gold.  Warn about possible overflow.
11412         (read_signed_LEB_128): Likewise.
11413         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11414         (read_signed_LEB_128): Declare.
11415         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11416         (HFILES): Add reduced_debug_output.h.
11417         * Makefile.in: Rebuild.
11418
11419 2008-05-21  Ian Lance Taylor  <iant@google.com>
11420
11421         * mapfile.cc: New file.
11422         * mapfile.h: New file.
11423         * options.h (class General_options): Add -M/--print-map and -Map.
11424         * options.cc (General_options::finalize): Make -M equivalent to
11425         -Map -.
11426         * main.cc: Include <cstdio> and "mapfile.h".
11427         (main): Open mapfile if requested.
11428         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11429         constructor.  Change caller.
11430         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11431         (queue_middle_tasks): Likewise.
11432         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11433         declarations.
11434         * archive.cc: Include "mapfile.h".
11435         (Archive::add_symbols): Add mapfile parameter.  Change all
11436         callers.  Pass mapfile, symbol, and reason to include_member.
11437         (Archive::include_all_members): Add mapfile parameter.  Change all
11438         callers.
11439         (Archive::include_member): Add mapfile, sym, and why parameters.
11440         Change all callers.  Report inclusion to map file.
11441         * archive.h: Include "fileread.h".
11442         (class Archive): Update declarations.
11443         (Archive::file): New const method.
11444         (class Add_archive_symbols): Add mapfile_ field.  Update
11445         constructor.  Change all callers.
11446         * readsyms.h (class Read_symbols): Likewise.
11447         (class Finish_group): Likewise.
11448         (class Read_script): Likewise.
11449         * common.cc: Include "mapfile.h".
11450         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11451         all callers.
11452         (Symbol_table::do_allocate_commons): Likewise.
11453         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11454         symbol allocation to mapfile.
11455         * common.h (class Allocate_commons_task): Add mapfile_ field.
11456         Update constructor.  Change all callers.
11457         * symtab.h (class Symbol_table): Update declarations.
11458         * layout.cc: Include "mapfile.h".
11459         (Layout_task_runner::run): Print information to mapfile.
11460         (Layout::create_gold_note): Change Output_data_fixed_space to
11461         Output_data_zero_fill.
11462         (Layout::create_build_id): Likewise.
11463         (Layout::print_to_mapfile): New function.
11464         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11465         constructor.  Change caller.
11466         (class Layout): Declare print_to_mapfile.
11467         * output.cc (Output_section::Input_section::print_to_mapfile): New
11468         function.
11469         (Output_section::add_input_section): If producing a map, always
11470         add to input_sections_ list.
11471         (Output_section::do_print_to_mapfile): New function.
11472         (Output_segment::print_sections_to_mapfile): New function.
11473         (Output_segment::print_section_list_to_mapfile): New function.
11474         * output.h: Include "mapfile.h".
11475         (Output_data::print_to_mapfile): New function.
11476         (Output_data::do_print_to_mapfile): New virtual function.
11477         (Output_segment_headers::do_print_to_mapfile): New function.
11478         (Output_file_header::do_print_to_mapfile): New function.
11479         (Output_data_const::do_print_to_mapfile): New function.
11480         (class Output_data_const_buffer): Add map_name_ field.  Update
11481         constructor.  Change all callers.  Add do_print_to_mapfile
11482         function.
11483         (class Output_data_fixed_space): Likewise.
11484         (class Output_data_space): Likewise.
11485         (class Output_data_zero_fill): New class.
11486         (Output_data_strtab::do_print_to_mapfile): New function.
11487         (Output_data_reloc_base::do_print_to_mapfile): New function.
11488         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11489         (Output_data_group::do_print_to_mapfile): New function.
11490         (Output_data_got::do_print_to_mapfile): New function.
11491         (Output_data_dynamic::do_print_to_mapfile): New function.
11492         (Output_symtab_xindex::do_print_to_mapfile): New function.
11493         (class Output_section): Declare do_print_to_mapflie.  Declare
11494         print_to_mapfile in Input_section.
11495         (class Output_segment): Declare new functions.
11496         * object.h (Sized_relobj::symbol_count): New function.
11497         * script-sections.cc
11498         (Output_section_element_dot_assignment::set_section_addresses):
11499         Change Output_data_fixed_space to Output_data_zero_fill.
11500         (Output_data_expression::do_print_to_mapfile): New function.
11501         * script.cc (read_input_script): Add mapfile parameter.  Change
11502         all callers.
11503         * script.h (read_input_script): Update declaration.
11504         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11505         (Eh_frame::do_print_to_mapfile): New function.
11506         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11507         (Output_merge_string::do_print_to_mapfile): New function.
11508         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11509         function.
11510         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11511         function.
11512         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11513         function.
11514         * Makefile.am (CCFILES): Add mapfile.cc.
11515         (HFILES): Add mapfile.h.
11516         * Makefile.in: Rebuild.
11517
11518 2008-05-19  Ian Lance Taylor  <iant@google.com>
11519
11520         * options.h (class General_options): Add -z relro.
11521         * layout.cc (Layout::Layout): Initialize relro_segment_.
11522         (Layout::add_output_section_data): Return the output section.
11523         (Layout::make_output_section): Rcognize relro sections and mark
11524         them appropriately.
11525         (Layout::attach_allocated_section_to_segment): Put relro sections
11526         in a PT_GNU_RELRO segment.
11527         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11528         section as relro.
11529         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11530         PT_TLS segments.
11531         (Layout::linkonce_mapping): Map d.rel.ro.local to
11532         .data.rel.ro.local.
11533         (Layout::output_section_name): Us .data.rel.ro.local for any
11534         section which begins with that.
11535         * layout.h (class Layout): Update add_output_section_data
11536         declaration.  Add relro_segment_ field.
11537         * output.cc (Output_section::Output_section): Initialize is_relro_
11538         and is_relro_local_ fields.
11539         (Output_segment::add_output_section): Group relro sections.
11540         (Output_segment::is_first_section_relro): New function.
11541         (Output_segment::maximum_alignment): If there is a relro section,
11542         align the segment to the common page size.
11543         (Output_segment::set_section_addresses): Track whether we are
11544         looking at relro sections.  If the last section is a relro
11545         section, align to the common page size.
11546         (Output_segment::set_section_list_addresses): Add in_relro
11547         parameter.  Change all callers.  Align to the page size when
11548         moving from relro to non-relro section.
11549         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11550         segment.
11551         * output.h (class Output_section): Add is_relro_ and
11552         is_relro_local_ fields.
11553         (Output_section::is_relro): New function.
11554         (Output_section::set_is_relro): New function.
11555         (Output_section::is_relro_local): New function.
11556         (Output_section::set_is_relro_local): New function.
11557         (class Output_segment): Update declarations.
11558         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11559         * sparc.cc (Target_sparc::got_section): Likewise.
11560         * x86_64.cc (Target_x86_64::got_section): Likewise.
11561         * testsuite/relro_test_main.cc: New file.
11562         * testsuite/relro_test.cc: New file.
11563         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11564         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11565         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11566         (relro_test.so, relro_test_pic.o): New targets.
11567         * testsuite/Makefile.in: Rebuild.
11568
11569 2008-05-16  Ian Lance Taylor  <iant@google.com>
11570
11571         * output.cc (Output_segment::add_output_section): Remove front
11572         parameter.
11573         * output.h (class Output_segment): Remove
11574         add_initial_output_section and overloaded add_output_section.
11575         Update declaration of remaining add_output_section.
11576         * layout.cc (Layout::create_interp): Call add_output_section
11577         rather than add_initial_output_section.
11578         (Layout::finish_dynamic_section): Likewise.
11579
11580         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11581         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11582         know the dynamic type.
11583         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11584         field.  Initialize it in constructor.
11585         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11586         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11587         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11588         reloc.
11589
11590         * output.cc (Output_reloc::get_address): Change return type to
11591         Elf_Addr.
11592         * output.h (class Output_reloc): Update get_address declaration.
11593         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11594         for section addresses.
11595
11596 2008-05-09  Ian Lance Taylor  <iant@google.com>
11597
11598         PR 6493
11599         * gold.cc (gold_nomem): Use return value of write.
11600
11601 2008-05-08  Ian Lance Taylor  <iant@google.com>
11602
11603         * symtab.c (Symbol::init_base_output_data): Add version
11604         parameter.  Change all callers.
11605         (Symbol::init_base_output_segment): Likewise.
11606         (Symbol::init_base_constant): Likewise.
11607         (Symbol::init_base_undefined): Likewise.
11608         (Sized_symbol::init_output_data): Likewise.
11609         (Sized_symbol::init_output_segment): Likewise.
11610         (Sized_symbol::init_constant): Likewise.
11611         (Sized_symbol::init_undefined): Likewise.
11612         (Symbol_table::do_define_in_output_data): If the new symbol has a
11613         version, mark it as the default.
11614         (Symbol_table::do_define_in_output_segment): Likewise.
11615         (Symbol_table::do_define_as_constant): Likewise.
11616         * symtab.h (class Symbol): Update declarations.
11617         (class Sized_symbol): Likewise.
11618         * resolve.cc (Symbol::override_version): New function.
11619         (Symbol::override_base): Call override_version.
11620         (Symbol::override_base_with_special): Likewise.
11621         * testsuite/ver_script_8.script: New file.
11622         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11623         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11624         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11625         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11626
11627 2008-05-06  Ian Lance Taylor  <iant@google.com>
11628
11629         PR 6049
11630         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11631         functions.
11632         (class General_options): Remove existing --undefined, and add
11633         --no-undefined instead.  Add new --undefined as synonym for -u.
11634         * archive.cc (Archive::add_symbols): Check whether symbol was
11635         named with -u.
11636         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11637         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11638         all uses.  Add IS_UNDEFINED.  Update declarations to split
11639         different versions of init_base.  Declare init_base_undefined.
11640         (Symbol::is_defined): Handle IS_UNDEFINED.
11641         (Symbol::is_undefined): Likewise.
11642         (Symbol::is_weak_undefined): Call is_undefined.
11643         (Symbol::is_absolute): Handle IS_CONSTANT.
11644         (class Sized_symbol): Update declarations to split different
11645         versions of init.  Declare init_undefined.
11646         (class Symbol_table): Declare new functions.
11647         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11648         Change all callers.
11649         (Symbol::init_base_output_data): Likewise.
11650         (Symbol::init_base_output_segment): Likewise.
11651         (Symbol::init_base_constant): Likewise.
11652         (Symbol::init_base_undefined): New function.
11653         (Sized_symbol::init_object): Rename from init.  Change all
11654         callers.
11655         (Sized_symbol::init_output_data): Likewise.
11656         (Sized_symbol::init_output_segment): Likewise.
11657         (Sized_symbol::init_constant): Likewise.
11658         (Sized_symbol::init_undefined): New function.
11659         (Symbol_table::add_undefined_symbols_from_command_line): New
11660         function.
11661         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11662         function.
11663         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11664         (Symbol::output_section): Likewise.
11665         (Symbol::set_output_section): Likewise.
11666         (Symbol_table::sized_finalize_symbol): Likewise.
11667         (Symbol_table::sized_write_globals): Likewise.
11668         * resolve.cc (Symbol_table::should_override): Likewise.
11669         (Symbol::override_base_with_special): Likewise.
11670
11671         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11672         symbol, change it to have default visibility.
11673         * testsuite/protected_1.cc: New file.
11674         * testsuite/protected_2.cc: New file.
11675         * testsuite/protected_3.cc: New file.
11676         * testsuite/protected_main_1.cc: New file.
11677         * testsuite/protected_main_2.cc: New file.
11678         * testsuite/protected_main_3.cc: New file.
11679         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11680         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11681         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11682         (protected_1.so): New target.
11683         (protected_1_pic.o, protected_2_pic.o): New targets.
11684         (protected_3_pic.o): New target.
11685         (check_PROGRAMS): Add protected_2.
11686         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11687         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11688         * testsuite/Makefile.in: Rebuild.
11689
11690         * options.h (DEFINE_var): Add set_user_set_##varname__.
11691         (DEFINE_bool_alias): New macro.
11692         (class General_options): Define -Bstatic using DEFINE_bool_alias
11693         rather than DEFINE_special.  Add --undefined as an alias for -z
11694         defs.
11695         * options.cc (General_options::parse_Bstatic): Remove.
11696
11697         * options.h (class General_options): Add --fatal-warnings.
11698         * main.cc (main): Implement --fatal-warnings.
11699         * errors.h (Errors::warning_count): New function.
11700
11701         * options.h (class General_options): Add -Bsymbolic-functions.
11702         * symtab.h (Symbol::is_preemptible): Check for
11703         -Bsymbolic-functions.
11704
11705 2008-05-05  Ian Lance Taylor  <iant@google.com>
11706
11707         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11708         as noVARNAME rather than no-VARNAME.
11709         (class General_options): Add option -z combreloc.
11710         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11711         get_address.
11712         (Output_reloc::sort_before) [SHT_REL]: New function.
11713         (Output_reloc::sort_before) [SHT_RELA]: New function.
11714         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11715         Sort_relocs_comparison.
11716         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11717         parameter.  Change all callers.
11718         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11719         sort_relocs parameter.  Change all callers.
11720         * output.cc (Output_reloc::get_address): New function, broken out
11721         of write_rel.
11722         (Output_reloc::write_rel): Call it.
11723         (Output_reloc::compare): New function.
11724         (Output_data_reloc_base::do_write): Optionally sort relocs.
11725
11726         * configure.ac: If targ_extra_obj is set, link it in.
11727         * configure.tgt: Initialize all variables.
11728         (x86_64*): Set targ_extra_obj and targ_extra_size.
11729         * configure: Rebuild.
11730
11731         * object.cc (Sized_relobj::include_section_group): Adjust section
11732         indexes read from group data.  Build vector to pass to
11733         layout_group.
11734         * layout.cc (Layout::layout_group): Add flags and shndxes
11735         parameters.  Remove contents parameter.  Change caller.  Update
11736         explicit instantiations.
11737         * layout.h (class Layout): Update layout_group declaration.
11738         * output.cc (Output_data_group::Output_data_group): Add flags and
11739         input_shndxes parameters.  Remove contents parameter.  Change
11740         caller.
11741         (Output_data_group::do_write): Change input_sections_ to
11742         input_shndxes_.
11743         * output.h (class Output_data_group): Update constructor
11744         declaration.  Rename input_sections_ to input_shndxes_.
11745         * testsuite/many_sections_test.cc: Add template.
11746
11747 2008-04-30  Cary Coutant  <ccoutant@google.com>
11748
11749         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11750
11751         * layout.cc (Layout::include_section): Refactored check for debug
11752         info section.
11753         (Layout::add_comdat): Add new parameters.  Change type
11754         of signature parameter.  Add object and shndx to signatures table.
11755         (Layout::find_kept_object): New function.
11756         * layout.h: Include <cstring>.
11757         (Layout::is_debug_info_section): New function.
11758         (Layout::add_comdat): Add new parameters.
11759         (Layout::find_kept_object): New function.
11760         (Layout::Kept_section): New struct.
11761         (Layout::Signatures): Change type of map range.
11762         * object.cc (Relobj::output_section_address): New function.
11763         (Sized_relobj::include_section_group): Add new parameters.  Change
11764         calls to Layout::add_comdat.  Change to build table of kept comdat
11765         groups and table mapping discarded sections to kept sections.
11766         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11767         (Sized_relobj::do_layout): Change calls to include_section_group and
11768         include_linkonce_section.
11769         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11770         value to zero when section is discarded.
11771         (Sized_relobj::map_to_kept_section): New function.
11772         * object.h (Relobj::output_section_address): New function.
11773         (Relobj::Comdat_group): New type.
11774         (Relobj::find_comdat_group): New function.
11775         (Relobj::Comdat_group_table): New type.
11776         (Relobj::Kept_comdat_section): New type.
11777         (Relobj::Kept_comdat_section_table): New type.
11778         (Relobj::add_comdat_group): New function.
11779         (Relobj::set_kept_comdat_section): New function.
11780         (Relobj::get_kept_comdat_section): New function.
11781         (Relobj::comdat_groups_): New field.
11782         (Relobj::kept_comdat_sections_): New field.
11783         (Symbol_value::input_value): Update comment.
11784         (Sized_relobj::map_to_kept_section) New function.
11785         (Sized_relobj::include_linkonce_section): Add new parameter.
11786         * target-reloc.h (Comdat_behavior): New type.
11787         (get_comdat_behavior): New function.
11788         (relocate_section): Add code to map a discarded section to the
11789         corresponding kept section when applying a relocation.
11790
11791 2008-04-30  Craig Silverstein  <csilvers@google.com>
11792
11793         * dwarf_reader.cc (next_generation_count): New static var.
11794         (Addr2line_cache_entry): New struct.
11795         (addr2line_cache): New static var.
11796         (Dwarf_line_info::one_addr2line): Added caching.
11797         (Dwarf_line_info::clear_addr2line_cache): New function.
11798         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11799         cache-size parameter.
11800         (Dwarf_line_info::one_addr2line_cache): New function.
11801         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11802         new cache-size argument to one_addr2line(), and clear cache.
11803
11804 2008-04-28  Cary Coutant  <ccoutant@google.com>
11805
11806         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11807         R_386_PC8 relocations.
11808
11809 2008-04-23  Ian Lance Taylor  <iant@google.com>
11810
11811         * object.cc (Sized_relobj::include_section_group): Check for
11812         invalid section group.
11813
11814         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11815         header size.
11816
11817         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11818         than read for file header.
11819         * archive.cc (Archive::include_member): Likewise.
11820
11821 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11822
11823         * aclocal.m4: Regenerate.
11824         * configure: Regenerate.
11825
11826 2008-04-19  Ian Lance Taylor  <iant@google.com>
11827
11828         * version.cc (version_string): Bump to 1.6.
11829
11830         * testsuite/Makefile.am (many_sections_r_test): New target.
11831         (many_sections_r_test_SOURCES): Remove.
11832         (many_sections_r_test_DEPENDENCIES): Remove.
11833         (many_sections_r_test_LDFLAGS): Remove.
11834         (many_sections_r_test_LDADD): Remove.
11835
11836         * object.cc (Sized_relobj::do_add_symbols): Always pass
11837         local_symbol_count_ to add_from_relobj.
11838
11839         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11840         every thousand variables.
11841         * testsuite/Makefile.in: Rebuild.
11842
11843         * object.cc (Xindex::initialize_symtab_xindex): New function.
11844         (Xindex::read_symtab_xindex): New function.
11845         (Xindex::sym_xindex_to_shndx): New function.
11846         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11847         available.
11848         (Sized_relobj::do_initialize_xindex): New function.
11849         (Sized_relobj::do_read_symbols): Adjust section links.
11850         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11851         parameter.  Change all callers.
11852         (Sized_relobj::include_section_group): Adjust section links and
11853         symbol section indexes.
11854         (Sized_relobj::do_layout): Adjust section links.
11855         (Sized_relobj::do_count_local_symbols): Adjust section links and
11856         symbol section indexes.
11857         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11858         ordinary and special symbols.
11859         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11860         dynsym_xindex parameters.  Change all callers.  Adjust section
11861         links.  Use SHN_XINDEX when needed.
11862         (Sized_relobj::get_symbol_location_info): Adjust section links.
11863         Don't get fooled by special symbols.
11864         * object.h (class Xindex): Define.
11865         (class Object): Add xindex_ parameter.  Declare virtual functoin
11866         do_initialize_xindex.
11867         (Object::adjust_sym_shndx): New function.
11868         (Object::set_xindex): New protected function.
11869         (class Symbol_value): Add is_ordinary_shndx_ field.
11870         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11871         (Symbol_value::value): Assert ordinary section.
11872         (Symbol_value::initialize_input_to_output_map): Likewise.
11873         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11874         Change all callers.
11875         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11876         all callers.
11877         (class Sized_relobj): Update declarations.
11878         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11879         parameter.  Change all callers.
11880         (Sized_relobj::adjust_shndx): New function.
11881         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11882         field.
11883         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11884         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11885         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11886         (Sized_dynobj::read_dynsym_section): Adjust section links.
11887         (Sized_dynobj::read_dynamic): Likewise.
11888         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11889         section links.
11890         (Sized_dynobj::do_initialize_xindex): New function.
11891         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11892         do_initialize_xindex.
11893         (Sized_dynobj::adjust_shndx): New function.
11894         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11895         dynsym_xindex_ fields.
11896         (Layout::finalize): Add a call to set_section_indexes before
11897         creating the symtab sections.
11898         (Layout::set_section_indexes): Don't do anything if the section
11899         already has a section index.
11900         (Layout::create_symtab_sections): Add shnum parameter.  Change
11901         caller.  Create .symtab_shndx section if needed.
11902         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11903         caller.
11904         (Layout::allocated_output_section_count): New function.
11905         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11906         needed.
11907         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11908         fields.  Update declarations.
11909         (Layout::symtab_xindex): New function.
11910         (Layout::dynsym_xindex): New function.
11911         (class Write_symbols_task): Add layout_ field.
11912         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11913         Change caller.
11914         * output.cc (Output_section_headers::Output_section_headers): Add
11915         shstrtab_section parameter.  Change all callers.
11916         (Output_section_headers::do_sized_write): Store overflow values
11917         for section count and section string table section index in
11918         section header zero.
11919         (Output_file_header::do_sized_write): Check for overflow of
11920         section count and section string table section index.
11921         (Output_symtab_xindex::do_write): New function.
11922         (Output_symtab_xindex::endian_do_write): New function.
11923         * output.h (class Output_section_headers): Add shstrtab_section_.
11924         Update declarations.
11925         (class Output_symtab_xindex): Define.
11926         (Output_section::has_out_shndx): New function.
11927         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11928         field.
11929         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11930         Change all callers.
11931         (Sized_symbol::init): Likewise.
11932         (Symbol::output_section): Check for ordinary symbol.
11933         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11934         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11935         callers.
11936         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11937         Change all callers.  Simplify handling of symbols from sections
11938         not included in the link.
11939         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11940         distinction.
11941         (Weak_alias_sorter::operator()): Assert that symbols are
11942         ordinary.
11943         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11944         distinction.
11945         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11946         parameters.  Change all callers.
11947         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11948         symbol distinction.  Use SHN_XINDEX when needed.
11949         (Symbol_table::write_section_symbol): Add symtab_xindex
11950         parameter.  Change all callers.
11951         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11952         SHN_XINDEX when needed.
11953         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11954         declarations.
11955         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11956         (Symbol::is_defined): Check is_ordinary.
11957         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11958         (Symbol::is_absolute, Symbol::is_common): Likewise.
11959         (class Sized_symbol): Update declarations.
11960         (class Symbol_table): Update declarations.
11961         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11962         parameters.  Change all callers.
11963         (Sized_symbol::override): Likewise.
11964         (Symbol_table::override): Likewise.
11965         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11966         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11967         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11968         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11969         to be in an ordinary section.
11970         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11971         object and is_ordinary parameters.  Change all callers.
11972         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11973         Change all callers.  Don't add undefined or non-ordinary symbols
11974         to reloc_map_.
11975         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11976         Change all callers.
11977         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11978         declarations.
11979         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11980         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11981         (Sized_relobj::relocate_sections): Likewise.
11982         * target-reloc.h (scan_relocs): Adjust section symbol index.
11983         (scan_relocatable_relocs): Likewise.
11984         * i386.cc (Scan::local): Check for ordinary symbols.
11985         * sparc.cc (Scan::local): Likewise.
11986         * x86_64.cc (Scan::local): Likewise.
11987         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11988         to symbol_section_and_value.
11989         * testsuite/many_sections_test.cc: New file.
11990         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11991         (check_PROGRAMS): Add many_sections_test.
11992         (many_sections_test_SOURCES): Define.
11993         (many_sections_test_DEPENDENCIES): Define.
11994         (many_sections_test_LDFLAGS): Define.
11995         (BUILT_SOURCES): Add many_sections_define.h.
11996         (many_sections_define.h): New target.
11997         (BUILT_SOURCES): Add many_sections_check.h.
11998         (many_sections_check.h): New target.
11999         (check_PROGRAMS): Add many_sections_r_test.
12000         (many_sections_r_test_SOURCES): Define.
12001         (many_sections_r_test_DEPENDENCIES): Define.
12002         (many_sections_r_test_LDFLAGS): Define.
12003         (many_sections_r_test_LDADD): Define.
12004         (many_sections_r_test.o): New target.
12005         * testsuite/Makefile.in: Rebuild.
12006
12007 2008-04-17  Cary Coutant  <ccoutant@google.com>
12008
12009         * errors.cc (Errors::info): New function.
12010         (gold_info): New function.
12011         * errors.h (Errors::info): New function.
12012         * gold.h (gold_info): New function.
12013         * object.cc (Input_objects::add_object): Print trace output.
12014         * options.cc (options::parse_set): New function.
12015         (General_options::parse_wrap): Deleted.
12016         (General_options::General_options): Deleted initializer.
12017         * options.h (options::String_set): New typedef.
12018         (options::parse_set): New function.
12019         (DEFINE_set): New macro.
12020         (General_options::wrap): Changed to use DEFINE_set. Changed
12021         callers of any_wrap_symbols and is_wrap_symbol.
12022         (General_options::trace, General_options::trace_symbol):
12023         New options.
12024         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12025         (General_options::wrap_symbols_): Deleted.
12026         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12027
12028 2008-04-17  David S. Miller  <davem@davemloft.net>
12029
12030         * options.cc (General_options::parse_V): New function.
12031         * options.h: Add entries for -V and -Qy.
12032
12033 2008-04-17  Ian Lance Taylor  <iant@google.com>
12034
12035         * common.cc (Symbol_table::allocate_commons): Remove options
12036         parameter.  Change caller.
12037         (Symbol_table::do_allocate_commons): Remove options parameter.
12038         Change caller.  Just call do_allocate_commons_list twice.
12039         (Symbol_table::do_allocate_commons_list): New function, broken out
12040         of do_allocate_commons.
12041         * common.h (class Allocate_commons_task): Remove options_ field.
12042         Update constructor.
12043         * symtab.cc (Symbol_table::Symbol_table): Initialize
12044         tls_commons_.
12045         (Symbol_table::add_from_object): Put TLS common symbols on
12046         tls_commons_ list.
12047         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12048         which are IN_OUTPUT_DATA.
12049         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12050         allocate_commons and do_allocate_commons declarations.  Declare
12051         do_allocate_commons_list.
12052         * gold.cc (queue_middle_tasks): Update creation of
12053         Allocate_commons_task to not pass options.
12054         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12055         (TLS_TEST_C_FLAGS): New variable.
12056         (tls_test_c_pic.o): New target.
12057         (tls_test_shared.so): Link in tls_test_c_pic.o.
12058         (tls_test_c_pic_ie.o): New target.
12059         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12060         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12061         (tls_test_c.o): New target.
12062         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12063         (tls_pic_test_LDADD): Likewise.
12064         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12065         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12066         (tls_test_c_gnu2.o): New target.
12067         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12068         tls_test_c_gnu2.o.
12069         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12070         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12071         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12072         * testsuite/tls_test.cc: Include "config.h".
12073         (t_last): Call t11_last.
12074         * testsuite/tls_test.h (t11, t11_last): Declare.
12075         * testsuite/tls_test_c.c: New file.
12076         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12077         * configure.ac: Check for OpenMP support.
12078         * configure, config.in, Makefile.in: Rebuild.
12079         * testsuite/Makefile.in: Rebuild.
12080
12081 2008-04-16  Cary Coutant  <ccoutant@google.com>
12082
12083         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12084         (Target_i386::tls_base_symbol_defined_): New field.
12085         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12086         (Target_i386::Scan::global): Likewise.
12087         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12088         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12089         (Target_x86_64::tls_base_symbol_defined_): New field.
12090         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12091         (Target_x86_64::Scan::global): Likewise.
12092
12093 2008-04-16  Cary Coutant  <ccoutant@google.com>
12094
12095         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12096         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12097         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12098         building shared libraries.
12099         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12100         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12101         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12102         * testsuite/Makefile.in: Rebuild.
12103         * testsuite/weak_undef.h: New file.
12104         * testsuite/weak_undef_file1.cc: Add extra test cases.
12105         * testsuite/weak_undef_file2.cc: Likewise.
12106         * testsuite/weak_undef_test.cc: Likewise.
12107
12108 2008-04-16  David S. Miller  <davem@davemloft.net>
12109
12110         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12111         Add issued_non_pic_error_ field.  Declare check_non_pic.
12112         (Target_sparc::Scan::check_non_pic): New function.
12113         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12114         (Target_sparc::Scan::global): Likewise.
12115
12116         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12117         * configure: Rebuild.
12118
12119         * options.h (DEFINE_enable): New macro.
12120         (new_dtags): New enable option.
12121         (initfirst, interpose, loadfltr, nodefaultlib,
12122         nodelete, nodlopen, nodump): New -z options.
12123         * layout.cc (Layout:finish_dynamic_section): If new
12124         dtags enabled, emit DT_RUNPATH.  Also, emit a
12125         DT_FLAGS_1 containing any specified -z flags.
12126
12127 2008-04-16  Ian Lance Taylor  <iant@google.com>
12128
12129         * copy-relocs.cc: New file.
12130         * copy-relocs.h: New file.
12131         * reloc.cc: Remove Copy_relocs code.
12132         * reloc.h: Likewise.
12133         * reloc-types.h (struct Reloc_types) [both versions]: Add
12134         get_reloc_addend_noerror.
12135         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12136         variants of add_global which take an addend which must be zero.
12137         * i386.cc: Include "copy-relocs.h".
12138         (class Target_i386): Change type of copy_relocs_ to variable,
12139         update initializer.
12140         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12141         Change all callers.
12142         (Target_i386::do_finalize_sections): Change handling of
12143         copy_relocs_.
12144         * sparc.cc: Include "copy-relocs.h".
12145         (class Target_sparc): Change type of copy_relocs_ to variable,
12146         update initializer.
12147         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12148         Change all callers.
12149         (Target_sparc::do_finalize_sections): Change handling of
12150         copy_relocs_.
12151         * x86_64.cc: Include "copy-relocs.h".
12152         (class Target_x86_64): Change type of copy_relocs_ to variable,
12153         update initializer.
12154         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12155         class.  Change all callers.
12156         (Target_x86_64::do_finalize_sections): Change handling of
12157         copy_relocs_.
12158         * Makefile.am (CCFILES): Add copy-relocs.cc.
12159         (HFILES): Add copy-relocs.h.
12160
12161         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12162
12163         * testsuite/script_test_4.sh: Permit leading zeroes.
12164
12165 2008-04-15  Ian Lance Taylor  <iant@google.com>
12166
12167         * script-sections.cc (Script_sections::create_segments): Use
12168         header_size_adjustment even when there is enough room for the
12169         headers.
12170         * testsuite/script_test_4.sh: New file.
12171         * testsuite/script_test_4.t: New file.
12172         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12173         (check_DATA): Add script_test_4.stdout.
12174         (MOSTLYCLEANFILES): Likewise.
12175         (script_test_4): New target.
12176         (script_test_4.stdout): New target.
12177         * testsuite/Makefile.in: Rebuild.
12178
12179         * sparc.cc: Add definitions for Output_data_plt_sparc class
12180         constants.
12181
12182 2008-04-14  David S. Miller  <davem@davemloft.net>
12183
12184         * sparc.cc: New file.
12185         * Makefile.am (TARGETSOURCES): Add sparc.cc
12186         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12187         * configure.tgt: Document targ_extra_size and
12188         targ_extra_big_endian.  Add entries for sparc-* and
12189         sparc64-*.
12190         * configure.ac: Handle targ_extra_size and
12191         targ_extra_big_endian.
12192         * Makefile.in: Rebuild.
12193         * configure: Likewise.
12194         * po/POTFILES.in: Likewise.
12195         * po/gold.pot: Likewise.
12196
12197 2008-04-14  Ian Lance Taylor  <iant@google.com>
12198
12199         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12200         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12201         in the name/type/flags to section mapping.  Don't call
12202         allocate_output_section.
12203         (Layout::choose_output_section): Change parameter from adjust_name
12204         to is_input_section.  Don't permit input sections after sections
12205         are attached to segments.  Don't call allocate_output_section.
12206         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12207         not write_enable_output_section.
12208         (Layout::make_output_section): Don't push to
12209         unattached_section_list_ nor call attach_to_segment.  Call
12210         attach_section_to_segment if sections are attached.
12211         (Layout::attach_sections_to_segments): New function.
12212         (Layout::attach_section_to_segment): New function.
12213         (Layout::attach_allocated_section_to_segment): Rename from
12214         attach_to_segment.  Remove flags parameter.
12215         (Layout::allocate_output_section): Remove function.
12216         (Layout::write_enable_output_section): Remove function.
12217         * layout.h (class Layout): Update for above changes.  Add new
12218         field sections_are_attached_.
12219         * output.h (Output_section::update_flags_for_input_section): New
12220         function.
12221         * output.cc (Output_section::add_input_section): Call
12222         update_flags_for_input_section.
12223         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12224
12225 2008-04-11  Cary Coutant  <ccoutant@google.com>
12226
12227         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12228         thought unnecessary.
12229         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12230
12231 2008-04-11  Ian Lance Taylor  <iant@google.com>
12232
12233         * output.h (class Output_section_data): Remove inline definition
12234         of set_addralign.
12235         * output.cc (Output_section_data::set_addralign): New function.
12236
12237 2008-04-11  Cary Coutant  <ccoutant@google.com>
12238
12239         Add support for TLS descriptors for i386 and x86_64.
12240         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12241         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12242         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12243         GOT_TYPE_TLS_DESC.
12244         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12245         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12246         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12247         relocations.
12248         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12249         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12250         Fix problem with initial-exec relocations.
12251         (Target_i386::Relocate::relocate_tls): Likewise.
12252         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12253         relaxation.
12254         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12255         support for section-plus-offset dynamic table entries.
12256         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12257         (Output_data_dynamic::Dynamic_entry): Add support for
12258         section-plus-offset dynamic table entries.
12259         (Output_data_dynamic::Classification): Likewise.
12260         (Output_data_dynamic::classification_): Renamed offset_.
12261         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12262         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12263         (Target_x86_64::make_plt_section): New function.
12264         (Target_x86_64::reserve_tlsdesc_entries): New function.
12265         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12266         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12267         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12268         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12269         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12270         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12271         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12272         add extra PLT entry for TLS descriptors.
12273         (Output_data_plt_x86_64::got_): New field.
12274         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12275         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12276         fields.
12277         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12278         descriptors.
12279         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12280         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12281         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12282         R_386_TLS_DESC_CALL relocations.
12283         (Target_x86_64::Scan::global): Likewise.
12284         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12285         for TLS descriptors.
12286         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12287         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12288         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12289         GD-to-IE relaxation.
12290         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12291         and TLS_DESCRIPTORS.
12292         * Makefile.in: Rebuild.
12293         * configure: Rebuild.
12294         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12295         (tls_test_shared2.so): New target.
12296         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12297         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12298         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12299         (tls_shared_gd_to_ie_test_LDADD): New variable.
12300         (tls_shared_gnu2_gd_to_ie_test): New target.
12301         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12302         New targets.
12303         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12304         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12305         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12306         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12307         (tls_shared_gnu2_test): New target.
12308         (tls_test_gnu2_shared.so): New target.
12309         (tls_shared_gnu2_test_SOURCES): New variable.
12310         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12311         (tls_shared_gnu2_test_LDFLAGS): New variable.
12312         (tls_shared_gnu2_test_LDADD): New variable.
12313         * testsuite/Makefile.in: Rebuild.
12314         * testsuite/Makefile.
12315
12316 2008-04-11  Ian Lance Taylor  <iant@google.com>
12317
12318         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12319         justsyms.t.
12320         * testsuite/Makefile.in: Rebuild.
12321
12322         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12323         long.
12324         * testsuite/script_test_2.cc (main): Adjust test.
12325
12326 2008-04-11  David S. Miller  <davem@davemloft.net>
12327             Ian Lance Taylor  <iant@google.com>
12328
12329         * options.h (General_options): Add entries for '-Y' and
12330         '-relax'.
12331         * options.cc (General_options:finalize): If -Y was used, add those
12332         entries to the library path instead of the default "/lib" and
12333         "/usr/lib".
12334
12335 2008-04-11  David S. Miller  <davem@davemloft.net>
12336
12337         * testsuite/justsyms.t: Start at 0x100.
12338         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12339         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12340         long.
12341         * testsuite/script_test_2.cc: Adjust string and section length
12342         checks.
12343
12344 2008-04-09  Ian Lance Taylor  <iant@google.com>
12345
12346         PR gold/5996
12347         * script-sections.cc (Sections_element::allocate_to_segment): Add
12348         orphan parameter.
12349         (Output_section_definition::allocate_to_segment): Likewise.
12350         (Orphan_output_section::allocate_to_segment): Likewise.
12351         (Script_sections::attach_sections_using_phdrs_clause): Don't
12352         propagate non-PT_LOAD segments to orphan sections.
12353         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12354         readelf rather than objdump.
12355         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12356         .interp section and PT_INTERP segment are the same size.
12357         * testsuite/Makefile.in: Rebuild.
12358
12359         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12360         aliases for symbols defined in the same object.
12361         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12362         (weak_alias_test_SOURCES): New variable.
12363         (weak_alias_test_DEPENDENCIES): New variable.
12364         (weak_alias_test_LDFLAGS): New variable.
12365         (weak_alias_test_LDADD): New variable.
12366         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12367         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12368         (weak_alias_test_3.o): New target.
12369         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12370         * testsuite/weak_alias_test_main.cc: New file.
12371         * testsuite/weak_alias_test_1.cc: New file.
12372         * testsuite/weak_alias_test_2.cc: New file.
12373         * testsuite/weak_alias_test_3.cc: New file.
12374
12375 2008-04-08  Ian Lance Taylor  <iant@google.com>
12376
12377         * options.h (class General_options): Add --noinhibit-exec option.
12378         * main.cc (main): Check --noinhibit-exec.
12379
12380         * options.h (class General_options): Define --wrap as a special
12381         option.  Add wrap_symbols_ field.
12382         (General_options::any_wrap_symbols): New function.
12383         (General_options::is_wrap_symbol): New function.
12384         * options.cc (General_options::parse_wrap): New function.
12385         (General_options::General_options): Initialize wrap_symbols_.
12386         * symtab.cc (Symbol_table::wrap_symbol): New function.
12387         (Symbol_table::add_from_object): Handle --wrap.
12388         * symtab.h (class Symbol_table): Declare wrap_symbol.
12389         * target.h (Target::wrap_char): New function.
12390         (Target::Target_info): Add wrap_char field.
12391         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12392         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12393         * testsuite/testfile.cc (Target_test::test_target_info):
12394         Likewise.
12395
12396         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12397         there is one.
12398
12399         * layout.h (class Layout): Add added_eh_frame_data_ field.
12400         * layout.cc (Layout::Layout): Initialize new field.
12401         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12402         output section until we find a section we merged successfully.
12403         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12404         that the size be non-zero.
12405
12406         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12407         qualifier.
12408
12409 2008-04-08  Craig Silverstein  <csilvers@google.com>
12410
12411         * configure.ac: Export new conditional variable HAVE_ZLIB.
12412         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12413         on HAVE_ZLIB.
12414         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12415         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12416
12417 2008-04-07  Ian Lance Taylor  <iant@google.com>
12418
12419         * version.cc (version_string): Set to "1.5".
12420
12421         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12422         Add issued_non_pic_error_ field.  Declare check_non_pic.
12423         (Target_x86_64::Scan::check_non_pic): New function.
12424         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12425         (Target_x86_64::Scan::global): Likewise.
12426
12427         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12428         addend parameter.  Change caller.  Handle merge sections.
12429         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12430         Address to Addend.  Don't add in the result of
12431         local_section_offset, pass down the addend and use the returned
12432         value.
12433         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12434         Update declarations of local_section_offset and symbol_value.
12435         * testsuite/two_file_test_1.cc (t18): New function.
12436         * testsuite/two_file_test_2.cc (f18): New function.
12437         * testsuite/two_file_test_main.cc (main): Call t18.
12438         * testsuite/two_file_test.h (t18, f18): Declare.
12439
12440         * configure.ac: Don't test for objdump, c++filt, or readelf.
12441         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12442         conditionals.
12443         (TEST_READELF): New variable.
12444         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12445         (check_PROGRAMS): Add two_file_strip_test.
12446         (two_file_strip_test): New target.
12447         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12448         (two_file_same_shared_strip_test_SOURCES): New variable.
12449         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12450         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12451         (two_file_same_shared_strip_test_LDADD): New variable.
12452         (two_file_shared_strip.so): New target.
12453         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12454         (ver_test_5.syms, ver_test_7.syms): Likewise.
12455         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12456         (strip_test_3.stdout): Use TEST_OBJDUMP.
12457         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12458
12459 2008-04-04  Cary Coutant  <ccoutant@google.com>
12460
12461         * symtab.h (Symbol::is_weak_undefined): New function.
12462         (Symbol::is_strong_undefined): New function.
12463         (Symbol::is_absolute): New function.
12464         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12465         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12466         absolute symbols.
12467         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12468         (weak_undef_test): New target.
12469         * testsuite/Makefile.in: Rebuild.
12470         * testsuite/weak_undef_file1.cc: New file.
12471         * testsuite/weak_undef_file2.cc: New file.
12472         * testsuite/weak_undef_test.cc: New file.
12473
12474 2008-04-03  Craig Silverstein  <csilvers@google.com>
12475
12476         * compressed_output.h (class Output_compressed_section): Use
12477         unsigned buffer.
12478         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12479         add zlib header.
12480         (zlib_compressed_suffix): Removed.
12481         (Output_compressed_section::set_final_data_size): Use unsigned
12482         buffers.
12483         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12484         Fix linker invocation.
12485         (flagstest_o_specialfile_and_compress_debug_sections):
12486         Likewise.
12487         * testsuite/Makefile.in: Regenerated.
12488
12489 2008-04-02  David S. Miller  <davem@davemloft.net>
12490
12491         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12492         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12493
12494 2008-04-02  Craig Silverstein  <csilvers@google.com>
12495
12496         * TODO: New file.
12497
12498 2008-04-02  Ian Lance Taylor  <iant@google.com>
12499
12500         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12501         parameters.  Update for new key type to views_.  Change all
12502         callers.
12503         (File_read::read): Adjust for byteshift in returned view.
12504         (File_read::add_view): New function, broken out of
12505         find_and_make_view.
12506         (File_read::make_view): New function, broken out of
12507         find_and_make_view.
12508         (File_read::find_or_make_view): Add offset and aligned
12509         parameters.  Rewrite accordingly.  Change all callers.
12510         (File_read::get_view): Add offset and aligned parameters.  Adjust
12511         for byteshift in return value.
12512         (File_read::get_lasting_view): Likewise.
12513         * fileread.h (class File_read): Update declarations.
12514         (class File_read::View): Add byteshift_ field.  Add byteshift to
12515         constructor.  Add byteshift method.
12516         * archive.h (Archive::clear_uncached_views): New function.
12517         (Archive::get_view): Add aligned parameter.  Change all callers.
12518         * object.h (Object::get_view): Add aligned parameter.  Change all
12519         callers.
12520         (Object::get_lasting_view): Likewise.
12521
12522         * fileread.cc (File_read::release): Don't call clear_views if
12523         there are multiple objects.
12524         * fileread.h (File_read::clear_uncached_views): New function.
12525         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12526         on the archive.
12527
12528 2008-03-31  Cary Coutant  <ccoutant@google.com>
12529
12530         Add thin archive support.
12531         * archive.cc (Archive::armagt): New const.
12532         (Archive::setup): Remove task parameter and calls to unlock.
12533         (Archive::unlock_nested_archives): New function.
12534         (Archive::read_header): Add nested_off parameter. Change
12535         all callers.
12536         (Archive::interpret_header): Likewise.
12537         (Archive::include_all_members): Change to handle thin
12538         archives.
12539         (Archive::include_member): Likewise.
12540         * archive.h (Archive::Archive): Add new parameters and
12541         initializers.
12542         (Archive::armagt): New const.
12543         (Archive::setup): Remove task parameter.
12544         (Archive::unlock_nested_archives): New function.
12545         (Archive::read_header): Add nested_off parameter.
12546         (Archive::interpret_header): Likewise.
12547         (Archive::Nested_archive_table): New typedef.
12548         (Archive::is_thin_archive_): New field.
12549         (Archive::nested_archives_): New field.
12550         (Archive::options_): New field.
12551         (Archive::dirpath_): New field.
12552         (Archive::task_): New field.
12553         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12554         for thin archives.  Pass additional parameters to
12555         Archive::Archive.  Unlock the archive file after calling
12556         Archive::setup.
12557
12558 2008-03-29  Ian Lance Taylor  <iant@google.com>
12559
12560         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12561         version symbol to be local.
12562         * testsuite/ver_test_4.sh: New file.
12563         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12564         (check_DATA): Add ver_test_4.syms.
12565         (ver_test_4.syms): New target.
12566         * testsuite/Makefile.in: Rebuild.
12567
12568         * output.cc
12569         (Output_section::Input_section_sort_entry::has_priority): New
12570         function.
12571         (Output_section::Input_section_sort_entry::match_file_name): New
12572         function.
12573         (Output_section::Input_section_sort_entry::match_section_name):
12574         Remove.
12575         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12576         Remove.
12577         (Output_section::Input_section_sort_entry::match_section_file):
12578         Remove.
12579         (Output_section::Input_section_sort_compare::operator()): Rewrite
12580         using new Input_section_sort_entry functions.  Sort crtbegin and
12581         crtend first.  Sort sections with no priority before sections with
12582         a priority.
12583         * testsuite/initpri1.c (d3): Check j != 4.
12584         (cd5): New constructor/destructor function.
12585         (main): Check j != 2.
12586
12587         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12588         new symbol when resolving, don't call set_is_default.
12589         * testsuite/ver_test_7.cc: New file.
12590         * testsuite/ver_test_7.sh: New file.
12591         * testsuite/Makefile.am (ver_test_7.so): New target.
12592         (ver_test_7.o): New target.
12593         (check_SCRIPTS): Add ver_test_7.sh.
12594         (check_DATA): Add ver_test_7.syms.
12595         (ver_test_7.syms): New target.
12596
12597 2008-03-28  Ian Lance Taylor  <iant@google.com>
12598
12599         * layout.cc (Layout::layout): If we see an input section with a
12600         name that needs sorting, set the must_sort flag for the output
12601         section.
12602         (Layout::make_output_section): If the name of the output section
12603         indicates that it might require sorting, set the may_sort flag.
12604         * output.h (Output_section::may_sort_attached_input_sections): New
12605         function.
12606         (Output_section::set_may_sort_attached_input_sections): New
12607         function.
12608         (Output_section::must_sort_attached_input_sections): New
12609         function.
12610         (Output_section::set_must_sort_attached_input_sections): New
12611         function.
12612         (class Output_section): Declare Input_section_sort_entry.  Define
12613         Input_section_sort_compare.  Declare
12614         sort_attached_input_sections.  Add new fields:
12615         may_sort_attached_input_sections_,
12616         must_sort_attached_input_sections_,
12617         attached_input_sections_are_sorted_.
12618         * output.cc (Output_section::Output_section): Initialize new
12619         fields.
12620         (Output_section::add_input_section): Add an entry to
12621         input_sections_ if may_sort or must_sort are true.
12622         (Output_section::set_final_data_size): Call
12623         sort_attached_input_sections if necessary.
12624         (Output_section::Input_section_sort_entry): Define new class.
12625         (Output_section::Input_section_sort_compare::operator()): New
12626         function.
12627         (Output_section::sort_attached_input_sections): New function.
12628         * configure.ac: Check whether the compiler supports constructor
12629         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12630         * testsuite/initpri1.c: New file.
12631         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12632         CONSTRUCTOR_PRIORITY.
12633         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12634         (initpri1_LDFLAGS): New variable.
12635         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12636
12637 2008-03-27  Ian Lance Taylor  <iant@google.com>
12638
12639         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12640         * testsuite/common_test_1.c: New file.
12641         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12642         (common_test_1_SOURCES): New variable.
12643         (common_test_1_DEPENDENCIES): New variable.
12644         (common_test_1_LDFLAGS): New variable.
12645
12646         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12647         and commons_ correctly when NAME/VERSION does not override
12648         NAME/NULL.
12649         * testsuite/ver_test_6.c: New file.
12650         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12651         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12652         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12653
12654 2008-03-26  Ian Lance Taylor  <iant@google.com>
12655
12656         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12657         of an undefined symbol from a version script.
12658         * testsuite/Makefile.am (ver_test_5.so): New target.
12659         (ver_test_5.o): New target.
12660         (check_SCRIPTS): Add ver_test_5.sh.
12661         (check_DATA): Add ver_test_5.syms.
12662         (ver_test_5.syms): New target.
12663         * testsuite/ver_test_5.cc: New file.
12664         * testsuite/ver_test_5.script: New file.
12665         * testsuite/ver_test_5.sh: New file.
12666         * Makefile.in, testsuite/Makefile.in: Rebuild.
12667
12668         PR gold/5986
12669         Fix problems building gold with gcc 4.3.0.
12670         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12671         (gold_error_at_location, gold_warning_at_location): Use it.
12672         * configure.ac: Check whether we can compile and use a template
12673         function with a printf attribute.
12674         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12675         when jumping over bytes.
12676         * object.cc: Instantiate Object::read_section_data.
12677         * debug.h: Include <cstring>
12678         * dwarf_reader.cc: Include <algorithm>
12679         * main.cc: Include <cstring>.
12680         * options.cc: Include <cstring>.
12681         * output.cc: Include <cstring>.
12682         * script.cc: Include <cstring>.
12683         * script.h: Include <string>.
12684         * symtab.cc: Include <cstring> and <algorithm>.
12685         * target-select.cc: Include <cstring>.
12686         * version.cc: Include <string>.
12687         * testsuite/testmain.cc: Include <cstdlib>.
12688         * configure, config.in: Rebuild.
12689
12690 2008-03-25  Ian Lance Taylor  <iant@google.com>
12691
12692         * options.cc: Include "../bfd/bfdver.h".
12693         (options::help): Print bug reporting address.
12694
12695         * version.cc (print_version): Adjust output for current value of
12696         BFD_VERSION_STRING.
12697
12698         * NEWS: New file.
12699
12700         * options.cc (options::help): Print list of supported targets.
12701         * target-select.h: Include <vector>.
12702         (class Target_selector): Make machine_, size_, and is_big_endian_
12703         fields const.  Add bfd_name_ and instantiated_target_ fields.
12704         (Target_selector::Target_selector): Add bfd_name parameter.
12705         (Target_selector::recognize): Make non-virtual, call
12706         do_recognize.
12707         (Target_selector::recognize_by_name): Make non-virtual, call
12708         do_recognize_by_name.
12709         (Target_selector::supported_names): New function.
12710         (Target_selector::bfd_name): New function.
12711         (Target_selector::do_instantiate_target): New pure virtual
12712         function.
12713         (Target_selector::do_recognize): New virtual function.
12714         (Target_selector::do_recognize_by_name): New virtual function.
12715         (Target_selector::instantiate_target): New private function.
12716         (supported_target_names): Declare.
12717         * target-select.cc (Target_selector::Target_selector): Update for
12718         new parameter and fields.
12719         (select_target_by_name): Check that the name matches before
12720         calling recognize_by_name.
12721         (supported_target_names): New function.
12722         * i386.cc (class Target_selector_i386): Update Target_selector
12723         constructor call.  Remove recognize and recognize_by_name.  Add
12724         do_instantiate_target.
12725         * x86_64.cc (class Target_selector_x86_64): Likewise.
12726         * testsuite/testfile.cc (class Target_selector_test): Update for
12727         changes to Target_selector.
12728
12729         * README: Rewrite, with some notes on unsupported features.
12730
12731 2008-03-24  Cary Coutant  <ccoutant@google.com>
12732
12733         * i386.cc (Target_i386::Got_type): New enum declaration.
12734         (Target_i386::Scan::local): Updated callers of Output_data_got
12735         member functions.
12736         (Target_i386::Scan::global): Likewise.
12737         (Target_i386::Relocate::relocate): Likewise.
12738         (Target_i386::Relocate::relocate_tls): Likewise.
12739         * object.h (Got_offset_list): New class.
12740         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12741         (Sized_relobj::local_got_offset): Likewise.
12742         (Sized_relobj::set_local_got_offset): Likewise.
12743         (Sized_relobj::local_has_tls_got_offset): Removed.
12744         (Sized_relobj::local_tls_got_offset): Removed.
12745         (Sized_relobj::set_local_tls_got_offset): Removed.
12746         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12747         * output.cc (Output_data_got::add_global): Added got_type parameter.
12748         (Output_data_got::add_global_with_rel): Likewise.
12749         (Output_data_got::add_global_with_rela): Likewise.
12750         (Output_data_got::add_global_pair_with_rel): New function.
12751         (Output_data_got::add_global_pair_with_rela): New function.
12752         (Output_data_got::add_local): Added got_type parameter.
12753         (Output_data_got::add_local_with_rel): Likewise.
12754         (Output_data_got::add_local_with_rela): Likewise.
12755         (Output_data_got::add_local_pair_with_rel): New function.
12756         (Output_data_got::add_local_pair_with_rela): New function.
12757         (Output_data_got::add_global_tls): Removed.
12758         (Output_data_got::add_global_tls_with_rel): Removed.
12759         (Output_data_got::add_global_tls_with_rela): Removed.
12760         (Output_data_got::add_local_tls): Removed.
12761         (Output_data_got::add_local_tls_with_rel): Removed.
12762         (Output_data_got::add_local_tls_with_rela): Removed.
12763         * output.h (Output_data_got::add_global): Added got_type parameter.
12764         (Output_data_got::add_global_with_rel): Likewise.
12765         (Output_data_got::add_global_with_rela): Likewise.
12766         (Output_data_got::add_global_pair_with_rel): New function.
12767         (Output_data_got::add_global_pair_with_rela): New function.
12768         (Output_data_got::add_local): Added got_type parameter.
12769         (Output_data_got::add_local_with_rel): Likewise.
12770         (Output_data_got::add_local_with_rela): Likewise.
12771         (Output_data_got::add_local_pair_with_rel): New function.
12772         (Output_data_got::add_local_pair_with_rela): New function.
12773         (Output_data_got::add_global_tls): Removed.
12774         (Output_data_got::add_global_tls_with_rel): Removed.
12775         (Output_data_got::add_global_tls_with_rela): Removed.
12776         (Output_data_got::add_local_tls): Removed.
12777         (Output_data_got::add_local_tls_with_rel): Removed.
12778         (Output_data_got::add_local_tls_with_rela): Removed.
12779         * resolve.cc (Symbol::override_base_with_special): Removed
12780         reference to has_got_offset_ field.
12781         * symtab.cc (Symbol::init_fields): Replaced initialization
12782         of got_offset_ with got_offsets_.  Removed initialization
12783         of has_got_offset_
12784         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12785         (Symbol::got_offset): Likewise.
12786         (Symbol::set_got_offset): Likewise.
12787         (Symbol::has_tls_got_offset): Removed.
12788         (Symbol::tls_got_offset): Removed.
12789         (Symbol::set_tls_got_offset): Removed.
12790         (Symbol::got_offset_): Removed.
12791         (Symbol::tls_mod_got_offset_): Removed.
12792         (Symbol::tls_pair_got_offset_): Removed.
12793         (Symbol::got_offsets_): New field.
12794         (Symbol::has_got_offset): Removed.
12795         (Symbol::has_tls_mod_got_offset): Removed.
12796         (Symbol::has_tls_pair_got_offset): Removed.
12797         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12798         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12799         member functions.
12800         (Target_x86_64::Scan::global): Likewise.
12801         (Target_x86_64::Relocate::relocate): Likewise.
12802         (Target_x86_64::Relocate::relocate_tls): Likewise.
12803
12804 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12805
12806         * yyscript.y: Fix spelling error in comment.
12807
12808 2008-03-24  Ian Lance Taylor  <iant@google.com>
12809
12810         * options.h (class General_options): Define build_id option.
12811         * layout.h (class Layout): Declare write_build_id, create_note,
12812         create_build_id.  Add build_id_note_ member.
12813         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12814         "libiberty.h", "md5.h", "sha1.h".
12815         (Layout::Layout): Initialize eh_frame_data_,
12816         eh_frame_hdr_section_, and build_id_note_.
12817         (Layout::finalize): Call create_build_id.
12818         (Layout::create_note): New function, broken out of
12819         Layout::create_gold_note.
12820         (Layout::create_gold_note): Call create_note.
12821         (Layout::create_build_id): New function.
12822         (Layout::write_build_id): New function.
12823         (Close_task_runner::run): Call write_build_id.
12824
12825         * x86_64.cc: Correct license to GPLv3.
12826
12827 2008-03-23  Ian Lance Taylor  <iant@google.com>
12828
12829         * options.cc: Include "demangle.h".
12830         (parse_optional_string): New function.
12831         (parse_long_option): Handle takes_optional_argument.
12832         (parse_short_option): Update dash_z initializer.  Handle
12833         takes_optional_argument.
12834         (General_options::General_options): Initialize do_demangle_.
12835         (General_options::finalize): Set do_demangle_.  Handle demangling
12836         style.
12837         * options.h (parse_optional_string): Declare.
12838         (struct One_option): Add optional_arg field.  Update constructor.
12839         Update call constructor calls.  Add takes_optional_argument
12840         function.
12841         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12842         (DEFINE_optional_string): Define.
12843         (General_options::demangle): Change from DEFINE_bool to
12844         DEFINE_optional_string.
12845         (General_options::no_demangle): New function.
12846         (General_options::do_demangle): New function.
12847         (General_options::set_do_demangle): New function.
12848         (General_options::execstack_status_): Move definition to end of
12849         class definition.
12850         (General_options::static_): Likewise.
12851         (General_options::do_demangle_): New field.
12852         * object.cc (big_endian>::get_symbol_location_info): Call
12853         Options::do_demangle, not Options::demangle.
12854         * symtab.cc (demangle): Likewise.
12855
12856 2008-03-22  Ian Lance Taylor  <iant@google.com>
12857
12858         * gold.h: Include <cstddef> and <sys/types.h>
12859         * options.h: Include <cstring>.
12860
12861 2008-03-21  Ian Lance Taylor  <iant@google.com>
12862
12863         * Added source code to GNU binutils.