gold: Fix parameterization of do_adjust_elf_header
[external/binutils.git] / gold / ChangeLog
1 2012-04-20  David S. Miller  <davem@davemloft.net>
2
3         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4         instead of false.
5
6 2012-04-16  David S. Miller  <davem@davemloft.net>
7
8         * sparc.cc (Target_sparc::got_address): New function.
9         (Sparc_relocate_functions::gdop_hix22): New function.
10         (Sparc_relocate_functions::gdop_lox10): New function.
11         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
12         relocs.
13         (Target_sparc::Scan::local): Likewise if the global symbol is not
14         preemptible and is not IFUNC.
15         (Target_sparc::Relocate::relocate): Perform GOTDATA code
16         transformations for local and non-preemptible non-IFUNC global
17         symbols.
18
19         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
20         writing out 64-bit part of ranges.
21
22         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
23         -fpic and -fpie respectively.
24         * Makefile.in: Regenerate.
25
26         * sparc.cc (class Target_sparc): Add rela_ifunc_.
27         (Target_sparc::Target_sparc): Initialize new field.
28         (Target_sparc::do_plt_section_for_global): New function.
29         (Target_sparc::do_plt_section_for_local): New function.
30         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
31         (Target_sparc::make_plt_section): New function, broken out of
32         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
33         (Target_sparc::make_plt_entry): Call make_plt_section.
34         (Target_sparc::make_local_ifunc_plt_entry): New function.
35         (Target_sparc::rela_ifunc_section): New function.
36         (Target_sparc::plt_section): Remove const.
37         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
38         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
39         and ifunc_count_ fields.
40         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
41         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
42         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
43         (Output_data_plt_sparc::rela_ifunc): New function.
44         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
45         (Output_data_plt_sparc::has_ifunc_section): New function.
46         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
47         (Output_data_plt_sparc::address_for_global): New function.
48         (Output_data_plt_sparc::address_for_local): New function.
49         (Output_data_plt_sparc::plt_index_to_offset): New function.
50         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
51         and entry_count.
52         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
53         entry_count.
54         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
55         R_SPARC_JMP_IREL to switch.
56         (Target_sparc::Scan::check_non_pic): Likewise.
57         (Target_sparc::Scan::local): Handle IFUNC symbols.
58         (Target_sparc::Scan::local): Likewise.
59         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
60         and plt_address_for_local.
61         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
62         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
63
64         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
65         (class Output_data_reloc): Adjust calls to Output_reloc_type.
66         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
67         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
68         global relocs too.
69         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
70         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
71         calls.
72         * sparc.cc (Target_sparc::Scan::global): Likewise.
73         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
74
75 2012-04-16  Cary Coutant  <ccoutant@google.com>
76
77         * archive.cc (Library_base::should_include_member): Check for
78         --export-dynamic-symbol.
79         * options.h (class General_options): Add --export-dynamic-symbol.
80         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
81         --export-dynamic-symbol.
82         (Symbol_table::gc_mark_undef_symbols): Likewise.
83         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
84
85 2012-04-12  David S. Miller  <davem@davemloft.net>
86
87         * sparc.cc (Reloc::wdisp10): New relocation method.
88         (Reloc::h34): Likewise.
89         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
90         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
91         R_SPARC_WDISP10.
92         (Target_sparc::Scan::local): Likewise.
93         (Target_sparc::Scan::global): Likewise.
94         (Target_sparc::Relocate::relocate): Likewise.
95
96 2012-04-09  Cary Coutant  <ccoutant@google.com>
97
98         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
99         low_pc == 0.
100
101 2012-04-06  Ian Lance Taylor  <iant@google.com>
102
103         * timer.cc: #include <unistd.h>.
104
105 2012-04-06  Roland McGrath  <mcgrathr@google.com>
106
107         * configure.in (AC_CHECK_HEADERS): Add locale.h.
108         * config.in: Regenerate.
109         * configure: Regenerate.
110
111 2012-04-05  Nick Clifton  <nickc@redhat.com>
112
113         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
114         (AM_LC_MESSAGES): Add.
115         * aclocal.m4: Regenerate.
116         * config.in: Regenerate.
117         * configure: Regenerate.
118
119 2012-03-21  Cary Coutant  <ccoutant@google.com>
120
121         * Makefile.am: Add gdb-index.cc, gdb-index.h.
122         * Makefile.in: Regenerate.
123         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
124         (Sized_elf_reloc_mapper::symbol_section): New function.
125         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
126         (make_elf_reloc_mapper): New function.
127         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
128         (Dwarf_abbrev_table::do_read_abbrevs): New function.
129         (Dwarf_abbrev_table::do_get_abbrev): New function.
130         (Dwarf_ranges_table::read_ranges_table): New function.
131         (Dwarf_ranges_table::read_range_list): New function.
132         (Dwarf_pubnames_table::read_section): New function.
133         (Dwarf_pubnames_table::read_header): New function.
134         (Dwarf_pubnames_table::next_name): New function.
135         (Dwarf_die::Dwarf_die): New function.
136         (Dwarf_die::read_attributes): New function.
137         (Dwarf_die::skip_attributes): New function.
138         (Dwarf_die::set_name): New function.
139         (Dwarf_die::set_linkage_name): New function.
140         (Dwarf_die::attribute): New function.
141         (Dwarf_die::string_attribute): New function.
142         (Dwarf_die::int_attribute): New function.
143         (Dwarf_die::uint_attribute): New function.
144         (Dwarf_die::ref_attribute): New function.
145         (Dwarf_die::child_offset): New function.
146         (Dwarf_die::sibling_offset): New function.
147         (Dwarf_info_reader::check_buffer): New function.
148         (Dwarf_info_reader::parse): New function.
149         (Dwarf_info_reader::do_parse): New function.
150         (Dwarf_info_reader::do_read_string_table): New function.
151         (Dwarf_info_reader::lookup_reloc): New function.
152         (Dwarf_info_reader::get_string): New function.
153         (Dwarf_info_reader::visit_compilation_unit): New function.
154         (Dwarf_info_reader::visit_type_unit): New function.
155         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
156         Sized_elf_reloc_mapper.
157         (Sized_dwarf_line_info::symbol_section): Remove function.
158         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
159         (Sized_dwarf_line_info::read_line_mappings): Remove object
160         parameter, adjust callers.
161         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
162         * dwarf_reader.h: Include <sys/types.h>.
163         (class Track_relocs): Remove forward declaration.
164         (class Elf_reloc_mapper): New class.
165         (class Sized_elf_reloc_mapper): New class.
166         (class Dwarf_abbrev_table): New class.
167         (class Dwarf_range_list): New class.
168         (class Dwarf_ranges_table): New class.
169         (class Dwarf_pubnames_table): New class.
170         (class Dwarf_die): New class.
171         (class Dwarf_info_reader): New class.
172         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
173         (Sized_dwarf_line_info::symbol_section): Remove member function.
174         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
175         base class.
176         * gdb-index.cc: New source file.
177         * gdb-index.h: New source file.
178         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
179         and .debug_types sections, call Layout::add_to_gdb_index.
180         (Sized_relobj_incr::do_section_name): Implement.
181         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
182         return type; Implement.
183         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
184         return type.
185         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
186         parameter list and return type.
187         (Sized_incr_dynobj::do_section_contents): Likewise.
188         * layout.cc: Include gdb-index.h.
189         (Layout::Layout): Initialize gdb_index_data_.
190         (Layout::init_fixed_output_section): Check for .gdb_index section.
191         (Layout::add_to_gdb_index): New function. Instantiate.
192         * layout.h: Add forward declaration for class Gdb_index.
193         (Layout::add_to_gdb_index): New member function.
194         (Layout::gdb_index_data_): New data member.
195         * main.cc: Include gdb-index.h.
196         (main): Print statistics for gdb index.
197         * object.cc (Object::section_contents): Move code into
198         do_section_contents.
199         (need_decompressed_section): Check for sections needed when building
200         gdb index.
201         (build_compressed_section_map): Likewise.
202         (Sized_relobj_file::do_read_symbols): Need local symbols when building
203         gdb index.
204         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
205         sections; call Layout::add_to_gdb_index.
206         (Sized_relobj_file::do_decompressed_section_contents): Call
207         do_section_contents directly.
208         * object.h (Object::do_section_contents): Adjust parameter list and
209         return type.
210         (Object::do_decompressed_section_contents): Call do_section_contents
211         directly.
212         (Sized_relobj_file::do_section_contents): Adjust parameter list and
213         return type.
214         * options.h (class General_options): Add --gdb-index option.
215         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
216         list and return type.
217         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
218         * reloc.h (Track_relocs::checkpoint): New function.
219         (Track_relocs::reset): New function.
220
221         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
222         New test cases.
223         * testsuite/Makefile.in: Regenerate.
224         * testsuite/gdb_index_test.cc: New test source file.
225         * testsuite/gdb_index_test_1.sh: New test source file.
226         * testsuite/gdb_index_test_2.sh: New test source file.
227
228 2012-03-19  Doug Kwan  <dougkwan@google.com>
229
230         * arm.cc (Target_arm::do_define_standard_symbols): New method.
231         (Target_arm::do_finalize_sections): Remove code which defines
232         __exidx_start and __exidx_end.  Make symbol table parameter
233         anonymous as it is not used.
234         * gold.cc (queue_middle_tasks): Call target hook to define any
235         target-specific symbols.
236         * target.h (Target::define_standard_symbols): New method.
237         (Target::do_define_standard_symbols): Same.
238         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
239         * testsuite/Makefile.in: Regenerate.
240         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
241         and __exidx_end.
242         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
243         relocations are generated for __exidx_start and __exidx_end.
244
245 2012-03-16  Doug Kwan  <dougkwan@google.com>
246
247         * testsuite/Makefile.am: Disable test initpri3b.
248         * testsuite/Makefile.in: Regenerate.
249
250 2012-03-15  Doug Kwan  <dougkwan@google.com>
251
252         * arm.cc (Target_arm::got_section): Make .got section read-only
253         if -z now is given.
254
255 2012-03-15  Ian Lance Taylor  <iant@google.com>
256
257         PR gold/13850
258         * layout.cc (Layout::make_output_section): Correctly mark
259         SHT_INIT_ARRAY, et. al., as relro.
260
261 2012-03-14  Doug Kwan  <dougkwan@google.com>
262
263         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
264         dynamic relocations for protected symbols in shared objects.
265
266 2012-03-13  Ian Lance Taylor  <iant@google.com>
267
268         * resolve.cc (Symbol_table::resolve): When merging common symbols,
269         keep the larger alignment.
270
271 2012-03-12  Cary Coutant  <ccoutant@google.com>
272
273         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
274         handling of DW_LNE_define_file.
275
276 2012-03-12  Cary Coutant  <ccoutant@google.com>
277
278         * reduced_debug_output.cc
279         (Output_reduced_debug_info_section::get_die_end): Add new FORM
280         codes to switch.
281
282 2012-02-29  Cary Coutant  <ccoutant@google.com>
283
284         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
285
286 2012-02-29  Cary Coutant  <ccoutant@google.com>
287
288         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
289         Call Object::decompressed_section_contents.
290         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
291         New dtor.
292         (Sized_dwarf_line_info::buffer_start_): New data member.
293         * merge.cc (Output_merge_data::do_add_input_section): Call
294         Object::decompressed_section_contents.
295         (Output_merge_string::do_add_input_section): Likewise.
296         * object.cc (need_decompressed_section): New function.
297         (build_compressed_section_map): Decompress sections needed later.
298         (Sized_relobj_file::do_decompressed_section_contents): New function.
299         (Sized_relobj_file::do_discard_decompressed_sections): New function.
300         * object.h (Object::decompressed_section_contents): New function.
301         (Object::discard_decompressed_sections): New function.
302         (Object::do_decompressed_section_contents): New function.
303         (Object::do_discard_decompressed_sections): New function.
304         (Compressed_section_info): New type.
305         (Compressed_section_map): Include decompressed section contents.
306         (Sized_relobj_file::do_decompressed_section_contents): New function.
307         (Sized_relobj_file::do_discard_decompressed_sections): New function.
308
309 2012-02-16  Cary Coutant  <ccoutant@google.com>
310
311         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
312         * testsuite/Makefile.in: Regenerate.
313
314 2012-02-14  Cary Coutant  <ccoutant@google.com>
315
316         * options.cc (General_options::finalize): Disallow -pie and -static.
317
318 2012-02-03  Doug Kwan  <dougkwan@google.com>
319
320         * arm.cc (Arm_relocate_functions::abs8,
321         Arm_relocate_functions::abs16): Use
322         Bits::has_signed_unsigned_overflow32.
323         (Arm_relocate_functions::thm_abs8): Correct range of
324         overflow check.
325         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
326         in assertions.
327
328 2012-02-02  Doug Kwan  <dougkwan@google.com>
329
330         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
331         position independent outputs, not just shared objects.
332
333 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
334
335         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
336         * configure: Regenerated.
337
338 2012-01-27  Ian Lance Taylor  <iant@google.com>
339
340         * reloc.h (Bits): New class with static functions, copied from
341         namespace utils in arm.cc.
342         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
343         instead.
344
345 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
346
347         * incremental.cc (write_info_blocks): Correct relocation offset.
348
349 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
350
351         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
352         (Relocate::tls_gd_to_le): Likewise.
353
354 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
355
356         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
357
358 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
359
360         * configure.ac: Check if -mcmodel=medium works.
361         * configure: Regenerated.
362
363 2012-01-24  Cary Coutant  <ccoutant@google.com>
364
365         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
366         definition and ...
367         (read_unsigned_LEB_128_x): ... this new function.
368         (read_signed_LEB_128): Replaced with inline definition and ...
369         (read_signed_LEB_128_x): ... this new function.
370         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
371         (read_unsigned_LEB_128): Add inline definition.
372         (read_signed_LEB_128_x): New function.
373         (read_signed_LEB_128): Add inline definition.
374         * testsuite/Makefile.am (leb128_unittest): New unit test.
375         * testsuite/Makefile.in: Regenerate.
376         * testsuite/leb128_unittest.cc: New unit test.
377
378 2012-01-23  Ian Lance Taylor  <iant@google.com>
379
380         PR gold/13617
381         * i386.cc (Target_i386::do_code_fill): When using a jmp
382         instruction, pad with nop instructions.
383         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
384
385 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
386
387         * x86_64.cc (gc_process_relocs): Add typename on types used in
388         template.
389         (scan_relocs): Likewise.
390         (relocate_section): Likewise.
391         (apply_relocation): Likewise.
392
393 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
394
395         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
396         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
397         under x32.
398
399 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
400
401         * x86_64.cc: Initial support for x32.
402
403 2012-01-03  Cary Coutant  <ccoutant@google.com>
404
405         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
406         Use abstract base class for GOT.
407         * gold/output.h (class Output_data_got_base): New abstract base class.
408         (class Output_data_got): Derive from new base class, adjust ctors.
409         (Output_data_got::reserve_slot): Make virtual; rename to
410         do_reserve_slot; Adjust callers.
411         * gold/target.h (Sized_target::init_got_plt_for_update): Return
412         pointer to abstract base class.
413         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
414
415 2011-12-18  Ian Lance Taylor  <iant@google.com>
416
417         * object.h (Relobj::local_symbol_value): New function.
418         (Relobj::local_plt_offset): New function.
419         (Relobj::local_has_got_offset): New function.
420         (Relobj::local_got_offset): New function.
421         (Relobj::set_local_got_offset): New function.
422         (Relobj::do_local_symbol_value): New pure virtual function.
423         (Relobj::do_local_plt_offset): Likewise.
424         (Relobj::do_local_has_got_offset): Likewise.
425         (Relobj::do_local_got_offset): Likewise.
426         (Relobj::do_set_local_got_offset): Likewise.
427         (Sized_relobj::do_local_has_got_offset): Rename from
428         local_has_got_offset.
429         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
430         (Sized_relobj::do_set_local_got_offset): Rename from
431         set_local_got_offset.
432         (Sized_relobj_file::do_local_plt_offset): Rename from
433         local_plt_offset.
434         (Sized_relobj_file::do_local_symbol_value): New function.
435         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
436         local_plt_offset.
437         * output.cc (Output_data_got::Got_entry::write): Change object to
438         Relobj.  Use local_symbol_value.
439         (Output_data_got::add_global_with_rel): Change rel_dyn to
440         Output_data_reloc_generic*.  Use add_global_generic.
441         (Output_data_got::add_global_with_rela): Remove.  Change all
442         callers to use add_global_with_rel.
443         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
444         Output_data_reloc_generic*.  Use add_global_generic.
445         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
446         callers to use add_global_pair_with_rel.
447         (Output_data_got::add_local): Change object to Relobj*.
448         (Output_data_got::add_local_plt): Likewise.
449         (Output_data_got::add_local_with_rel): Change object to Relobj*,
450         change rel_dyn to Output_data_reloc_generic*.  Use
451         add_local_generic.
452         (Output_data_got::add_local_with_rela): Remove.  Change all
453         callers to use all_local_with_rel.
454         (Output_data_got::add_local_pair_with_rel): Change object to
455         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
456         add_output_section_generic.
457         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
458         callers to use add_local_pair_with_rel.
459         (Output_data_got::reserve_local): Change object to Relobj*.
460         * output.h: (class Output_data_reloc_generic): Add pure virtual
461         declarations for add_global_generic, add_local_generic,
462         add_output_section_generic.
463         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
464         functions for Output_data_reloc_generic.  Update declarations for
465         changes listed in output.cc.
466         (class Output_data_got): Change template parameter to got_size.
467         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
468         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
469         function.
470         (Sized_relobj_incr::do_local_plt_offset): New function.
471         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
472         add_global_generic.
473
474 2011-12-17  Cary Coutant  <ccoutant@google.com>
475
476         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
477         * resolve.cc (Symbol_table::resolve): Likewise.
478         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
479         arrays.
480         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
481
482 2011-12-16  Ian Lance Taylor  <iant@google.com>
483
484         * output.h (Output_data_reloc_generic::add): Only call
485         add_dynamic_reloc if this is a dynamic reloc section.
486
487 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
488
489         PR gold/13505
490         * target-reloc.h (apply_relocation): Replace <64, false> with
491         <size, big_endian>.
492
493 2011-11-25  Nick Clifton  <nickc@redhat.com>
494
495         * po/it.po: New Italian translation.
496
497 2011-11-17  Sterling Augustine  <saugustine@google.com>
498
499         * script.cc (script_include_directive): Implement.
500         (read_script_file): New local variables name and search_path. Update
501         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
502         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
503         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
504
505 2011-11-11  Sterling Augustine  <saugustine@google.com>
506
507         * yyscript.y (section_cmd): Add support for INCLUDE directive.
508         (file_or_sections_cmd): Likewise.
509
510 2011-11-11  Doug Kwan  <dougkwan@google.com>
511
512         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
513         if --just-symbols is given.
514
515 2011-11-10  Doug Kwan  <dougkwan@google.com>
516
517         PR gold/13362
518         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
519         when processing data relocs.
520         * reloc.h (Relocate_functions::rel_unaligned): New method.
521         (Relocate_functions::pcrel_unaligned): Ditto.
522         (Relocate_functions::rel32_unaligned): Ditto.
523         (Relocate_functions::pcrel32_unaligned): Ditto.
524
525 2011-11-09  Doug Kwan  <dougkwan@google.com>
526
527         PR gold/13362
528         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
529         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
530         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
531         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
532         (Relocate_functions::rel_unaligned): New.
533         (Relocate_functions::rel32_unaligned): New.
534         * target-reloc.h (relocate_for_relocatable): Add code to handle
535         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
536         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
537         arm_unaligned_reloc_r): New targets.
538         * testsuite/Makefile.in: Regenerate.
539         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
540         linking.
541
542 2011-11-02  Ian Lance Taylor  <iant@google.com>
543
544         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
545         NATIVE_LINKER.
546         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
547         * options.cc (General_options::finalize): Use library search path
548         from configure script if specified.  If not native and no sysroot,
549         only search TOOLLIBDIR.
550         * options.h (Search_directory::Search_directory): Change name to
551         const std::string&.
552         (General_options::add_to_library_path_with_sysroot): Change arg to
553         const std::string&.
554         * configure, Makefile.in, config.in: Rebuild.
555
556 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
557
558         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
559         we are working around the ARM1176 Erratum.
560         * options.h (General_options::fix_arm1176): Add option.
561         * testsuite/Makefile.am: Add testcases, and keep current ones
562         working.
563         * testsuite/Makefile.in: Regenerate.
564         * testsuite/arm_fix_1176.s: New file.
565         * testsuite/arm_fix_1176.sh: Likewise.
566
567 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
568
569         * arm.cc (Target_arm::Target_arm): Remove initialisation of
570         may_use_blx_.
571         (Target_arm::may_use_blx): Remove method.
572         (Target_arm::set_may_use_blx): Likewise.
573         (Target_arm::may_use_v4t_interworking): New method.
574         (Target_arm::may_use_v5t_interworking): Likewise.
575         (Target_arm::may_use_blx_): Remove member variable.
576         (Arm_relocate_functions::arm_branch_common): Check for v5T
577         interworking.
578         (Arm_relocate_functions::thumb_branch_common): Likewise.
579         (Reloc_stub::stub_type_for_reloc): Likewise.
580         (Target_arm::do_finalize_sections): Correct interworking checks.
581         * testsuite/Makefile.am: Add new tests.
582         * testsuite/Makefile.in: Regenerate.
583         * testsuite/arm_farcall_arm_arm.s: New test.
584         * testsuite/arm_farcall_arm_arm.sh: Likewise.
585         * testsuite/arm_farcall_arm_thumb.s: Likewise.
586         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
587         * testsuite/arm_farcall_thumb_arm.s: Likewise.
588         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
589         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
590         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
591
592 2011-10-31  Cary Coutant  <ccoutant@google.com>
593
594         PR gold/13023
595         * expression.cc (Expression::eval_with_dot): Add
596         is_section_dot_assignment parameter.
597         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
598         absolute and assigning to dot within a section.
599         * script-sections.cc
600         (Output_section_element_assignment::set_section_addresses): Pass
601         dot_section to set_if_absolute.
602         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
603         as is_section_dot_assignment flag to eval_with_dot.
604         (Output_section_element_dot_assignment::set_section_addresses):
605         Likewise.
606         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
607         parameter.  Also set value if relative to dot_section; set the
608         symbol's output_section.
609         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
610         parameter.  Adjust all callers.
611         (Expression::eval_maybe_dot): Likewise.
612         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
613         Adjust all callers.
614         * testsuite/script_test_2.t: Test assignment of an absolute value
615         to dot within an output section element.
616
617 2011-10-31  Cary Coutant  <ccoutant@google.com>
618
619         * options.h (class General_options): Add --[no-]gnu-unique options.
620         * symtab.cc (Symbol_table::sized_write_globals): Convert
621         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
622
623 2011-10-31  Cary Coutant  <ccoutant@google.com>
624
625         PR gold/13359
626         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
627         unnecessary assertion.
628         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
629
630 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
631
632         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
633         gc_mark_symbol.
634         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
635         gc_mark_symbol.
636         Change to just keep the section associated with symbol.
637         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
638         they are externally visible and --export-dynamic is turned on.
639         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
640
641 2011-10-19  Ian Lance Taylor  <iant@google.com>
642
643         PR gold/13163
644         * script-sections.cc
645         (Output_section_element_dot_assignment::needs_output_section): New
646         function.
647
648 2011-10-19  Ian Lance Taylor  <iant@google.com>
649
650         PR gold/13204
651         * layout.cc (Layout::segment_precedes): Don't assert failure if a
652         --section-start option was seen.
653         * options.h (General_options::any_section_start): New function.
654
655 2011-10-18  David S. Miller  <davem@davemloft.net>
656
657         PR binutils/13301
658         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
659         member to track relocation locations that have moved during TLS
660         reloc optimizations.
661         (Target_sparc::Relocate::Relocate): Initialize to NULL.
662         (Target_sparc::Relocate::relocate): Adjust view down by 4
663         bytes if it matches reloc_adjust_addr_.
664         (Target_sparc::Relocate::relocate_tls): Always move the
665         __tls_get_addr call delay slot instruction forward 4 bytes when
666         performing relaxation.
667
668 2011-10-18  Cary Coutant  <ccoutant@google.com>
669
670         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
671         (Output_file::map_no_anonymous): Check for non-zero
672         return code from posix_fallocate.
673
674 2011-10-17  Cary Coutant  <ccoutant@google.com>
675
676         PR gold/13245
677         * plugin.cc (is_visible_from_outside): Check for symbols
678         referenced from dynamic objects.
679         * resolve.cc (Symbol_table::resolve): Don't count references
680         from dynamic objects as references from real ELF files.
681         * testsuite/plugin_test_2.sh: Adjust expected result.
682
683 2011-10-17  Cary Coutant  <ccoutant@google.com>
684
685         * gold.cc: Include timer.h.
686         (queue_middle_tasks): Stamp time.
687         (queue_final_tasks): Likewise.
688         * main.cc (main): Store timer in parameters.  Print timers
689         for each pass.
690         * parameters.cc (Parameters::Parameters): Initialize timer_.
691         (Parameters::set_timer): New function.
692         (set_parameters_timer): New function.
693         * parameters.h (Parameters::set_timer): New function.
694         (Parameters::timer): New function.
695         (Parameters::timer_): New data member.
696         (set_parameters_timer): New function.
697         * timer.cc (Timer::stamp): New function.
698         (Timer::get_pass_time): New function.
699         * timer.h (Timer::stamp): New function.
700         (Timer::get_pass_time): New function.
701         (Timer::pass_times_): New data member.
702
703 2011-10-17  Cary Coutant  <ccoutant@google.com>
704
705         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
706         task for members of lib groups.
707
708 2011-10-17  Cary Coutant  <ccoutant@google.com>
709
710         PR gold/13288
711         * fileread.cc (File_read::find_view): Add assert.
712         (File_read::make_view): Move bounds check (replace with assert)...
713         (File_read::find_or_make_view): ... to here.
714
715 2011-10-12  Cary Coutant  <ccoutant@google.com>
716
717         * output.cc (Output_file::open_base_file): Handle case where
718         ::read returns less than requested size.
719
720 2011-10-10  Cary Coutant  <ccoutant@google.com>
721
722         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
723         Initialize defined_count_.
724         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
725         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
726         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
727         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
728         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
729         * incremental.h (Sized_relobj_incr::defined_count_): New data
730         member.
731         (Sized_incr_dynobj::defined_count_): New data member.
732         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
733         Return zeroes instead of internal error.
734
735 2011-10-10  Cary Coutant  <ccoutant@google.com>
736
737         PR gold/13249
738         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
739         (Output_reloc::symbol_value): Return PLT offset if flag is set.
740         * output.h (class Output_reloc): Add use_plt_offset flag.
741         (Output_reloc::type_): Adjust size of bit field.
742         (Output_reloc::use_plt_offset_): New bit field.
743         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
744         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
745         flag.  Adjust all callers.
746         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
747         creating RELATIVE relocations.
748
749 2011-10-10  Nick Clifton  <nickc@redhat.com>
750
751         * po/es.po: Updated Spanish translation.
752         * po/fi.po: Updated Finnish translation.
753
754 2011-10-03   Diego Novillo  <dnovillo@google.com>
755
756         * options.cc (parse_uint): Fix dereference of RETVAL.
757
758 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
759
760         * layout.h (section_order_map_): New member.
761         (get_section_order_map): New member function.
762         * output.cc (Output_section::add_input_section): Check for patterns
763         only when --section-ordering-file is specified.
764         * gold.cc (queue_middle_tasks): Delay updating order of sections till
765         output_sections have been formed.
766         * layout.cc (Layout_Layout): Initialize section_order_map_.
767         * plugin.cc (update_section_order): Store order in order_map. Do not
768         update the order.
769         * testsuite/Makefile.am: Add test case for plugin_final_layout.
770         * testsuite/Makefile.in: Regenerate.
771         * testsuite/plugin_section_order.c: New file.
772         * testsuite/plugin_final_layout.cc: New file.
773         * testsuite/plugin_final_layout.sh: New file.
774
775 2011-09-29  Cary Coutant  <ccoutant@google.com>
776
777         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
778         Check for NULL.
779         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
780         symbols during incremental update.
781         (Symbol_table::add_from_dynobj): Likewise.
782
783 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
784             Ian Lance Taylor  <iant@google.com>
785
786         * symtab.cc (Symbol_table::define_special_symbol): Always
787         canonicalize version string.
788
789 2011-09-26  Cary Coutant  <ccoutant@google.com>
790
791         * gold.cc (queue_initial_tasks): Move option checks ...
792         * options.cc (General_options::finalize): ... to here. Disable
793         some options; make others fatal.
794
795 2011-09-26  Cary Coutant  <ccoutant@google.com>
796
797         gcc PR lto/47247
798         * plugin.cc (get_symbols_v2): New function.
799         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
800         (is_referenced_from_outside): New function.
801         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
802         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
803         (get_symbols): Pass version parameter.
804         (get_symbols_v2): New function.
805         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
806         parameter.
807         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
808         (onload): Add LDPT_GET_SYMBOLS_V2.
809         (all_symbols_read_hook): Use get_symbols_v2; check for
810         LDPR_PREVAILING_DEF_IRONLY_EXP.
811         * testsuite/plugin_test_3.sh: Update expected results.
812
813 2011-09-23  Simon Baldwin  <simonb@google.com>
814
815         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
816         configuration options.
817         * configure: Regenerate.
818         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
819         * Makefile.in: Regenerate.
820         * testsuite/Makefile.in: Regenerate.
821
822 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
823
824         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
825
826 2011-09-19  Cary Coutant  <ccoutant@google.com>
827
828         * incremental.cc (can_incremental_update): Fix typo in comment.
829         * incremental.h (can_incremental_update): Likewise.
830
831 2011-09-18  Cary Coutant  <ccoutant@google.com>
832
833         * incremental.cc (can_incremental_update): New function.
834         * incremental.h (can_incremental_update): New function.
835         * layout.cc (Layout::init_fixed_output_section): Call it.
836         (Layout::make_output_section): Don't allow patch space in .eh_frame.
837         * object.cc (Sized_relobj_file::do_layout): Call
838         can_incremental_update.
839
840 2011-09-13  Cary Coutant  <ccoutant@google.com>
841
842         * configure.ac: Check for glibc support for gnu_indirect_function
843         support with static linking, setting automake conditional
844         IFUNC_STATIC.
845         * Makefile.in: Regenerate.
846         * configure: Regenerate.
847
848         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
849         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
850         for IFUNC_STATIC.
851         * testsuite/Makefile.in: Regenerate.
852
853 2011-09-13  Cary Coutant  <ccoutant@google.com>
854
855         * incremental.cc (Sized_relobj_incr::do_layout): Call
856         report_comdat_group for kept comdat sections.
857         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
858         * testsuite/Makefile.in: Regenerate.
859         * testsuite/incr_comdat_test_1.cc: New source file.
860         * testsuite/incr_comdat_test_2_v1.cc: New source file.
861         * testsuite/incr_comdat_test_2_v2.cc: New source file.
862         * testsuite/incr_comdat_test_2_v3.cc: New source file.
863
864 2011-09-13  Ian Lance Taylor  <iant@google.com>
865
866         * object.cc (Sized_relobj_file::do_layout): Remove unused local
867         variable external_symbols_offset.
868
869 2011-09-12  Ian Lance Taylor  <iant@google.com>
870
871         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
872         triggered if object has no symbols.
873
874 2011-09-09  David S. Miller  <davem@davemloft.net>
875
876         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
877         (Output_fill_debug_line::do_write): Likewise.
878
879 2011-08-29  Cary Coutant  <ccoutant@google.com>
880
881         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
882         casts to match formatting specs.
883         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
884
885 2011-08-26  Cary Coutant  <ccoutant@google.com>
886
887         * layout.cc (Free_list::allocate): Provide guarantee of minimum
888         remaining hole size when allocating.
889         (Layout::make_output_section): Set fill methods for debug sections.
890         * layout.h (Free_list::Free_list_node): Move from private to
891         public.
892         (Free_list::set_min_hole_size): New function.
893         (Free_list::begin, Free_list::end): New functions.
894         (Free_list::min_hole_): New data member.
895         * output.cc: Include dwarf.h.
896         (Output_fill_debug_info::do_minimum_hole_size): New function.
897         (Output_fill_debug_info::do_write): New function.
898         (Output_fill_debug_line::do_minimum_hole_size): New function.
899         (Output_fill_debug_line::do_write): New function.
900         (Output_section::Output_section): Initialize new data member.
901         (Output_section::set_final_data_size): Ensure patch space is larger
902         than minimum hole size.
903         (Output_section::do_write): Fill holes in debug sections.
904         * output.h (Output_fill): New class.
905         (Output_fill_debug_info): New class.
906         (Output_fill_debug_line): New class.
907         (Output_section::set_free_space_fill): New function.
908         (Output_section::free_space_fill_): New data member.
909         * testsuite/Makefile.am (incremental_test_3): Add
910         --incremental-patch option.
911         (incremental_test_4): Likewise.
912         (incremental_test_5): Likewise.
913         (incremental_test_6): Likewise.
914         (incremental_copy_test): Likewise.
915         (incremental_common_test_1): Likewise.
916         * testsuite/Makefile.in: Regenerate.
917
918 2011-08-26  Nick Clifton  <nickc@redhat.com>
919
920         * po/es.po: Updated Spanish translation.
921
922 2011-08-01  Cary Coutant  <ccoutant@google.com>
923
924         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
925         * gold/testsuite/Makefile.in: Regenerate.
926         * gold/testsuite/justsyms_exec.c: New source file.
927         * gold/testsuite/justsyms_lib.c: New source file.
928
929 2011-08-01  Cary Coutant  <ccoutant@google.com>
930
931         * layout.cc (Layout::set_segment_offsets): Don't realign text
932         segment if -Ttext was specified.
933         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
934         file type.
935         * object.h (Sized_relobj_file::e_type): New function.
936         (Sized_relobj_file::e_type_): New data member.
937         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
938         base address for ET_EXEC files.
939         * target.cc (Target::do_make_elf_object_implementation): Allow
940         ET_EXEC files with --just-symbols option.
941
942 2011-07-28  Cary Coutant  <ccoutant@google.com>
943
944         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
945         Add thread_number parameter.
946         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
947         * workqueue-threads.cc
948         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
949         current thread if its thread number is greater than desired thread
950         count.
951         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
952         Add thread_number parameter.
953         (Workqueue::should_cancel_thread): Likewise.
954         (Workqueue::find_runnable_or_wait): Pass thread_number to
955         should_cancel_thread.
956         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
957         parameter.
958
959 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
960
961         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
962         only after checking if it cannot be forced local.
963         * symtab.h (is_externally_visible): Check if the symbol is not forced
964         local.
965
966 2011-07-15  Ian Lance Taylor  <iant@google.com>
967
968         * options.h (class General_options): Add --print-output-format.
969         Move -EL next to -EB, for  better --help output.
970         * target-select.cc: Include <cstdio>, "options.h", and
971         "parameters.h".
972         (Target_selector::do_target_bfd_name): New function.
973         (print_output_format): New function.
974         * target-select.h (class Target_selector): Update declarations.
975         (Target_selector::target_bfd_name): New function.
976         (print_output_format): Declare.
977         * main.cc: Include "target-select.h".
978         (main): Handle --print-output-format.
979         * gold.cc: Include "target-select.h".
980         (queue_initial_tasks): Handle --print-output-format when there are
981         no input files.
982         * parameters.cc (parameters_force_valid_target): Give a better
983         error message if -EB/-EL does not match target.
984         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
985         function.
986
987 2011-07-15  Ian Lance Taylor  <iant@google.com>
988
989         * i386.cc (class Output_data_plt_i386): Add layout_ field.
990         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
991         (Output_data_plt_i386::do_write): Write address of .dynamic
992         section to first entry in .got.plt section.
993         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
994         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
995         Initialize layout_.
996         (Output_data_plt_x86_64::do_write): Write address of .dynamic
997         section to first entry in .got.plt section.
998         * layout.h (Layout::dynamic_section): New function.
999
1000 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1001
1002         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1003         to claim_file call.
1004         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1005         input_section_position_, and input_section_glob_.
1006         (read_layout_from_file): Call function section_ordering_specified.
1007         * layout.h (is_section_ordering_specified): New function.
1008         (section_ordering_specified): New function.
1009         (section_ordering_specified_): New boolean member.
1010         * main.cc(main): Call load_plugins after layout object is defined.
1011         * output.cc (Output_section::add_input_section): Use
1012         function section_ordering_specified to check if section ordering is
1013         needed.
1014         * output.cc (Output_section::add_relaxed_input_section): Use
1015         function section_ordering_specified to check if section ordering is
1016         needed.
1017         (Output_section::update_section_layout): New function.
1018         (Output_section::sort_attached_input_sections): Check if input section
1019         must be reordered.
1020         * output.h (Output_section::update_section_layout): New function.
1021         * plugin.cc (get_section_count): New function.
1022         (get_section_type): New function.
1023         (get_section_name): New function.
1024         (get_section_contents): New function.
1025         (update_section_order): New function.
1026         (allow_section_ordering): New function.
1027         (Plugin::load): Add the new interfaces to the transfer vector.
1028         (Plugin_manager::load_plugins): New parameter.
1029         (Plugin_manager::all_symbols_read): New parameter.
1030         (Plugin_manager::claim_file): New parameter. Save the elf object for
1031         unclaimed objects.
1032         (Plugin_manager::get_elf_object): New function.
1033         (Plugin_manager::get_view): Change to directly use the bool to check
1034         if get_view is called from claim_file_hook.
1035         * plugin.h (input_objects): New function
1036         (Plugin__manager::load_plugins): New parameter.
1037         (Plugin_manager::claim_file): New parameter.
1038         (Plugin_manager::get_elf_object): New function.
1039         (Plugin_manager::in_claim_file_handler): New function.
1040         (Plugin_manager::in_claim_file_handler_): New member.
1041         (layout): New function.
1042         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1043         handler with an extra parameter. Make the elf object before calling
1044         claim_file handler.
1045         * testsuite/plugin_test.c (get_section_count): New function pointer.
1046         (get_section_type): New function pointer.
1047         (get_section_name): New function pointer.
1048         (get_section_contents): New function pointer.
1049         (update_section_order): New function pointer.
1050         (allow_section_ordering): New function pointer.
1051         (onload): Check if the new interfaces exist.
1052
1053 2011-07-13  Ian Lance Taylor  <iant@google.com>
1054
1055         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1056         relro section.
1057         * x86_64.cc (Target_x86_64::got_section): Likewise.
1058         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1059         (relro_now_test_SOURCES): New variable.
1060         (relro_now_test_DEPENDENCIES): New variable.
1061         (relro_now_test_LDFLAGS): New variable.
1062         (relro_now_test_LDADD): New variable.
1063         (relro_now_test.so): New target.
1064         * testsuite/Makefile.in: Rebuild.
1065
1066 2011-07-12  Ian Lance Taylor  <iant@google.com>
1067
1068         PR gold/12980
1069         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1070         GLOB_DAT relocation rather than a RELATIVE relocation for a
1071         protected symbol when creating a shared library.
1072         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1073         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1074         * testsuite/protected_main_1.cc (main): Test that protected
1075         function has same address.
1076
1077 2011-07-11  Ian Lance Taylor  <iant@google.com>
1078
1079         PR gold/12979
1080         * options.h (class General_options): Add -Bgroup.
1081         * options.cc (General_options::finalize): If -Bgroup is set,
1082         default to --unresolved-symbols=report-all.
1083         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1084         * target-reloc.h (issue_undefined_symbol_error): Handle
1085         --unresolved-symbols=report-all.
1086
1087 2011-07-08  Ian Lance Taylor  <iant@google.com>
1088
1089         PR gold/11985
1090         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1091         if linker script discards key sections.
1092         (Layout::create_dynamic_symtab): Likewise.
1093         (Layout::assign_local_dynsym_offsets): Likewise.
1094         (Layout::sized_create_version_sections): Likewise.
1095         (Layout::create_interp): Likewise.
1096         (Layout::finish_dynamic_section): Likewise.
1097         (Layout::set_dynamic_symbol_size): Likewise.
1098
1099 2011-07-08  Ian Lance Taylor  <iant@google.com>
1100
1101         PR gold/12386
1102         * options.h (class General_options): Add --unresolved-symbols.
1103         * target-reloc.h (issue_undefined_symbol_error): Check
1104         --unresolved-symbols.  Add comments.
1105
1106 2011-07-08  Ian Lance Taylor  <iant@google.com>
1107
1108         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1109         expression more complex.
1110
1111 2011-07-08  Ian Lance Taylor  <iant@google.com>
1112
1113         PR gold/11317
1114         * target-reloc.h (issue_undefined_symbol_error): New inline
1115         function, broken out of relocate_section.
1116         (relocate_section): Call issue_undefined_symbol_error.
1117         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1118         there is no TLS segment if we are about to issue an undefined
1119         symbol error.
1120         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1121
1122 2011-07-08  Ian Lance Taylor  <iant@google.com>
1123
1124         PR gold/12279
1125         * resolve.cc (Symbol_table::should_override): Add fromtype
1126         parameter.  Change all callers.  Give error when linking together
1127         TLS and non-TLS symbol.
1128         (Symbol_table::should_override_with_special): Add fromtype
1129         parameter.  Change all callers.
1130         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1131         there is no TLS segment if we have reported some errors.
1132         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1133
1134 2011-07-08  Ian Lance Taylor  <iant@google.com>
1135
1136         PR gold/12372
1137         * target.h (Target::plt_address_for_global): New function.
1138         (Target::plt_address_for_local): New function.
1139         (Target::plt_section_for_global): Remove.
1140         (Target::plt_section_for_local): Remove.
1141         (Target::do_plt_address_for_global): New virtual function.
1142         (Target::do_plt_address_for_local): New virtual function.
1143         (Target::do_plt_section_for_global): Remove.
1144         (Target::do_plt_section_for_local): Remove.
1145         (Target::register_global_plt_entry): Add Symbol_table and Layout
1146         parameters.
1147         * output.cc (Output_data_got::Got_entry::write): Use
1148         plt_address_for_global and plt_address_for_local.
1149         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1150         address of output section.
1151         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1152         got_irelative_, and irelative_count_ fields.  Update
1153         declarations.
1154         (Output_data_plt_i386::has_irelative_section): New function.
1155         (Output_data_plt_i386::entry_count): Add irelative_count_.
1156         (Output_data_plt_i386::set_final_data_size): Likewise.
1157         (class Target_i386): Add got_irelative_ and rel_irelative_
1158         fields.  Update declarations.
1159         (Target_i386::Target_i386): Initialize new fields.
1160         (Target_i386::do_plt_address_for_global): New function replacing
1161         do_plt_section_for_global.
1162         (Target_i386::do_plt_address_for_local): New function replacing
1163         do_plt_section_for_local.
1164         (Target_i386::got_section): Create got_irelative_.
1165         (Target_i386::rel_irelative_section): New function.
1166         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1167         fields.  Don't define __rel_iplt_{start,end}.
1168         (Output_data_plt_i386::add_entry): Add symtab and layout
1169         parameters.  Change all callers.  Use different PLT and GOT for
1170         IFUNC symbols.
1171         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1172         layout parameters.  Change all callers.  Use different PLT and
1173         GOT.
1174         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1175         (Output_data_plt_i386::rel_irelative): New function.
1176         (Output_data_plt_i386::address_for_global): New function.
1177         (Output_data_plt_i386::address_for_local): New function.
1178         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1179         IRELATIVE GOT when changing IFUNC GOT entries.
1180         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1181         reloc.
1182         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1183         if we didn't create an IRELATIVE GOT.
1184         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1185         plt_address_for_local.
1186         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1187         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1188         got_irelative_, and irelative_count_ fields.  Update
1189         declarations.
1190         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1191         Initialize new fields.  Remove symtab parameter.  Change all
1192         callers.
1193         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1194         irelative_count_.
1195         (Output_data_plt_x86_64::has_irelative_section): New function.
1196         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1197         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1198         fields.  Update declarations.
1199         (Target_x86_64::Target_x86_64): Initialize new fields.
1200         (Target_x86_64::do_plt_address_for_global): New function replacing
1201         do_plt_section_for_global.
1202         (Target_x86_64::do_plt_address_for_local): New function replacing
1203         do_plt_section_for_local.
1204         (Target_x86_64::got_section): Create got_irelative_.
1205         (Target_x86_64::rela_irelative_section): New function.
1206         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1207         all callers.  Don't create __rel_iplt_{start,end}.
1208         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1209         parameters.  Change all callers.  Use different PLT and GOT for
1210         IFUNC symbols.
1211         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1212         layout parameters.  Change all callers.  Use different PLT and
1213         GOT.
1214         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1215         parameters.  Change all callers.  Use different PLT and GOT for
1216         IFUNC symbols.
1217         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1218         (Output_data_plt_x86_64::rela_irelative): New function.
1219         (Output_data_plt_x86_64::address_for_global): New function.
1220         (Output_data_plt_x86_64::address_for_local): New function.
1221         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1222         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1223         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1224         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1225         parameters.
1226         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1227         reloc.
1228         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1229         symbols if we didn't create an IRELATIVE GOT.
1230         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1231         plt_address_for_local.
1232         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1233         * testsuite/ifuncvar1.c: New test file.
1234         * testsuite/ifuncvar2.c: New test file.
1235         * testsuite/ifuncvar3.c: New test file.
1236         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1237         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1238         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1239         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1240         * testsuite/Makefile.in: Rebuild.
1241
1242 2011-07-07  Cary Coutant  <ccoutant@google.com>
1243
1244         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1245         (two_file_test_1_ndebug.o): Likewise.
1246         (two_file_test_1b_ndebug.o): Likewise.
1247         (two_file_test_2_ndebug.o): Likewise.
1248         (two_file_test_main_ndebug.o): Likewise.
1249         (incremental_test_2): Link with no-debug versions.
1250
1251 2011-07-06  Cary Coutant  <ccoutant@google.com>
1252
1253         * gold/incremental.cc
1254         (Output_section_incremental_inputs::write_info_blocks): Check for
1255         hidden and internal symbols.
1256
1257 2011-07-06  Cary Coutant  <ccoutant@google.com>
1258
1259         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1260         Check disposition for startup file.
1261         (Incremental_inputs::report_command_line): Ignore
1262         --incremental-startup-unchanged option.
1263         * options.cc (General_options::parse_incremental_startup_unchanged):
1264         New function.
1265         (General_options::General_options): Initialize new data member.
1266         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1267         (General_options): Add --incremental-startup-unchanged option.
1268         (General_options::incremental_startup_disposition): New function.
1269         (General_options::incremental_startup_disposition_): New data member.
1270
1271 2011-07-06  Cary Coutant  <ccoutant@google.com>
1272
1273         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1274         input file index to Script_info ctor.
1275         (Sized_incremental_binary::do_file_has_changed): Find the
1276         command-line argument for files named in scripts.
1277         * incremental.h (Script_info::Script_info): New ctor
1278         with input file index.
1279         (Script_info::input_file_index): New function.
1280         (Script_info::input_file_index_): New data member.
1281         (Incremental_binary::get_library): Add const.
1282         (Incremental_binary::get_script_info): Add const.
1283         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1284         * testsuite/Makefile.am (incremental_test_5): New test case.
1285         (incremental_test_6): New test case.
1286         * testsuite/Makefile.in: Regenerate.
1287
1288 2011-07-06  Cary Coutant  <ccoutant@google.com>
1289
1290         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1291         debug output when command lines differ.
1292
1293 2011-07-06  Cary Coutant  <ccoutant@google.com>
1294
1295         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1296         --incremental-patch option.
1297         * layout.cc (Free_list::allocate): Extend allocation beyond original
1298         end if enabled.
1299         (Layout::make_output_section): Mark sections that should get
1300         patch space.
1301         * options.cc (parse_percent): New function.
1302         * options.h (parse_percent): New function.
1303         (DEFINE_percent): New macro.
1304         (General_options): Add --incremental-patch option.
1305         * output.cc (Output_section::Output_section): Initialize new data
1306         members.
1307         (Output_section::add_input_section): Print section name when out
1308         of patch space.
1309         (Output_section::add_output_section_data): Likewise.
1310         (Output_section::set_final_data_size): Add patch space when
1311         doing --incremental-full.
1312         (Output_section::do_reset_address_and_file_offset): Remove patch
1313         space.
1314         (Output_segment::set_section_list_addresses): Print debug output
1315         only if --incremental-update.
1316         * output.h (Output_section::set_is_patch_space_allowed): New function.
1317         (Output_section::is_patch_space_allowed_): New data member.
1318         (Output_section::patch_space_): New data member.
1319         * parameters.cc (Parameters::incremental_full): New function.
1320         * parameters.h (Parameters::incremental_full): New function
1321         * testsuite/Makefile.am (incremental_test_2): Add test for
1322         --incremental-patch option.
1323         * testsuite/Makefile.in: Regenerate.
1324         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1325         (t18): Remove function body.
1326
1327 2011-07-05  Doug Kwan  <dougkwan@google.com>
1328
1329         PR gold/12771
1330         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1331         Arm_Address type for relocation result.
1332         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1333         overflow check.
1334         (Arm_relocate_functions::abs32): Use unaligned access.
1335         (Arm_relocate_functions::rel32): Ditto.
1336         (Arm_relocate_functions::prel31): Ditto.
1337         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1338         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1339         static data relocations.
1340         * testsuite/Makefile.in: Regnerate.
1341         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1342
1343 2011-07-05  Ian Lance Taylor  <iant@google.com>
1344
1345         PR gold/12392
1346         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1347         symbols if necessary.
1348         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1349
1350 2011-07-05  Ian Lance Taylor  <iant@google.com>
1351
1352         PR gold/12952
1353         * resolve.cc (Symbol::override_base_with_special): Simply override
1354         version with special symbol version, ignoring previous version.
1355
1356 2011-07-05  Ian Lance Taylor  <iant@google.com>
1357
1358         * object.cc (Sized_relobj_file::include_section_group): Add
1359         information to comment about signature location.
1360
1361 2011-07-02  Ian Lance Taylor  <iant@google.com>
1362
1363         PR gold/12957
1364         * options.h (class General_options): Add -f and -F.
1365         * options.cc (General_options::finalize): Fatal error if -f/-F
1366         are used without -shared.
1367         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1368
1369 2011-07-02  Ian Lance Taylor  <iant@google.com>
1370
1371         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1372
1373 2011-07-01  Ian Lance Taylor  <iant@google.com>
1374
1375         PR gold/12525
1376         PR gold/12952
1377         * resolve.cc (Symbol::override_base_with_special): Don't override
1378         the version if the overriding symbol has a different name.
1379         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1380         all callers.  If we give an error about an undefined version,
1381         define the base version if necessary.
1382         * dynobj.h (class Versions): Update declaration.
1383         * testsuite/weak_alias_test_5.cc: New file.
1384         * testsuite/weak_alias_test.script: New file.
1385         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1386         and versioned_alias have the right value, and call t2.
1387         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1388         weak_alias_test_5.so.
1389         (weak_alias_test_LDADD): Likewise.
1390         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1391         * testsuite/Makefile.in: Rebuild.
1392
1393 2011-07-01  Ian Lance Taylor  <iant@google.com>
1394
1395         PR gold/12525
1396         * options.h (class General_options): Support -z notext.
1397         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1398         -Wl,-z,notext.
1399         (two_file_shared_nonpic.so): Likewise.
1400         (two_file_shared_mixed.so): Likewise.
1401         (two_file_shared_mixed_1.so): Likewise.
1402         (weak_undef_lib_nonpic.so): Likewise.
1403         (alt/weak_undef_lib_nonpic.so): Likewise.
1404         (tls_test_shared_nonpic.so): Likewise.
1405         * testsuite/Makefile.in: Rebuild.
1406
1407 2011-07-01  Ian Lance Taylor  <iant@google.com>
1408
1409         PR gold/12525
1410         * configure.ac: Test whether static linking works, setting
1411         the automake conditional HAVE_STATIC.
1412         * testsuite/Makefile.am: Disable tests using -static if
1413         HAVE_STATIC is not true.
1414         * configure, testsuite/Makefile.in: Rebuild.
1415
1416 2011-07-01  Ian Lance Taylor  <iant@google.com>
1417
1418         PR gold/12525
1419         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1420         Assert if we see DW_EH_PE_indirect.
1421         * target.h (Target::ehframe_datarel_base): New function.
1422         (Target::do_ehframe_datarel_base): New target function.
1423         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1424         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1425         function.
1426
1427 2011-07-01  Ian Lance Taylor  <iant@google.com>
1428
1429         PR gold/12571
1430         * options.h (class General_options): Add
1431         --ld-generated-unwind-info.
1432         * ehframe.cc (Fde::write): Add address parameter.  Change all
1433         callers.  If associated with PLT, fill in address and size.
1434         (Cie::set_output_offset): Only add merge mapping if there is an
1435         object.
1436         (Cie::write): Add address parameter.  Change all callers.
1437         (Eh_frame::add_ehframe_for_plt): New function.
1438         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1439         input_offset_ fields into union u_, with new plt field.
1440         (Fde::Fde): Adjust for new union field.
1441         (Fde::Fde) [Output_data version]: New constructor.
1442         (Fde::add_mapping): Only add merge mapping if there is an object.
1443         (class Cie): Update declarations.
1444         (class Eh_frame): Declare add_ehframe_for_plt.
1445         * layout.cc (Layout::layout_eh_frame): Break out code into
1446         make_eh_frame_section, and call it.
1447         (Layout::make_eh_frame_section): New function.
1448         (Layout::add_eh_frame_for_plt): New function.
1449         * layout.h (class Layout): Update declarations.
1450         * merge.cc (Merge_map::add_mapping): Add assertion.
1451         * i386.cc: Include "dwarf.h".
1452         (class Output_data_plt_i386): Make first_plt_entry,
1453         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1454         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1455         and plt_eh_frame_fde.
1456         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1457         boundary.  Call add_eh_frame_for_plt if appropriate.
1458         * x86_64.cc: Include "dwarf.h".
1459         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1460         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1461         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1462         and plt_eh_frame_fde.
1463         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1464         appropriate.
1465
1466 2011-06-29  Ian Lance Taylor  <iant@google.com>
1467
1468         PR gold/12629
1469         * object.cc (Sized_relobj_file::layout_section): Change shdr
1470         parameter to be const.
1471         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1472         out of do_layout.
1473         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1474         appropriate.  Call layout_eh_frame_section.
1475         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1476         sections.
1477         * object.h (class Sized_relobj_file): Update declarations.
1478
1479 2011-06-29  Ian Lance Taylor  <iant@google.com>
1480
1481         PR gold/12652
1482         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1483         modifier.
1484         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1485
1486 2011-06-29  Ian Lance Taylor  <iant@google.com>
1487
1488         PR gold/12675
1489         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1490         SHT_X86_64_UNWIND.
1491         * layout.cc (Layout::layout_eh_frame): Likewise.
1492
1493 2011-06-29  Ian Lance Taylor  <iant@google.com>
1494
1495         PR gold/12695
1496         * layout.cc (Layout::symtab_section_shndx): New function.
1497         * layout.h (class Layout): Declare symtab_section_shndx.
1498         * output.cc (Output_section::write_header): Call it.
1499
1500 2011-06-29  Ian Lance Taylor  <iant@google.com>
1501
1502         PR gold/12818
1503         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1504         symbols which are not used in a relocation.
1505
1506 2011-06-28  Ian Lance Taylor  <iant@google.com>
1507
1508         PR gold/12898
1509         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1510         script create indistinguishable segments.
1511         (Layout::set_segment_offsets): Use stable_sort when sorting
1512         segments.  Pass this to Compare_segments constructor.
1513         * layout.h (class Layout): Make segment_precedes non-static.
1514         (class Compare_segments): Change from struct to class.  Add
1515         layout_ field.  Add constructor.
1516         * script-sections.cc
1517         (Script_sections::attach_sections_using_phdrs_clause): Rename
1518         local orphan to is_orphan.  Don't report failure to put empty
1519         section in segment.  On attachment failure, report name of
1520         section, and attach to first PT_LOAD segment.
1521
1522 2011-06-28  Ian Lance Taylor  <iant@google.com>
1523
1524         PR gold/12934
1525         * target-select.cc (Target_selector::Target_selector): Add
1526         emulation parameter.  Change all callers.
1527         (select_target_by_bfd_name): Rename from select_target_by_name.
1528         Change all callers.
1529         (select_target_by_emulation): New function.
1530         (supported_emulation_names): New function.
1531         * target-select.h (class Target_selector): Add emulation_ field.
1532         Update declarations.
1533         (Target_selector::recognize_by_bfd_name): Rename from
1534         recognize_by_name.  Change all callers.
1535         (Target_selector::supported_bfd_names): Rename from
1536         supported_names.  Change all callers.
1537         (Target_selector::recognize_by_emulation): New function.
1538         (Target_selector::supported_emulations): New function.
1539         (Target_selector::emulation): New function.
1540         (Target_selector::do_recognize_by_bfd_name): Rename from
1541         do_recognize_by_name.  Change all callers.
1542         (Target_selector::do_supported_bfd_names): Rename from
1543         do_supported_names.  Change all callers.
1544         (Target_selector::do_recognize_by_emulation): New function.
1545         (Target_selector::do_supported_emulations): New function.
1546         (select_target_by_bfd_name): Change name in declaration.
1547         (select_target_by_emulation): Declare.
1548         (supported_emulation_names): Declare.
1549         * parameters.cc (parameters_force_valid_target): Try to find
1550         target based on emulation from -m option.
1551         * options.h (class General_options): Change doc string for -m.
1552         * options.cc (help): Print emulations.
1553         (General_options::parse_V): Likewise.
1554         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1555         Add emulation parameter.  Change all callers.
1556
1557 2011-06-28  Ian Lance Taylor  <iant@google.com>
1558
1559         * target.h (class Target): Add osabi_ field.
1560         (Target::osabi): New function.
1561         (Target::set_osabi): New function.
1562         (Target::Target): Initialize osabi_.
1563         (Target::do_adjust_elf_header): Make pure virtual.
1564         (Sized_target::do_adjust_elf_header): Declare.
1565         * target.cc (Sized_target::do_adjust_elf_header): New function.
1566         (class Sized_target): Instantiate all versions.
1567         * freebsd.h (class Target_freebsd): Remove.
1568         (Target_selector_freebsd::do_recognize): Call set_osabi on
1569         Target.
1570         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1571         (Target_selector_freebsd::set_osabi): Remove.
1572         * i386.cc (class Target_i386): Inherit from Sized_target rather
1573         than Target_freebsd.
1574         * x86_64.cc (class Target_x86_64): Likewise.
1575
1576 2011-06-28  Ian Lance Taylor  <iant@google.com>
1577
1578         * target.h (Target::can_check_for_function_pointers): Rewrite.
1579         Make non-virtual.
1580         (Target::can_icf_inline_merge_sections): Likewise.
1581         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1582         (Target::Target_info): Add can_icf_inline_merge_sections field.
1583         (Target::do_can_check_for_function_pointers): New virtual
1584         function.
1585         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1586         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1587         from can_check_for_function_pointers, move in file.
1588         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1589         section_may_have_icf_unsafe_poineters, move in file.
1590         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1591         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1592         Rename from can_check_for_function_pointers, move in file.
1593         (Target_i386::can_icf_inline_merge_sections): Remove.
1594         (Target_i386::i386_info): Initialize
1595         can_icf_inline_merge_sections.
1596         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1597         Initialize can_icf_inline_merge_sections.
1598         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1599         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1600         Rename from can_check_for_function_pointers, move in file.
1601         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1602         (Target_x86_64::x86_64_info): Initialize
1603         can_icf_inline_merge_sections.
1604         * testsuite/testfile.cc (Target_test::test_target_info):
1605         Likewise.
1606         * icf.cc (get_section_contents): Correct formatting.
1607
1608 2011-06-27  Ian Lance Taylor  <iant@google.com>
1609
1610         * symtab.cc (Symbol::versioned_name): New function.
1611         (Symbol_table::add_to_final_symtab): Use versioned_name when
1612         appropriate.
1613         (Symbol_table::sized_write_symbol): Likewise.
1614         * symtab.h (class Symbol): Declare versioned_name.
1615         * stringpool.h (class Stringpool_template): Add variant of add
1616         which takes a std::basic_string.
1617         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1618         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1619         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1620         (ver_test_12.o): New target.
1621         * testsuite/Makefile.in: Rebuild.
1622
1623 2011-06-27  Doug Kwan  <dougkwan@google.com>
1624
1625         * arm.cc (Arm_relocate_functions::thm_jump8,
1626         Arm_relocate_functions::thm_jump11): Use a wider signed
1627         type to compute offset.
1628         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1629         arm_thm_jump8.
1630         * testsuite/Makefile.in: Regenerate.
1631         * testsuite/arm_branch_in_range.sh: Check test results of
1632         arm_thm_jump11 and arm_thm_jump8.
1633         * testsuite/arm_thm_jump11.s: New test source file.
1634         * testsuite/arm_thm_jump11.t: New linker script.
1635         * testsuite/arm_thm_jump8.s: New test source file.
1636         * testsuite/arm_thm_jump8.t: New linker script.
1637
1638 2011-06-24  Ian Lance Taylor  <iant@google.com>
1639
1640         * layout.cc: Include "object.h".
1641         (ctors_sections_in_init_array): New static variable.
1642         (Layout::is_ctors_in_init_array): New function.
1643         (Layout::layout): Add entry to ctors_sections_in_init_array if
1644         appropriate.
1645         * layout.h (class Layout): Declare is_ctors_in_init_array.
1646         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1647         is_ctors_reverse_view is set.
1648         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1649         all callers.  Set is_ctors_reverse_view field of View_size.
1650         (Sized_relobj_file::reverse_words): New function.
1651         * object.h (Sized_relobj_file::View_size): Add
1652         is_ctors_reverse_view field.
1653         (class Sized_relobj_file): Update declarations.
1654         * testsuite/initpri3.c: New test.
1655         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1656         initpri3b.
1657         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1658         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1659         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1660         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1661         * testsuite/Makefile.in: Rebuild.
1662
1663 2011-06-24  Cary Coutant  <ccoutant@google.com>
1664
1665         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1666         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1667         (debug_msg_cdebug.err): New targets.
1668         * testsuite/Makefile.in: Regenerate.
1669         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1670         Fix checks for link with shared library.
1671
1672 2011-06-24  Doug Kwan  <dougkwan@google.com>
1673
1674         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1675         skip empty text sections.
1676         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1677
1678 2011-06-22  Ian Lance Taylor  <iant@google.com>
1679
1680         PR gold/12910
1681         * options.h (class General_options): Add --ctors-in-init-array.
1682         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1683         friends as SHT_PROGBITS for merging sections.
1684         (Layout::layout): Remove special handling of .init_array and
1685         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1686         and .dtors if ctors_in_init_array.
1687         (Layout::make_output_section): Force correct section types for
1688         .init_array and friends.  Don't sort if doing relocatable link,
1689         Don't sort .ctors and .dtors if ctors_in_init_array.
1690         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1691         (Layout::output_section_name): Add relobj parameter.  Change all
1692         callers.  Handle .ctors. and .dtors. in code rather than table.
1693         Handle .ctors and .dtors if ctors_in_init_array.
1694         (Layout::match_file_name): New function, moved from output.cc.
1695         * layout.h (class Layout): Update declarations.
1696         * output.cc: Include "layout.h".
1697         (Input_section_sort_entry::get_priority): New function.
1698         (Input_section_sort_entry::match_file_name): Just call
1699         Layout::match_file_name.
1700         (Output_section::Input_section_sort_init_fini_compare::operator()):
1701         Handle .ctors and .dtors.  Sort by explicit priority rather than
1702         by name.
1703         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1704         * testsuite/initpri2.c: New test.
1705         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1706         (check_PROGRAMS): Add initpri2.
1707         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1708         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1709         * configure, testsuite/Makefile.in: Rebuild.
1710
1711 2011-06-19  Ian Lance Taylor  <iant@google.com>
1712
1713         PR gold/12880
1714         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1715         .interp section to a PT_INTERP segment even if we have seen a
1716         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1717         clause in a linker script.
1718         (Layout::finalize): Don't create a .interp section if we've
1719         already create a PT_INTERP segment.
1720         (Layout::create_interp): Always call choose_output_section (revert
1721         patch of 2011-06-17).  Don't create PT_INTERP segment.
1722         * script-sections.cc
1723         (Script_sections::create_note_and_tls_segments): Add a .interp
1724         section to a PT_INTERP segment even if we have seen a
1725         --dynamic-linker option.
1726
1727 2011-06-18  Ian Lance Taylor  <iant@google.com>
1728
1729         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1730         merely because a non-PT_LOAD segment has a dynamic reloc.
1731
1732 2011-06-18  Ian Lance Taylor  <iant@google.com>
1733
1734         * layout.cc (Layout::finish_dynamic_section): Don't create
1735         DT_FLAGS entry if not needed.
1736
1737 2011-06-18  Ian Lance Taylor  <iant@google.com>
1738
1739         PR gold/12745
1740         * layout.cc (Layout::layout_eh_frame): Correct handling of
1741         writable .eh_frame section.
1742
1743 2011-06-17  Ian Lance Taylor  <iant@google.com>
1744
1745         PR gold/12893
1746         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1747         symbol is redefined with the exact same object and value.
1748
1749 2011-06-17  Ian Lance Taylor  <iant@google.com>
1750
1751         PR gold/12880
1752         * layout.h (class Layout): Add interp_segment_ field.
1753         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1754         (Layout::attach_allocated_section_to_segment): If making shared
1755         library, put .interp section in PT_INTERP segment.
1756         (Layout::finalize): Also call create_interp if -dynamic-linker
1757         option was used.
1758         (Layout::create_interp): Assert that there is no PT_INTERP
1759         segment.  If not using a SECTIONS clause, use make_output_section.
1760         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1761         * script-sections.cc
1762         (Script_sections::create_note_and_tls_segments): If making shared
1763         library, put .interp section in PT_INTERP segment.
1764
1765 2011-06-17  Ian Lance Taylor  <iant@google.com>
1766
1767         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1768         when making a shared library.
1769
1770 2011-06-17  Ian Lance Taylor  <iant@google.com>
1771
1772         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1773         parameter.  Change all callers.  Don't issue warning about PC32
1774         against locally defined symbol.
1775
1776 2011-06-16  Ian Lance Taylor  <iant@google.com>
1777
1778         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1779         occurs in same object.
1780
1781 2011-06-14  Alan Modra  <amodra@gmail.com>
1782
1783         * po/POTFILES.in: Regenerate.
1784
1785 2011-06-09  Ian Lance Taylor  <iant@google.com>
1786
1787         * script-sections.cc
1788         (Orphan_output_section::set_section_addresses): For a relocatable
1789         link set address to 0.
1790
1791 2011-06-09  Cary Coutant  <ccoutant@google.com>
1792
1793         PR gold/12804
1794         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1795         used with --compress-debug-sections.
1796         * gold/object.cc (Sized_relobj_file::do_layout): Report
1797         uncompressed size of compressed input sections.
1798
1799 2011-06-08  Cary Coutant  <ccoutant@google.com>
1800
1801         PR gold/12804
1802         * testsuite/two_file_test_2_v1.cc: Change initialization of
1803         v2 to keep it in .data.
1804
1805 2011-06-07  Cary Coutant  <ccoutant@google.com>
1806
1807         * common.cc (Symbol_table::do_allocate_commons_list): Call
1808         gold_fallback.
1809         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1810         (Errors::fallback): New function.
1811         (gold_fallback): New function.
1812         * errors.h (Errors::fallback): New function.
1813         * gold.cc (gold_exit): Change status parameter to enum; adjust
1814         all callers.
1815         (queue_initial_tasks): Call gold_fallback.
1816         * gold.h: Include cstdlib.
1817         (Exit_status): New enum type.
1818         (gold_exit): Change status parameter to enum.
1819         (gold_fallback): New function.
1820         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1821         (Layout::create_symtab_sections): Likewise.
1822         (Layout::create_shdrs): Likewise.
1823         * main.cc (main): Adjust call to gold_exit.
1824         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1825         (Output_data_got::add_got_entry_pair): Likewise.
1826         (Output_section::add_input_section): Likewise.
1827         (Output_section::add_output_section_data): Likewise.
1828         (Output_segment::set_section_list_addresses): Likewise.
1829         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1830
1831 2011-06-07  Cary Coutant  <ccoutant@google.com>
1832
1833         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1834         for incremental links.
1835         * output.cc (Output_segment::set_section_list_addresses): Remove
1836         FIXME and test for TLS or BSS.
1837
1838 2011-06-07  Cary Coutant  <ccoutant@google.com>
1839
1840         * testsuite/Makefile.am: Add incremental_copy_test,
1841         incremental_common_test_1.
1842         * testsuite/Makefile.in: Regenerate.
1843         * testsuite/common_test_1_v1.c: New source file.
1844         * testsuite/common_test_1_v2.c: New source file.
1845         * testsuite/copy_test_v1.cc: New source file.
1846
1847 2011-06-07  Cary Coutant  <ccoutant@google.com>
1848
1849         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1850         update, allocate common from bss section's free list.
1851         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1852         linker-defined symbols.
1853         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1854         Skip GOT and PLT entries that are no longer referenced.
1855         (Output_section_incremental_inputs::write_info_blocks): Mark
1856         linker-defined symbols.
1857         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1858         * output.cc (Output_section::allocate): New function.
1859         * output.h (Output_section::allocate): New function.
1860         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1861         linker-defined symbols.
1862         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1863         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1864         (Symbol::init_base_output_data): Likewise.
1865         (Symbol::init_base_output_segment): Likewise.
1866         (Symbol::init_base_constant): Likewise.
1867         (Sized_symbol::init_output_data): Likewise.
1868         (Sized_symbol::init_output_segment): Likewise.
1869         (Sized_symbol::init_constant): Likewise.
1870         (Symbol_table::do_define_in_output_data): Likewise.
1871         (Symbol_table::do_define_in_output_segment): Likewise.
1872         (Symbol_table::do_define_as_constant): Likewise.
1873         * symtab.h (Symbol::is_predefined): New function.
1874         (Symbol::init_base_output_data): Add is_predefined parameter.
1875         (Symbol::init_base_output_segment): Likewise.
1876         (Symbol::init_base_constant): Likewise.
1877         (Symbol::is_predefined_): New data member.
1878         (Sized_symbol::init_output_data): Add is_predefined parameter.
1879         (Sized_symbol::init_output_segment): Likewise.
1880         (Sized_symbol::init_constant): Likewise.
1881         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1882
1883 2011-06-07  Cary Coutant  <ccoutant@google.com>
1884
1885         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1886         instead of emit_copy_reloc.
1887         (Copy_relocs::emit_copy_reloc): Refactor.
1888         (Copy_relocs::make_copy_reloc): New function.
1889         (Copy_relocs::add_copy_reloc): Remove.
1890         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1891         section.
1892         (Copy_relocs::make_copy_reloc): New function.
1893         (Copy_relocs::add_copy_reloc): Remove.
1894         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1895         unchanged input files.
1896         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1897         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1898         Reserve BSS space for COPY relocations.
1899         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1900         (Output_section_incremental_inputs::write_info_blocks): Record
1901         whether a symbol is copied from a shared object.
1902         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1903         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1904         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1905         (Incremental_input_entry_reader::get_output_symbol_index): Add
1906         is_copy parameter.
1907         (Incremental_binary::emit_copy_relocs): New function.
1908         (Incremental_binary::do_emit_copy_relocs): New function.
1909         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1910         new data member.
1911         (Sized_incremental_binary::add_copy_reloc): New function.
1912         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1913         (Sized_incremental_binary::Copy_reloc): New struct.
1914         (Sized_incremental_binary::Copy_relocs): New typedef.
1915         (Sized_incremental_binary::copy_relocs_): New data member.
1916         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1917         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1918         * target.h (Sized_target::emit_copy_reloc): New function.
1919         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1920
1921 2011-06-02  Cary Coutant  <ccoutant@google.com>
1922
1923         PR gold/12163
1924         * gold/archive.cc (Archive::Archive): Initialize new data member.
1925         (Archive::include_all_members): Return if archive has already been
1926         included.
1927         * gold/archive.h (Archive::include_all_members_): New data member.
1928
1929 2011-06-02  Nick Clifton  <nickc@redhat.com>
1930
1931         * dynobj.h: Fix spelling mistake in comment.
1932         * output.cc: Likewise.
1933
1934 2011-05-31  Doug Kwan  <dougkwan@google.com>
1935             Asier Llano
1936
1937         PR gold/12826
1938         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1939         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1940         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1941         redundant arm_exidx_test.so.
1942         * testsuite/Makefile.in: Regenerate.
1943         (check_SCRIPTS): Add pr12826.sh
1944         (check_DATA): Add pr12826.stdout
1945         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1946         * testsuite/pr12826.sh: New file.
1947         * testsuite/pr12826_1.s: Ditto.
1948         * testsuite/pr12826_1.s: Ditto.
1949
1950 2011-05-30  Ian Lance Taylor  <iant@google.com>
1951
1952         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1953         sections.
1954
1955 2011-05-29  Ian Lance Taylor  <iant@google.com>
1956
1957         PR gold/12804
1958         * testsuite/Makefile.am: Use different file name for two_file_test
1959         temporary file for each incremental test.
1960         * testsuite/Makefile.in: Rebuild.
1961
1962 2011-05-29  Ian Lance Taylor  <iant@google.com>
1963
1964         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1965         binary input file is empty.
1966
1967 2011-05-27  Ian Lance Taylor  <iant@google.com>
1968
1969         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1970         (ver_test_9.so): Likewise.
1971         * testsuite/Makefile.in: Rebuild.
1972
1973 2011-05-26 Cary Coutant  <ccoutant@google.com>
1974
1975         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1976         * incremental.cc (Incremental_inputs::report_input_section): Fix
1977         comment, indentation.
1978         (Incremental_inputs::report_comdat_group): New function.
1979         (Output_section_incremental_inputs::set_final_data_size): Adjust size
1980         of data for incremental input file entry.
1981         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1982         group count, COMDAT group signatures.
1983         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1984         an unchanged input file.
1985         * incremental.h (Incremental_object_entry::Incremental_object_entry):
1986         Initialize new data member.
1987         (Incremental_object_entry::add_comdat_group): New function.
1988         (Incremental_object_entry::get_comdat_group_count): New function.
1989         (Incremental_object_entry::get_comdat_signature_key): New function.
1990         (Incremental_object_entry::groups_): New data member.
1991         (Incremental_inputs::report_comdat_group): New function.
1992         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1993         data for incremental input file entry.
1994         (Incremental_input_entry_reader::get_comdat_group_count): New function.
1995         (Incremental_input_entry_reader::get_input_section): Adjust size of
1996         data for incremental input file entry.
1997         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1998         (Incremental_input_entry_reader::get_comdat_group_signature): New
1999         function.
2000         * object.cc (Sized_relobj::include_section_group): Report kept
2001         COMDAT groups for incremental links.
2002
2003 2011-05-24  David Meyer  <pdox@google.com>
2004
2005         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2006         with name parameter.  Add found_name parameter.
2007         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2008         * dirsearch.h (class Dirsearch): Update declaration.
2009
2010 2011-05-24  Ian Lance Taylor  <iant@google.com>
2011
2012         * archive.cc (Library_base::should_include_member): Pull in object
2013         from archive if it defines the entry symbol.
2014         * parameters.cc (Parameters::entry): New function.
2015         * parameters.h (class Parameters): Declare entry.
2016         * output.h (class Output_file_header): Remove entry_ field.
2017         * output.cc (Output_file_header::Output_file_header): Remove entry
2018         parameter.  Change all callers.
2019         (Output_file_header::entry): Use parameters->entry.
2020         * gold.cc (queue_middle_tasks): Likewise.
2021         * plugin.cc (Plugin_hook::run): Likewise.
2022
2023 2011-05-24 Cary Coutant  <ccoutant@google.com>
2024
2025         * gold.cc (queue_initial_tasks): Pass incremental base filename
2026         to Output_file::open_base_file; don't print error message.
2027         * incremental-dump.cc (main): Adjust call to
2028         Output_file::open_for_modification.
2029         * incremental-dump.cc (main): Likewise.
2030         * incremental.cc (Incremental_inputs::report_command_line):
2031         Ignore --incremental-base option when comparing command lines.
2032         Ignore parameter when given as separate argument.
2033         * options.h (class General_options): Add --incremental-base.
2034         * output.cc (Output_file::Output_file):
2035         (Output_file::open_base_file): Add base_name and writable parameters;
2036         read base file into new file; print error message here.
2037         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2038         callers.
2039         * output.h (Output_file::open_for_modification): Rename to...
2040         (Output_file::open_base_file): ...this; add base_name and
2041         writable parameters; adjust all callers.
2042         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2043         callers.
2044         * testsuite/Makefile.am (incremental_test_4): Test
2045         --incremental-base.
2046         * testsuite/Makefile.in: Regenerate.
2047
2048 2011-05-24 Cary Coutant  <ccoutant@google.com>
2049
2050         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2051         incremental_test_4.
2052         * testsuite/Makefile.in: Regenerate.
2053         * testsuite/two_file_test_1_v1.cc: New test source file.
2054         * testsuite/two_file_test_1b_v1.cc: New test source file.
2055         * testsuite/two_file_test_2_v1.cc: New test source file.
2056
2057 2011-05-24 Cary Coutant  <ccoutant@google.com>
2058
2059         * dynobj.h (Dynobj::do_dynobj): New function.
2060         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2061         flag and soname for shared objects.
2062         * incremental.cc (Incremental_inputs::report_object): Make
2063         either Incremental_object_entry or Incremental_dynobj_entry; add
2064         soname to string table.
2065         (Incremental_inputs::report_input_section): Add assertion.
2066         (Output_section_incremental_inputs::set_final_data_size): Adjust
2067         type of input file entry for shared libraries; adjust size of
2068         shared library info entry.
2069         (Output_section_incremental_inputs::write_input_files): Write
2070         as_needed flag for shared libraries.
2071         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2072         of input file entry for shared libraries; write soname.
2073         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2074         soname from incremental info.
2075         * incremental.h (enum Incremental_input_flags): Add
2076         INCREMENTAL_INPUT_AS_NEEDED.
2077         (Incremental_input_entry::Incremental_input_entry): Initialize new
2078         data member.
2079         (Incremental_input_entry::set_as_needed): New function.
2080         (Incremental_input_entry::as_needed): New function.
2081         (Incremental_input_entry::do_dynobj_entry): New function.
2082         (Incremental_input_entry::as_needed_): New data member.
2083         (Incremental_object_entry::Incremental_object_entry): Don't check
2084         for shared library.
2085         (Incremental_object_entry::do_type): Likewise.
2086         (class Incremental_dynobj_entry): New class.
2087         (Incremental_input_entry_reader::as_needed): New function.
2088         (Incremental_input_entry_reader::get_soname): New function.
2089         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2090         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2091         size of shared library info entry.
2092         * layout.cc (Layout::finish_dynamic_section): Don't test for
2093         incremental link when adding DT_NEEDED entries.
2094         * object.h (Object::Object): Initialize new data member.
2095         (Object::dynobj): New function.
2096         (Object::set_as_needed): New function.
2097         (Object::as_needed): New function.
2098         (Object::do_dynobj): New function.
2099         (Object::as_needed_): New data member.
2100
2101 2011-05-24 Cary Coutant  <ccoutant@google.com>
2102
2103         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2104         info; adjust display of GOT entries.
2105         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2106         vector of input objects; remove file_status_.
2107         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2108         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2109         got_plt reader; call target hooks to reserve GOT entries.
2110         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2111         of input file info header and GOT info entry.
2112         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2113         relocation info.
2114         (Got_plt_view_info::got_descriptor): Remove.
2115         (Got_plt_view_info::sym_index): New data member.
2116         (Got_plt_view_info::input_index): New data member.
2117         (Local_got_offset_visitor::visit): Write input file index.
2118         (Global_got_offset_visitor::visit): Write 0 for input file index.
2119         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2120         with sym_index and input_index.
2121         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2122         incremental info GOT entry; replace got_descriptor with input_index.
2123         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2124         map from input file index to object.
2125         (Sized_relobj_incr::do_layout): Replace direct data member reference
2126         with accessor function.
2127         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2128         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2129         Adjust size of input file info header.
2130         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2131         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2132         (Incremental_input_entry_reader::get_input_section): Adjust size of
2133         input file info header.
2134         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2135         of incremental info GOT entry.
2136         (Incremental_got_plt_reader::get_got_desc): Remove.
2137         (Incremental_got_plt_reader::get_got_symndx): New function.
2138         (Incremental_got_plt_reader::get_got_input_index): New function.
2139         (Sized_incremental_binary::Sized_incremental_binary): Remove
2140         file_status_; add input_objects_.
2141         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2142         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2143         (Sized_incremental_binary::file_is_unchanged): Remove.
2144         (Sized_incremental_binary::set_input_object): New function.
2145         (Sized_incremental_binary::input_object): New function.
2146         (Sized_incremental_binary::file_status_): Remove.
2147         (Sized_incremental_binary::input_objects_): New data member.
2148         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2149         references.
2150         (Sized_relobj_incr::invalid_address): Move to base class.
2151         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2152         class.
2153         (Sized_relobj_incr::do_output_section_offset): Likewise.
2154         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2155         (Sized_relobj_incr::section_offsets_): Likewise.
2156         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2157         function.
2158         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2159         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2160         with accessor function.
2161         (Sized_relobj_file::do_layout): Likewise.
2162         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2163         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2164         (Sized_relobj_file::compute_final_local_value): Replace refs to
2165         section_offsets_ with accessor function.
2166         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2167         * object.h (Relobj::Relobj): Initialize new data members.
2168         (Relobj::add_dyn_reloc): New function.
2169         (Relobj::first_dyn_reloc): New function.
2170         (Relobj::dyn_reloc_count): New function.
2171         (Relobj::first_dyn_reloc_): New data member.
2172         (Relobj::dyn_reloc_count_): New data member.
2173         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2174         references.
2175         (Sized_relobj::Address): New typedef.
2176         (Sized_relobj::invalid_address): Move here from child class.
2177         (Sized_relobj::Sized_relobj): Initialize new data members.
2178         (Sized_relobj::sized_relobj): New function.
2179         (Sized_relobj::is_output_section_offset_invalid): Move here from
2180         child class.
2181         (Sized_relobj::get_output_section_offset): Likewise.
2182         (Sized_relobj::local_has_got_offset): Likewise.
2183         (Sized_relobj::local_got_offset): Likewise.
2184         (Sized_relobj::set_local_got_offset): Likewise.
2185         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2186         (Sized_relobj::clear_got_offsets): New function.
2187         (Sized_relobj::section_offsets): Move here from child class.
2188         (Sized_relobj::do_output_section_offset): Likewise.
2189         (Sized_relobj::do_set_section_offset): Likewise.
2190         (Sized_relobj::Local_got_offsets): Likewise.
2191         (Sized_relobj::local_got_offsets_): Likewise.
2192         (Sized_relobj::section_offsets_): Likewise.
2193         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2194         references.
2195         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2196         class.
2197         (Sized_relobj_file::sized_relobj): New function
2198         (Sized_relobj_file::local_has_got_offset): Move to base class.
2199         (Sized_relobj_file::local_got_offset): Likewise.
2200         (Sized_relobj_file::set_local_got_offset): Likewise.
2201         (Sized_relobj_file::get_output_section_offset): Likewise.
2202         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2203         (Sized_relobj_file::do_output_section_offset): Likewise.
2204         (Sized_relobj_file::do_set_section_offset): Likewise.
2205         (Sized_relobj_file::Local_got_offsets): Likewise.
2206         (Sized_relobj_file::local_got_offsets_): Likewise.
2207         (Sized_relobj_file::section_offsets_): Likewise.
2208         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2209         (all constructors).
2210         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2211         (Output_reloc::get_symbol_index): Likewise.
2212         (Output_reloc::local_section_offset): Likewise.
2213         (Output_reloc::get_address): Likewise.
2214         (Output_reloc::symbol_value): Likewise.
2215         (Output_data_got::reserve_slot): Move to class definition.
2216         (Output_data_got::reserve_local): New function.
2217         (Output_data_got::reserve_slot_for_global): Remove.
2218         (Output_data_got::reserve_global): New function.
2219         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2220         (all constructors, two instantiations).
2221         (Output_reloc::get_relobj): New function (two instantiations).
2222         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2223         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2224         (Output_data_reloc::add_global): Adjust type of relobj.
2225         (Output_data_reloc::add_global_relative): Likewise.
2226         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2227         (Output_data_reloc::add_local): Likewise.
2228         (Output_data_reloc::add_local_relative): Likewise.
2229         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2230         (Output_data_reloc::add_local_section): Likewise.
2231         (Output_data_reloc::add_output_section): Likewise.
2232         (Output_data_reloc::add_absolute): Likewise.
2233         (Output_data_reloc::add_target_specific): Likewise.
2234         (Output_data_got::reserve_slot): Move definition here.
2235         (Output_data_got::reserve_local): New function.
2236         (Output_data_got::reserve_global): New function.
2237         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2238         section_offsets_ with accessor function.
2239         (Sized_relobj_file::write_sections): Likewise.
2240         (Sized_relobj_file::do_relocate_sections): Likewise.
2241         * target.h (Sized_target::reserve_local_got_entry): New function.
2242         (Sized_target::reserve_global_got_entry): New function.
2243         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2244         (Target_x86_64::reserve_global_got_entry): New function.
2245         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2246
2247 2011-05-23 Cary Coutant  <ccoutant@google.com>
2248
2249         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2250         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2251         bit when checking got_type.
2252         * incremental.cc (Sized_incremental_binary::setup_readers):
2253         Store symbol table and string table locations; initialize bit vector
2254         of file status flags.
2255         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2256         unchanged files.
2257         (Sized_incremental_binary::do_process_got_plt): New function.
2258         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2259         (Output_section_incremental_inputs::set_final_data_size): Record
2260         file index for each input file.
2261         (Output_section_incremental_inputs::write_got_plt): Store file index
2262         instead of input entry offset for each GOT entry.
2263         * incremental.h
2264         (Incremental_input_entry::Incremental_input_entry): Initialize new
2265         data member.
2266         (Incremental_input_entry::set_offset): Store file index.
2267         (Incremental_input_entry::get_file_index): New function.
2268         (Incremental_input_entry::file_index_): New data member.
2269         (Incremental_binary::process_got_plt): New function.
2270         (Incremental_binary::do_process_got_plt): New function.
2271         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2272         data members.
2273         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2274         (Sized_incremental_binary::set_file_is_unchanged): New function.
2275         (Sized_incremental_binary::file_is_unchanged): New function.
2276         (Sized_incremental_binary::do_process_got_plt): New function.
2277         (Sized_incremental_binary::file_status_): New data member.
2278         (Sized_incremental_binary::main_symtab_loc_): New data member.
2279         (Sized_incremental_binary::main_strtab_loc_): New data member.
2280         * output.cc (Output_data_got::Got_entry::write): Add case
2281         RESERVED_CODE.
2282         (Output_data_got::add_global): Call add_got_entry.
2283         (Output_data_got::add_global_plt): Likewise.
2284         (Output_data_got::add_global_with_rel): Likewise.
2285         (Output_data_got::add_global_with_rela): Likewise.
2286         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2287         (Output_data_got::add_global_pair_with_rela): Likewise.
2288         (Output_data_got::add_local): Call add_got_entry.
2289         (Output_data_got::add_local_plt): Likewise.
2290         (Output_data_got::add_local_with_rel): Likewise.
2291         (Output_data_got::add_local_with_rela): Likewise.
2292         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2293         (Output_data_got::add_local_pair_with_rela): Likewise.
2294         (Output_data_got::reserve_slot): New function.
2295         (Output_data_got::reserve_slot_for_global): New function.
2296         (Output_data_got::add_got_entry): New function.
2297         (Output_data_got::add_got_entry_pair): New function.
2298         (Output_section::add_output_section_data): Edit FIXME.
2299         * output.h
2300         (Output_section_data_build::Output_section_data_build): New
2301         constructor with size parameter.
2302         (Output_data_space::Output_data_space): Likewise.
2303         (Output_data_got::Output_data_got): Initialize new data member; new
2304         constructor with size parameter.
2305         (Output_data_got::add_constant): Call add_got_entry.
2306         (Output_data_got::reserve_slot): New function.
2307         (Output_data_got::reserve_slot_for_global): New function.
2308         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2309         (Output_data_got::add_got_entry): New function.
2310         (Output_data_got::add_got_entry_pair): New function.
2311         (Output_data_got::free_list_): New data member.
2312         * target.h (Sized_target::init_got_plt_for_update): New function.
2313         (Sized_target::register_global_plt_entry): New function.
2314         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2315         Initialize new data member; call init; add constructor with PLT count.
2316         (Output_data_plt_x86_64::init): New function.
2317         (Output_data_plt_x86_64::add_relocation): New function.
2318         (Output_data_plt_x86_64::reserve_slot): New function.
2319         (Output_data_plt_x86_64::free_list_): New data member.
2320         (Target_x86_64::init_got_plt_for_update): New function.
2321         (Target_x86_64::register_global_plt_entry): New function.
2322         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2323         incremental updates.
2324         (Output_data_plt_x86_64::add_relocation): New function.
2325         * testsuite/object_unittest.cc (Object_test): Set default options.
2326
2327 2011-05-16  Ian Lance Taylor  <iant@google.com>
2328
2329         * options.h (class General_options): Make -i a synonym for -r.
2330
2331 2011-05-16  Ian Lance Taylor  <iant@google.com>
2332
2333         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2334
2335 2011-05-10 Cary Coutant  <ccoutant@google.com>
2336
2337         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2338         strip_all (-s).
2339
2340 2011-05-06  Ian Lance Taylor  <iant@google.com>
2341
2342         * layout.cc (Layout::layout): If the output section flags change,
2343         update the ordering.
2344
2345 2011-04-25 Cary Coutant  <ccoutant@google.com>
2346
2347         * incremental-dump.cc (dump_incremental_inputs): Print local
2348         symbol info for each input file.
2349         * incremental.cc
2350         (Output_section_incremental_inputs::set_final_data_size): Add local
2351         symbol info to input file entries in incremental info.
2352         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2353         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2354         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2355         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2356         implementation.
2357         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2358         (Sized_incr_relobj::do_relocate): Write the local symbols.
2359         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2360         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2361         Adjust size of input file header.
2362         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2363         (Incremental_inputs_reader::get_local_symbol_count): New function.
2364         (Incremental_inputs_reader::get_input_section): Adjust size of input
2365         file header.
2366         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2367         (Sized_incr_relobj::This): New typedef.
2368         (Sized_incr_relobj::sym_size): New const data member.
2369         (Sized_incr_relobj::Local_symbol): New struct.
2370         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2371         (Sized_incr_relobj::do_local_symbol_offset): New function.
2372         (Sized_incr_relobj::local_symbol_count_): New data member.
2373         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2374         (Sized_incr_relobj::local_symbol_index_): New data member.
2375         (Sized_incr_relobj::local_symbol_offset_): New data member.
2376         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2377         (Sized_incr_relobj::local_symbols_): New data member.
2378         * object.h (Relobj::output_local_symbol_count): New function.
2379         (Relobj::local_symbol_offset): New function.
2380         (Relobj::do_output_local_symbol_count): New function.
2381         (Relobj::do_local_symbol_offset): New function.
2382         (Sized_relobj::do_output_local_symbol_count): New function.
2383         (Sized_relobj::do_local_symbol_offset): New function.
2384
2385 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2386
2387         * descriptors.cc (set_close_on_exec): New function.
2388         (Descriptors::open): Use set_close_on_exec.
2389         * output.cc (S_ISLNK): Define if not defined.
2390
2391 2011-04-22 Cary Coutant  <ccoutant@google.com>
2392
2393         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2394         global symbol map.
2395         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2396         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2397         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2398         relocations.
2399         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2400         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2401         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2402         * incremental.h
2403         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2404         function.
2405         (Incremental_binary::apply_incremental_relocs): New function.
2406         (Incremental_binary::do_apply_incremental_relocs): New function.
2407         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2408         data member.
2409         (Sized_incremental_binary::add_global_symbol): New function.
2410         (Sized_incremental_binary::global_symbol): New function.
2411         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2412         (Sized_incremental_binary::symbol_map_): New data member.
2413         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2414         * target.h (Sized_target::apply_relocation): New function.
2415         * target-reloc.h (apply_relocation): New function.
2416         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2417
2418 2011-04-22  Doug Kwan  <dougkwan@google.com>
2419
2420         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2421         flag of a SHT_ARM_EXIDX section.
2422         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2423         * testsuite/Makefile.in: Regenerate.
2424         * testsuite/arm_exidx_test.s: New file.
2425         * testsuite/arm_exidx_test.sh: Same.
2426
2427 2011-04-20 Cary Coutant  <ccoutant@google.com>
2428
2429         PR gold/12689
2430         * archive.h (Incremental_archive_entry::Archive_member):
2431         Initialize arg_serial_ (second constructor).
2432
2433 2011-04-17  Ian Lance Taylor  <iant@google.com>
2434
2435         * object.cc (Relocate_info::location): Simplify location string.
2436         * errors.cc (Errors::error_at_location): Don't print program
2437         name.
2438         (Errors::warning_at_location): Likewise.
2439         (Errors::undefined_symbol): Likewise.
2440         * testsuite/debug_msg.sh: Update accordingly.
2441
2442 2011-04-14 Cary Coutant  <ccoutant@google.com>
2443
2444         * gold/layout.cc (Layout::symtab_section_offset): New function.
2445         * gold/layout.h (Layout::symtab_section_offset): New function.
2446         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2447
2448 2011-04-12  Ian Lance Taylor  <iant@google.com>
2449
2450         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2451         with MREMAP_MAYMOVE.
2452         * output.h (class Output_file): Add map_is_allocated_ field.
2453         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2454         not available, provide stubs.  If mremap is not available, #define
2455         it to gold_mremap.
2456         (MREMAP_MAYMOVE): Define if not defined.
2457         (Output_file::Output_file): Initialize map_is_allocated_.
2458         (Output_file::resize): Check map_is_allocated_.
2459         (Output_file::map_anonymous): If mmap fails, use malloc.
2460         (Output_file::unmap): Don't do anything for an anonymous map.
2461         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2462         is not available, provide stubs.
2463         (File_read::View::~View): Use free rather than delete[].
2464         (File_read::make_view): Use malloc rather than new[].  If mmap
2465         fails, use malloc.
2466         (File_read::find_or_make_view): Use malloc rather than new[].
2467         * gold.h: Remove HAVE_REMAP code.
2468         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2469         exists.  Rename mremap to gold_mremap.  If mmap is not available
2470         don't do anything.
2471         * configure, config.in: Rebuild.
2472
2473 2011-04-11  Ian Lance Taylor  <iant@google.com>
2474
2475         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2476         initialize local variable v.
2477
2478 2011-04-11  Cary Coutant  <ccoutant@google.com>
2479
2480         * archive.cc (Archive::include_member): Adjust call to
2481         report_object.
2482         (Add_archive_symbols::run): Track argument serial numbers.
2483         (Lib_group::include_member): Likewise.
2484         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2485         * archive.h (Incremental_archive_entry::Archive_member):
2486         Initialize arg_serial_.
2487         (Archive_member::arg_serial_): New data member.
2488         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2489         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2490         incremental link.
2491         (Sized_dynobj::do_for_all_local_got_entries): New function.
2492         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2493         function.
2494         * fileread.cc (get_mtime): New function.
2495         * fileread.h (get_mtime): New function.
2496         * gold.cc (queue_initial_tasks): Check for incremental update.
2497         (process_incremental_input): New function.
2498         (queue_middle_tasks): Don't force valid target for incremental
2499         update.
2500         * incremental-dump.cc (find_input_containing_global): Adjust
2501         size of symbol info entry.
2502         (dump_incremental_inputs): Dump argument serial number and
2503         in_system_directory flag; bias shndx by 1; print symbol names
2504         when dumping per-file symbol lists; use new symbol info readers.
2505         * incremental.cc
2506         (Output_section_incremental_inputs:update_data_size): New function.
2507         (Sized_incremental_binary::setup_readers): Setup input readers
2508         for each input file; build maps for files added from libraries
2509         and scripts.
2510         (Sized_incremental_binary::check_input_args): New function.
2511         (Sized_incremental_binary::do_check_inputs): Build map of argument
2512         serial numbers to input arguments.
2513         (Sized_incremental_binary::do_file_has_changed): Rename
2514         do_file_is_unchanged to this; compare file modification times.
2515         (Sized_incremental_binary::do_init_layout): New function.
2516         (Sized_incremental_binary::do_reserve_layout): New function.
2517         (Sized_incremental_binary::do_get_input_reader): Remove.
2518         (Sized_incremental_binary::get_symtab_view): New function.
2519         (Incremental_checker::can_incrementally_link_output_file): Remove.
2520         (Incremental_inputs::report_command_line): Exclude --debug options.
2521         (Incremental_inputs::report_archive_begin): Add parameter; track
2522         argument serial numbers; don't put input file entry for archive
2523         before archive members.
2524         (Incremental_inputs::report_archive_end): Put input file entry
2525         for archive after archive members.
2526         (Incremental_inputs::report_object): Add parameter; track argument
2527         serial numbers and in_system_directory flag.
2528         (Incremental_inputs::report_script): Add parameter; track argument
2529         serial numbers.
2530         (Output_section_incremental_inputs::set_final_data_size): Adjust
2531         size of symbol info entry; check for forwarding symbols.
2532         (Output_section_incremental_inputs::write_input_files): Write
2533         in_system_directory flag and argument serial number.
2534         (Output_section_incremental_inputs::write_info_blocks): Map section
2535         indices between incremental info and original input file; store
2536         input section index for each symbol.
2537         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2538         change operator() to visit().
2539         (class Global_got_offset_visitor): Likewise.
2540         (class Global_symbol_visitor_got_plt):
2541         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2542         classes.
2543         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2544         (Sized_incr_relobj::do_read_symbols): New function.
2545         (Sized_incr_relobj::do_layout): New function.
2546         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2547         (Sized_incr_relobj::do_add_symbols): New function.
2548         (Sized_incr_relobj::do_should_include_member): New function.
2549         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2550         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2551         (Sized_incr_relobj::do_section_size): New function.
2552         (Sized_incr_relobj::do_section_name): New function.
2553         (Sized_incr_relobj::do_section_contents): New function.
2554         (Sized_incr_relobj::do_section_flags): New function.
2555         (Sized_incr_relobj::do_section_entsize): New function.
2556         (Sized_incr_relobj::do_section_address): New function.
2557         (Sized_incr_relobj::do_section_type): New function.
2558         (Sized_incr_relobj::do_section_link): New function.
2559         (Sized_incr_relobj::do_section_info): New function.
2560         (Sized_incr_relobj::do_section_addralign): New function.
2561         (Sized_incr_relobj::do_initialize_xindex): New function.
2562         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2563         (Sized_incr_relobj::do_read_relocs): New function.
2564         (Sized_incr_relobj::do_gc_process_relocs): New function.
2565         (Sized_incr_relobj::do_scan_relocs): New function.
2566         (Sized_incr_relobj::do_count_local_symbols): New function.
2567         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2568         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2569         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2570         (Sized_incr_relobj::do_relocate): New function.
2571         (Sized_incr_relobj::do_set_section_offset): New function.
2572         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2573         (Sized_incr_dynobj::do_read_symbols): New function.
2574         (Sized_incr_dynobj::do_layout): New function.
2575         (Sized_incr_dynobj::do_add_symbols): New function.
2576         (Sized_incr_dynobj::do_should_include_member): New function.
2577         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2578         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2579         (Sized_incr_dynobj::do_section_size): New function.
2580         (Sized_incr_dynobj::do_section_name): New function.
2581         (Sized_incr_dynobj::do_section_contents): New function.
2582         (Sized_incr_dynobj::do_section_flags): New function.
2583         (Sized_incr_dynobj::do_section_entsize): New function.
2584         (Sized_incr_dynobj::do_section_address): New function.
2585         (Sized_incr_dynobj::do_section_type): New function.
2586         (Sized_incr_dynobj::do_section_link): New function.
2587         (Sized_incr_dynobj::do_section_info): New function.
2588         (Sized_incr_dynobj::do_section_addralign): New function.
2589         (Sized_incr_dynobj::do_initialize_xindex): New function.
2590         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2591         (make_sized_incremental_object): New function.
2592         (Incremental_library::copy_unused_symbols): New function.
2593         (Incremental_library::do_for_all_unused_symbols): New function.
2594         * incremental.h (enum Incremental_input_flags): New type.
2595         (class Incremental_checker): Remove.
2596         (Incremental_input_entry::Incremental_input_entry): Add argument
2597         serial number.
2598         (Incremental_input_entry::arg_serial): New function.
2599         (Incremental_input_entry::set_is_in_system_directory): New function.
2600         (Incremental_input_entry::is_in_system_directory): New function.
2601         (Incremental_input_entry::arg_serial_): New data member.
2602         (Incremental_input_entry::is_in_system_directory_): New data member.
2603         (class Script_info): Move here from script.h.
2604         (Script_info::Script_info): Add filename parameter.
2605         (Script_info::filename): New function.
2606         (Script_info::filename_): New data member.
2607         (Incremental_script_entry::Incremental_script_entry): Add argument
2608         serial number.
2609         (Incremental_object_entry::Incremental_object_entry): Likewise.
2610         (Incremental_object_entry::add_input_section): Build list of input
2611         sections with map to original shndx.
2612         (Incremental_object_entry::get_input_section_index): New function.
2613         (Incremental_object_entry::shndx_): New data member.
2614         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2615         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2616         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2617         serial number.
2618         (Incremental_inputs::report_archive_begin): Likewise.
2619         (Incremental_inputs::report_object): Likewise.
2620         (Incremental_inputs::report_script): Likewise.
2621         (class Incremental_global_symbol_reader): New class.
2622         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2623         and store flags and input file type.
2624         (Incremental_input_entry_reader::arg_serial): New function.
2625         (Incremental_input_entry_reader::type): Extract type from flags.
2626         (Incremental_input_entry_reader::is_in_system_directory): New function.
2627         (Incremental_input_entry_reader::get_input_section_count): Call
2628         accessor function for type.
2629         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2630         function for type; adjust size of global symbol entry.
2631         (Incremental_input_entry_reader::get_global_symbol_count): Call
2632         accessor function for type.
2633         (Incremental_input_entry_reader::get_object_count): Likewise.
2634         (Incremental_input_entry_reader::get_object_offset): Likewise.
2635         (Incremental_input_entry_reader::get_member_count): Likewise.
2636         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2637         (Incremental_input_entry_reader::get_member_offset): Likewise.
2638         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2639         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2640         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2641         (Incremental_input_entry_reader::get_global_symbol_reader): New
2642         function.
2643         (Incremental_input_entry_reader::get_output_symbol_index): New
2644         function.
2645         (Incremental_input_entry_reader::type_): Remove.
2646         (Incremental_input_entry_reader::flags_): New data member.
2647         (Incremental_inputs_reader::input_file_offset): New function.
2648         (Incremental_inputs_reader::input_file_index): New function.
2649         (Incremental_inputs_reader::input_file): Call input_file_offset.
2650         (Incremental_inputs_reader::input_file_at_offset): New function.
2651         (Incremental_relocs_reader::get_r_type): Reformat.
2652         (Incremental_relocs_reader::get_r_shndx): Reformat.
2653         (Incremental_relocs_reader::get_r_offset): Reformat.
2654         (Incremental_relocs_reader::data): New function.
2655         (Incremental_binary::Incremental_binary): Initialize new data members.
2656         (Incremental_binary::check_inputs): Add cmdline parameter.
2657         (Incremental_binary::file_is_unchanged): Remove.
2658         (Input_reader::arg_serial): New function.
2659         (Input_reader::get_unused_symbol_count): New function.
2660         (Input_reader::get_unused_symbol): New function.
2661         (Input_reader::do_arg_serial): New function.
2662         (Input_reader::do_get_unused_symbol_count): New function.
2663         (Input_reader::do_get_unused_symbol): New function.
2664         (Incremental_binary::input_file_count): New function.
2665         (Incremental_binary::get_input_reader): Change signature to use
2666         index instead of filename.
2667         (Incremental_binary::file_has_changed): New function.
2668         (Incremental_binary::get_input_argument): New function.
2669         (Incremental_binary::get_library): New function.
2670         (Incremental_binary::get_script_info): New function.
2671         (Incremental_binary::init_layout): New function.
2672         (Incremental_binary::reserve_layout): New function.
2673         (Incremental_binary::output_file): New function.
2674         (Incremental_binary::do_check_inputs): New function.
2675         (Incremental_binary::do_file_is_unchanged): Remove.
2676         (Incremental_binary::do_file_has_changed): New function.
2677         (Incremental_binary::do_init_layout): New function.
2678         (Incremental_binary::do_reserve_layout): New function.
2679         (Incremental_binary::do_input_file_count): New function.
2680         (Incremental_binary::do_get_input_reader): Change signature.
2681         (Incremental_binary::input_args_map_): New data member.
2682         (Incremental_binary::library_map_): New data member.
2683         (Incremental_binary::script_map_): New data member.
2684         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2685         new data members.
2686         (Sized_incremental_binary::output_section): New function.
2687         (Sized_incremental_binary::inputs_reader): Add const.
2688         (Sized_incremental_binary::symtab_reader): Add const.
2689         (Sized_incremental_binary::relocs_reader): Add const.
2690         (Sized_incremental_binary::got_plt_reader): Add const.
2691         (Sized_incremental_binary::get_symtab_view): New function.
2692         (Sized_incremental_binary::Inputs_reader): New typedef.
2693         (Sized_incremental_binary::Input_entry_reader): New typedef.
2694         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2695         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2696         (Sized_incremental_binary::do_file_has_changed): New function.
2697         (Sized_incremental_binary::do_init_layout): New function.
2698         (Sized_incremental_binary::do_reserve_layout): New function.
2699         (Sized_input_reader::Inputs_reader): Remove.
2700         (Sized_input_reader::Input_entry_reader): Remove.
2701         (Sized_input_reader::do_arg_serial): New function.
2702         (Sized_input_reader::do_get_unused_symbol_count): New function.
2703         (Sized_input_reader::do_get_unused_symbol): New function.
2704         (Sized_incremental_binary::do_input_file_count): New function.
2705         (Sized_incremental_binary::do_get_input_reader): Change signature;
2706         use index instead of filename.
2707         (Sized_incremental_binary::section_map_): New data member.
2708         (Sized_incremental_binary::input_entry_readers_): New data member.
2709         (class Sized_incr_relobj): New class.
2710         (class Sized_incr_dynobj): New class.
2711         (make_sized_incremental_object): New function.
2712         (class Incremental_library): New class.
2713         * layout.cc (Free_list::num_lists): New static data member.
2714         (Free_list::num_nodes): New static data member.
2715         (Free_list::num_removes): New static data member.
2716         (Free_list::num_remove_visits): New static data member.
2717         (Free_list::num_allocates): New static data member.
2718         (Free_list::num_allocate_visits): New static data member.
2719         (Free_list::init): New function.
2720         (Free_list::remove): New function.
2721         (Free_list::allocate): New function.
2722         (Free_list::dump): New function.
2723         (Free_list::print_stats): New function.
2724         (Layout_task_runner::run): Resize output file for incremental updates.
2725         (Layout::Layout): Initialize new data members.
2726         (Layout::set_incremental_base): New function.
2727         (Layout::init_fixed_output_section): New function.
2728         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2729         incremental updates.
2730         (Layout::create_gold_note): Do not create gold note section for
2731         incremental updates.
2732         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2733         for incremental updates.
2734         (Layout::set_section_offsets): For incremental updates, allocate space
2735         from free list.
2736         (Layout::create_symtab_sections): Layout with offsets relative to
2737         start of section; for incremental updates, allocate space from free
2738         list.
2739         (Layout::create_shdrs): For incremental updates, allocate space from
2740         free list.
2741         (Layout::finish_dynamic_section): For incremental updates, do not
2742         check --as-needed (fixed in subsequent patch).
2743         * layout.h (class Free_list): New class.
2744         (Layout::set_incremental_base): New function.
2745         (Layout::incremental_base): New function.
2746         (Layout::init_fixed_output_section): New function.
2747         (Layout::allocate): New function.
2748         (Layout::incremental_base_): New data member.
2749         (Layout::free_list_): New data member.
2750         * main.cc (main): Print Free_list statistics.
2751         * object.cc (Relobj::finalize_incremental_relocs): Add
2752         clear_counts parameter; clear counts only when clear_counts is set.
2753         (Sized_relobj::Sized_relobj): Initialize new base class.
2754         (Sized_relobj::do_layout): Don't report special sections.
2755         (Sized_relobj::do_for_all_local_got_entries): New function.
2756         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2757         symtab_off to all symbol table offsets.
2758         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2759         * object.h (class Got_offset_list): Move to top of file.
2760         (Object::Object): Allow case where input_file == NULL.
2761         (Object::~Object): Likewise.
2762         (Object::input_file): Assert that input_file != NULL.
2763         (Object::lock): Allow case where input_file == NULL.
2764         (Object::unlock): Likewise.
2765         (Object::is_locked): Likewise.
2766         (Object::token): Likewise.
2767         (Object::release): Likewise.
2768         (Object::is_incremental): New function.
2769         (Object::get_mtime): New function.
2770         (Object::for_all_local_got_entries): New function.
2771         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2772         (Object::set_is_in_system_directory): New function.
2773         (Object::is_in_system_directory): New function.
2774         (Object::do_is_incremental): New function.
2775         (Object::do_get_mtime): New function.
2776         (Object::do_for_all_local_got_entries): New function.
2777         (Object::is_in_system_directory_): New data member.
2778         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2779         (class Sized_relobj_base): New class.
2780         (class Sized_relobj): Derive from Sized_relobj_base.
2781         (class Sized_relobj::Symbols): Redeclare from base class.
2782         (class Sized_relobj::local_got_offset_list): Remove.
2783         (class Sized_relobj::Output_sections): Redeclare from base class.
2784         (class Sized_relobj::do_for_all_local_got_entries): New function.
2785         (class Sized_relobj::write_local_symbols): Add offset parameter.
2786         (class Sized_relobj::local_symbol_offset_): Update comment.
2787         (class Sized_relobj::local_dynsym_offset_): Update comment.
2788         * options.cc (Input_arguments::add_file): Remove const.
2789         * options.h (Input_file_argument::Input_file_argument):
2790         Initialize arg_serial_ (all constructors).
2791         (Input_file_argument::set_arg_serial): New function.
2792         (Input_file_argument::arg_serial): New function.
2793         (Input_file_argument::arg_serial_): New data member.
2794         (Input_arguments::Input_arguments): Initialize file_count_.
2795         (Input_arguments::add_file): Remove const.
2796         (Input_arguments::number_of_input_files): New function.
2797         (Input_arguments::file_count_): New data member.
2798         (Command_line::number_of_input_files): Call
2799         Input_arguments::number_of_input_files.
2800         * output.cc (Output_segment_headers::Output_segment_headers):
2801         Set current size.
2802         (Output_section::Input_section::current_data_size): New function.
2803         (Output_section::Output_section): Initialize new data members.
2804         (Output_section::add_input_section): Don't do merge sections for
2805         an incremental link; allocate space from free list for an
2806         incremental update.
2807         (Output_section::add_output_section_data): Allocate space from
2808         free list for an incremental update.
2809         (Output_section::update_data_size): New function.
2810         (Output_section::set_fixed_layout): New function.
2811         (Output_section::reserve): New function.
2812         (Output_segment::set_section_addresses): Remove const.
2813         (Output_segment::set_section_list_addresses): Remove const; allocate
2814         space from free list for an incremental update.
2815         (Output_segment::set_offset): Adjust size of RELRO segment for an
2816         incremental update.
2817         * output.h (Output_data::current_data_size): Move here from
2818         child classes.
2819         (Output_data::pre_finalize_data_size): New function.
2820         (Output_data::update_data_size): New function.
2821         (Output_section_headers::update_data_size): new function.
2822         (Output_section_data_build::current_data_size): Move to Output_data.
2823         (Output_data_strtab::update_data_size): New function.
2824         (Output_section::current_data_size): Move to Output_data.
2825         (Output_section::set_fixed_layout): New function.
2826         (Output_section::has_fixed_layout): New function.
2827         (Output_section::reserve): New function.
2828         (Output_section::update_data_size): New function.
2829         (Output_section::has_fixed_layout_): New data member.
2830         (Output_section::free_list_): New data member.
2831         (Output_segment::set_section_addresses): Remove const.
2832         (Output_segment::set_section_list_addresses): Remove const.
2833         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2834         New function.
2835         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2836         New function.
2837         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2838         parameter when calling Add_symbols constructor; store argument
2839         serial number for members of a lib group.
2840         (Add_symbols::locks): Allow case where token == NULL.
2841         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2842         (Read_member::~Read_member): New function.
2843         (Read_member::is_runnable): New function.
2844         (Read_member::locks): New function.
2845         (Read_member::run): New function.
2846         (Check_script::~Check_script): New function.
2847         (Check_script::is_runnable): New function.
2848         (Check_script::locks): New function.
2849         (Check_script::run): New function.
2850         (Check_library::~Check_library): New function.
2851         (Check_library::is_runnable): New function.
2852         (Check_library::locks): New function.
2853         (Check_library::run): New function.
2854         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2855         (Add_symbols::library_): New data member.
2856         (class Read_member): New class.
2857         (class Check_script): New class.
2858         (class Check_library): New class.
2859         * reloc.cc (Read_relocs::is_runnable): Allow case where
2860         token == NULL.
2861         (Read_relocs::locks): Likewise.
2862         (Scan_relocs::locks): Likewise.
2863         (Relocate_task::locks): Likewise.
2864         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2865         to clear counters.
2866         (Sized_relobj::incremental_relocs_scan): Fix comment.
2867         (Sized_relobj::do_relocate): Pass output file offset to
2868         write_local_symbols.
2869         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2870         from class declaration.
2871         * script.cc (read_input_script): Allocate Script_info; pass
2872         argument serial number to report_script.
2873         * script.h (class Script_info): Move to incremental.h.
2874         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2875         * symtab.h (Symbol_table::add_from_incrobj): New function.
2876         (Symbol_table::set_file_offset): New function.
2877
2878 2011-04-05  Cary Coutant  <ccoutant@google.com>
2879
2880         * incremental-dump.cc (dump_incremental_inputs): Change signature
2881         to take a Sized_incremental_binary; change caller.  Use readers
2882         in Sized_incremental_binary.
2883         * incremental.cc
2884         (Sized_incremental_binary::find_incremental_inputs_sections):
2885         Rename do_find_incremental_inputs_sections to this.
2886         (Sized_incremental_binary::setup_readers): New function.
2887         (Sized_incremental_binary::do_check_inputs): Check
2888         has_incremental_info_ flag; move setup code to setup_readers;
2889         use input readers.
2890         (Sized_incremental_binary::do_file_is_unchanged): New function.
2891         (Sized_incremental_binary::do_get_input_reader): New function.
2892         * incremental.h (class Incremental_binary): Move to end of file.
2893         (Incremental_binary::file_is_unchanged): New function.
2894         (Incremental_binary::do_file_is_unchanged): New function.
2895         (Incremental_binary::Input_reader): New class.
2896         (Incremental_binary::get_input_reader): New function.
2897         (class Sized_incremental_binary): Move to end of file.
2898         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2899         input section reader classes.
2900         (Sized_incremental_binary::has_incremental_info): New function.
2901         (Sized_incremental_binary::inputs_reader): New function.
2902         (Sized_incremental_binary::symtab_reader): New function.
2903         (Sized_incremental_binary::relocs_reader): New function.
2904         (Sized_incremental_binary::got_plt_reader): New function.
2905         (Sized_incremental_binary::do_file_is_unchanged): New function.
2906         (Sized_incremental_binary::Sized_input_reader): New class.
2907         (Sized_incremental_binary::get_input_reader): New function.
2908         (Sized_incremental_binary::find_incremental_inputs_sections):
2909         Rename do_find_incremental_inputs_sections to this.
2910         (Sized_incremental_binary::setup_readers): New function.
2911         (Sized_incremental_binary::has_incremental_info_): New data member.
2912         (Sized_incremental_binary::inputs_reader_): New data member.
2913         (Sized_incremental_binary::symtab_reader_): New data member.
2914         (Sized_incremental_binary::relocs_reader_): New data member.
2915         (Sized_incremental_binary::got_plt_reader_): New data member.
2916         (Sized_incremental_binary::current_input_file_): New data member.
2917
2918 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2919
2920         PR gold/12640
2921         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2922         violation.
2923
2924 2011-03-30  Cary Coutant  <ccoutant@google.com>
2925
2926         * archive.cc (Archive::include_member): Adjust call to report_object.
2927         (Add_archive_symbols::run): Add script_info to call to
2928         report_archive_begin.
2929         (Lib_group::include_member): Adjust call to report_object.
2930         (Add_lib_group_symbols::run): Adjust call to report_object.
2931         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2932         blocks.  Add object count for script input files.
2933         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2934         script_info parameter; change all callers.
2935         (Incremental_inputs::report_object): Add script_info parameter;
2936         change all callers.
2937         (Incremental_inputs::report_script): Store backpointer to
2938         incremental info entry.
2939         (Output_section_incremental_inputs::set_final_data_size): Record
2940         additional information for scripts.
2941         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2942         * incremental.h (Incremental_script_entry::add_object): New function.
2943         (Incremental_script_entry::get_object_count): New function.
2944         (Incremental_script_entry::get_object): New function.
2945         (Incremental_script_entry::objects_): New data member; adjust
2946         constructor.
2947         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2948         (Incremental_inputs::report_object): Add script_info parameter.
2949         (Incremental_inputs_reader::get_object_count): New function.
2950         (Incremental_inputs_reader::get_object_offset): New function.
2951         * options.cc (Input_arguments::add_file): Return reference to
2952         new input argument.
2953         * options.h (Input_argument::set_script_info): New function.
2954         (Input_argument::script_info): New function.
2955         (Input_argument::script_info_): New data member; adjust all
2956         constructors.
2957         (Input_file_group::add_file): Return reference to new input argument.
2958         (Input_file_lib::add_file): Likewise.
2959         (Input_arguments::add_file): Likewise.
2960         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2961         * script.cc (Parser_closure::Parser_closure): Add script_info
2962         parameter; adjust all callers.
2963         (Parser_closure::script_info): New function.
2964         (Parser_closure::script_info_): New data member.
2965         (read_input_script): Report scripts earlier to incremental info.
2966         (script_add_file): Set script_info in Input_argument.
2967         (script_add_library): Likewise.
2968         * script.h (Script_options::Script_info): Rewrite class.
2969
2970 2011-03-29  Cary Coutant  <ccoutant@google.com>
2971
2972         * archive.cc (Library_base::should_include_member): Move
2973         method here from class Archive.
2974         (Archive::Archive): Initialize base class.
2975         (Archive::should_include_member): Move to base class.
2976         (Archive::do_for_all_unused_symbols): New function.
2977         (Add_archive_symbols::run): Remove redundant access to
2978         incremental_inputs.
2979         (Lib_group::Lib_group): Initialize base class.
2980         (Lib_group::do_filename): New function.
2981         (Lib_group::include_member): Pass pointer to Lib_group to
2982         report_object.
2983         (Lib_group::do_for_all_unused_symbols): New function.
2984         (Add_lib_group_symbols::run): Report archive information for
2985         incremental links.
2986         * archive.h (class Library_base): New base class.
2987         (class Archive): Derive from Library_base.
2988         (Archive::filename): Move to base class.
2989         (Archive::set_incremental_info): Likewise.
2990         (Archive::incremental_info): Likewise.
2991         (Archive::Should_include): Likewise.
2992         (Archive::should_include_member): Likewise.
2993         (Archive::Armap_entry): Remove.
2994         (Archive::Unused_symbol_iterator): Remove.
2995         (Archive::unused_symbols_begin): Remove.
2996         (Archive::unused_symbols_end): Remove.
2997         (Archive::do_filename): New function.
2998         (Archive::do_get_mtime): New function.
2999         (Archive::do_for_all_unused_symbols): New function.
3000         (Archive::task_): Move to base class.
3001         (Archive::incremental_info_): Likewise.
3002         (class Lib_group): Derive from Library_base.
3003         (Lib_group::do_filename): New function.
3004         (Lib_group::do_get_mtime): New function.
3005         (Lib_group::do_for_all_unused_symbols): New function.
3006         (Lib_group::task_): Move to base class.
3007         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3008         function.
3009         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3010         function.
3011         * incremental.cc (Incremental_inputs::report_archive_begin):
3012         Use Library_base; call library's get_mtime; add incremental inputs
3013         entry before members.
3014         (class Unused_symbol_visitor): New class.
3015         (Incremental_inputs::report_archive_end): Use Library_base; use
3016         visitor class to record unused symbols; don't add incremental inputs
3017         entry after members.
3018         (Incremental_inputs::report_object): Use Library_base.
3019         * incremental.h
3020         (Incremental_archive_entry::Incremental_archive_entry): Remove
3021         unused Archive parameter.
3022         (Incremental_inputs::report_archive_begin): Use Library_base.
3023         (Incremental_inputs::report_archive_end): Likewise.
3024         (Incremental_inputs::report_object): Likewise.
3025         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3026         function.
3027         * object.h (Object::for_all_global_symbols): New function.
3028         (Object::do_for_all_global_symbols): New function.
3029         (Sized_relobj::do_for_all_global_symbols): New function.
3030         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3031         function.
3032         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3033         function.
3034
3035 2011-03-27  Ian Lance Taylor  <iant@google.com>
3036
3037         * archive.cc (Archive::interpret_header): Return -1 if something
3038         goes wrong.  Change callers accordingly.
3039
3040 2011-03-25  Cary Coutant  <ccoutant@google.com>
3041
3042         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3043         * testsuite/Makefile.in: Regenerate.
3044
3045 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3046
3047         * plugin.cc (get_view): New.
3048         (Plugin::load): Pass get_view to the plugin.
3049         (Plugin_manager::get_view): New.
3050
3051 2011-03-21  Ian Lance Taylor  <iant@google.com>
3052
3053         * testsuite/final_layout.sh: Rewrite to not use dc.
3054         * testsuite/relro_test.sh: Fail if dc is not present.
3055
3056 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3057
3058         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3059         Change == to -eq.
3060         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3061         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3062         Change == to -eq.
3063         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3064         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3065
3066 2011-03-14  Ian Lance Taylor  <iant@google.com>
3067
3068         * script-sections.cc (Sort_output_sections::script_compare):
3069         Rename from is_before, change return type.
3070         (Sort_output_sections::operator()): Adjust accordingly.
3071
3072 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3073
3074         PR gold/12572
3075         * testsuite/odr_violation2.cc: Add comment to make all error line
3076         numbers double digits.
3077         * testsuite/debug_msg.sh: Adjust expected errors.
3078
3079 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3080
3081         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3082         but mark earlier ones as non-canonical
3083         (offset_to_iterator): Update search target and example
3084         (do_addr2line): Return extra lines in a vector*
3085         (format_file_lineno): Extract from do_addr2line
3086         (one_addr2line): Add vector* out-param
3087         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3088         when a lineno entry appeared last for its instruction
3089         (Dwarf_line_info): Add vector* out-param
3090         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3091         * symtab.cc (Odr_violation_compare): Include the lineno in the
3092         comparison again.
3093         (linenos_from_loc): New. Combine the canonical line for an
3094         address with its other lines.
3095         (True_if_intersect): New. Helper functor to make
3096         std::set_intersection a query.
3097         (detect_odr_violations): Compare sets of lines instead of just
3098         one line for each function. This became less deterministic, but
3099         has fewer false positives.
3100         * symtab.h: Declarations.
3101         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3102         mix an optimized and non-optimized object in the same binary
3103         (odr_violation2.so): Same.
3104         * testsuite/Makefile.in: Regenerate from Makefile.am.
3105         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3106         * testsuite/debug_msg.sh: Update line numbers and add
3107         assertions.
3108         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3109         non-optimized context.
3110         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3111         isn't inlined, and use OdrDerived in an optimized context.
3112         * testsuite/odr_header1.h: Defines OdrDerived, where
3113         optimization will change the
3114         first-instruction-in-the-destructor's file and line number.
3115         * testsuite/odr_header2.h: Defines OdrBase.
3116
3117 2011-03-09  Ian Lance Taylor  <iant@google.com>
3118
3119         * fileread.cc (File_read::clear_views): Don't delete the whole
3120         file view.
3121
3122 2011-03-08  Ian Lance Taylor  <iant@google.com>
3123
3124         PR gold/12525
3125         * fileread.cc: #include <climits>.
3126         (GOLD_IOV_MAX): Define.
3127         (File_read::read_multiple): Limit number of entries by iov_max.
3128         * fileread.h (class File_read): Always set max_readv_entries to
3129         128.
3130
3131 2011-03-07  Ian Lance Taylor  <iant@google.com>
3132
3133         PR gold/12525
3134         * options.h (class General_options): Add -dy and -dn.
3135
3136 2011-03-02  Cary Coutant  <ccoutant@google.com>
3137
3138         * testsuite/script_test_9.t: Add TLS segment.
3139
3140 2011-03-02  Simon Baldwin  <simonb@google.com>
3141
3142         * configure.ac: Add check for gnu_indirect_function support in
3143         the toolchain building binutils.
3144         * configure: Rebuild.
3145
3146 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3147
3148         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3149         plugin only symbols.
3150         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3151         in plugin files as not needed in the symbol table.
3152
3153 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3154
3155         * output.cc (Output_section::add_input_section): Delay fill
3156         generation for section ordering.
3157
3158 2011-02-09  Ian Lance Taylor  <iant@google.com>
3159
3160         PR gold/12316
3161         * object.h (class Sized_relobj): Remove clear_local_symbols.
3162         * reloc.cc (Sized_relobj::do_relocate): Don't call
3163         clear_local_symbols.
3164
3165 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3166
3167         * plugin.cc (is_visible_from_outside): Return true for symbols
3168         in the -u option.
3169
3170 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3171
3172         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3173         filename.
3174
3175 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3176
3177         * icf.h (is_section_foldable_candidate): Change type of parameter
3178         to std::string.
3179         * icf.cc (Icf::find_identical_sections): Change type of local variable
3180         section_name to be std::string.
3181         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3182
3183 2011-01-25  Ian Lance Taylor  <iant@google.com>
3184
3185         * script.cc (script_add_extern): Rewrite to use
3186         add_symbol_reference.
3187
3188 2011-01-25  Doug Kwan  <dougkwan@google.com>
3189
3190         * icf.cc (get_section_contents): Always lock section's object.
3191
3192 2011-01-24  Ian Lance Taylor  <iant@google.com>
3193
3194         * options.h (class General_options): Accept
3195         --no-detect-odr-violations.
3196
3197 2011-01-24  Ian Lance Taylor  <iant@google.com>
3198
3199         * version.cc (version_string): Bump to 1.11.
3200
3201 2011-01-24  Ian Lance Taylor  <iant@google.com>
3202
3203         * plugin.cc (class Plugin_rescan): Define new class.
3204         (Plugin_manager::claim_file): Set any_claimed_.
3205         (Plugin_manager::save_archive): New function.
3206         (Plugin_manager::save_input_group): New function.
3207         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3208         necessary.
3209         (Plugin_manager::new_undefined_symbol): New function.
3210         (Plugin_manager::rescan): New function.
3211         (Plugin_manager::rescannable_defines): New function.
3212         (Plugin_manager::add_input_file): Set any_added_.
3213         * plugin.h (class Plugin_manager): define new fields rescannable_,
3214         undefined_symbols_, any_claimed_, and any_added_.  Declare
3215         Plugin_rescan as friend.  Declare new functions.
3216         (Plugin_manager::Rescannable): Define type.
3217         (Plugin_manager::Rescannable_list): Define type.
3218         (Plugin_manager::Undefined_symbol_list): Define type.
3219         (Plugin_manager::Plugin_manager): Initialize new fields.
3220         * archive.cc (Archive::defines_symbol): New function.
3221         (Add_archive_symbols::run): Pass archive to plugins if any.
3222         * archive.h (class Archive): Declare defines_symbol.
3223         * readsyms.cc (Input_group::~Input_group): New function.
3224         (Finish_group::run): Pass input_group to plugins if any.
3225         * readsyms.h (class Input_group): Declare destructor.
3226         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3227         any.
3228
3229 2011-01-10  Ian Lance Taylor  <iant@google.com>
3230
3231         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3232         section as relro.
3233         (Layout::set_segment_offsets): Reset increase_relro before calling
3234         set_section_addresses a second time.
3235
3236 2011-01-04  Cary Coutant  <ccoutant@google.com>
3237
3238         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3239         sections before NOBITS sections.
3240
3241 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3242
3243         * version.cc (print_version): Update copyright to 2011.
3244
3245 2010-12-23  Cary Coutant  <ccoutant@google.com>
3246
3247         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3248         of OS to this->add.  Add OD parameter to second form of the function.
3249
3250 2010-12-20  Ian Lance Taylor  <iant@google.com>
3251
3252         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3253         second of two consecutive entries with same offset.
3254
3255 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3256
3257         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3258         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3259         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3260         to avoid unneeded links against $(LDADD).
3261         * testsuite/Makefile.in: Regenerate.
3262
3263 2010-12-15  Ian Lance Taylor  <iant@google.com>
3264
3265         PR gold/12324
3266         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3267         for R_X86_64_32 and R_X86_64_PC32.
3268         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3269         ver_matching_def_pic.o.
3270         (ver_matching_def_pic.o): New target.
3271
3272 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3273
3274         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3275         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3276         Move definition before File_read::View member definitions.
3277         (File_read::View::~View): Initialize and hold lock before
3278         updating current_mapped_bytes.
3279
3280 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3281
3282         * dwarf_reader.cc: Remove outdated comment.
3283         * gold-threads.cc: Fix typo in error message.
3284         * archive.cc: Fix typos in comments.
3285         * archive.h: Likewise.
3286         * arm-reloc-property.cc: Likewise.
3287         * arm-reloc-property.h: Likewise.
3288         * arm-reloc.def: Likewise.
3289         * arm.cc: Likewise.
3290         * attributes.h: Likewise.
3291         * cref.cc: Likewise.
3292         * ehframe.cc: Likewise.
3293         * fileread.h: Likewise.
3294         * gold.h: Likewise.
3295         * i386.cc: Likewise.
3296         * icf.cc: Likewise.
3297         * incremental.h: Likewise.
3298         * int_encoding.cc: Likewise.
3299         * layout.h: Likewise.
3300         * main.cc: Likewise.
3301         * merge.h: Likewise.
3302         * object.cc: Likewise.
3303         * object.h: Likewise.
3304         * options.cc: Likewise.
3305         * readsyms.cc: Likewise.
3306         * reduced_debug_output.cc: Likewise.
3307         * reloc.cc: Likewise.
3308         * script-sections.cc: Likewise.
3309         * sparc.cc: Likewise.
3310         * symtab.h: Likewise.
3311         * target-reloc.h: Likewise.
3312         * target.cc: Likewise.
3313         * target.h: Likewise.
3314         * timer.cc: Likewise.
3315         * timer.h: Likewise.
3316         * x86_64.cc: Likewise.
3317
3318 2010-12-09  Cary Coutant  <ccoutant@google.com>
3319
3320         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3321         stack.
3322         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3323         parameter; change all callers.
3324         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3325         * options.h (warn_execstack): New option.
3326
3327 2010-12-07  Doug Kwan  <dougkwan@google.com>
3328
3329         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3330         like function call relocations.
3331
3332 2010-12-07  Ian Lance Taylor  <iant@google.com>
3333
3334         * archive.cc (Archive::get_elf_object_for_member): Permit
3335         punconfigured to be NULL.
3336         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3337         (Archive::include_member): Pass NULL to get_elf_object_for_member
3338         if we searched for the archive and this is the first included
3339         object.
3340
3341 2010-12-01  Ian Lance Taylor  <iant@google.com>
3342
3343         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3344         track_relocs_type_ field.
3345         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3346         Set track_relocs_type_.
3347         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3348         contents when using RELA relocs.
3349         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3350         reloc_map_.
3351         * reloc.cc (Track_relocs::next_addend): New function.
3352         * reloc.h (class Track_relocs): Declare next_addend.
3353
3354 2010-12-01  Ian Lance Taylor  <iant@google.com>
3355
3356         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3357         virtual destructor.
3358
3359 2010-12-01  Ian Lance Taylor  <iant@google.com>
3360
3361         * README: Update compilers known to work and fail.
3362
3363 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3364
3365         * configure.in: For --enable-gold, handle value `default' instead of
3366         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3367         not the default.
3368         * configure: Regenerate.
3369
3370 2010-11-18  Doug Kwan  <dougkwan@google.com>
3371
3372         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3373         and right_alignment to be zero.  Store result alignment only if it is
3374         greater than existing alignment.
3375
3376 2010-11-16  Cary Coutant  <ccoutant@google.com>
3377
3378         PR gold/12220
3379         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3380         Check for ".zdebug_line".
3381
3382 2010-11-16  Doug Kwan  <dougkwan@google.com>
3383             Cary Coutant  <ccoutant@google.com>
3384
3385         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3386         by reference; adjust all callers.
3387         * output.cc (Output_segment::set_section_addresses): Adjust references
3388         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3389         list is empty.
3390         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3391         end at page boundary.
3392
3393 2010-11-16  Cary Coutant  <ccoutant@google.com>
3394
3395         PR gold/12220
3396         * layout.cc (Layout::choose_output_section): Transform names of
3397         compressed sections even when using a script with a SECTIONS clause.
3398         (Layout::output_section_name): Remove code to transform
3399         compressed debug section names.
3400         * output.cc (Output_section::add_input_section): Use uncompressed
3401         section size when tracking input sections.
3402
3403 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3404
3405         * symtab.h (Symbol::NON_PIC_REF): Remove.
3406         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3407         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3408         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3409         (Symbol::use_plt_offset): Take a flags argument and pass it
3410         directly to needs_dynamic_reloc.  Restrict check for undefined
3411         weak symbols to function calls.
3412         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3413         (Target_arm::Scan::global): Use it.
3414         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3415         (Target_arm::Relocate::relocate): Likewise.
3416         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3417         parameter with an r_type parameter.  Use get_reference_flags
3418         to get the flags.
3419         (Target_arm::Relocate::relocate): Update accordingly.
3420         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3421         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3422         (Target_i386::Scan::global): Likewise.
3423         (Target_i386::Relocate::relocate): Likewise.
3424         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3425         parameter with an r_type parameter.  Use get_reference_flags
3426         to get the flags.
3427         (Target_i386::Relocate::relocate): Update accordingly.
3428         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3429         (Target_powerpc::Scan::global): Use it.
3430         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3431         (Target_powerpc::Relocate::relocate): Likewise.
3432         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3433         (Target_sparc::Scan::global): Use it.
3434         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3435         (Target_sparc::Relocate::relocate): Likewise.
3436         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3437         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3438         (Target_x86_64::Scan::global): Likewise.
3439         (Target_x86_64::Relocate::relocate): Likewise.
3440
3441 2010-11-08  Doug Kwan  <dougkwan@google.com>
3442             Cary Coutant  <ccoutant@google.com>
3443
3444         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3445         (Arm_exidx_merge_section::section_contents_): New data member.
3446         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3447         (Arm_input_section::~Arm_input_section): De-allocate memory.
3448         (Arm_input_section::original_contents_): New data member.
3449         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3450         in parameters instead of calling Object::section_contents without
3451         locking.
3452         (Arm_output_section::group_section): New parameter TASK.  Pass it
3453         to callees that need locking objects.
3454         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3455         to lock EXIDX input sections.  Fix a formatting issue.  Call
3456         Arm_exidx_merged_section::build_contents to create merged section
3457         contents.
3458         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3459         to lock object of stub table owner.
3460         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3461         TEXT_SIZE to initialize data member TEXT_SIZE_.
3462         (Arm_exidx_input_section::addralign): Fix typo in comment.
3463         (Arm_exidx_input_section::text_size): New method.
3464         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3465         that require locking objects.  Lock objects before scanning for stubs
3466         and updating local symbols.
3467         (Arm_input_section<big_endian>::init): Copy contents of original
3468         input section.
3469         (Arm_input_section<big_endian>::do_write): Use saved contents of
3470         original input section instead of calling Object::section_contents
3471         without locking.
3472         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3473         size without calling Object::section_size().
3474         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3475         for size.  Allocate a buffer for merged EXIDX entries.
3476         (Arm_exidx_merged_section::build_contents): New method.
3477         (Arm_exidx_merged_section::do_write): Move merge section contents
3478         building code to Arm_exidx_merged_section::build_contetns.  Write
3479         out contetns in buffer instead of building it on the fly.
3480         (Arm_relobj::make_exidx_input_section): Also pass text section size
3481         to Arm_exidx_input_section constructor.
3482         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3483         (Arm_dynobj::do_read_symbols): Fix memory leak.
3484         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3485         * target.h: (class Task): Add forward declaration.
3486         (Target::relax): Add new parameter TASK and pass it to
3487         Target::do_relax().
3488         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3489
3490 2010-11-05  Cary Coutant  <ccoutant@google.com>
3491
3492         PR gold/10708
3493         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3494         object when reading from the file.
3495         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3496         second layout pass.
3497         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3498         when reading section contents.
3499         (get_section_contents): Likewise.
3500         (icf::find_identical_sections): Likewise.
3501         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3502         object when reading from the file.
3503         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3504         the object when doing deferred section layout.
3505
3506 2010-11-03  Nick Clifton  <nickc@redhat.com>
3507
3508         PR gold/12001
3509         * script.h (class Symbol_assignment: name): New member.  Returns
3510         the name of the symbol.
3511         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3512         Returns true if the given symbol name is on the list of
3513         assignments wating to be processed.
3514         * archive.cc (should_incldue_member): If the symbol is undefined,
3515         check to see if it is on the list of symbols pending assignment.
3516
3517 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3518
3519         * script-sections.cc (Script_sections::find_memory_region): Check
3520         for a NULL output section pointer.
3521
3522 2010-10-29  Doug Kwan  <dougkwan@google.com>
3523
3524         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3525         Output_section::add_relaxed_input_section.
3526         * output.cc (Output_section::add_relaxed_input_section): Add new
3527         arguments LAYOUT and NAME.  Set section order index.
3528         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3529         Copy section order index.
3530         * output.h (Output_section::add_relaxed_input_section): Add new
3531         arguments LAYOUT and NAME.
3532
3533 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3534
3535         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3536         NATIVE_OR_CROSS_LINKER.
3537         * testsuite/Makefile.in: Regenerate.
3538
3539 2010-10-20  Doug Kwan  <dougkwan@google.com>
3540
3541         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3542         without SHF_LINK_ORDER flags.
3543         * layout.cc (Layout::choose_output_section): Do not filter
3544         SHF_LINK_ORDER flag in a relocatable link.
3545
3546 2010-10-17  Cary Coutant  <ccoutant@google.com>
3547
3548         * output.h (Output_segment::set_section_addresses): Change function
3549         signature.  Update all callers.
3550         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3551         sections.
3552         (Output_segment::set_section_addresses): Align after last TLS
3553         section.  Add padding before last relro section instead of after.
3554
3555 2010-10-17  Doug Kwan  <dougkwan@google.com>
3556
3557         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3558         GOT output section to be writable.
3559
3560 2010-10-14  Cary Coutant  <ccoutant@google.com>
3561
3562         * debug.h (DEBUG_INCREMENTAL): New flag.
3563         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3564         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3565         mode.
3566         * incremental.cc (report_command_line): Ignore all forms of
3567         --incremental.
3568         * layout.cc (Layout::Layout): Check parameters for incremental link
3569         mode.
3570         * options.cc (General_options::parse_incremental): New function.
3571         (General_options::parse_no_incremental): New function.
3572         (General_options::parse_incremental_full): New function.
3573         (General_options::parse_incremental_update): New function.
3574         (General_options::incremental_mode_): New data member.
3575         (General_options::finalize): Check incremental_mode_.
3576         * options.h (General_options): Update help text for --incremental.
3577         Add --no-incremental, --incremental-full, --incremental-update.
3578         (General_options::Incremental_mode): New enum type.
3579         (General_options::incremental_mode): New function.
3580         (General_options::incremental_mode_): New data member.
3581         * parameters.cc (Parameters::incremental_mode_): New data member.
3582         (Parameters::set_options): Set incremental_mode_.
3583         (Parameters::set_incremental_full): New function.
3584         (Parameters::incremental): New function.
3585         (Parameters::incremental_update): New function.
3586         (set_parameters_incremental_full): New function.
3587         * parameters.h (Parameters::set_incremental_full): New function.
3588         (Parameters::incremental): New function.
3589         (Parameters::incremental_update): New function.
3590         (Parameters::incremental_mode_): New data member.
3591         (set_parameters_incremental_full): New function.
3592         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3593         incremental link mode.
3594         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3595         (Sized_relobj::do_relocate_sections): Likewise.
3596         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3597         option.
3598         * testsuite/Makefile.in: Regenerate.
3599         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3600
3601 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3602
3603         * script-sections.h (class Script_sections): Make
3604         Sections_elements typedef public.
3605         * script-sections.cc (class Sort_output_sections): Add elements_
3606         field.  Add constructor which sets it; change all callers.
3607         (Sort_output_sections::is_before): New function.
3608         (Sort_output_sections::operator()): Call is_before.
3609         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3610         conditional.
3611         * testsuite/script_test_10.sh: New test. Test script section
3612         order.
3613         * testsuite/script_test_10.t: Likewise.
3614         * testsuite/script_test_10.s: Likewise.
3615         * testsuite/Makefile.am: Wrap the cross linker tests and the
3616         common tests into NATIVE_OR_CROSS_LINKER.
3617         (check_SCRIPTS): Add script_test_10.sh.
3618         (check_DATA): Add script_test_10.stdout.
3619         (script_test_10.o, script_test_10): New targets.
3620         (script_test_10.stdout): New target.
3621         * configure, testsuite/Makefile.in: Regenerate.
3622
3623 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3624
3625         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3626         error for the deprecated relocations.
3627         (Target_arm::Scan::global): Likewise.
3628         (Target_arm::Relocate::relocate): Likewise.
3629
3630 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3631
3632         * fileread.cc (Input_file::find_file): Initialize *found_name
3633         and *namep when using the fallback search for case 4.
3634
3635 2010-10-11  Cary Coutant  <ccoutant@google.com>
3636
3637         * options.h (class General_options): Redefine -z lazy as an alias for
3638         the negation of -z now.
3639
3640 2010-10-11  Ian Lance Taylor  <iant@google.com>
3641
3642         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3643         binding.
3644
3645 2010-10-06  Nick Clifton  <nickc@redhat.com>
3646
3647         * script-sections.cc(class Memory_region): Remove
3648         current_lma_offset_ field.  Rename current_vma_offset_ to
3649         current_offset_.  Add last_section_ field.
3650         (Memory_region::get_current_vma_address): Rename to
3651         get_current_address.
3652         (Memory_region::get_current_lma_address): Delete.
3653         (Memory_region::increment_vma_offset): Rename to
3654         increment_offset.
3655         (Memory_region::increment_lma_offset): Delete.
3656         (Memory_region::attributes_compatible): New method.  Returns
3657         true if the provided section is compatible with the region.
3658         (Memory_region::get_last_section): New method.  Returns the last
3659         section to use the region.
3660         (Memory_region::set_last_section): New method.  Stores the last
3661         section to use the region.
3662         (Script_sections::block_in_region): New method.  Returns true if
3663         a block of memory is contained within a region.
3664         (Script_sections::find_memory_region): New method.  Locates a
3665         memory region to be used to set a VMA or LMA address.
3666         (Output_section_definition::set_section_addresses): Add code to
3667         check for addresses set by memory regions.
3668         (Output_segment::set_section_addresses): Remove memory region
3669         walking code.
3670         (Script_sections::create_segment): Add a warning if a header
3671         segment is created outside of any region.
3672         * script-sections.h (class Script_sections): Add prototypes for
3673         find_memory_region and block_in_region methods.
3674         * testsuite/memory_test.s: Use .long instead of .word.
3675         * testsuite/memory_test.t: Add some more output sections.
3676         * testsuite/memory_test.sh: Update expected output.
3677
3678 2010-10-02  Doug Kwan  <dougkwan@google.com>
3679
3680         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3681         defintion to symtab.h
3682         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3683         declaration to defintion.
3684
3685 2010-10-01  Nick Clifton  <nickc@redhat.com>
3686
3687         * expression.cc (eval): Replace dummy argument with NULL.
3688         (eval_maybe_dot): Check for a NULL result section pointer.
3689         (Symbol_expression::value): Likewise.
3690         (Dot_expression::value): Likewise.
3691         (BINARY_EXPRESSION): Likewise.
3692         (Max_expression::value): Likewise.
3693         (Min_expression::value): Likewise.
3694         (Absolute_expression::value): Likewise.
3695         (Addr_expression::value_from_output_section): Likewise.
3696         (Loaddddr_expression::value_from_output_section): Likewise.
3697         (Segment_start_expression::value): Likewise.
3698         * script-sections.cc
3699         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3700         argument with NULL.
3701         (Sections_elememt_dot_assignment::set_section_addresses):
3702         Likewise.
3703         (Output_data_expression::do_write_to_buffer): Likewise.
3704         (Output_section_definition::finalize_symbols): Likewise.
3705         (Output_section_definition::set_section_addresses): Likewise.
3706
3707 2010-09-30  Doug Kwan  <dougkwan@google.com>
3708
3709         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3710
3711 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3712
3713         * target.h (Target::can_icf_inline_merge_sections): New virtual
3714         function.
3715         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3716         virtual function.
3717         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3718         virtual function.
3719         * icf.cc (get_section_contents): Inline merge sections only when
3720         target allows it.
3721
3722 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3723
3724         * configure: Regenerate.
3725
3726 2010-09-17  Ian Lance Taylor  <iant@google.com>
3727
3728         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3729         * testsuite/Makefile.am (memory_test.o): New target.
3730         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3731         memory_test.t.
3732         * testsuite/Makefile.in: Rebuild.
3733
3734 2010-09-17  Doug Kwan  <dougkwan@google.com>
3735
3736         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3737         defintion if relocation uses GOT entries of the symbol.
3738         * testsuite/icf_safe_test.sh: Fix test.
3739         * testsuite/icf_safe_so_test.sh: Fix test.
3740
3741 2010-09-16  Cary Coutant  <ccoutant@google.com>
3742
3743         * script_sections.cc (class Memory_region): Remove "NULL" from
3744         vector initializations.
3745
3746 2010-09-15  Cary Coutant  <ccoutant@google.com>
3747
3748         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3749         Resolve forwarding symbols.
3750
3751 2010-09-15  Doug Kwan  <dougkwan@google.com>
3752
3753         * gold/testsuite/script_test_3.t: Add ARM special sections.
3754         * gold/testsuite/script_test_4.t: Same.
3755         * gold/testsuite/script_test_5.t: Same.
3756         * gold/testsuite/script_test_6.t: Same.
3757         * gold/testsuite/script_test_7.t: Same.
3758         * gold/testsuite/script_test_7.t: Same.
3759         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3760
3761 2010-09-14  Cary Coutant  <ccoutant@google.com>
3762
3763         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3764         (Target_x86_64::Relocate::relocate_tls): Replace check for
3765         saw_tls_block_reloc_ with test for executable section.
3766
3767 2010-09-12  Cary Coutant  <ccoutant@google.com>
3768
3769         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3770         position-independent executables to shared libraries need dynamic
3771         relocations.
3772         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3773         position-independent executables.
3774         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3775         * testsuite/Makefile.in: Regenerate.
3776
3777 2010-09-10  Nick Clifton  <nickc@redhat.com>
3778
3779         PR gold/11997
3780         * testsuite/memory_test.t: Discard any sections that are not
3781         needed.
3782
3783 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3784
3785         PR gold/11996
3786         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3787         "This::" to work around a bug in gcc 4.2.
3788
3789         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3790
3791 2010-09-09  Rafael Espindola  <espindola@google.com>
3792
3793         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3794         sections with different PF_X flags in the same segment.
3795         (Layout::find_first_load_seg): Search all segments to find the first
3796         one.
3797         * options.h (rosegment): New.
3798
3799 2010-09-08  Rafael Espindola  <espindola@google.com>
3800
3801         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3802
3803 2010-09-08  Doug Kwan  <dougkwan@google.com>
3804
3805         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3806         (Arm_relobj::do_relocate_sections): Add new parameter for output
3807         file to match the parent.
3808         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3809         of local symbols instead of input values.  Update code to track
3810         changes in gold::relocate_section.
3811         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3812         (Sized_relobj::compute_final_local_value_internal): New methods.
3813         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3814         body into private version of Sized_relobj::compute_final_local_value.
3815         Call the inline method.
3816         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3817         merged symbol value if there is one.
3818         (Symbol_value::has_output_value): New method defintiion.
3819         (Sized_relobj::Compute_final_local_value_status): New enum type.
3820         (Sized_relobj::compute_final_local_value): New methods.
3821         (Sized_relobj::compute_final_local_value_internal): New methods.
3822         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3823         and arm_cortex_a8.sh.
3824         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3825         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3826         New tests.
3827         * Makefile.in: Regenerate.
3828         * testsuite/arm_bl_out_of_range.s: Update test.
3829         * testsuite/thumb_bl_out_of_range.s: Ditto.
3830         * testsuite/thumb_blx_out_of_range.s: Ditto.
3831         * testsuite/arm_branch_out_of_range.sh: New file.
3832         * testsuite/arm_cortex_a8.sh: Ditto.
3833         * testsuite/arm_cortex_a8_b.s: Ditto.
3834         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3835         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3836         * testsuite/arm_cortex_a8_bl.s: Ditto.
3837         * testsuite/arm_cortex_a8_blx.s: Ditto.
3838         * testsuite/arm_cortex_a8_local.s: Ditto.
3839         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3840         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3841
3842 2010-09-08  Rafael Espindola  <espindola@google.com>
3843
3844         * Makefile.am (memory_test.stdout): Run readelf with -W.
3845         * Makefile.in: Regenerate.
3846         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3847         64 bit output.
3848
3849 2010-09-08  Rafael Espindola  <espindola@google.com>
3850
3851         * script-sections.cc (Script_sections::add_memory_region): Convert
3852         field precision to int.
3853         * script.cc (script_set_section_region, script_set_section_region):
3854         Convert field precision to int.
3855
3856 2010-09-08  Rafael Espindola  <espindola@google.com>
3857
3858         * arm.cc (do_finalize_sections): Create the __exidx_start and
3859         __exdix_end symbols even when the section is missing.
3860
3861 2010-09-08  Nick Clifton  <nickc@redhat.com>
3862
3863         * README: Remove claim that MEMORY is not supported.
3864         * expression.cc (script_exp_function_origin)
3865         (script_exp_function_length): Move from here to ...
3866         * script.cc: ... here.
3867         (script_set_section_region, script_add_memory)
3868         (script_parse_memory_attr, script_include_directive): New
3869         functions.
3870         * script-sections.cc
3871         (class Memory_region): New class.
3872         (class Output_section_definition): Add set_memory_region,
3873         set_section_vma, set_section_lma and get_section_name methods.
3874         (class Script_Sections): Add add_memory_region,
3875         find_memory_region, find_memory_region_origin,
3876         find_memory_region_length and set_memory_region methods.
3877         Have set_section_addresses method walk the list of set memory
3878         regions.
3879         Extend the print methos to display memory regions.
3880         * script-sections.h: Add prototypes for new methods.
3881         Add enum for MEMORY region attributes.
3882         * yyscript.y: Add support for parsing MEMORY regions.
3883         * script-c.h: Add prototypes for new functions.
3884         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3885         * testsuite/Makefile.in: Regenerate.
3886         * testsuite/memory_test.sh: New script.
3887         * testsuite/memory_test.s: New assembler source file.
3888         * testsuite/memory_test.t: New linker script.
3889
3890 2010-08-27  Doug Kwan  <dougkwan@google.com>
3891
3892         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3893         reference override an existing dynamic weak reference.
3894         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3895         * testsuite/Makefile.in: Regenerate.
3896         * testsuite/dyn_weak_ref.sh: New file.
3897         * testsuite/dyn_weak_ref_1.c: Ditto.
3898         * testsuite/dyn_weak_ref_2.c: Ditto.
3899
3900 2010-08-27  Ian Lance Taylor  <iant@google.com>
3901
3902         * incremental.h (class Incremental_input_entry): Add virtual
3903         destructor.
3904
3905 2010-08-27  Ian Lance Taylor  <iant@google.com>
3906
3907         * testsuite/start_lib_test_3.c: Mark t3 as used.
3908
3909 2010-08-27  Nick Clifton  <nickc@redhat.com>
3910
3911         * options.cc (version_script): Fix small typo in previous
3912         whitespace tidyup.
3913
3914 2010-08-25  Nick Clifton  <nickc@redhat.com>
3915
3916         * archive.cc: Formatting fixes: Remove whitespace between
3917         typename and following asterisk.  Remove whitespace between
3918         function name and opening parenthesis.
3919         * archive.h: Likewise.
3920         * arm.cc: Likewise.
3921         * attributes.cc: Likewise.
3922         * attributes.h: Likewise.
3923         * common.cc: Likewise.
3924         * copy-relocs.cc: Likewise.
3925         * dirsearch.h: Likewise.
3926         * dynobj.cc: Likewise.
3927         * ehframe.cc: Likewise.
3928         * ehframe.h: Likewise.
3929         * expression.cc: Likewise.
3930         * fileread.cc: Likewise.
3931         * fileread.h: Likewise.
3932         * gc.h: Likewise.
3933         * gold-threads.cc: Likewise.
3934         * gold.cc: Likewise.
3935         * i386.cc: Likewise.
3936         * icf.h: Likewise.
3937         * incremental-dump.cc: Likewise.
3938         * incremental.cc: Likewise.
3939         * layout.cc: Likewise.
3940         * layout.h: Likewise.
3941         * main.cc: Likewise.
3942         * merge.cc: Likewise.
3943         * merge.h: Likewise.
3944         * object.cc: Likewise.
3945         * object.h: Likewise.
3946         * options.cc: Likewise.
3947         * options.h: Likewise.
3948         * output.cc: Likewise.
3949         * output.h: Likewise.
3950         * plugin.cc: Likewise.
3951         * plugin.h: Likewise.
3952         * powerpc.cc: Likewise.
3953         * reloc.cc: Likewise.
3954         * script-c.h: Likewise.
3955         * script-sections.cc: Likewise.
3956         * script.cc: Likewise.
3957         * stringpool.cc: Likewise.
3958         * symtab.cc: Likewise.
3959         * symtab.h: Likewise.
3960         * target.cc: Likewise.
3961         * timer.cc: Likewise.
3962         * timer.h: Likewise.
3963         * version.cc: Likewise.
3964         * x86_64.cc: Likewise.
3965
3966 2010-08-24  Nick Clifton  <nickc@redhat.com>
3967
3968         PR 11899
3969         * layout.cc (segment_precedes): Sort segments by their physical
3970         addresses, if they have been set.
3971
3972 2010-08-23  Cary Coutant  <ccoutant@google.com>
3973
3974         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3975         symbols data.
3976         (Lib_group::include_member): Unlock object after deleting its
3977         symbols data.
3978         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3979         the bug fixed here.
3980
3981 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
3982             Cary Coutant  <ccoutant@google.com>
3983
3984         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3985         constructor, and set_blocker.
3986         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3987         readsyms_blocker_.
3988         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3989         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3990         * testsuite/Makefile.am (start_lib_test): New test case.
3991         * testsuite/Makefile.in: Regenerate.
3992         * testsuite/start_lib_test_main.c: New file.
3993         * testsuite/start_lib_test_1.c: New file.
3994         * testsuite/start_lib_test_2.c: New file.
3995         * testsuite/start_lib_test_3.c: New file.
3996
3997 2010-08-19  Ian Lance Taylor  <iant@google.com>
3998
3999         * Makefile.in: Rebuild with automake 1.11.1.
4000         * aclocal.m4: Likewise.
4001         * testsuite/Makefile.in: Likewise.
4002
4003 2010-08-19  Ian Lance Taylor  <iant@google.com>
4004
4005         PR 10893
4006         * i386.cc (class Output_data_plt_i386): Update declarations.
4007         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4008         local_ifuncs_ fields.
4009         (Target_i386::do_plt_section_for_global): New function.
4010         (Target_i386::do_plt_section_for_local): New function.
4011         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4012         parameter; change all callers.  Initialize global_ifuncs_ and
4013         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4014         __rel_iplt_end.
4015         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4016         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4017         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4018         symbols.
4019         (Target_i386::make_plt_section): New function, broken out of
4020         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4021         (Target_i386::make_plt_entry): Call make_plt_section.
4022         (Target_i386::make_local_ifunc_plt_entry): New function.
4023         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4024         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4025         R_386_IRELATIVE to switch.
4026         (Target_i386::Scan::global): Likewise.
4027         (Target_i386::Relocate::relocate): Likewise.
4028         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4029         switch.
4030         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4031         (Target_x86_64::do_plt_section_for_global): New function.
4032         (Target_x86_64::do_plt_section_for_local): New function.
4033         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4034         parameter; change all callers.  If doing a static link define
4035         __rela_iplt_start and __rela_iplt_end.
4036         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4037         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4038         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4039         to point to .plt.
4040         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4041         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4042         switch.
4043         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4044         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4045         R_X86_64_IRELATIVE to switch.
4046         (Target_x86_64::Scan::global): Likewise.
4047         (Target_x86_64::Relocate::relocate): Likewise.
4048         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4049         switch.
4050         * target.h (class Target): Add plt_section_for_global and
4051         plt_section_for_local functions.  Add do_plt_section_for_global
4052         and do_plt_section_for_local virtual functions.
4053         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4054         clarifying comments.
4055         (Symbol::use_plt_offset): Handle IFUNC symbol.
4056         * object.cc (Sized_relobj::Sized_relobj): Initialize
4057         local_plt_offsets_.
4058         (Sized_relobj::local_has_plt_offset): New function.
4059         (Sized_relobj::local_plt_offset): New function.
4060         (Sized_relobj::set_local_plt_offset): New function.
4061         (Sized_relobj::do_count): Handle IFUNC symbol.
4062         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4063         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4064         is_ifunc_symbol functions.
4065         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4066         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4067         local_plt_offsets_ field.
4068         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4069         * output.h (class Output_section_data): Add non-const
4070         output_section function.
4071         (class Output_data_got): Update declarations.
4072         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4073         Add use_plt_offset parameter to global and local constructors.
4074         Change all callers.  Change local_sym_index_ field to 31 bits.
4075         Change GSYM_CODE and CONSTANT_CODE accordingly.
4076         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4077         doing a static link don't set sh_link field.
4078         (Output_data_got::Got_entry::write): Use PLT offset if
4079         appropriate.
4080         (Output_data_got::add_global_plt): New function.
4081         (Output_data_got::add_local_plt): New function.
4082         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4083         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4084         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4085         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4086         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4087         IFUNC conditional.
4088         * testsuite/ifunc-sel.h: New file.
4089         * testsuite/ifuncmain1.c: New file.
4090         * testsuite/ifuncmain1vis.c: New file.
4091         * testsuite/ifuncmod1.c: New file.
4092         * testsuite/ifuncdep2.c: New file.
4093         * testsuite/ifuncmain2.c: New file.
4094         * testsuite/ifuncmain3.c: New file.
4095         * testsuite/ifuncmod3.c: New file.
4096         * testsuite/ifuncmain4.c: New file.
4097         * testsuite/ifuncmain5.c: New file.
4098         * testsuite/ifuncmod5.c: New file.
4099         * testsuite/ifuncmain6pie.c: New file.
4100         * testsuite/ifuncmod6.c: New file.
4101         * testsuite/ifuncmain7.c: New file.
4102         * configure, testsuite/Makefile.in: Rebuild.
4103
4104 2010-08-18  Ian Lance Taylor  <iant@google.com>
4105
4106         * incremental.cc
4107         (Output_section_incremental_inputs::write_input_files): Add cast
4108         to avoid signed/unsigned comparison warning.
4109         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4110
4111 2010-08-12  Cary Coutant  <ccoutant@google.com>
4112
4113         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4114
4115 2010-08-13  Ian Lance Taylor  <iant@google.com>
4116
4117         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4118
4119 2010-08-12  Cary Coutant  <ccoutant@google.com>
4120             Doug Kwan  <dougkwan@google.com>
4121
4122         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4123         defintion overrides non-weak undef, remember that the original undef
4124         is not weak.
4125         * symtab.cc (Symbol_table::sized_write_global): For undef without
4126         an original weak binding, set binding to global in output.
4127         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4128         * testsuite/Makefile.in: Regenerate.
4129         * testsuite/strong_ref_weak_def.sh: New file.
4130         * testsuite/strong_ref_weak_def_1.c: Ditto.
4131         * testsuite/strong_ref_weak_def_2.c: Ditto.
4132
4133 2010-08-12  Cary Coutant  <ccoutant@google.com>
4134
4135         * testsuite/incremental_test.sh: Rewrite.
4136         * testsuite/incremental_test_1.c: Rewrite.
4137         * testsuite/incremental_test_2.c: Rewrite.
4138
4139 2010-08-12  Cary Coutant  <ccoutant@google.com>
4140
4141         * arm.cc (Target_arm::got_size): Add const.
4142         (Target_arm::got_entry_count): New function.
4143         (Target_arm::plt_entry_count): New function.
4144         (Target_arm::first_plt_entry_offset): New function.
4145         (Target_arm::plt_entry_size): New function.
4146         (Output_data_plt_arm::entry_count): New function.
4147         (Output_data_plt_arm::first_plt_entry_offset): New function.
4148         (Output_data_plt_arm::get_plt_entry_size): New function.
4149         * i386.cc (Target_i386::got_size): Add const.
4150         (Target_i386::got_entry_count): New function.
4151         (Target_i386::plt_entry_count): New function.
4152         (Target_i386::first_plt_entry_offset): New function.
4153         (Target_i386::plt_entry_size): New function.
4154         (Output_data_plt_i386::entry_count): New function.
4155         (Output_data_plt_i386::first_plt_entry_offset): New function.
4156         (Output_data_plt_i386::get_plt_entry_size): New function.
4157         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4158         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4159         * incremental.cc: Include target.h.
4160         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4161         parameter.  Adjust all callers.  Find incremental_got_plt section.
4162         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4163         section.
4164         (Output_section_incremental_inputs::set_final_data_size): Calculate
4165         size of incremental_got_plt section.
4166         (Output_section_incremental_inputs::do_write): Write the
4167         incremental_got_plt section.
4168         (Got_plt_view_info): New struct.
4169         (Local_got_offset_visitor): New class.
4170         (Global_got_offset_visitor): New class.
4171         (Global_symbol_visitor_got_plt): New class.
4172         (Output_section_incremental_inputs::write_got_plt): New function.
4173         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4174         Add parameter.  Adjust all callers.
4175         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4176         (Incremental_inputs::got_plt_section): New function.
4177         (Incremental_inputs::got_plt_section_): New data member.
4178         (Incremental_got_plt_reader): New class.
4179         * layout.cc (Layout::create_incremental_info_sections): Add the
4180         incremental_got_plt section.
4181         * object.h (Got_offset_list::get_list): New function.
4182         (Got offset_list::for_all_got_offsets): New function.
4183         (Sized_relobj::local_got_offset_list): New function.
4184         * powerpc.cc (Target_powerpc::got_size): Add const.
4185         (Target_powerpc::got_entry_count): New function.
4186         (Target_powerpc::plt_entry_count): New function.
4187         (Target_powerpc::first_plt_entry_offset): New function.
4188         (Target_powerpc::plt_entry_size): New function.
4189         (Output_data_plt_powerpc::entry_count): New function.
4190         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4191         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4192         * sparc.cc (Target_sparc::got_size): Add const.
4193         (Target_sparc::got_entry_count): New function.
4194         (Target_sparc::plt_entry_count): New function.
4195         (Target_sparc::first_plt_entry_offset): New function.
4196         (Target_sparc::plt_entry_size): New function.
4197         (Output_data_plt_sparc::entry_count): New function.
4198         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4199         (Output_data_plt_sparc::get_plt_entry_size): New function.
4200         * symtab.h (Symbol::got_offset_list): New function.
4201         (Symbol_table::for_all_symbols): New function.
4202         * target.h (Sized_target::got_entry_count): New function.
4203         (Sized_target::plt_entry_count): New function.
4204         (Sized_target::plt_entry_size): New function.
4205         * x86_64.cc (Target_x86_64::got_size): Add const.
4206         (Target_x86_64::got_entry_count): New function.
4207         (Target_x86_64::plt_entry_count): New function.
4208         (Target_x86_64::first_plt_entry_offset): New function.
4209         (Target_x86_64::plt_entry_size): New function.
4210         (Output_data_plt_x86_64::entry_count): New function.
4211         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4212         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4213
4214 2010-08-12  Cary Coutant  <ccoutant@google.com>
4215
4216         * archive.cc: Include incremental.h.
4217         (Archive::Archive): Initialize incremental_info_.
4218         (Archive::include_member): Record archive members in incremental info.
4219         (Add_archive_symbols::run): Record begin and end of an archive in
4220         incremental info.
4221         (Lib_group::include_member): Record objects in incremental info.
4222         * archive.h (Incremental_archive_entry): Forward declaration.
4223         (Archive::set_incremental_info): New member function.
4224         (Archive::incremental_info): New member function.
4225         (Archive::Unused_symbol_iterator): New class.
4226         (Archive::unused_symbols_begin): New member function.
4227         (Archive::unused_symbols_end): New member function.
4228         (Archive::incremental_info_): New data member.
4229         * incremental-dump.cc (find_input_containing_global): New function.
4230         (dump_incremental_inputs): Dump new incremental info sections.
4231         * incremental.cc: Include symtab.h.
4232         (Output_section_incremental_inputs): New class.
4233         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4234         new incremental info sections.
4235         (Sized_incremental_binary::do_check_inputs): Likewise.
4236         (Incremental_inputs::report_archive): Remove.
4237         (Incremental_inputs::report_archive_begin): New function.
4238         (Incremental_inputs::report_archive_end): New function.
4239         (Incremental_inputs::report_object): New function.
4240         (Incremental_inputs::finalize_inputs): Remove.
4241         (Incremental_inputs::report_input_section): New function.
4242         (Incremental_inputs::report_script): Rewrite.
4243         (Incremental_inputs::finalize): Do nothing but finalize string table.
4244         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4245         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4246         (Incremental_inputs::create_data_sections): New function.
4247         (Incremental_inputs::relocs_entsize): New function.
4248         (Output_section_incremental_inputs::set_final_data_size): New function.
4249         (Output_section_incremental_inputs::do_write): New function.
4250         (Output_section_incremental_inputs::write_header): New function.
4251         (Output_section_incremental_inputs::write_input_files): New function.
4252         (Output_section_incremental_inputs::write_info_blocks): New function.
4253         (Output_section_incremental_inputs::write_symtab): New function.
4254         * incremental.h (Incremental_script_entry): Forward declaration.
4255         (Incremental_object_entry): Forward declaration.
4256         (Incremental_archive_entry): Forward declaration.
4257         (Incremental_inputs): Forward declaration.
4258         (Incremental_inputs_header_data): Remove.
4259         (Incremental_inputs_header): Remove.
4260         (Incremental_inputs_header_write): Remove.
4261         (Incremental_inputs_entry_data): Remove.
4262         (Incremental_inputs_entry): Remove.
4263         (Incremental_inputs_entry_write): Remove.
4264         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4265         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4266         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4267         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4268         Likewise.
4269         (Incremental_input_entry): New class.
4270         (Incremental_script_entry): New class.
4271         (Incremental_object_entry): New class.
4272         (Incremental_archive_entry): New class.
4273         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4274         (Incremental_inputs::report_inputs): Remove.
4275         (Incremental_inputs::report_archive): Remove.
4276         (Incremental_inputs::report_archive_begin): New function.
4277         (Incremental_inputs::report_archive_end): New function.
4278         (Incremental_inputs::report_object): Change prototype.
4279         (Incremental_inputs::report_input_section): New function.
4280         (Incremental_inputs::report_script): Change prototype.
4281         (Incremental_inputs::get_reloc_count): New function.
4282         (Incremental_inputs::set_reloc_count): New function.
4283         (Incremental_inputs::create_data_sections): New function.
4284         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4285         (Incremental_inputs::inputs_section): New function.
4286         (Incremental_inputs::symtab_section): New function.
4287         (Incremental_inputs::relocs_section): New function.
4288         (Incremental_inputs::get_stringpool): Add const.
4289         (Incremental_inputs::command_line): Add const.
4290         (Incremental_inputs::inputs): Remove.
4291         (Incremental_inputs::command_line_key): New function.
4292         (Incremental_inputs::input_file_count): New function.
4293         (Incremental_inputs::input_files): New function.
4294         (Incremental_inputs::relocs_entsize): New function.
4295         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4296         (Incremental_inputs::finalize_inputs): Remove.
4297         (Incremental_inputs::Input_info): Remove.
4298         (Incremental_inputs::lock_): Remove.
4299         (Incremental_inputs::inputs_): Change type.
4300         (Incremental_inputs::inputs_map_): Remove.
4301         (Incremental_inputs::current_object_entry_): New data member.
4302         (Incremental_inputs::inputs_section_): New data member.
4303         (Incremental_inputs::symtab_section_): New data member.
4304         (Incremental_inputs::relocs_section_): New data member.
4305         (Incremental_inputs::reloc_count_): New data member.
4306         (Incremental_inputs_reader): New class.
4307         (Incremental_symtab_reader): New class.
4308         (Incremental_relocs_reader): New class.
4309         * layout.cc (Layout::finalize): Move finalization of incremental info
4310         and creation of incremental info sections to follow finalization of
4311         symbol table.  Set offsets for postprocessing sections.
4312         (Layout::create_incremental_info_sections): Call
4313         Incremental_inputs::create_data_sections.  Add incremental symtab
4314         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4315         sections to layout after input sections.
4316         * layout.h (struct Timespec): Forward declaration.
4317         (Layout::incremental_inputs): Add const.
4318         (Layout::create_incremental_info_sections): Add parameter.
4319         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4320         * object.cc: Include incremental.h.
4321         (Relobj::finalize_incremental_relocs): New function.
4322         (Sized_relobj::do_layout): Record input sections in incremental info.
4323         * object.h (Object::output_section): New function.
4324         (Object::output_section_offset): Moved from Relobj.
4325         (Object::get_incremental_reloc_base): New function.
4326         (Object::get_incremental_reloc_count): New function.
4327         (Object::do_output_section): New function.
4328         (Object::do_output_section_offset): Moved from Relobj.
4329         (Object::do_get_incremental_reloc_base): New function.
4330         (Object::do_get_incremental_reloc_count): New function.
4331         (Object::Object): Initialize new data members.
4332         (Relobj::output_section): Renamed do_output_section and moved to
4333         protected.
4334         (Relobj::output_section_offset): Moved to Object.
4335         (Relobj::do_get_incremental_reloc_base): New function.
4336         (Relobj::do_get_incremental_reloc_count): New function.
4337         (Relobj::allocate_incremental_reloc_counts): New function.
4338         (Relobj::count_incremental_reloc): New function.
4339         (Relobj::finalize_incremental_relocs): New function.
4340         (Relobj::next_incremental_reloc_index): New function.
4341         (Relobj::reloc_counts_): New data member.
4342         (Relobj::reloc_bases_): New data member.
4343         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4344         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4345         (Sized_relobj::incremental_relocs_scan): New function.
4346         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4347         (Sized_relobj::incremental_relocs_write): New function.
4348         (Sized_relobj::incremental_relocs_write_reltype): New function.
4349         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4350         incremental link.
4351         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4352         archives and object files elsewhere.
4353         (Add_symbols::run): Report object files here.
4354         (Finish_group::run): Report end of archive at end of group.
4355         * reloc.cc: Include layout.h, incremental.h.
4356         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4357         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4358         (Sized_relobj::incremental_relocs_scan): New function.
4359         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4360         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4361         (Sized_relobj::incremental_relocs_write): New function.
4362         (Sized_relobj::incremental_relocs_write_reltype): New function.
4363         * script.cc (read_input_script): Rewrite test for incremental link.
4364         Change call to Incremental_inputs::report_script.
4365         * symtab.h (Symbol_table::first_global_index): New function.
4366         (Symbol_table::output_count): New function.
4367
4368 2010-08-12  Doug Kwan  <dougkwan@google.com>
4369
4370         * arm.cc (Target_arm::merge_object_attributes): Check command line
4371         options --no-wchar-size-warning and --no-enum-size-warning.
4372         * options.h (General_options): Add ld-compatible options
4373         --no-enum-size-warning and --no-wchar-size-warning.
4374
4375 2010-08-04  Ian Lance Taylor  <iant@google.com>
4376
4377         * x86_64.cc (Target_x86_64::Scan::local): Use
4378         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4379         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4380         (Target_x86_64::Scan::global): Likewise.
4381         (Target_x86_64::Relocate::relocate): Likewise.
4382         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4383         Likewise.
4384
4385 2010-08-03  Cary Coutant  <ccoutant@google.com>
4386
4387         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4388         to reserve space in merged_strings vector. Keep total input size
4389         for stats.
4390         (Output_merge_string::do_print_merge_stats): Print total input size.
4391         * merge.h (Output_merge_string): Add input_size_ field.
4392         * stringpool.cc (Stringpool_template::string_length): Move
4393         implementations out of Stringpool_template class and place in
4394         stringpool.h.
4395         * stringpool.h (string_length): Move out of Stringpool_template.
4396
4397 2010-08-03  Ian Lance Taylor  <iant@google.com>
4398
4399         PR 11712
4400         * layout.cc (relaxation_loop_body): If address of load segment is
4401         set, adjust address to include headers if possible.
4402
4403 2010-08-03  Ian Lance Taylor  <iant@google.com>
4404
4405         * version.cc (version_string): Bump to 1.10.
4406
4407 2010-08-03  Ian Lance Taylor  <iant@google.com>
4408
4409         PR 11805
4410         * layout.h (enum Output_section_order): Define.
4411         (class Layout): Update declarations.
4412         * layout.cc (Layout::get_output_section): Add order parameter.
4413         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4414         is_first_non_relro parameters.  Change all callers.
4415         (Layout::choose_output_section): Likewise.
4416         (Layout::add_output_section_data): Likewise.
4417         (Layout::make_output_section): Likewise.  Set order.
4418         (Layout::default_section_order): New function.
4419         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4420         * output.cc (Output_section::Output_section): Initialize order_.
4421         Don't initialize deleted fields.
4422         (Output_segment::Output_segment): Don't initialize deleted
4423         fields.
4424         (Output_segment::add_output_section_to_load): New function
4425         replacing add_output_section.  Change all callers to call this or
4426         add_output_section_to_nonload.
4427         (Output_segment::add_output_section_to_nonload): New function.
4428         (Output_segment::remove_output_section): Rewrite.
4429         (Output_segment::add_initial_output_data): Likewise.
4430         (Output_segment::has_any_data_sections): Likewise.
4431         (Output_segment::is_first_section_relro): Likewise.
4432         (Output_segment::maximum_alignment): Likewise.
4433         (Output_segment::has_dynamic_reloc): New function replacing
4434         dynamic_reloc_count.  Change all callers.
4435         (Output_segment::has_dynamic_reloc_list): New function replacing
4436         dynamic_reloc_count_list.  Change all callers.
4437         (Output_segment::set_section_addresses): Rewrite.
4438         (Output_segment::set_offset): Rewrite.
4439         (Output_segment::find_first_and_last_list): Remove.
4440         (Output_segment::set_tls_offsets): Rewrite.
4441         (Output_segment::first_section_load_address): Likewise.
4442         (Output_segment::output_section_count): Likewise.
4443         (Output_segment::section_with_lowest_load_address): Likewise.
4444         (Output_segment::write_section_headers): Likewise.
4445         (Output_segment::print_sections_to_map): Likewise.
4446         * output.h (class Output_data): Remove dynamic_reloc_count_
4447         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4448         (Output_data::add_dynamic_reloc): Rewrite.
4449         (Output_data::has_dynamic_reloc): New function.
4450         (Output_data::dynamic_reloc_count): Remove.
4451         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4452         is_last_relro_, is_first_non_relro_, is_interp_,
4453         is_dynamic_linker_section_ fields.  Add order and set_order
4454         functions.  Remove is_relro_local, set_is_relro_local,
4455         is_last_relro, set_is_last_relro, is_first_non_relro,
4456         set_is_first_non_relro functions, is_interp, set_is_interp,
4457         is_dynamic_linker_section, and set_is_dynamic_linker_section
4458         functions.
4459         (class Output_segment): Change Output_data_list from std::list to
4460         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4461         output_bss_ fields.  Update declarations.
4462
4463 2010-08-02  Ian Lance Taylor  <iant@google.com>
4464
4465         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4466         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4467         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4468
4469 2010-08-02  Ian Lance Taylor  <iant@google.com>
4470
4471         PR 11855
4472         * script.cc (Script_options::Script_options): Initialize
4473         symbol_definitions_ and symbol_references_.
4474         (Script_options::add_symbol_assignment): Update
4475         symbol_definitions_ and symbol_references_.
4476         (Script_options::add_symbol_reference): New function.
4477         (script_symbol): New function.
4478         * script.h (class Script_options): Add symbol_definitions_ and
4479         symbol_references_ fields.
4480         (Script_options::referenced_const_iterator): New type.
4481         (Script_options::referenced_begin): New function.
4482         (Script_options::referenced_end): New function.
4483         (Script_options::is_referenced): New function.
4484         (Script_options::any_unreferenced): New function.
4485         * script-c.h (script_symbol): Declare.
4486         * yyscript.y (exp): Call script_symbol.
4487         * symtab.cc: Include "script.h".
4488         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4489         Change all callers.  Check symbols referenced by scripts.
4490         (Symbol_table::add_undefined_symbols_from_command_line): Add
4491         layout parameter.  Change all callers.
4492         (Symbol_table::do_add_undefined_symbols_from_command_line):
4493         Likewise.  Break out loop body.  Check symbols referenced by
4494         scripts.
4495         (Symbol_table::add_undefined_symbol_from_command_line): New
4496         function broken out of
4497         do_add_undefined_symbols_from_command_line.
4498         * symtab.h (class Symbol_table): Update declarations.
4499         * archive.cc: Include "layout.h".
4500         (Archive::should_include_member): Add layout parameter.  Change
4501         all callers.  Check for symbol mentioned in expression.
4502         * archive.h (class Archive): Update declaration.
4503         * object.cc (Sized_relobj::do_should_include_member): Add layout
4504         parameter.
4505         * object.h (Object::should_include_member): Add layout parameter.
4506         Change all callers.
4507         (Object::do_should_include_member): Add layout parameter.
4508         (class Sized_relobj): Update declaration.
4509         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4510         parameter.
4511         * dynobj.h (class Sized_dynobj): Update declaration.
4512         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4513         layout parameter.
4514         * plugin.h (class Sized_pluginobj): Update declaration.
4515
4516 2010-08-02  Ian Lance Taylor  <iant@google.com>
4517
4518         PR 11866
4519         * output.cc (Output_segment::set_offset): Search for the first and
4520         last sections rather than assuming that the list is in order.
4521         (Output_segment::find_first_and_last_list): New function.
4522         * output.h (class Output_segment): Update declarations.
4523         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4524         (relro_strip_test_SOURCES): New variable.
4525         (relro_strip_test_DEPENDENCIES): New variable.
4526         (relro_strip_test_LDFLAGS): New variable.
4527         (relro_strip_test_LDADD): New variable.
4528         (relro_strip_test.so): New target.
4529
4530 2010-08-02  Ian Lance Taylor  <iant@google.com>
4531
4532         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4533         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4534         (Target_i386::got_tlsdesc_section): New function.
4535         (Target_i386::got_section): Create space for GOT entries for
4536         TLSDESC relocations.
4537         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4538         R_386_TLS_GOTDESC.
4539         (Target_i386::Scan::global): Likewise.
4540         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4541         using TLSDESC GOT.
4542         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4543         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4544         (Target_x86_64::got_tlsdesc_section): New function.
4545         (Target_x86_64::got_section): Create space for GOT entries for
4546         TLSDESC relocations.
4547         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4548         R_386_TLS_GOTDESC.
4549         (Target_x86_64::Scan::global): Likewise.
4550         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4551         using TLSDESC GOT.
4552
4553 2010-08-02  Ian Lance Taylor  <iant@google.com>
4554
4555         * testsuite/final_layout.sh: Use dc to convert from hex to
4556         decimal.
4557
4558 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4559
4560         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4561         paramter to the call to gold::gc_process_relocs.
4562         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4563         paramter to the call to gold::gc_process_relocs.
4564         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4565         parameter to the call to gold::gc_process_relocs.
4566         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4567         template parameter to the call to gold::gc_process_relocs.
4568         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4569         paramter to the call to gold::gc_process_relocs.
4570         * gc.h (get_embedded_addend_size): New function.
4571         (gc_process_relocs): Save the size of the reloc for use by ICF.
4572         * icf.cc (get_section_contents): Get the addend from the text section
4573         for SHT_REL relocation sections.
4574         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4575         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4576         * int_encoding.h (read_from_pointer): New overloaded function.
4577         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4578         * testsuite/icf_sht_rel_addend_test.sh: New file.
4579         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4580         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4581
4582 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4583
4584         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4585         * Makefile.in: Regenerate.
4586         * testsuite/Makefile.in: Regenerate.
4587
4588 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4589
4590         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4591         * gold/testsuite/debug_msg.cc: Likewise.
4592         * gold/testsuite/odr_violation1.cc
4593         * gold/testsuite/odr_violation2.cc
4594
4595 2010-07-21  Cary Coutant  <ccoutant@google.com>
4596
4597         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4598         string, and length fields.
4599         (Output_merge_string::Merged_strings_list): New type.
4600         (Output_merge_string::Merged_strings_lists): New typedef.
4601         (Output_merge_string): Replace merged_strings_ with
4602         merged_strings_lists_.
4603         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4604         Merged_strings_list per input object and section.  Don't store pointer
4605         to the string.  Don't store length with each merged string entry.
4606         (Output_merge_string::finalize_merged_data): Loop over list of merged
4607         strings lists.  Recompute length of each merged string.
4608
4609 2010-07-15  Cary Coutant  <ccoutant@google.com>
4610
4611         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4612         here.
4613
4614 2010-07-14  Ian Lance Taylor  <iant@google.com>
4615
4616         * descriptors.cc (Descriptors::open): Report correct name in error
4617         message.
4618
4619 2010-07-13  Doug Kwan  <dougkwan@google.com>
4620
4621         * arm.cc (Arm_input_section::Arm_input_section): For a
4622         SHT_ARM_EXIDX section, always keeps the input sections.
4623         (Arm_input_section::set_exidx_section_link): New method.
4624         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4625         has_errors_ to false.
4626         (Arm_exidx_input_section::has_errors,
4627         Arm_exidx_input_section::set_has_errors): New methods.
4628         (Arm_exidx_input_section::has_errors_): New data member.
4629         (Arm_relobj::get_exidx_shndx_list): New method.
4630         (Arm_output_section::append_text_sections_to_list): Do not skip
4631         section without SHF_EXECINSTR.
4632         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4633         errors.
4634         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4635         section header.  Make error messages more verbose.  Check for
4636         a non-executable section linked to an EXIDX section.
4637         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4638         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4639         check that there is no deferred EXIDX section if we exit early.
4640         Instead of not making an EXIDX section in case of an error, make one
4641         and set the has_errors flag of it.
4642         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4643         in a relocatable link.
4644         (Target_arm::do_relax): Look for the EXIDX output section instead of
4645         assuming that it is called .ARM.exidx.
4646         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4647         section list.  Do not check for SHF_EXECINSTR section flags but
4648         skip any input section with errors.
4649         * output.cc (Output_section::Output_section): Initialize
4650         always_keeps_input_sections_ to false.
4651         (Output_section::add_input_section): Check for
4652         always_keeps_input_sections_.
4653         *  output.h (Output_section::always_keeps_input_sections,
4654         Output_section::set_always_keeps_input_sections): New methods.
4655         (Output_section::always_keeps_input_sections): New data member.
4656
4657 2010-07-13  Rafael Espindola  <espindola@google.com>
4658
4659         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4660         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4661
4662 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4663             Ian Lance Taylor  <iant@google.com>
4664
4665         * output.h (Output_section_lookup_maps::add_merge_section):
4666         Correct check of whether value was inserted.
4667         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4668         (Output_section_lookup_maps::add_relaxed_input_section):
4669         Likewise.
4670         * arm.cc (Target_arm::got_section): Remove used local os.
4671         * i386.cc (Target_i386::got_section): Likewise.
4672         * x86_64.cc (Target_x86_64::got_section): Likewise.
4673         * sparc.cc (Target_sparc::got_section): Likewise.
4674         (Target_sparc::relocate): Remove unused local have_got_offset.
4675         * powerpc.cc (Target_powerpc::relocate): Likewise.
4676
4677 2010-07-13  Ian Lance Taylor  <iant@google.com>
4678
4679         * compressed_output.cc (zlib_decompress): Fix signature in
4680         !HAVE_ZLIB_H case.
4681
4682         * archive.cc (Archive::include_member): Unlock an external member
4683         of a thin archive.  Don't bother to delete an object we know is
4684         NULL.
4685
4686 2010-07-12  Cary Coutant  <ccoutant@google.com>
4687
4688         * compressed_output.cc (zlib_decompress): New function.
4689         (get_uncompressed_size): New function.
4690         (decompress_input_section): New function.
4691         * compressed_output.h (get_uncompressed_size): New function.
4692         (decompress_input_section): New function.
4693         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4694         Handle compressed debug sections.
4695         * layout.cc (is_compressed_debug_section): New function.
4696         (Layout::output_section_name): Map compressed section names to
4697         canonical names.
4698         * layout.h (is_compressed_debug_section): New function.
4699         (is_debug_info_section): Recognize compressed debug sections.
4700         * merge.cc: Include compressed_output.h.
4701         (Output_merge_data::do_add_input_section): Handle compressed
4702         debug sections.
4703         (Output_merge_string::do_add_input_section): Handle compressed
4704         debug sections.
4705         * object.cc: Include compressed_output.h.
4706         (Sized_relobj::Sized_relobj): Initialize new data members.
4707         (build_compressed_section_map): New function.
4708         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4709         * object.h (Object::section_is_compressed): New method.
4710         (Object::do_section_is_compressed): New method.
4711         (Sized_relobj::Compressed_section_map): New type.
4712         (Sized_relobj::do_section_is_compressed): New method.
4713         (Sized_relobj::compressed_sections_): New data member.
4714         * output.cc (Output_section::add_input_section): Handle compressed
4715         debug sections.
4716         * reloc.cc: Include compressed_output.h.
4717         (Sized_relobj::write_sections): Handle compressed debug sections.
4718
4719 2010-07-08  Cary Coutant  <ccoutant@google.com>
4720
4721         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4722         weak when resolving to a dynamic def.
4723         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4724         for weak undef/dynamic def cases. Adjust callers.
4725         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4726         undef_binding_weak_.
4727         (Symbol_table::sized_write_globals): Adjust symbol binding.
4728         (Symbol_table::sized_write_symbol): Add binding parameter.
4729         * symtab.h (Symbol::set_undef_binding): New method.
4730         (Symbol::is_undef_binding_weak): New method.
4731         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4732         (Symbol_table::should_override): Add new parameter.
4733         (Symbol_table::sized_write_symbol): Add new parameter.
4734
4735         * testsuite/weak_undef_file1.cc: Add new test case.
4736         * testsuite/weak_undef_file2.cc: Fix header comment.
4737         * testsuite/weak_undef_test.cc: Add new test case.
4738
4739 2010-06-29  Doug Kwan  <dougkwan@google.com>
4740
4741         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4742         Initialize USE_SYMBOL_.
4743         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4744         definition.
4745         (Arm_reloc_property::uses_symbol_): New data member declaration.
4746         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4747         uses symbol value and symbol is undefined but not weakly undefined.
4748
4749 2010-06-28  Rafael Espindola  <espindola@google.com>
4750
4751         * plugin.cc (Plugin::load): Use dlerror.
4752
4753 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4754
4755         * symtab.cc (detect_odr_violations): When reporting an ODR
4756         violation, report an object where the symbol is defined.
4757
4758 2010-06-25  Doug Kwan  <dougkwan@google.com>
4759
4760         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4761         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4762         definition.
4763         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4764         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4765         target hook to detect function points.
4766         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4767         * icf.h (Icf::check_section_for_function_pointers): Change type of
4768         parameter SECTION_NAME to const reference to std::string.  Use
4769         target hook to determine if section may have unsafe pointers.
4770         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4771         method definition.
4772
4773 2010-06-21  Rafael Espindola  <espindola@google.com>
4774
4775         * fileread.cc (Input_file::find_fie): New
4776         (Input_file::open): Use Input_file::find_fie.
4777         * fileread.h (Input_file::find_fie): New
4778         * plugin.cc (set_extra_library_path): New.
4779         (Plugin::load): Add set_extra_library_path to the transfer vector.
4780         (Plugin_manager::set_extra_library_path): New.
4781         (Plugin_manager::add_input_file): Use the extra search path if set.
4782         (set_extra_library_path(): New.
4783         * plugin.h (Plugin_manager): Add set_extra_library_path and
4784         extra_search_path_.
4785
4786 2010-06-19  Cary Coutant  <ccoutant@google.com>
4787
4788         * layout.cc (gdb_sections): Add .debug_types.
4789         (lines_only_debug_sections): Likewise.
4790
4791 2010-06-18  Rafael Espindola  <espindola@google.com>
4792
4793         * plugin.cc (add_input_file,add_input_library)
4794         (Plugin_manager::add_input_file): Make filename arguments const.
4795         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4796         const.
4797
4798 2010-06-16  Doug Kwan  <dougkwan@google.com>
4799
4800         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4801         .ARM.attributes section if we have not merged any input
4802         attributes sections.
4803
4804 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4805
4806         * arm.cc: Allow combining objects with no EABI version
4807         information.
4808
4809 2010-06-15  Rafael Espindola  <espindola@google.com>
4810
4811         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4812
4813 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4814
4815         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4816         (struct iovec): Correct !HAVE_READV definition.
4817
4818 2010-06-10  Cary Coutant  <ccoutant@google.com>
4819
4820         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4821         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4822         reloc sections.
4823         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4824
4825         PR 11683
4826         * symtab.h (Symbol::is_placeholder): New member function.
4827         * target-reloc.h (relocate_section): Check for placeholder symbols.
4828
4829         * testsuite/Makefile.am (plugin_test_8): New test.
4830         (plugin_test_9): New test.
4831         * testsuite/Makefile.in: Regenerate.
4832
4833 2010-06-09  Nick Clifton  <nickc@redhat.com>
4834
4835         * yyscript.y (input_list_element): Allow strings prefixed with
4836         the '-' character.  Treat these as libraries.
4837         * script.cc (script_add_library): New function.  Adds a library
4838         specified by "-l<name>" found in an input script.
4839         * script-c.h: Add prototype for script_add_library.
4840
4841 2010-06-07  Doug Kwan  <dougkwan@google.com>
4842
4843         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4844         Restrict stub-group size to be within long conditional branch
4845         range when working around cortex-A8 erratum.
4846
4847 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4848
4849         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4850         #ifdef typo.
4851
4852 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4853
4854         PR gold/11658
4855         * output.cc
4856         (Output_section::Input_section_sort_entry::compare_section_ordering):
4857         Change to return non-zero correctly.
4858         (Output_section::Input_section_sort_section_order_index_compare
4859         ::operator()): Change to fix ambiguity in comparisons.
4860
4861 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4862
4863         * gold.h (is_wildcard_string): New function.
4864         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4865         (Layout::layout_eh_frame): Ditto.
4866         (Layout::find_section_order_index): New method.
4867         (Layout::read_layout_from_file): New method.
4868         * layout.h (Layout::find_section_order_index): New method.
4869         (Layout::read_layout_from_file): New method.
4870         (Layout::input_section_position_): New private member.
4871         (Layout::input_section_glob_): New private member.
4872         * main.cc (main): Call read_layout_from_file here.
4873         * options.h (--section-ordering-file): New option.
4874         * output.cc (Output_section::input_section_order_specified_): New
4875         member.
4876         (Output_section::Output_section): Initialize new member.
4877         (Output_section::add_input_section): Add new parameter.
4878         Keep input sections when --section-ordering-file is used.
4879         (Output_section::set_final_data_size): Sort input sections when
4880         section ordering file is specified.
4881         (Output_section::Input_section_sort_entry): Add new parameter.
4882         Check sorting type.
4883         (Output_section::Input_section_sort_entry::compare_section_ordering):
4884         New method.
4885         (Output_section::Input_section_sort_compare::operator()): Change to
4886         consider section_order_index.
4887         (Output_section::Input_section_sort_init_fini_compare::operator()):
4888         Change to consider section_order_index.
4889         (Output_section::Input_section_sort_section_order_index_compare
4890         ::operator()): New method.
4891         (Output_section::sort_attached_input_sections): Change to sort
4892         according to section order when specified.
4893         (Output_section::add_input_section<32, true>): Add new parameter.
4894         (Output_section::add_input_section<64, true>): Add new parameter.
4895         (Output_section::add_input_section<32, false>): Add new parameter.
4896         (Output_section::add_input_section<64, false>): Add new parameter.
4897         * output.h (Output_section::add_input_section): Add new parameter.
4898         (Output_section::input_section_order_specified): New
4899         method.
4900         (Output_section::set_input_section_order_specified): New method.
4901         (Input_section::Input_section): Initialize section_order_index_.
4902         (Input_section::section_order_index): New method.
4903         (Input_section::set_section_order_index): New method.
4904         (Input_section::section_order_index_): New member.
4905         (Input_section::Input_section_sort_section_order_index_compare): New
4906         struct.
4907         (Output_section::input_section_order_specified_): New member.
4908         * script-sections.cc (is_wildcard_string): Delete and move modified
4909         method to gold.h.
4910         (Output_section_element_input::Output_section_element_input): Modify
4911         call to is_wildcard_string.
4912         (Output_section_element_input::Input_section_pattern
4913         ::Input_section_pattern): Ditto.
4914         (Output_section_element_input::Output_section_element_input): Ditto.
4915         * testsuite/Makefile.am (final_layout): New test case.
4916         * testsuite/Makefile.in: Regenerate.
4917         * testsuite/final_layout.cc: New file.
4918         * testsuite/final_layout.sh: New file.
4919
4920 2010-06-01  Rafael Espindola  <espindola@google.com>
4921
4922         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4923
4924 2010-06-01  Rafael Espindola  <espindola@google.com>
4925
4926         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4927         visibility of symbols.
4928
4929 2010-05-27  Doug Kwan  <dougkwan@google.com>
4930
4931         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4932         from start of output section instead of address for a local symbol
4933         in a merged or relaxed section when doing a relocatable link.
4934
4935 2010-05-26  Rafael Espindola  <espindola@google.com>
4936
4937        PR 11604
4938         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4939         adding sections the garbage collector removed.
4940         * gold/testsuite/Makefile.am: Add test.
4941         * gold/testsuite/Makefile.in: Regenerate.
4942         * gold/testsuite/plugin_test_7.sh: New.
4943         * gold/testsuite/plugin_test_7_1.c: New.
4944         * gold/testsuite/plugin_test_7_2.c: New.
4945
4946 2010-05-26  Rafael Espindola  <espindola@google.com>
4947
4948         * script-sections.cc (Output_section_definition::set_section_addresses):
4949         Check for --section-start.
4950
4951 2010-05-26  Doug Kwan  <dougkwan@google.com>
4952
4953         * arm.cc (Arm_scan_relocatable_relocs): New class.
4954         (Target_arm::relocate_special_relocatable): New method.
4955         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4956         (Arm_relocate_functions::thumb_branch_common): Same.
4957         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4958         instead of Default_scan_relocatable_relocs.
4959         * target-reloc.h (relocate_for_relocatable): Let target handle
4960         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4961         * target.h (Sized_target::relocate_special_relocatable): New method.
4962
4963 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4964
4965         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4966
4967 2010-05-23  Doug Kwan  <dougkwan@google.com>
4968
4969         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4970         instead of a cast.
4971         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4972         with a direct branch, not a conditional branch, to a stub.
4973         * merge.cc (Output_merge_base::record_input_section): New method
4974         defintion.
4975         (Output_merge_data::do_add_input_section): Record input section if
4976         keeps-input-sections flag is set.
4977         (Output_merge_string::do_add_input_section): Ditto.
4978         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4979         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4980         INPUT_SECTIONS_.
4981         (Output_merge_base::keeps_input_sections,
4982         Output_merge_base::set_keeps_input_sections,
4983         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4984         method definitions.
4985         (Output_merge_base::Input_sections): New type declaration.
4986         (Output_merge_base::input_sections_begin,
4987         Output_merge_base::input_sections_end,
4988         Output_merge_base::do_set_keeps_input_sections): New method definitions.
4989         (Output_merge_base::bool keeps_input_sections_,
4990         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4991         Output_merge_base::input_sections_): New data members.
4992         (Output_merge_data::do_set_keeps_input_sections): New method
4993         defintion.
4994         (Output_merge_string::do_set_keeps_input_sections): Ditto.
4995         * output.cc (Output_section::Input_section::relobj): Move method
4996         defintion from class declaration to here and handle merge sections.
4997         (Output_section::Input_section::shndx): Ditto.
4998         (Output_section::Output_section): Remove initializations of removed
4999         data members and initialize new data member LOOKUP_MAPS_.
5000         (Output_section::add_input_section): Set keeps-input-sections flag
5001         for a newly created merge output section as appropriate.  Adjust code
5002         to use Output_section_lookup_maps class.
5003         (Output_section::add_relaxed_input_section): Adjst code for lookup
5004         maps code refactoring.
5005         (Output_section::add_merge_input_section): Add a new parameter
5006         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5007         class.  If adding input section to a newly created merge output
5008         section fails, remove the new merge section.
5009         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5010         Adjust code for use of the Output_section_lookup_maps class.
5011         (Output_section::find_merge_section): Ditto.
5012         (Output_section::build_lookup_maps): New method defintion.
5013         (Output_section::find_relaxed_input_section): Adjust code to use
5014         Output_section_lookup_maps class.
5015         (Output_section::get_input_sections): Export merge sections.  Adjust
5016         code to use Output_section_lookup_maps class.
5017         (Output_section:::add_script_input_section): Adjust code to use
5018         Output_section_lookup_maps class.  Update lookup maps for merge
5019         sections also.
5020         (Output_section::discard_states): Use Output_section_lookup_maps.
5021         (Output_section::restore_states): Same.
5022         * output.h (Merge_section_properties): Move class defintion out of
5023         Output_section.
5024         (Output_section_lookup_maps): New class.
5025         (Output_section::Input_section::is_merge_section): New method
5026         defintion.
5027         (Output_section::Input_section::relobj): Move defintion out of class
5028         defintion.  Declare method only.
5029         (Output_section::Input_section::shndx): Ditto.
5030         (Output_section::Input_section::output_merge_base): New method defintion.
5031         (Output_section::Input_section::u2_.pomb): New union field.
5032         (Output_section::Merge_section_by_properties_map,
5033         Output_section::Output_section_data_by_input_section_map,
5034         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5035         Remove types.
5036         (Output_section::add_merge_input_section): Add new parameter
5037         KEEPS_INPUT_SECTIONS.
5038         (Output_section::build_lookup_maps): New method declaration.
5039         (Output_section::merge_section_map_,
5040         Output_section::merge_section_by_properties_map_,
5041         Output_section::relaxed_input_section_map_,
5042         Output_section::is_relaxed_input_section_map_valid_): Remove data
5043         members.
5044         (Output_section::lookup_maps_): New data member.
5045
5046 2010-05-21  Doug Kwan  <dougkwan@google.com>
5047
5048         PR gold/11619
5049         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5050         avoid a compilation error.
5051
5052 2010-05-19  Rafael Espindola  <espindola@google.com>
5053
5054         * script-sections.cc (Output_section_definition::allocate_to_segment):
5055         Update the phdrs_list even when the output section is NULL.
5056         * testsuite/Makefile.am: Add test.
5057         * testsuite/Makefile.in: Regenerate.
5058         * testsuite/script_test_9.cc: New.
5059         * testsuite/script_test_9.sh: New.
5060         * testsuite/script_test_9.t: New.
5061
5062 2010-05-19  Doug Kwan  <dougkwan@google.com>
5063
5064         * arm.cc (Arm_input_section::original_size): New method.
5065         (Arm_input_section::do_addralign): Add a cast.
5066         (Arm_input_section::do_output_offset): Remove static cast.
5067         (Arm_input_section::original_addralign,
5068          Arm_input_section::original_size_): Change type to uint32_t.
5069         (Arm_input_section::init): Add safe casts for section alignment
5070         and size.
5071         (Arm_input_section::set_final_data_size): Do not set address and
5072         offset of stub table.
5073         (Arm_output_section::fix_exidx_coverage): Change use of of
5074         Output_section::Simple_input_section to that of
5075         Output_section::Input_section.
5076         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5077         except for the first pass.
5078         * output.cc (Output_section::get_input_sections): Change type of
5079         input_sections to std::list<Input_section>.
5080         (Output_section::add_script_input_section): Rename from
5081         Output_section::add_simple_input_section.  Change type of SIS
5082         parameter from Simple_input_section to Input_section.
5083         * output.h (Output_section::Simple_input_section): Remove class.
5084         (Output_section::Input_section): Change class visibility to public.
5085         (Output_section::Input_section::addralign): Use stored alignments
5086         for special input sections if set.
5087         (Output_section::Input_section::set_addralign): New method.
5088         (Output_section::get_input_sections): Change parameter type from
5089         list of Simple_input_section to list of Input_section.
5090         (Output_section::add_script_input_section): Rename from
5091         Output_section::add_simple_input_section. Change first parameter's
5092         type from Simple_input_section to Input_section and remove the
5093         second and third parameters.
5094         * script-sections.cc (Input_section::Input_section_list): Change
5095         type to list of Output_section::Input_section/
5096         (Input_section_info::Input_section_info): Change parameter type of
5097         INPUT_SECTION to Output_section::Input_section.
5098         (Input_section_info::input_section): Change return type.
5099         (Input_section_info::input_section_): Change type to
5100         Output_section::Input_section.
5101         (Output_section_element_input::set_section_addresses): Adjust code
5102         to use Output_section::Input_section instead of
5103         Output_section::Simple_input_section.  Adjust code for renaming
5104         of Output_section::add_simple_input_section.
5105         (Orphan_output_section::set_section_addresses): Ditto.
5106
5107 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5108
5109         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5110         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5111
5112 2010-05-18  Rafael Espindola  <espindola@google.com>
5113
5114         * options.cc (General_options::finalize): Handle -nostdlib.
5115         * options.h (nostdlib): New option.
5116         * script.cc (script_add_search_dir): Handle -nostdlib.
5117
5118 2010-05-12  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5121         attributes section only if there no attributes section after merging.
5122         (Target_arm::merge_object_attributes): Move value of
5123         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5124         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5125         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5126         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5127         and arm_attr_merge_7.stdout.
5128         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5129         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5130         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5131         arm_attr_merge_7b.o): New rules.
5132         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5133         arm_attr_merge_7
5134         * testsuite/Makefile.in: Regenerate.
5135         * testsuite/arm_attr_merge.sh: New file.
5136         * testsuite/arm_attr_merge_[67][ab].s: Same.
5137
5138 2010-05-05  Nick Clifton  <nickc@redhat.com>
5139
5140         * po/es.po: Updated Spanish translation.
5141
5142 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5143
5144         * Makefile.am (install-exec-local): Properly install gold as
5145         default cross linker.
5146         * Makefile.in: Regenerated.
5147
5148 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5149             Nick Clifton  <nickc@redhat.com>
5150
5151         * configure.ac (install_as_default): Define and set to false
5152         unless --enable-gold or --enable-gold=both/gold has been
5153         specified.
5154         * configure: Regenerate.
5155
5156         * Makefile.am (install-exec-local): Install the executable as
5157         'ld.gold'.  If install_as_default is true then also install it as
5158         'ld'.
5159         * Makefile.in: Regenerated.
5160
5161 2010-04-24  Ian Lance Taylor  <iant@google.com>
5162
5163         * layout.cc (Layout::layout_reloc): In relocatable link don't
5164         combine reloc sections for grouped sections.
5165
5166 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5167
5168         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5169         sections that are not ordinary to icf.
5170         * icf.cc (get_section_contents): Handle relocation pointing to section
5171         with no object or shndx information.
5172         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5173         * testsuite/Makefile.in: Regenerate.
5174         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5175         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5176
5177 2010-04-22  Ian Lance Taylor  <iant@google.com>
5178
5179         * expression.cc (Expression::Expression_eval_info): Add
5180         result_alignment_pointer field.
5181         (Expression::eval_with_dot): Add result_alignment_pointer
5182         parameter.  Change all callers.
5183         (Expression::eval_maybe_dot): Likewise.
5184         (class Binary_expression): Add alignment_pointer parameter to
5185         left_value and right_value.  Change all callers.
5186         (BINARY_EXPRESSION): Set result alignment.
5187         (class Trinary_expression): Add alignment_pointer parameter to
5188         arg2_value and arg3_value.  Change all callers.
5189         (Trinary_cond::value): Set result alignment.
5190         (Max_expression::value, Min_expression::value): Likewise.
5191         (Align_expression::value): Likewise.
5192         * script-sections.cc (class Sections_element): Add dot_alignment
5193         parameter to set_section_addresses virtual function.  Update
5194         instantiations.
5195         (class Output_section_element): Likewise.
5196         (Script_sections::create_segments): Add dot_alignment parameter.
5197         Change all callers.
5198         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5199         (Script_sections::set_phdrs_clause_addresses): Likewise.
5200         * script-sections.h: Update declarations.
5201         * script.h: Update declarations.
5202         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5203         min_p_align.
5204         * testsuite/script_test_3.t: Set large alignment.
5205         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5206         segment has expected alignment.
5207
5208 2010-04-22  Nick Clifton  <nickc@redhat.com>
5209
5210         * po/gold.pot: Updated by the Translation project.
5211         * po/vi.po: Updated Vietnamese translation.
5212
5213 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5214
5215         * testsuite/Makefile.am (check_PROGRAMS): Add
5216         icf_virtual_function_folding_test.
5217         * testsuite/Makefile.in: Regenerated.
5218
5219 2010-04-15  Andrew Haley  <aph@redhat.com>
5220
5221         * options.h (merge_exidx_entries): New option.
5222         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5223         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5224         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5225         (Target_arm::merge_exidx_entries): New function.
5226         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5227         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5228         to Arm_exidx_fixup constructor.
5229         Add new arg, merge_exidx_entries.
5230         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5231         Arm_output_section::fix_exidx_coverage.
5232
5233 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5234
5235         * icf.cc (get_section_contents): Check for preemptible functions.
5236         Ignore addend when appropriate.
5237         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5238         section folded.
5239         (add_from_relobj): Check for section folded.
5240         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5241         * symtab.h (should_add_dynsym_entry): Add new parameter.
5242         * target-reloc.h (scan_relocs): Check for section folded.
5243         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5244         Check reloc types for function pointers in shared objects.
5245         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5246         case.
5247         (icf_preemptible_functions_test): New test case.
5248         (icf_string_merge_test): New test case.
5249         * testsuite.Makefile.in: Regenerate.
5250         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5251         bar_glob.  Refactor code.
5252         * testsuite/icf_preemptible_functions_test.cc: New file.
5253         * testsuite/icf_preemptible_functions_test.sh: New file.
5254         * testsuite/icf_string_merge_test.cc: New file.
5255         * testsuite/icf_string_merge_test.sh: New file.
5256         * testsuite/icf_virtual_function_folding_test.cc: New file.
5257         * testsuite/icf_virtual_function_folding_test.sh: New file.
5258
5259 2010-04-14  Doug Kwan  <dougkwan@google.com>
5260
5261         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5262         for local symbol recounting if we remove a section due to ICF.
5263         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5264         there are no regular objects in input.
5265
5266 2010-04-13  Doug Kwan  <dougkwan@google.com>
5267
5268         * arm.cc (Arm_input_section::set_final_data_size): Compute
5269         accurate final data size instead of using current data size.
5270
5271 2010-04-09  Doug Kwan  <dougkwan@google.com>
5272
5273         * layout.cc (Layout::choose_output_section): Handle script section
5274         types.
5275         (Layout::make_output_section_for_script): Add section type parameter.
5276         Handle script section types.
5277         * layout.h (Layout::make_output_section_for_script): Add section
5278         type parameter.
5279         * output.cc (Output_section::Output_section): Initialize data member
5280         is_noload_.
5281         (Output_section::do_reset_address_and_file_offset): Do not set address
5282         to 0 if section is a NOLOAD section.
5283         * output.h (Output_section::is_noload): New method.
5284         (Output_section::set_is_noload): Ditto.
5285         (Output_section::is_noload_): New data member.
5286         * script-c.h (Script_section_type): New enum type.
5287         (struct Parser_output_section_header): Add new file section_type.
5288         * script-sections.cc (Sections_element::output_section_name): Add
5289         parameter for returning script section type.
5290         (Output_section_definition::output_section_name): Ditto.
5291         (Output_section_definition::section_type)P; New method.
5292         (Output_section_definiton::script_section_type_name): Ditto.
5293         (Output_section_definition::script_section_type_): New data member.
5294         (Output_section_definition::Output_section_definition): Initialize
5295         data member Output_section_definition::script_section_type_.
5296         (Output_section_definition::create_sections): Pass script section type
5297         to Layout::make_output_section_for_script.
5298         (Output_section_definition::output_section_name): Return script
5299         section type to caller.
5300         (Output_section_definition::set_section_address): Do not advance
5301         dot value and load address if section type is NOLOAD.  Set address
5302         of NOLOAD sections regardless of section flags.
5303         (Output_section_definition::print): Print section type if it is
5304         not SCRIPT_SECTION_TYPE_NONE.
5305         (Output_section_definition::section_type): New method.
5306         (Output_section_definition::script_section_type_name): Ditto.
5307         (Script_sections::output_section_name): Add new parameter
5308         PSECTION_TYPE for returning script section type.  Pass it to
5309         section elements.  Handle discard sections.
5310         (Sort_output_sections::operator()): Handle NOLOAD sections.
5311         * script-sections.h (Script_sections::Section_type): New enum type.
5312         (Script_sections::output_section_name): Add a new parameter for
5313         returning script section type.
5314         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5315         INFO and NOLOAD.
5316         * yyscript.y (union): Add new field SECTION_TYPE.
5317         (COPY, DSECT, INFO, NOLOAD): New tokens.
5318         (opt_address_and_section_type): Change type to output_section_header.
5319         (section_type): New non-terminal
5320         (section_header): Handle section type.
5321         (opt_address_and_section_type): Return section type value.
5322
5323 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5324
5325         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5326         * testsuite/plugin_common_test_2.c (foo): Likewise.
5327
5328 2010-04-08  Doug Kwan  <dougkwan@google.com>
5329
5330         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5331         Output_merge_data.
5332         * output.cc (Output_section::add_merge_input_section): Simplify
5333         code and return status of Output_merge_base::add_input_section.
5334         Update merge section map only if Output_merge_base::add_input_section
5335         returns true.
5336
5337 2010-04-07  Doug Kwan  <dougkwan@google.com>
5338
5339         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5340         if section is marked as containing instructions but has no mapping
5341         symbols.
5342         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5343         correct section index.
5344         (Arm_relobj::find_linked_text_section): Ditto.
5345
5346 2010-04-07  Cary Coutant  <ccoutant@google.com>
5347
5348         * archive.cc (include_member): Destroy Read_symbols_data object before
5349         releasing file.
5350         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5351         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5352         (Read_symbols_data::~Read_symbols_data) New destructor.
5353         (Section_relocs::Section_relocs) New constructor.
5354         (Section_relocs::~Section_relocs) New destructor.
5355         (Read_relocs_data::Read_relocs_data) New constructor.
5356         (Read_relocs_data::~Read_relocs_data) New destructor.
5357         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5358         pointers to NULL after deleting.
5359
5360 2010-04-07  Doug Kwan  <dougkwan@google.com>
5361
5362         * arm.cc: Replace "endianity" with "endianness" in comments.
5363         (Arm_exidx_cantunwind): Ditto.
5364         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5365         (Arm_relobj::merge_flags_and_attributes): New method.
5366         (Arm_relobj::merge_flags_and_attributes_): New data member.
5367         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5368         (Arm_relobj::scan_sections_for_stubs): Ditto.
5369         (Arm_relobj::do_read_symbols): Check to see if we really want to
5370         merge processor-specific flags and attributes.  Exit early if
5371         an object is empty except for section names and the undefined symbol.
5372         (Target_arm::do_finalize_sections): Move check for ELF format to
5373         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5374         attributes from a regular object only when we have determined that
5375         it is aapropriate.  Do not create an .ARM.attributes section in
5376         output if there is no regular input object.
5377         (Target_arm::merge_processor_specific_flags): Check
5378         --warn-mismatch before printing any error.
5379         (Target_arm::merge_object_attributes): Ditto.
5380         * gold.cc (queue_middle_tasks): Handle the case in which there is
5381         no regular object in input.
5382         * options.cc (General_options::parse_EB): New method.
5383         (General_options::parse_EL): Same.
5384         (General_options::General_options): Initialize endianness_.
5385         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5386         New options.
5387         (General_options::Endianness): New enum.
5388         (General_options::endianness): New method.
5389         (General_options::endianness_): New data member.
5390         * parameters.cc (Parameters::set_options): Check target endianness.
5391         (Parameters::set_target_once): Ditto.
5392         (Parameters::check_target_endianness): New method.
5393         (parameters_force_valid_target): If either -EL or -EB is specified,
5394         use it to define endianness of default target.
5395         * parameters.h (Parameters::check_target_endianness): New method
5396         declaration.
5397         * target.h (class Target): Change "endianity" to "endianness"
5398         in comments.
5399
5400 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5401
5402         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5403         * configure: Regenerate.
5404         * Makefile.in: Regenerate.
5405         * testsuite/Makefile.in: Regenerate.
5406
5407 2010-04-06  Cary Coutant  <ccoutant@google.com>
5408
5409         gcc PR lto/42757
5410         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5411         prevailing definitions of common symbols.
5412         * testsuite/plugin_test_6.sh: New test case.
5413         * testsuite/plugin_common_test_1.c: New test case.
5414         * testsuite/plugin_common_test_2.c: New test case.
5415         * testsuite/Makefile.am (plugin_test_6): New test case.
5416         * testsuite/Makefile.in: Regenerate.
5417
5418 2010-04-06  Nick Clifton  <nickc@redhat.com>
5419
5420         * po/vi.po: New Vietnamese translation.
5421
5422 2010-03-30  Doug Kwan  <dougkwan@google.com>
5423
5424         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5425
5426 2010-03-25  Doug Kwan  <dougkwan@google.com>
5427
5428         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5429         to avoid a conversion warning on a 32-bit host.
5430
5431 2010-03-24  Ian Lance Taylor  <iant@google.com>
5432
5433         * testsuite/script_test_3.t: Add a TLS segment.
5434         * testsuite/Makefile.am (check_PROGRAMS): Add
5435         tls_phdrs_script_test.
5436         (tls_phdrs_script_test_SOURCES): Define.
5437         (tls_phdrs_script_test_DEPENDENCIES): Define.
5438         (tls_phdrs_script_test_LDFLAGS): Define.
5439         (tls_phdrs_script_test_LDADD): Define.
5440         * testsuite/Makefile.in: Rebuild.
5441
5442 2010-03-23  Cary Coutant  <ccoutant@google.com>
5443
5444         * fileread.cc (find_or_make_view): Fix comment.
5445
5446 2010-03-23  Ian Lance Taylor  <iant@google.com>
5447
5448         * script-sections.cc (class Orphan_section_placement): Define
5449         PLACE_TLS and PLACE_TLS_BSS.
5450         (Orphan_section_placement::Orphan_section_placement): Initialize
5451         new places.
5452         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5453         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5454         (tls_script_test_SOURCES): Define.
5455         (tls_script_test_DEPENDENCIES): Define.
5456         (tls_script_test_LDFLAGS): Define.
5457         (tls_script_test_LDADD): Define.
5458         * testsuite/Makefile.in: Rebuild.
5459
5460 2010-03-22  Doug Kwan  <dougkwan@google.com>
5461
5462         * arm.cc (Arm_relocate_functions::abs8,
5463         Arm_relocate_functions::abs16): Use correct check for overflow
5464         specified in the ARM ELF specs.
5465         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5466         target of a BLX instruction specially.
5467         (Reloc_stub::stub_type_for_reloc): Ditto.
5468         (Relocate::relocate): Use symbolic names instead of numeric relocation
5469         codes to report error.
5470         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5471         workaround.
5472         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5473         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5474         thumb2_blx_out_of_range.stdout
5475         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5476         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5477         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5478         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5479         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5480         thumb2_blx_in_range, thumb2_blx_in_range.o,
5481         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5482         thumb2_blx_out_of_range.o): New rules.
5483         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5484         thumb2_blx_in_range and thumb2_blx_out_of_range.
5485         * testsuite/Makefile.in: Regenerate.
5486         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5487         * testsuite/thumb_blx_in_range.s: New file.
5488         * testsuite/thumb_blx_out_of_range.s: New file.
5489
5490 2010-03-22  Rafael Espindola  <espindola@google.com>
5491
5492         * archive.cc (Should_include): Move to archive.h.
5493         (should_include_member): Make it a member of Archive.
5494         (Lib_group): New.
5495         (Add_lib_group_symbols): New.
5496         * archive.h: Include options.h.
5497         (Archive_member): Moved from Archive.
5498         (Should_include): Moved from archive.cc.
5499         (Lib_group): New.
5500         (Add_lib_group_symbols): New.
5501         * dynobj.cc (do_should_include_member): New.
5502         * dynobj.h (do_should_include_member): New.
5503         * gold.cc (queue_initial_tasks): Update call to queue.
5504         * main.cc (main): Print lib group stats.
5505         * object.cc (do_should_include_member): New.
5506         * object.h: Include archive.h.
5507         (Object::should_include_member): New.
5508         (Object::do_should_include_member): New.
5509         (Sized_relobj::do_should_include_member): New.
5510         * options.cc (General_options::parse_start_lib): New.
5511         (General_options::parse_end_lib): New.
5512         (Input_arguments::add_file): Handle lib groups.
5513         (Input_arguments::start_group): Check we are not in a lib.
5514         (Input_arguments::start_lib): New.
5515         (Input_arguments::end_lib): New.
5516         * options.h (General_options): Add start_lib and end_lib.
5517         (Input_argument::lib_): New.
5518         (Input_argument::lib): New.
5519         (Input_argument::is_lib): New.
5520         (Input_file_lib): New.
5521         (Input_arguments::in_lib_): New.
5522         (Input_arguments::in_lib): New.
5523         (Input_arguments::start_lib): New.
5524         (Input_arguments::end_lib_): New.
5525         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5526         in unused members as preempted.
5527         (Sized_pluginobj::do_should_include_member): New.
5528         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5529         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5530         return the blocker.
5531         (Read_symbols::do_whole_lib_group): New.
5532         (Read_symbols::do_lib_group): New.
5533         (Read_symbols::do_read_symbols): Handle lib groups.
5534         (Read_symbols::get_name): Handle lib groups.
5535         * readsyms.h (Read_symbols): Add an archive member pointer.
5536         (Read_symbols::do_whole_lib_group): New.
5537         (Read_symbols::do_lib_group): New.
5538         (Read_symbols::member_): New.
5539         * script.cc (read_input_script): Update call to queue_soon.
5540
5541 2010-03-19  Doug Kwan  <dougkwan@google.com>
5542
5543         * arm.cc (Stub_table::Stub_table): Initialize new data members
5544         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5545         (Stub_table::add_reloc_stub): Assign stub offset and update
5546         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5547         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5548         New data members.
5549         (Stub_table::update_data_size_and_addralign): Use
5550         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5551         instead of going over all reloc stubs.
5552         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5553         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5554         Stringpool_template::offset_ to size of Stringpool_char.
5555         (Stringpool_template::new_key_offset): Remove code to initialize
5556         Stringpool_template::offset_.
5557         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5558         Stringpool_template::offset_ to zero.
5559
5560 2010-03-15  Doug Kwan  <dougkwan@google.com>
5561
5562         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5563         offset_.
5564         (Stringpool_template::new_key_offset): New method.
5565         (Stringpool_template::add_string): Assign offsets when adding new
5566         strings.
5567         (Stringpool_template::set_string_offsets): Do not set string offsets
5568         when not optimizing.
5569         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5570         member size_.
5571         (Chunked_vector::clear): Clear size_.
5572         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5573         (Chunked_vector::size): Return size_.
5574         (Chunked_vector::push_back): Use size_ to find insert position.
5575         (Chunked_vector::size_): New data member.
5576         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5577         (Stringpool_template::new_key_offset): New method declaration.
5578         (Stringpool_template::offset_): New data member.
5579
5580 2010-03-15   Rafael Espindola  <espindola@google.com>
5581
5582         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5583         Add_symbols' constructor.
5584         * readsyms.h (Add_symbols): Remove the input_group member.
5585
5586 2010-03-10  Ian Lance Taylor  <iant@google.com>
5587
5588         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5589         target to ask whether a reference to a symbol requires a stack
5590         split.
5591         * target.h (Target::is_call_to_non_split): New function.
5592         (Target::do_is_call_to_non_split): Declare virtual function.
5593         * target.cc: Include "symtab.h".
5594         (Target::do_is_call_to_non_split): New function.
5595         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5596
5597 2010-03-10  Cary Coutant  <ccoutant@google.com>
5598
5599         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5600         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5601         (File_read::open[2]): Add whole_file_view_ to list of views.
5602         (File_read::make_view): Remove test of whole_file_view_.
5603         (File_read::find_or_make_view): Create whole_file_view_ if
5604         necessary.
5605         (File_read::clear_views): Replace bool parameter with enum;
5606         adjust all callers.  Don't delete views with permanent data;
5607         do delete cached views and views from archives if
5608         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5609         if clearing the corresponding view.
5610         * fileread.h (File_read::Clear_views_mode): New enum.
5611         (File_read::View::is_permanent_view): New method.
5612         (File_read::clear_views): Replace bool parameter
5613         with enum; adjust all callers.
5614         * options.h (General_options): Change keep_files_mapped option;
5615         add map_whole_files.
5616         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5617         releasing the file.
5618         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5619         the file.
5620
5621 2010-03-10  David S. Miller  <davem@davemloft.net>
5622
5623         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5624
5625 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5626
5627         * icf.cc (get_section_contents): Add '@' marker after processing the
5628         merge reloc.
5629
5630 2010-03-08  Doug Kwan  <dougkwan@google.com>
5631
5632         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5633         due to a conversion warning.
5634         (Arm_relobj::update_output_local_symbol_count): Check for local
5635         symbol with unset output index.
5636
5637 2010-03-05  Ian Lance Taylor  <iant@google.com>
5638
5639         * options.h (class General_options): Add --spare-dynamic-tags.
5640         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5641         --spare-dynamic-tags.
5642
5643 2010-03-05  Ian Lance Taylor  <iant@google.com>
5644
5645         * incremental.cc: Include "libiberty.h".
5646
5647 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5648
5649         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5650         function, is_info_ member.
5651         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5652         (Versions::Versions): Update caller.
5653         (Versions::define_base_version): Likewise.
5654         (Versions::add_def): Likewise.
5655
5656 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5657
5658         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5659         (Scan::possible_function_pointer_reloc): New function.
5660         (Scan::local_reloc_may_be_function_pointer): Change to call
5661         possible_function_pointer_reloc.
5662         (Scan::global_reloc_may_be_function_pointer): Ditto.
5663         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5664         relocations in ".data.rel.ro._ZTV" section.
5665         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5666         * testsuite/icf_safe_so_test.cc: Ditto.
5667         * testsuite/icf_safe_test.cc: Ditto.
5668         * testsuite/icf_safe_test.sh: Ditto.
5669
5670 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5671             Ian Lance Taylor  <iant@google.com>
5672
5673         * target-reloc.h (relocate_section): Check the symbol table index
5674         for -1U before setting the local symbol index.
5675         (scan_relocatable_relocs): If copying the relocation, record that
5676         the local symbol is required.
5677         * object.h (Symbol_value::is_output_symtab_index_set): New
5678         function.
5679         (Symbol_value::may_be_discarded_from_output_symtab): New
5680         function.
5681         (Symbol_value::has_output_symtab_entry): New function.
5682         (Symbol_value::needs_output_symtab_entry): Remove.
5683         (Symbol_value::output_symtab_index): Make sure the symbol index is
5684         set.
5685         (Symbol_value::set_output_symtab_index): Make sure the symbol
5686         index is not set.  Make sure the new index is valid.
5687         (Symbol_value::set_must_have_output_symtab_entry): New function.
5688         (Symbol_value::has_output_dynsym_entry): New function.
5689         (Symbol_value::set_output_dynsym_index): Make sure the new index
5690         is valid.
5691         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5692         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5693         local symbol if permitted.
5694         (Sized_relobj::do_finalize_local_symbols): Call
5695         is_output_symtab_index_set rather than needs_output_symtab_entry.
5696         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5697         rather than needs_output_symtab_entry.  Call
5698         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5699         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5700         is_output_symtab_index_set rather than needs_output_symtab_entry.
5701         * testsuite/discard_locals_relocatable_test.c: New file.
5702         * testsuite/discard_locals_test.sh: Test -r.
5703         * testsuite/Makefile.am (check_DATA): Add
5704         discard_locals_relocatable_test1.syms,
5705         discard_local_relocatable_test2.syms.
5706         (MOSTLYCLEANFILES): Likewise.  Also add
5707         discard_locals_relocatable_test1.lout and
5708         discard_locals_relocatable_test2.out.
5709         (discard_locals_relocatable_test1.syms): New target.
5710         (discard_locals_relocatable_test.o): New target.
5711         (discard_locals_relocatable_test1.out): New target.
5712         (discard_locals_relocatable_test2.syms): New target.
5713         (discard_locals_relocatable_test2.out): New target.
5714         (various): Add missing ../ld-new dependencies.
5715         * testsuite/Makefile.in: Rebuild.
5716
5717 2010-03-03  Nick Clifton  <nickc@redhat.com>
5718
5719         * po/fi.po: New Finnish translation.
5720
5721 2010-03-01  Doug Kwan  <dougkwan@google.com>
5722
5723         * layout.cc (Layout::Layout): Force section types of .init_array*,
5724         .preinit_array* and .fini_array* sections.
5725         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5726         Fix check of return value of std::string::find.().
5727         (Output_section::Input_section_sort_compare::operator()): Remove
5728         comment about .init_array.
5729         (Output_section::Input_section_sort_init_fini_compare::operator()):
5730         New method.
5731         (Output_section::sort_attached_input_sections): Handle .init_array
5732         and .fini_array specially.
5733         * output.h (Output_section::Inut_section_sort_compare): Update
5734         comment.
5735         (Output_section::Input_section_sort_init_fini_compare): New struct.
5736
5737 2010-02-26  Doug Kwan  <dougkwan@google.com>
5738
5739         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5740         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5741         * testsuite/debug_msg.sh: Avoid matching source line number for
5742         use of global variable undef_int.
5743
5744 2010-02-26  Doug Kwan  <dougkwan@google.com>
5745
5746         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5747         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5748         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5749         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5750         * options.cc (General_options::General_options): Initialize member
5751         fix_v4bx_.
5752         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5753         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5754         and rm_no_fix_v4bx.stdout
5755         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5756         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5757         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5758         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5759         and arm_no_fix_v4bx.
5760         * Makefile.in: Regenerate.
5761         * testsuite/arm_fix_v4bx.s: New file.
5762         * testsuite/arm_fix_v4bx.sh: Ditto.
5763
5764 2010-02-24  Doug Kwan  <dougkwan@google.com>
5765
5766         * arm.cc (Target_arm::got_section): Make the .got section the first
5767         non RELRO section in the data segment.
5768         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5769         suffixes of section names.
5770
5771 2010-02-24  Doug Kwan  <dougkwan@google.com>
5772
5773         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5774         flags and attributes merging if an input file is a binary file.
5775         * fileread.cc (Input_file::open): Record format of original file.
5776         * fileread.h (Input_file::Format): New enum type.
5777         (Input_file::Input_file): Initialize data member format_.
5778         (Input_file::format): New method definition.
5779         (Input_file::format_):: New data member.
5780
5781 2010-02-24  Doug Kwan  <dougkwan@google.com>
5782
5783         * arm.cc (Arm_output_data_got): New class.
5784         (ARM_TCB_SIZE): New constant
5785         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5786         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5787         If user uses a script with a SECTIONS clause, issue only a warning
5788         for a misplaced EXIDX input section.  Otherwise, issue an error.
5789         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5790         garbage collection.
5791         (Target_arm::got_mode_index_entry): Handle static linking.
5792         (Target_arm::Scan::local): Ditto.
5793         (Target_arm::Scan::global): Ditto.
5794         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5795         all incorrectly implemented relocations.
5796         (Target_arm::fix_exidx_coverage): Pass layout to
5797         Arm_output_section::fix_exidx_coverage.
5798         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5799         from ".ARM.exidx." and ".ARM.extab.".
5800
5801 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5802
5803         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5804         section if it does not already exist.
5805         * attributes.cc (Attributes_section_data::Attributes_section_data):
5806         Don't crash if size is zero.
5807
5808 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5809             Ian Lance Taylor  <iant@google.com>
5810
5811         * gold.cc (queue_middle_tasks): If no input files were opened,
5812         exit.
5813         * workqueue.h (Task_function::Task_function): Assert that there is
5814         a blocker.
5815
5816 2010-02-22  Doug Kwan  <dougkwan@google.com>
5817
5818         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5819         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5820         types to avoid warnings due to different uint64_t implementations
5821         on different hosts.
5822
5823 2010-02-21  Doug Kwan  <dougkwan@google.com>
5824
5825         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5826         handling of the maximum backward branch offset.
5827         (Arm_relocate_functions::thumb_branch_common): Ditto.
5828         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5829         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5830         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5831         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5832         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5833         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5834         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5835         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5836         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5837         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5838         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5839         thumb2_bl_out_of_range.o): New rules.
5840         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5841         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5842         thumb2_bl_out_of_range
5843         * testsuite/Makefile.in: Regenerate.
5844         * testsuite/arm_bl_in_range.s: New file.
5845         * testsuite/arm_bl_out_of_range.s: Ditto.
5846         * testsuite/arm_branch_in_range.sh: Ditto.
5847         * testsuite/arm_branch_range.t: Ditto.
5848         * testsuite/thumb2_branch_range.t: Ditto.
5849         * testsuite/thumb_bl_in_range.s: Ditto.
5850         * testsuite/thumb_bl_out_of_range.s: Ditto.
5851         * testsuite/thumb_branch_range.t: Ditto.
5852
5853 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5854
5855         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5856         Add reloc offset information.
5857         * icf.cc (get_section_contents): Change iterators to point to the new
5858         vectors. Add reloc offset information to the contents.
5859         * icf.h (Icf::Sections_reachable_info): New typedef.
5860         (Icf::Sections_reachable_list): New typedef.
5861         (Icf::Offset_info): New typedef.
5862         (Icf::Reloc_info): New struct typedef.
5863         (Icf::Reloc_info_list): New typedef.
5864         (Icf::symbol_reloc_list): Delete method.
5865         (Icf::addend_reloc_list): Delete method.
5866         (Icf::section_reloc_list): Delete method.
5867         (Icf::reloc_info_list): New method.
5868         (Icf::reloc_info_list_): New member.
5869
5870 2010-02-19  Doug Kwan  <dougkwan@google.com>
5871
5872         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5873         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5874         * arm.cc (Arm_relocation_functions): New forward declaration.
5875         (Target_arm::Target_arm): Initialize new data members
5876         got_mod_index_offset_ and tls_base_symbol_defined_.
5877         (Target_arm::Relocate::relocate_tls): New method.
5878         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5879          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5880         New methods.
5881         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5882         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5883         (Target_arm::got_mod_index_offset_,
5884         Target_arm::tls_base_symbol_defined_): New data members.
5885         (Target_arm::Scan::local, Target::Scan::global,
5886         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5887         relocations.
5888
5889 2010-02-18  Doug Kwan  <dougkwan@google.com>
5890
5891         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5892         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5893         text section as a parameter becuase some broken tools may not set
5894         the link in section header.
5895         (Target_arm::has_got_section): New method.
5896         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5897         without any mapping symbol as data only.  Remove warning.
5898         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5899         link in its section header, try to discover the link by inspecting the
5900         REL31 relocation at the beginning of the section.
5901         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5902         in error message.
5903         (Target_arm::Scan::global): Treat any reference to the symbol
5904         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5905
5906 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5907
5908         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5909         (Scan::global_reloc_may_be_function_pointer): New function.
5910         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5911         (Scan::global_reloc_may_be_function_pointer): New function.
5912         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5913         (Scan::global_reloc_may_be_function_pointer): New function.
5914         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5915         (Scan::global_reloc_may_be_function_pointer): New function.
5916         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5917         (Scan::global_reloc_may_be_function_pointer): New function.
5918         (Scan::possible_function_pointer_reloc): New function.
5919         (Target_x86_64::can_check_for_function_pointers): New function.
5920         * gc.h (gc_process_relocs): Scan relocation types to determine if
5921         function pointers were taken for targets that support it.
5922         * icf.cc (Icf::find_identical_sections): Include functions for
5923         folding in safe ICF whose pointer is not taken.
5924         * icf.h (Secn_fptr_taken_set): New typedef.
5925         (fptr_section_id_): New member.
5926         (section_has_function_pointers): New function.
5927         (set_section_has_function_pointers): New function.
5928         (check_section_for_function_pointers): New function.
5929         * options.h: Fix comment for safe ICF option.
5930         * target.h (can_check_for_function_pointers): New function.
5931         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5932         Modify icf_safe_test for X86-64.
5933         * testsuite/Makefile.in: Regenerate.
5934         * testsuite/icf_safe_so_test.cc: New file.
5935         * testsuite/icf_safe_so_test.sh: New file.
5936         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5937         (main): Change to take pointer to function kept_func_3.
5938         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5939         folding is done correctly for X86-64.
5940
5941 2010-02-12  David S. Miller  <davem@davemloft.net>
5942
5943         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5944         is_symbolless parameter.
5945         (Output_reloc<SHT_REL>::is_symbolless): New.
5946         (Output_reloc<SHT_REL>::is_symbolless_): New.
5947         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5948         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5949         (Output_reloc<SHT_RELA>::is_symbolless): New.
5950         (Output_data_reloc::add_global): Handle is_symbolless.
5951         (Output_data_reloc::add_global_relative): Likewise.
5952         (Output_data_reloc::add_local): Likewise.
5953         (Output_data_reloc::add_local_relative): Likewise.
5954         (Output_data_reloc::add_symbolless_global_addend): New.
5955         (Output_data_reloc::add_symbolless_local_addend): New.
5956         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5957         is_symbolless.
5958         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5959         instead of ->is_relative_
5960         (Output_reloc::write): Likewise.
5961         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5962         (Output_reloc::write_rel): Simplify.
5963
5964         * sparc.cc (Target_sparc::Scan::local): Use
5965         ->add_symbolless_local_addend as needed.
5966         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5967         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
5968         based upon relocation offset.
5969
5970 2010-02-11  Doug Kwan  <dougkwan@google.com>
5971
5972         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5973         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
5974         beginning of function.
5975         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5976         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
5977         parameter is_32bit in calls to should_apply_static_reloc.
5978         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5979         (check_DATA): Add arm_abs_global.stdout.
5980         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5981         arm_abs_global.stdout): New rules.
5982         (MOSTLLYCLEANFILES): Add arm_abs_global
5983         * Makefile.in: Regenerate.
5984         * testsuite/arm_abs_global.s: New file.
5985         * testsuite/arm_abs_global.sh: Ditto.
5986         * testsuite/arm_abs_lib.s: Ditto.
5987
5988 2010-02-11  Ian Lance Taylor  <iant@google.com>
5989
5990         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5991         Read_relocs task.
5992         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
5993         Allocate_commons_task first.
5994         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5995         task, rather than symtab_lock_.
5996         (Gc_process_relocs::~Gc_process_relocs): New function.
5997         (Gc_process_relocs::is_runnable): Check this_blocker_.
5998         (Gc_process_relocs::locks): Use next_blocker_ rather than
5999         blocker_.
6000         (Scan_relocs::~Scan_relocs): New function.
6001         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6002         symtab_lock_.
6003         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6004         next_blocker_.
6005         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6006         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6007         constructor accordingly.
6008         (class Gc_process_relocs): Likewise.
6009         (class Scan_relocs): Likewise.
6010         * common.h (class Allocate_commons_task): Remove symtab_lock_
6011         field, and corresponding constructor parameter.
6012         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6013         symtab_lock_.
6014         (Allocate_commons_task::locks): Likewise.
6015
6016 2010-02-11  Ian Lance Taylor  <iant@google.com>
6017
6018         * gold-threads.h (class Once): Define.
6019         (class Initialize_lock): Rewrite as child of Once.
6020         * gold-threads.cc (class Once_initialize): Define.
6021         (once_pointer_control): New static variable.
6022         (once_pointer, once_arg): New static variables.
6023         (c_run_once): New static function.
6024         (Once::Once, Once::run_once, Once::internal_run): New functions.
6025         (class Initialize_lock_once): Remove.
6026         (initialize_lock_control): Remove.
6027         (initialize_lock_pointer): Remove.
6028         (initialize_lock_once): Remove.
6029         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6030         (Initialize_lock::initialize): Rewrite.
6031         (Initialize_lock::do_run_once): New function.
6032         * archive.cc (Archive::interpret_header): Only clear name if it is
6033         not already empty.
6034         * fileread.cc: Include "gold-threads.h"
6035         (file_counts_lock): New static variable.
6036         (file_counts_initialize_lock): Likewise.
6037         (File_read::release): Only increment counts when using --stats.
6038         Use a lock around the increment.
6039         * parameters.cc (class Set_parameters_target_once): Define.
6040         (set_parameters_target_once): New static variable.
6041         (Parameters::Parameters): Move here from parameters.h.
6042         (Parameters::set_target): Rewrite.
6043         (Parameters::set_target_once): New function.
6044         (Parameters::clear_target): Move here and rewrite.
6045         * parameters.h (class Parameters): Update declarations.  Add
6046         set_parameters_target_once_ field.
6047         (Parameters::Parameters): Move to parameters.cc.
6048         (Parameters::clear_target): Likewise.
6049         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6050         task.
6051         (Start_group::~Start_group): New function.
6052         (Start_group::is_runnable): New function.
6053         (Start_group::locks, Start_group::run): New functions.
6054         (Finish_group::run): Change saw_undefined to size_t.
6055         * readsyms.h (class Start_group): Define.
6056         (class Finish_group): Change saw_undefined_ field to size_t.
6057         (Finish_group::Finish_group): Remove saw_undefined and
6058         this_blocker parameters.  Change all callers.
6059         (Finish_group::set_saw_undefined): New function.
6060         (Finish_group::set_blocker): New function.
6061         * symtab.h (class Symbol_table): Change saw_undefined to return
6062         size_t.  Change saw_undefined_ field to size_t.
6063         * target-select.cc (Set_target_once::do_run_once): New function.
6064         (Target_selector::Target_selector): Initialize set_target_once_
6065         field.  Don't initialize lock_ and initialize_lock_ fields.
6066         (Target_selector::instantiate_target): Rewrite.
6067         (Target_selector::set_target): New function.
6068         * target-select.h (class Set_target_once): Define.
6069         (class Target_selector): Update declarations.  Make
6070         Set_target_once a friend.  Remove lock_ and initialize_lock_
6071         fields.  Add set_target_once_ field.
6072
6073 2010-02-10  Ian Lance Taylor  <iant@google.com>
6074
6075         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6076         queueing any tasks.
6077         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6078         (queue_middle_tasks): Add all blockers before queueing any tasks.
6079         (queue_final_tasks): Likewise.
6080         * token.h (Task_token::add_blockers): New function.
6081         * object.h (Input_objects::number_of_relobjs): New function.
6082
6083 2010-02-10  Ian Lance Taylor  <iant@google.com>
6084
6085         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6086         shared, not if not position independent.
6087         * x86_64.cc (Relocate::relocate_tls): Likewise.
6088         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6089         (tls_pie_pic_test): New target.
6090         * testsuite/Makefile.in: Rebuild.
6091
6092         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6093         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6094         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6095         * testsuite/Makefile.in: Rebuild.
6096
6097 2010-02-09  David S. Miller  <davem@davemloft.net>
6098
6099         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6100         R_SPARC_RELATIVE using ->add_local_relative().
6101         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6102
6103         * output.h (Output_data_dynamic::add_section_size): New method
6104         that takes two Output_data objects.
6105         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6106         entry param.  Handle it in initializers.
6107         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6108         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6109         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6110         arg.
6111         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6112         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6113         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6114         for dynrel_includes_plt.
6115         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6116         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6117         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6118         before .rela.plt
6119         (Target_sparc::do_finalize_sections): Update to pass true for
6120         dynrel_includes_plt.
6121         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6122         output before .rela.plt
6123         (Target_powerpc::do_finalize_sections): Update to pass true for
6124         dynrel_includes_plt when 32-bit.
6125
6126 2010-02-08  Doug Kwan  <dougkwan@google.com>
6127
6128         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6129         method.
6130         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6131         Arm_relobj::scan_section_for_cortex_a8_stubs,
6132         Arm_relobj::do_relocation_section): Instead of calling
6133         Output_section::output_address, use faster
6134         Arm_relobj::simple_input_section_output_address.
6135
6136 2010-02-08  David S. Miller  <davem@davemloft.net>
6137
6138         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6139         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6140         relocation helper function.
6141
6142         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6143         just like R_SPARC_GOT{10,13,22}.
6144         (Target_sparc::Scan::local): Likewise.
6145         (Target_sparc::Relocate:relocate): Likewise.
6146
6147 2010-02-06  Ian Lance Taylor  <iant@google.com>
6148
6149         * configure.ac: Rewrite targetobjs duplicate removal code to use
6150         only shell constructs.
6151         * configure: Rebuild.
6152
6153 2010-02-05  Doug Kwan  <dougkwan@google.com>
6154
6155         PR 11247
6156         * arm.cc (Arm_relobj::section_is_scannable): New method.
6157         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6158         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6159
6160 2010-02-04  Doug Kwan  <dougkwan@google.com>
6161
6162         PR 11247
6163         * arm-reloc-property.cc (cstdio): Include.
6164         * configure.ac (targetobjs): Remove duplicates.
6165         * configure: Regenerate.
6166         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6167         big and little endian version for a given address size.
6168
6169 2010-02-03  Doug Kwan  <dougkwan@google.com>
6170
6171         * arm-reloc-property.cc
6172         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6173         definition.
6174         * arm-reloc-property.h
6175         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6176         New method definition.
6177         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6178         declaration.
6179         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6180         overflow to N.
6181         (GOT_PREL): Change implemented to Y.
6182         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6183         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6184         (Arm_relocate_functions::movw_abs_nc): Remove method.
6185         (Arm_relocate_functions::movt_abs): Ditto.
6186         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6187         (Arm_relocate_functions::thm_movt_abs): Ditto.
6188         (Arm_relocate_functions::movw_rel_nc): Ditto.
6189         (Arm_relocate_functions::movw_rel): Ditto.
6190         (Arm_relocate_functions::movt_rel): Ditto.
6191         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6192         (Arm_relocate_functions:thm_movw_rel): Ditto.
6193         (Arm_relocate_functions:thm_movt_rel): Ditto.
6194         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6195         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6196         New method definitions.
6197         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6198         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6199         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6200         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6201         (Target_arm::Relocate::relocate): Check for non-static or
6202         unimplemented relocation code and exit early.  Change calls to
6203         Target_arm::reloc_uses_thumb_bit and
6204         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6205         instead.  Refactor code to handle similar relocations to increase
6206         code sharing.  Remove check for unsupported relocation code in switch
6207         statement.
6208         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6209         relocation property table to find out size.  Change error message to
6210         print out the name of a relocation code instead of the numeric value.
6211         (Target_arm::scan_reloc_for_stub): Use relocation property table
6212         instead of calling Target_arm::reloc_uses_thumb_bit().
6213
6214 2010-02-02  Doug Kwan  <dougkwan@google.com>
6215
6216         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6217         types of relaxed input section.
6218
6219 2010-02-02  Doug Kwan  <dougkwan@google.com>
6220
6221         * Makefile.am (HFILES): Add arm-reloc-property.h.
6222         (DEFFILES): New.
6223         (TARGETSOURCES): Add arm-reloc-property.cc
6224         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6225         (libgold_a_SOURCES): $(DEFFILES)
6226         * Makefile.in: Regenerate.
6227         * arm-reloc-property.cc: New file.
6228         * arm-reloc-property.h: New file.
6229         * arm-reloc.def: New file.
6230         * arm.cc: Update comments.
6231         (arm-reloc-property.h): New included header.
6232         (arm_reloc_property_table): New global variable.
6233         (Target_arm::do_select_as_default_target): New method definition.
6234         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6235         arm-reloc-property to targ_extra_obj.
6236         * parameters.cc (set_parameters_target): Call
6237         Target::select_as_default_target().
6238         * target.h (Target::select_as_default_target): New method definition.
6239         (Target::do_select_as_default_target): Same.
6240
6241 2010-02-01  Doug Kwan  <dougkwan@google.com>
6242
6243         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6244         first_output_text_section_.
6245         (Arm_exidx_fixup::first_output_text_section): New method definition.
6246         (Arm_exidx_fixup::first_output_text_section_): New data member.
6247         (Arm_exidx_fixup::process_exidx_section): Record the first text
6248         output section seen.
6249         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6250         and entsize in output section header.
6251
6252 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6253
6254         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6255         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6256         (Arm_relocate_functions::thm_alu11): New Method.
6257         (Arm_relocate_functions::thm_pc8): New Method.
6258         (Arm_relocate_functions::thm_pc12): New Method.
6259         (Target_arm::Scan::local): Handle the relocations.
6260         (Target_arm::Scan::global): Likewise.
6261         (Target_arm::Relocate::relocate): Likewise.
6262         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6263
6264 2010-01-29  Doug Kwan  <dougkwan@google.com>
6265
6266         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6267         of relocation types as ld.
6268
6269 2010-01-29  Doug Kwan  <dougkwan@google.com>
6270
6271         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6272         to public.
6273         (Arm_relocate_functions::thumb_branch_common): Ditto.
6274         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6275         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6276         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6277         Arm_relocate_functions::jump24): Remove.
6278         (Target_arm::Relocate::relocate): Adjust code to call
6279         Arm_relocation_functions::arm_branch_common and
6280         Arm_relocation_functions::thumb_branch_common instead of their removed
6281         wrappers.  Merge switch-cases together to reduce source code size.
6282
6283 2010-01-29  Doug Kwan  <dougkwan@google.com>
6284
6285         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6286         output_local_symbol_count_needs_update_.
6287         (Arm_relobj::output_local_symbol_count_needs_update,
6288          Arm_relobj::set_output_local_symbol_count_needs_update,
6289          Arm_relobj::update_output_local_symbol_count): New methods.
6290         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6291         member.
6292         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6293         of pointed function as in a R_ARM_PREL31 relocation.
6294         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6295         for output local symbol count updating.
6296         (Target_arm::do_relax): Update output local symbol counts in objects
6297         if necessary.
6298         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6299
6300 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6301
6302         * arm.cc: Added support for the ARM relocations:
6303         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6304         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6305         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6306         movw_prel_nc).
6307         (Arm_relocate_functions::movw_rel): New method.
6308         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6309         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6310         thm_movw_prel_nc).
6311         (Arm_relocate_functions::thm_movw_rel): New method.
6312         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6313         thm_movt_prel).
6314         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6315         relocations.
6316         (Target_arm::Scan::global): Likewise.
6317         (Target_arm::Relocate::relocate): Likewise.
6318         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6319         Likewise.
6320
6321 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6322
6323         * arm.cc: Added support for ARM group relocations.
6324         (Target_arm::reloc_needs_sym_origin): New method.
6325         (Arm_relocate_functions::calc_grp_kn): New method.
6326         (Arm_relocate_functions::calc_grp_residual): New method.
6327         (Arm_relocate_functions::calc_grp_gn): New method.
6328         (Arm_relocate_functions::arm_grp_alu): New Method.
6329         (Arm_relocate_functions::arm_grp_ldr): New Method.
6330         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6331         (Arm_relocate_functions::arm_grp_ldc): New Method.
6332         (Target_arm::Scan::local): Handle the ARM group relocations.
6333         (Target_arm::Scan::global): Likewise.
6334         (Target_arm::Relocate::relocate): Likewise.
6335         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6336         Likewise.
6337
6338 2010-01-26  Doug Kwan  <dougkwan@google.com>
6339
6340         * arm.cc (set): Include.
6341         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6342         pointer type.
6343         (Arm_output_section::Text_section_list): New type.
6344         (Arm_output_section::append_text_sections_to_list): New method.
6345         (Arm_output_section::fix_exidx_coverage): Ditto.
6346         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6347         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6348         Relobj::set_section_offset() instead of
6349         Sized_relobj::invalidate_section_offset().
6350         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6351         parameter for section headers. Ignore relocation sections for
6352         unallocated sections and EXIDX sections.
6353         (Target_arm::fix_exidx_coverage): New method.
6354         (Target_arm::output_section_address_less_than): New type.
6355         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6356         linked text section instead of the EXIDX section.
6357         (Arm_output_section::create_stub_group): Add an assertion to check
6358         that this is not an EXIDX output section.
6359         (Arm_output_section::append_text_sections_to_list): New method.
6360         (Arm_output_section::fix_exidx_coverage): Ditto.
6361         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6362         Arm_relobj::section_needs_reloc_stub_scanning.
6363         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6364         first pass.
6365         (Target_arm::fix_exidx_coverage): New method.
6366         * object.h (Relobj::set_output_section): New method.
6367         (Sized_relobj::invalidate_section_offset): Remove method.
6368         (Sized_relobj::do_invalidate_section_offset): Remove method.
6369         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6370
6371 2010-01-25  Doug Kwan  <dougkwan@google.com>
6372
6373         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6374         Fix warning due to signed and unsigned comparison on a 32-bit host.
6375
6376 2010-01-22  Doug Kwan  <dougkwan@google.com>
6377
6378         * arm.cc (Target_arm::do_relax): Record an output section for section
6379         offset adjustment it contains any stub table that has changed.
6380         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6381         offsets in an output section if necessary.
6382         * output.cc (Output_section::Output_section): Initialize
6383         section_offsets_need_adjustments_.
6384         (Output_section::add_input_section_for_script): Renamed to
6385         Output_section::add_simple_input_section.
6386         (Output_section::save_states): Add a comment.
6387         (Output_section::discard_states): New method defintion.
6388         (Output_section::adjust_section_offsets): Same.
6389         * output.h (Output_section::add_input_section_for_script): Renamed to
6390         Output_section::add_simple_input_section.
6391         (Output_section::discard_states): New method declaration.
6392         (Output_section::adjust_section_offsets): Same.
6393         (Output_section::section_offsets_need_adjustment,
6394         Output_section::set_section_offsets_need_adjustment): New method
6395         definitions.
6396         (Output_section::section_offsets_need_adjustment_): New data member.
6397         * script-sections.cc
6398         (Output_section_element_input::set_section_address): Adjust code for
6399         renaming of Output_section::add_input_section_for_script.
6400         (Orphan_output_section::set_section_address): Same.
6401
6402 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6403
6404         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6405         Fix_v4bx enum values .
6406         * gold/options.h (General_options): New option definitions.
6407         (General_options::fix_v4bx): New method.
6408         (General_options::Fix_v4bx): New enum.
6409         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6410         (General_options::parse_fix_v4bx_interworking): New method.
6411
6412 2010-01-22  Doug Kwan  <dougkwan@google.com>
6413
6414         * arm.cc (Arm_exidx_fixup): New class.
6415
6416 2010-01-21  Doug Kwan  <dougkwan@google.com>
6417
6418         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6419         classes.
6420         (Arm_exidx_section_offset_map): New type.
6421
6422 2010-01-21  Doug Kwan  <dougkwan@google.com>
6423
6424         * arm.cc (Arm_exidx_input_section): New class.
6425         (Arm_relobj::exidx_input_section_by_link,
6426         Arm_relobj::exidx_input_section_by_shndx,
6427         Arm_relobj::make_exidx_input_section): New methods.
6428         (read_arm_attributes_section): Remove.
6429         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6430         information about them.
6431         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6432         to here.
6433
6434 2010-01-20  Doug Kwan  <dougkwan@google.com>
6435
6436         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6437         Input_section_specifier to Section_id.
6438         (Target_arm::new_arm_input_section: Adjust code for change of key
6439         type.
6440         (Target_arm::find_arm_input_section): Ditto.
6441         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6442         (Section_id): Remove.
6443         (Garbage_collection::Section_id_hash): Remove.
6444         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6445         (Section_id): Remove.
6446         (Icf::Section_id_hash): Remove.
6447         * object.h (Section_id, Const_section_id, Section_id_hash,
6448         Const_section_id_hash): New type definitions.
6449         * output.cc (Output_section::add_relaxed_input_section): Change to
6450         use Const_section_id instead of Input_section_specifier as key type.
6451         (Output_section::add_merge_input_section): Ditto.
6452         (Output_section::build_relaxation_map): Change to use Section_id
6453         instead of Input_section_specifier as key type.
6454         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6455         Ditto.
6456         (Output_section::convert_input_sections_to_relaxed_sections): Change
6457         to use Const_section_id instead of Input_section_specifier as key type.
6458         (Output_section::find_merge_section): Ditto.
6459         (Output_section::find_relaxed_input_section): Ditto.
6460         * output.h (Input_section_specifier): Remove class.
6461         (Output_section::Output_section_data_by_input_section_map): Change
6462         key type to Const_section_id.
6463         (Output_section::Output_relaxed_input_section_by_input_section_map):
6464         Ditto.
6465         (Output_section::Relaxation_map): Change key type to Section_id.
6466
6467 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6468
6469         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6470         (class Arm_v4bx_stub): New class.
6471         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6472         (Stub_factory::make_arm_v4bx_stub): New method.
6473         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6474         (Stub_table::empty): Handle v4bx stubs.
6475         (Stub_table::add_arm_v4bx_stub): New method.
6476         (Stub_table::find_arm_v4bx_stub): New method.
6477         (Arm_relocate_functions::v4bx): New method.
6478         (Target_arm::fix_v4bx): New method.
6479         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6480         (Stub_table::relocate_stubs): Likewise.
6481         (Stub_table::do_write): Likewise.
6482         (Stub_table::update_data_size_and_addralign): Likewise.
6483         (Stub_table::finalize_stubs):  Likewise.
6484         (Target_arm::Scan::local): Likewise.
6485         (Target_arm::Scan::global): Likewise.
6486         (Target_arm::do_finalize_sections): Likewise.
6487         (Target_arm::Relocate::relocate): Likewise.
6488         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6489         Likewise.
6490         (Target_arm::scan_reloc_for_stub): Likewise.
6491         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6492
6493 2010-01-19  Ian Lance Taylor  <iant@google.com>
6494
6495         * output.cc (Output_section_headers::do_sized_write): Write large
6496         segment count to sh_info field.
6497         (Output_file_header::do_sized_write): For large segment count,
6498         write PN_XNUM to e_phnum field.
6499
6500 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6501
6502         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6503         (Arm_relocate_functions::thm_jump8): New function.
6504         (Arm_relocate_functions::thm_jump11): New function.
6505         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6506         R_ARM_THM_JUMP11.
6507         (Target_arm::Scan::global): Likewise.
6508         (Target_arm::Relocate::relocate): Likewise.
6509         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6510         Likewise.
6511
6512 2010-01-14  Doug Kwan  <dougkwan@google.com>
6513
6514         * arm.cc (map, utility): Include headers.
6515         (Target_arm::apply_cortex_a8_workaround): New method.
6516         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6517         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6518         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6519         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6520         the --[no-]fix-cortex-a8 command line options.
6521         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6522         (Target_arm::relocate_stub): Use addend in instruction template.
6523         * options.h (DEFINE_bool): Set the user-set flag.
6524         (General_options): Add --[no-]-fix-cortex options.
6525         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6526         : Update fast look-up map after conversion.
6527
6528 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6529
6530         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6531         in the first pass of do_layout.
6532
6533 2010-01-13  Doug Kwan  <dougkwan@google.com>
6534
6535         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6536         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6537         apparent compiler problem of not folding static constant integral
6538         data members of elfcpp::Elf_sizes<32>.
6539
6540 2010-01-13  Doug Kwan  <dougkwan@google.com>
6541
6542         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6543         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6544         Arm_relobj::scan_section_for_cortex_a8_erratum,
6545         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6546         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6547         sections to scan for relocation stubs into a new method
6548         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6549         relocation and Cortex-A8 stub scanning.
6550         (Target_arm::do_relax): Force stubs to be after stubbed sections
6551         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6552         the beginning of a new relaxation pass.  Update a comment.
6553         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6554
6555 2010-01-12  Ian Lance Taylor  <iant@google.com>
6556
6557         * target-reloc.h (visibility_error): New inline function.
6558         (relocate_section): Call visibility_error.
6559         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6560         (MOSTLYCLEANFILES): Likewise.
6561         (protected_4_pic.o, protected_3.err): New targets.
6562         * testsuite/protected_4.cc: New file.
6563
6564 2010-01-12  Doug Kwan  <dougkwan@google.com>
6565
6566         * arm.cc (Cortex_a8_reloc): New class.
6567         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6568         and cortex_a8_relocs_info_.
6569         (Target_arm::fix_cortex_a8): New method definition.
6570         (Target_arm::Cortex_a8_relocs_info): New type.
6571         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6572         New data member declarations.
6573         (Target_arm::scan_reloc_for_stub): Record information about
6574         relocations for THUMB branches that might be exempted from the
6575         Cortex-A8 workaround.
6576         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6577         at the beginning of a relaxation pass.
6578
6579 2010-01-12  Doug Kwan  <dougkwan@google.com>
6580
6581         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6582         (Arm_relobj::Mapping_symbol_position,
6583          Arm_reloj::Mapping_symbol_position_less,
6584          Arm_relobj::Mapping_symbols_info): New types.
6585         (Target_arm::is_mapping_symbol_name): New method definition.
6586         (Arm_relobj::do_count_local_symbols): Save information about mapping
6587         symbols.
6588
6589 2010-01-11  Doug Kwan  <dougkwan@google.com>
6590
6591         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6592         Arm_relocate_functions::thumb32_branch_upper,
6593         Arm_relocate_functions::thumb32_branch_lower,
6594         Arm_relocate_functions::thumb32_cond_branch_offset,
6595         Arm_relocate_functions::thumb32_cond_branch_upper,
6596         Arm_relocate_functions::thumb32_cond_branch_lower,
6597         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6598         branch offset encoding.
6599         (Arm_relocate_functions::thumb_branch_common): Use new branch
6600         offset encoding methods to avoid code duplication.
6601         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6602         (Stub_addend_reader::operator()): Use new branch encoding method
6603         to avoid code duplication.
6604
6605 2010-01-11  Doug Kwan  <dougkwan@google.com>
6606
6607         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6608         (Target_arm::do_finalize_sections): Define special EXIDX section
6609         symbols only if referenced.
6610         * gc.h (Garbage_collection::add_reference): New method.
6611         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6612         code duplication.
6613
6614 2010-01-11  Ian Lance Taylor  <iant@google.com>
6615
6616         * script.cc (Version_script_info::build_expression_list_lookup):
6617         Change complaing about duplicate wildcard match from error to
6618         warning.
6619
6620         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6621         of 2009-12-30.
6622         (Version_script_info::Version_script_info): Initialize globs_,
6623         default_version_, default_is_global_, and exact_.  Don't
6624         initialize globals_ or locals_.
6625         (Version_script_info::build_lookup_tables): Build local symbols
6626         first.
6627         (Version_script_info::unquote): New function.
6628         (Version_script_info::add_exact_match): New function.
6629         (Version_script_info::build_expression_list_lookup): Remove lookup
6630         parameter.  Add is_global parameter.  Change all callers.  Handle
6631         wildcard pattern specially.  Unquote pattern.  Call
6632         add_exact_match.
6633         (Version_script_info::get_name_to_match): New function.
6634         (Version_script_info::get_symbol_version): New function.
6635         (Version_script_info::get_symbol_version_helper): Remove.
6636         (Version_script_info::check_unmatched_names): Call unquote.
6637         * script.h (class Version_script_info): Change get_symbol_version
6638         to be non-inline and add is_global parameter; change all callers.
6639         Rewrite symbol_is_local.  Update declarations.  Define struct
6640         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6641         Remove globals_ and locals_ members.  Add exact_, globs_,
6642         default_version_, is_global_.
6643         (Version_script_info::Glob): Remove pattern, add expression and
6644         is_global.  Update constructor.  Change all callers.
6645         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6646         default version.
6647         (Versions::symbol_section_contents): If a symbol is undefined, or
6648         defined in a dynamic object, set the version index to
6649         VER_NDX_LOCAL.
6650         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6651         symbol_is_local.
6652         (Symbol_table::add_from_pluginobj): Likewise.
6653         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6654
6655 2010-01-11  Doug Kwan  <dougkwan@google.com>
6656
6657         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6658         (incremental_dump_LDADD): Add linking option for libintl.
6659         * Makefile.in: Regenerate.
6660
6661 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6662
6663         PR gold/11144
6664         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6665         instead of -Ds.
6666         * testsuite/Makefile.in: Regenerated.
6667
6668 2010-01-10  Doug Kwan  <dougkwan@google.com>
6669
6670         * options.h (DEFINE_var): Use parentheses around argument varname__
6671         in macro body to avoid any unintended subsequent substitutions.
6672
6673 2010-01-10  Ian Lance Taylor  <iant@google.com>
6674
6675         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6676         candidates before doing symbol resolution.
6677
6678         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6679         ODR candidates if only one is weak.
6680
6681 2010-01-08  Ian Lance Taylor  <iant@google.com>
6682
6683         * script.cc (Version_script_info::build_expression_list_lookup):
6684         Don't warn about ambiguous version, just record the ambiguity.
6685         (Version_script_info::get_symbol_version_helper): Give error if
6686         version is ambiguous.
6687
6688 2010-01-08  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6691           prev_data_size_ and prev_addralign_.  Remove initializer for
6692           deleted data member has_been_changed_.
6693           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6694           to determine if the table is empty.
6695           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6696           Remove.
6697           (Stub_table::add_reloc_stub): Define method in class definition
6698           instead of just declaring it there.
6699           (Stub_table::add_cortex_a8_stub): New method definition.
6700           (Stub_table::update_data_size_and_addralign): Ditto.
6701           (Stub_table::finalize_stubs): Ditto.
6702           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6703           (Stub_table::do_addralign_): Return address alignment in the
6704           (Stub_table::do_reset_address_and_file_offset): Define method in
6705           class definition instead of declaring it there.  Set current data
6706           size to be the data size of the previous pass.
6707           (Stub_table::set_final_data_size): Use current data size as the
6708           final data size.
6709           (Stub_table::relocate_stub): Change parameter type of stub from
6710           Reloc_stub pointer to Stub pointer.
6711           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6712           (Stub_table::Cortex_a8_stub_list): New typedef.
6713           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6714            Stub_table::prev_addralign_): New data member.
6715           (Arm_relobj::Arm_relobj): Initialize data member
6716           section_has_cortex_a8_workaround_.
6717           (Arm_relobj::section_has_cortex_a8_workaround,
6718            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6719            definitions.
6720           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6721           declarations.
6722           (Target_arm::relocate_stub): Change parameter type of stub from
6723           Reloc_stub pointer to Stub pointer.
6724           (Insn_template::size, Insn_template::alignment): Handle
6725           THUMB16_SPECIAL_TYPE.
6726           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6727            Stub_table::update_data_size_and_addralign,
6728            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6729           definitions.
6730           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6731           (Stub_table::do_write): Ditto.
6732           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6733
6734 2010-01-08  Ian Lance Taylor  <iant@google.com>
6735
6736         PR 11108
6737         * symtab.h (class Symbol): Remove fields is_target_special_ and
6738         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6739         (Symbol::is_defined_in_discarded_section): New function.
6740         (Symbol::set_is_defined_in_discarded_section): New function.
6741         (Symbol::has_plt_offset): Rewrite.
6742         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6743         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6744         Don't initialize is_target_special_ or has_plt_offset_.
6745         Initialize is_defined_in_discarded_section_.
6746         (Symbol_table::add_from_relobj): If appropriate, set
6747         is_defined_in_discarded_section.
6748         * resolve.cc (Symbol::override_base_with_special): Don't test
6749         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6750         * target-reloc.h (relocate_section): Do special handling for
6751         symbols defined in discarded sections for global symbols as well
6752         as local symbols.
6753
6754 2010-01-08  Ian Lance Taylor  <iant@google.com>
6755
6756         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6757         the SHT_SYMTAB case.
6758
6759 2010-01-08  Ian Lance Taylor  <iant@google.com>
6760
6761         * object.cc (Sized_relobj::do_layout): Don't get confused if
6762         layout_eh_frame returns NULL.
6763
6764 2010-01-08  Ian Lance Taylor  <iant@google.com>
6765
6766         PR 11084
6767         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6768         dynamic symbol table, use the normal symbol table.
6769         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6770         symbol table.
6771
6772 2010-01-08  Ian Lance Taylor  <iant@google.com>
6773
6774         PR 11072
6775         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6776         sections.
6777
6778 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6779
6780         * version.cc (print_version): Change to "Copyright 2010".
6781
6782 2010-01-08  Ian Lance Taylor  <iant@google.com>
6783
6784         PR 10287
6785         PR 11063
6786         * i386.cc (class Target_i386): Change return type of plt_section
6787         to be non-const.
6788         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6789         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6790         tls_desc_rel_ field.
6791         (Output_data_plt_i386::rel_tls_desc): New function.
6792         (Target_i386::rel_tls_desc_section): New function.
6793         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6794         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6795         R_386_TLS_DESC reloc in rel_tls_desc_section.
6796         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6797         Define struct Tlsdesc_info.
6798         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6799         (Target_x86_64::do_reloc_symbol_index): New function.
6800         (Target_x86_64::add_tlsdesc_info): New function.
6801         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6802         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6803         tlsdesc_rel_ field.
6804         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6805         all callers.
6806         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6807         (Target_x86_64::rela_tlsdesc_section): New function.
6808         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6809         handling.
6810         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6811         (Target_x86_64::do_reloc_addend): New function.
6812         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6813         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6814         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6815         (Output_reloc::type): New function.
6816         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6817         (Output_reloc::is_target_specific): New function.
6818         (Output_reloc::target_arg): New function.
6819         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6820         absolute relocs and target specific relocs.
6821         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6822         add_target_specific.
6823         (class Output_data_reloc) [SHT_RELA]: Likewise.
6824         * output.cc (Output_reloc::Output_reloc): Add four new versions
6825         for absolute relocs and target specific relocs.
6826         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6827         (Output_reloc::get_symbol_index): Likewise.
6828         (Output_reloc::local_section_offset): Check that local_sym_index_
6829         is not TARGET_CODE or 0.
6830         (Output_reloc::symbol_value): Likewise.
6831         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6832         reloc.
6833         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6834         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6835         functions.
6836         * layout.cc (add_target_dynamic_tags): Use output section for
6837         DT_PLTRELSZ and DT_JMPREL.
6838
6839 2010-01-07  Ian Lance Taylor  <iant@google.com>
6840
6841         PR 11061
6842         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6843         function.
6844         (class Output_data_reloc_generic): Define.
6845         (class Output_data_reloc_base): Change base class to
6846         Output_data_reloc_generic.  Change add() method to call
6847         bump_relative_reloc_count for a relative reloc.  Remove
6848         sort_relocs_ field.
6849         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6850         to sort_relocs().
6851         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6852         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6853         appropriate.
6854         * layout.h (class Layout): Update declaration.
6855
6856 2010-01-07  Ian Lance Taylor  <iant@google.com>
6857
6858         * output.h (class Output_data): Add const version of
6859         output_section and do_output_section.
6860         (class Output_section_data): Add const version of
6861         do_output_section.
6862         (class Output_section): Likewise.
6863         * layout.cc (Layout::add_target_dynamic_tags): New function.
6864         * layout.h (class Layout): Update declarations.
6865         * arm.cc (Target_arm::do_finalize_sections): Use
6866         add_target_dynamic_tags.
6867         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6868         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6869         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6870         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6871
6872 2010-01-07  Ian Lance Taylor  <iant@google.com>
6873
6874         PR 11042
6875         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6876         object as needed.
6877
6878 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6879             Ian Lance Taylor  <iant@google.com>
6880
6881         PR 11019
6882         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6883         Xindex::read_symtab_xindex.
6884
6885 2010-01-07  Doug Kwan  <dougkwan@google.com>
6886
6887         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6888         (Insn_template::thumb16_bcond_insn): New method declaration.
6889         (Insn_template): Fix spelling.
6890         (Stub::thumb16_special): New method declaration.
6891         (Stub::do_write): Define virtual method which was previously pure
6892         virtual.
6893         (Stub::do_thumb16_special): New method declaration.
6894         (Stub::do_fixed_endian_write): New template member.
6895         (Reloc_stub::do_write): Remove.
6896         (Reloc_stub::do_fixed_endian_write): Remove.
6897         (Cortex_a8_stub): New class definition.
6898         (Stub_factory::make_cortex_a8_stub): New method definition.
6899         (Stub_factory::Stub_factory): Add missing static storage class
6900         qualifier for elf32_arm_stub_a8_veneer_blx.
6901
6902 2010-01-07  Ian Lance Taylor  <iant@google.com>
6903
6904         PR 10980
6905         * options.h (class General_options): Add --warn-unresolved-symbols
6906         and --error-unresolved-symbols.
6907         * errors.cc (Errors::undefined_symbol): Implement
6908         --warn-unresolved-symbols.
6909
6910         * options.h (class General_options): Add -z text and -z textoff.
6911         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6912
6913 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6914
6915         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6916         (Garbage_collection::cident_sections): New function.
6917         (Garbage_collection::add_cident_section): New function.
6918         (Garbage_collection::cident_sections_): New member.
6919         (gc_process_relocs): Add references to sections whose names are C
6920         identifiers.
6921         * gold.h (cident_section_start_prefix): New constant.
6922         (cident_section_stop_prefix): New constant.
6923         (is_cident): New function.
6924         * layout.cc (Layout::define_section_symbols): Replace string constants
6925         with the newly defined constants.
6926         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6927         C identifiers.
6928         * testsuite/Makefile.am: Add gc_orphan_section_test.
6929         * testsuite/Makefile.in: Regenerate.
6930         * testsuite/gc_orphan_section_test.cc: New file.
6931         * testsuite/gc_orphan_section_test.sh: New file.
6932
6933 2010-01-06  Ian Lance Taylor  <iant@google.com>
6934
6935         PR 10980
6936         * options.h (class General_options): Add --warn-shared-textrel.
6937         * layout.cc (Layout::finish_dynamic_section): Implement
6938         --warn-shared-textrel.
6939
6940         PR 10980
6941         * options.h (class General_options): Add --warn-multiple-gp.
6942
6943 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6944
6945         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6946         $(THREADSLIB) and $(LIBDL).
6947         * Makefile.in: Rebuild.
6948
6949 2010-01-06  Ian Lance Taylor  <iant@google.com>
6950
6951         PR 10980
6952         * options.cc (General_options::parse_section_start): New function.
6953         (General_options::section_start): New function.
6954         (General_options::General_options): Initialize all members.
6955         * options.h: Include <map>
6956         (class General_options): Add --section-start.  Add section_starts_
6957         member.
6958         * layout.cc (Layout::attach_allocated_section_to_segment): If
6959         --section-start was used, set the address of the segment.  Remove
6960         local sort_sections.
6961         (Layout::relaxation_loop_body): If the address of the load segment
6962         has been set by --section-start, don't use it.
6963         * output.h (Output_segment::update_flags_for_output_section): New
6964         function.
6965         * output.cc (Output_segment::add_output_section): Call
6966         update_flags_for_output_section.
6967
6968 2010-01-05  Ian Lance Taylor  <iant@google.com>
6969
6970         PR 10980
6971         * options.h (class General_options): Add --undefined-version.
6972         * script.cc (struct Version_expression): Add was_matched_by_symbol
6973         field.
6974         (Version_script_info::matched_symbol): New function.
6975         (Version_script_info::get_symbol_version_helper): Call
6976         matched_symbol.
6977         (Version_script_info::check_unmatched_names): New function.
6978         * script.h (class Version_script_info): Update declarations.
6979         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6980
6981         * options.h (class General_options): Use DEFINE_bool_alias for
6982         allow_multiple_definition.
6983         * resolve.cc (Symbol_table::should_override): Don't test
6984         allow_multiple_definition.
6985
6986         PR 10980
6987         * options.h (class General_options): Add --cref.
6988         * main.cc (main): Print cref table if --cref.  Don't close mapfile
6989         until after printing cref table.
6990         * cref.cc: Include "symtab.h".
6991         (class Cref_inputs): Define Cref_table_compare and Cref_table.
6992         (Cref_table_compare::operator()): New function.
6993         (Cref_inputs::gather_cref): New function.
6994         (filecol): New static const.
6995         (Cref_inputs::print_cref): New function.
6996         (Cref::print_cref): New function.
6997         * cref.h: Include <cstdio>.
6998         (class Cref): Update declarations.
6999         * mapfile.h (Mapfile::file): New function.
7000         * object.h (class Object): Define Symbols.  Declare virtual
7001         do_get_global_symbols.
7002         (Object::get_global_symbols): New function.
7003         * object.cc (Input_objects::add_object): Pass object to cref_ if
7004         --cref.
7005         (Input_objects::archive_start): Likewise.
7006         (Input_objects::archive_stop): Likewise.
7007         (Input_objects::print_cref): New function.
7008         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7009         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7010         --cref.
7011         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7012         function.
7013         * plugin.h (class Sized_pluginobj): Update declarations.
7014
7015 2010-01-05  Ian Lance Taylor  <iant@google.com>
7016
7017         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7018         to is_default_version.  Rename insdef to insdefault.
7019         (Symbol_table::add_from_relobj): Rename def to is_default_version
7020         and local to is_forced_local.
7021         (Symbol_table::add_from_pluginobj): Likewise.
7022         (Symbol_table::add_from_dynobj): Likewise.
7023         (Symbol_table::define_special_symbol): Rename insdef to
7024         insdefault.
7025
7026 2010-01-04  Ian Lance Taylor  <iant@google.com>
7027
7028         PR 10980
7029         * options.h (class General_options): Add
7030         --allow-multiple-definition and -z muldefs.
7031         * resolve.cc (Symbol_table::should_override): Don't warn about a
7032         multiple symbol definition if --allow-multiple-definition or -z
7033         muldefs.
7034
7035         PR 10980
7036         * options.h (class General_options): Add --add-needed and
7037         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7038         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7039         error if --copy-dt-needed-entries aka --add-needed is used and
7040         would cause a change in behaviour.
7041
7042         PR 10980
7043         * options.h (class General_options): Add -G as a short version of
7044         --shared.  Add no-op options -assert, -g, and -i.
7045
7046 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7047
7048         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7049         check for .text or .gnu.linkonce.t sections.
7050         * icf.cc (Icf::find_identical_sections): Ditto.
7051         Change the detection for mangled function name within the section
7052         name.
7053         * icf.h (is_section_foldable_candidate): New function.
7054
7055 2009-12-30  Ian Lance Taylor  <iant@google.com>
7056
7057         PR 10980
7058         * options.h (class General_options): Permit two dashes with
7059         --retain-symbols-file.
7060
7061 2009-12-30  Ian Lance Taylor  <iant@google.com>
7062
7063         PR 10979
7064         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7065         don't put the file header and segment headers in the text
7066         segment.
7067
7068         PR 10979
7069         * common.cc (Sort_commons::operator()): Stabilize sort when both
7070         entries are NULL.
7071         (Symbol_table::do_allocate_commons_list): When allocating common
7072         symbols, skip a symbol which is no longer common.
7073         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7074         an object before checking its type.
7075         * testsuite/common_test_2.c: New file.
7076         * testsuite/common_test_3.c: New file.
7077         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7078         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7079         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7080         (common_test_2_pic.o, common_test_2.so): New targets.
7081         (common_test_3_pic.o, common_test_3.so): New targets.
7082         * testsuite/Makefile.in: Rebuild.
7083
7084         PR 10979
7085         * script.cc (read_input_script): If we see a new SECTIONS clause,
7086         and we have added an input section, give an error.
7087         * layout.h (class Layout): Add have_added_input_section function.
7088         Add have_added_input_section_ field.
7089         * layout.cc (Layout::Layout): Initialize
7090         have_added_input_section_.
7091         (Layout::layout): Set have_added_input_section_.
7092         (Layout::layout_eh_frame): Likewise.
7093
7094 2009-12-30  Ian Lance Taylor  <iant@google.com>
7095
7096         PR 10931
7097         * options.h (class General_options): Add --sort-common option.
7098         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7099         * common.cc (Sort_common): Add sort_order parameter to
7100         constructor.  Add sort_order_ field.
7101         (Sort_commons::operator): Check sort_order_.
7102         (Symbol_table::allocate_commons): Determine the sort order.
7103         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7104         Change all callers.
7105         (Symbol_table::do_allocate_commons_list): Likewise.
7106
7107 2009-12-30  Ian Lance Taylor  <iant@google.com>
7108
7109         PR 10916
7110         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7111         symbols from this object, don't change the visibility of an
7112         undefined symbol.
7113         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7114
7115 2009-12-30  Ian Lance Taylor  <iant@google.com>
7116
7117         PR 10861
7118         * script.h (class Version_script_info): Define Language enum.
7119         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7120         new fields globals_, locals_, and is_finalized_.
7121         * script.cc: Various formatting fixes.
7122         (class Parser_closure): Change language_stack_ from a vector of
7123         std::string to one of Version_script_info::Language.  Adjust all
7124         uses accordingly.
7125         (class Lazy_demangler): Remove.
7126         (struct Version_expression): Change language from std::string to
7127         Version_script_info::Language.
7128         (Version_script_info::Version_script_info): New function.
7129         (Version_script_info::~Version_script_info): Don't call clear.
7130         (Version_script_info::finalize): New function.
7131         (Version_script_info::build_lookup_tables): New function.
7132         (Version_script_info::build_expression_list_lookup): New
7133         function.
7134         (Version_script_info::get_symbol_version_helper): Rewrite to use
7135         lookup tables.
7136         (Version_script_info::print_expression_list): Adjust to use
7137         Version_script_info::Language.
7138         (script_push_lex_into_version_mode): Check that the version script
7139         has not been finalized.
7140         (version_script_push_lang): Change language string to
7141         Version_script_info::Language.
7142         * options.cc (Command_line::version_script): New function.
7143         * options.h (class General_options): Add finalize_dynamic_list
7144         function.  Change version_script from declaration to definition.
7145         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7146         * testsuite/version_script.map: Remove duplicate def of foo.
7147         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7148         version_script.map.
7149         * testsuite/Makefile.in: Rebuild.
7150
7151 2009-12-30  Ian Lance Taylor  <iant@google.com>
7152
7153         PR 10843
7154         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7155         if the input symbol index is 0, make the output symbol index 0.
7156
7157 2009-12-30  Ian Lance Taylor  <iant@google.com>
7158
7159         PR 10670
7160         * options.h (class General_options): Add -x/--discard-all.
7161         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7162         --discard-all.  If the local symbol needs a dynamic entry, check
7163         that before handling --discard-locals.
7164
7165 2009-12-30  Ian Lance Taylor  <iant@google.com>
7166
7167         PR 10450
7168         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7169         flags to PF_R.
7170         (Output_segment::add_output_section): Don't change the flags if
7171         the type is PT_TLS.
7172
7173         PR 10450
7174         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7175         GNU hash table if they need a dynamic value.  Otherwise, don't add
7176         them if they are defined in a dynamic object or are forced local.
7177
7178 2009-12-29  Ian Lance Taylor  <iant@google.com>
7179
7180         PR 10450
7181         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7182         .gnu.hash table for a 32-bit target.
7183
7184         PR 10450
7185         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7186         regular and a dynamic object only needs a dynamic symbol table
7187         entry if it is externally visible.
7188
7189         PR 10450
7190         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7191         constructor.  Add global_offset_table_ field.
7192         (Target_i386::got_section): Set global_offset_table_.
7193         (Target_i386::do_finalize_sections): Set global_offset_table_
7194         size.
7195         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7196         in constructor.  Add global_offset_table_ field.
7197         (Target_x86_64::got_section): Set global_offset_table_.
7198         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7199         size.
7200
7201         * layout.cc (Layout::Layout): Initialize increase_relro_.
7202         (Layout::get_output_section): Add is_relro, is_last_relro, and
7203         is_first_non_relro parameters.  Change all callers.
7204         (Layout::choose_output_section): Likewise.
7205         (Layout::add_output_section_data): Likewise.
7206         (Layout::make_output_section): Likewise.
7207         (Layout::set_segment_offsets): Clear increase_relro when using a
7208         linker script.
7209         * layout.h (class Layout): Add increase_relro method.  Add
7210         increase_relro_ field.  Update declarations.
7211         * output.cc (Output_section::Output_section): Initialize
7212         is_last_relro_ and is_first_non_relro_.
7213         (Output_segment::add_output_section): Group relro sections is
7214         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7215         (Output_segment::maximum_alignment): Remove relro handling.
7216         (Output_segment::set_section_addresses): Add increase_relro
7217         parameter.  Change all callers.  Add initial alignment to align
7218         relro sections on separate page.  Remove old relro handling.
7219         (Output_segment::set_section_list_addresses): Remove in_relro
7220         parameter.  Change all callers.
7221         (Output_segment::set_offset): Add increase parameter.  Change all
7222         callers.  Remove old relro handling.
7223         * output.h (class Output_section): Add new methods: is_last_relro,
7224         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7225         Add is_last_relro_ and is_first_non_relro_ fields.
7226         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7227         Create separate .got.plt section.  Call increase_relro.
7228         * x86_64.cc (Target_x86_64::got_section): Likewise.
7229         * testsuite/relro_script_test.t: Add .got.plt.
7230
7231         PR 10450
7232         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7233         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7234         (Layout::finalize): Call set_dynamic_symbol_size.
7235         (Layout::set_dynamic_symbol_size): New function.
7236         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7237         set_dynamic_symbol_size.
7238
7239         PR 10450
7240         * output.h (class Output_section): Add is_entsize_zero_ field.
7241         * output.cc (Output_section::Output_section): Initialize
7242         is_entsize_zero_.
7243         (Output_section::set_entsize): If two different entsizes are
7244         requested, force it to zero.
7245         (Output_section::add_input_section): Set flags for .debug_str
7246         before updating section flags.  Set entsize.
7247         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7248         and SHF_STRING if all input sections have those flags.
7249
7250 2009-12-29   Rafael Espindola  <espindola@google.com>
7251
7252         * main.cc (main): Fix the sys time reporting.
7253         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7254         reporting.
7255
7256 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7257
7258         * options.cc (General_options::parse_version): Allow -v to exit
7259         without an error if there is nothing to link.
7260
7261 2009-12-29  Ian Lance Taylor  <iant@google.com>
7262
7263         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7264         using a version of gcc before 4.1.
7265         * configure: Rebuild.
7266
7267 2009-12-28  Chris Demetriou  <cgd@google.com>
7268
7269         * attributes.cc (Output_attributes_section_data::do_write): Use
7270         std::vector::front rather than std::vector::data.
7271
7272 2009-12-28  Ian Lance Taylor  <iant@google.com>
7273
7274         * symtab.h (class Symbol_table): Add enum Defined.
7275         * resolve.cc (Symbol_table::should_override): Add defined
7276         parameter.  Change all callers.  Test whether object is NULL
7277         before calling a method on it.
7278         (Symbol_table::report_resolve_problem): Add defined parameter.
7279         Change all callers.
7280         (Symbol_table::should_override_with_special): Likewise.
7281         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7282         parameter.  Change all callers.
7283         (Symbol_table::do_define_in_output_data): Likewise.
7284         (Symbol_table::define_in_output_segment): Likewise.
7285         (Symbol_table::do_define_in_output_segment): Likewise.
7286         (Symbol_table::define_as_constant): Likewise.
7287         (Symbol_table::do_define_as_constant): Likewise.
7288         * script.h (class Symbol_assignment): Add is_defsym parameter to
7289         constructor; change all callers.
7290         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7291         parameter.  Change all callers.  Add is_defsym_ field.
7292         (class Parser_closure): Add parsing_defsym parameter to
7293         constructor; change all callers.  Add parsing_defsym accessor
7294         function.  Add parsing_defsym_ field.
7295
7296 2009-12-28  Ian Lance Taylor  <iant@google.com>
7297
7298         * gold.cc (queue_middle_tasks): Fix formatting.
7299         * object.cc (Relobj::is_section_name_included): Likewise.
7300
7301 2009-12-23  Ian Lance Taylor  <iant@google.com>
7302
7303         * i386.cc (Target_i386::do_calls_non_split): Recognize
7304         -fsplit-stack prologue for a function with a static chain.
7305         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7306         -fsplit-stack prologue when using %r11.
7307
7308 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7309
7310         * options.cc (General_options::parse_version): Make -v continue and do
7311         the link like GNU ld does.
7312
7313 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7314
7315         * Makefile.am (CCFILES): Add timer.cc.
7316         (HFILES): Add timer.h.
7317         * configure.ac: Check for sysconf and times.
7318         * main.cc: include timer.h.
7319         (main): Use Timer instead of get_run_time.
7320         * timer.cc: New.
7321         * timer.h: New.
7322         * workqueue.cc: include timer.h.
7323         (Workqueue::find_and_run_task):
7324         Report user, sys and wall time.
7325         * Makefile.in: Regenerate.
7326         * config.in: Regenerate.
7327         * configure: Regenerate.
7328
7329 2009-12-16  Doug Kwan  <dougkwan@google.com>
7330
7331         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7332         sections.
7333         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7334         relaxed input sections.
7335         * output.cc (Output_section::find_relaxed_input_section): Change
7336         return type to Output_relaxed_input_section pointer.  Adjust code
7337         for new type of relaxed_input_section_map_.
7338         * output.h (Output_section::find_relaxed_input_section): Change
7339         return type to Output_relaxed_input_section pointer.
7340         (Output_section::Output_relaxed_input_section_by_input_section_map):
7341         New type.
7342         (Output_section::relaxed_input_section_map_): Change type to
7343         Output_section::Output_relaxed_input_section_by_input_section_map.
7344         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7345         input section.
7346
7347 2009-12-15  Ian Lance Taylor  <iant@google.com>
7348
7349         * layout.cc (Layout::create_shstrtab): Only write out after input
7350         sections if we are compressing debug sections.
7351
7352 2009-12-15  Ian Lance Taylor  <iant@google.com>
7353
7354         * archive.cc (Archive::add_symbols): Only look up a symbol without
7355         a version if there is, in fact, a version.
7356
7357 2009-12-14  Ian Lance Taylor  <iant@google.com>
7358
7359         Revert -Wshadow changes, all changes from:
7360         2009-12-11  Doug Kwan  <dougkwan@google.com>
7361         2009-12-11  Nick Clifton  <nickc@redhat.com>
7362         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7363
7364 2009-12-11  Doug Kwan  <dougkwan@google.com>
7365
7366         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7367         due to -Wshadow.
7368         * attributes.cc (Object_attribute::size): Ditto.
7369         (Attributes_section_data::size): Ditto.
7370         (Attributes_section_data::Attributes_section_data): Ditto.
7371         (Output_attributes_section_data::do_write): Ditto.
7372         * attributes.h (Object_attribute::set_type): Ditto.
7373         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7374
7375 2009-12-11  Nick Clifton  <nickc@redhat.com>
7376
7377         * archive.cc: Fix shadowed variable warnings.
7378         * arm.cc: Likewise.
7379         * compressed_output.cc: Likewise.
7380         * compressed_output.h: Likewise.
7381         * configure: Likewise.
7382         * dwarf_reader.cc: Likewise.
7383         * dynobj.cc: Likewise.
7384         * dynobj.h: Likewise.
7385         * ehframe.cc: Likewise.
7386         * ehframe.h: Likewise.
7387         * errors.cc: Likewise.
7388         * expression.cc: Likewise.
7389         * fileread.cc: Likewise.
7390         * fileread.h: Likewise.
7391         * freebsd.h: Likewise.
7392         * i386.cc: Likewise.
7393         * icf.cc: Likewise.
7394         * incremental.h: Likewise.
7395         * layout.cc: Likewise.
7396         * layout.h: Likewise.
7397         * mapfile.cc: Likewise.
7398         * merge.cc: Likewise.
7399         * merge.h: Likewise.
7400         * object.cc: Likewise.
7401         * object.h: Likewise.
7402         * options.h: Likewise.
7403         * output.cc: Likewise.
7404         * output.h: Likewise.
7405         * parameters.cc: Likewise.
7406         * plugin.cc: Likewise.
7407         * powerpc.cc: Likewise.
7408         * reduced_debug_output.cc: Likewise.
7409         * reduced_debug_output.h: Likewise.
7410         * reloc.cc: Likewise.
7411         * reloc.h: Likewise.
7412         * resolve.cc: Likewise.
7413         * script-sections.cc: Likewise.
7414         * script.cc: Likewise.
7415         * script.h: Likewise.
7416         * sparc.cc: Likewise.
7417         * symtab.cc: Likewise.
7418         * symtab.h: Likewise.
7419         * target-select.cc: Likewise.
7420         * target-select.h: Likewise.
7421         * token.h: Likewise.
7422         * workqueue.cc: Likewise.
7423         * workqueue.h: Likewise.
7424         * x86_64.cc: Likewise.
7425
7426 2009-12-10  Doug Kwan  <dougkwan@google.com>
7427
7428         * arm.cc (attributes.h): New include.
7429         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7430         (Arm_relobj::~Arm_relobj): Delete object pointed by
7431         attributes_section_data_.
7432         (Arm_relobj::attributes_section_data): New method definition.
7433         (Arm_relobj::attributes_section_data_): New data member declaration.
7434         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7435         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7436         attributes_section_data_.
7437         (Arm_dynobj::attributes_section_data): New method definition.
7438         (Arm_dynobj::attributes_section_data_): New data member declaration.
7439         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7440         initialization value of may_use_blx_ to false.
7441         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7442         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7443         object attributes to compute results instead of hard-coding.
7444         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7445         Target_arm::get_secondary_compatible_arch,
7446         Target_arm::set_secondary_compatible_arch
7447         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7448         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7449         New method declarations.
7450         (Target_arm::get_aeabi_object_attribute): New method definition.
7451         (Target_arm::attributes_section_data_): New data member declaration.
7452         (read_arm_attributes_section): New template definition.
7453         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7454         (Arm_dynobj::do_read_symbols): Ditto.
7455         (Target_arm::do_finalize_sections): Merge attributes sections from
7456         input.  Check for BLX use after attributes section merging.
7457         Fix __exidx_start and __exidx_end visibility.  Create an
7458         .ARM.attributes section if necessary.
7459         (Target_arm::get_secondary_compatible_arch,
7460         Target_arm::set_secondary_compatible_arch,
7461         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7462         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7463         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7464         New method definitions.
7465
7466 2009-12-09  Ian Lance Taylor  <iant@google.com>
7467
7468         * plugin.cc (Plugin::load): Don't cast from void* to a function
7469         pointer.
7470
7471 2009-12-09  Ian Lance Taylor  <iant@google.com>
7472
7473         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7474         information fields.
7475
7476 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7477
7478         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7479         Replace two_file_shared_1.so with two_file_shared_2.so.
7480         * testsuite/Makefile.in: Regenerated.
7481
7482 2009-12-08  Doug Kwan  <dougkwan@google.com>
7483
7484         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7485         (HFILES): Add attributes.h and int_encoding.h.
7486         * Makefile.in: Regenerate.
7487         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7488         function definitions to int_encoding.cc
7489         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7490         prototypes to int_encoding.h
7491         * reduced_debug_output.cc (int_encoding.h): New include.
7492         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7493         function definitions to int_encoding.cc
7494         (insert_into_vector, read_from_pointer): Move template definitions to
7495         int_encoding.h
7496         * attributes.cc: New file.
7497         * attributes.h: New file.
7498         * int_encoding.cc: New file.
7499         * int_encoding.h: New file.
7500
7501 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7502
7503         PR gold/11055
7504         * incremental-dump.cc (dump_incremental_inputs): New.
7505         (main): Use dump_incremental_inputs.
7506
7507 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7508
7509         PR gold/10893
7510         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7511         checking elfcpp::STT_FUNC.
7512         (Target_i386::Relocate::relocate): Likewise.
7513         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7514
7515         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7516         symbols from shared libraries into normal FUNC symbols.
7517
7518         * symtab.h (Symbol): Add is_func and use it.
7519
7520 2009-12-05  Doug Kwan  <dougkwan@google.com>
7521
7522         * arm.cc (Target_arm::arm_info): Initialize new fields
7523         attributes_section and attributes_vendor.
7524         * i386.cc (Target_i386::i386_info): Same.
7525         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7526         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7527         fields attributes_section and attributes_vendor.
7528         * sparc.cc (Target_sparc::sparc_info): Same.
7529         * target.h (Target::attributes_section, Target::attributes_vendor,
7530         Target::is_attributes_section, Target::attribute_arg_type,
7531         Target::attributes_order): New method definitions.
7532         (Target::Target_info::attributes_section,
7533         Target::Target_info::attributes_vendor): New fields.
7534         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7535         virtual method definitions.
7536         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7537         attributes_section and attributes_vendor.
7538         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7539
7540 2009-12-05  Doug Kwan  <dougkwan@google.com>
7541
7542         * arm.cc: Update comments about interworking and stub generation.
7543         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7544         considered as non-PIC.
7545         (Arm_relocate_functions::base_abs): Fix formatting.
7546         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7547         of function to use GOT entry address instead of offset.
7548         (Target_arm::Scan::global): Issue an error if a symbol would need a
7549         PLT does not get one because it is untyped.  Remove code to create
7550         dynamic symbols for relative branches.
7551         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7552         takes unsigned integer instead of boolean.
7553
7554 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7555
7556         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7557         (two_file_test_LDADD): Likewise.
7558         (common_test_1_LDADD): Likewise.
7559         (exception_test_LDADD) Likewise.
7560         (weak_test_LDADD): Likewise.
7561         (many_sections_test_LDADD): Likewise.
7562         (initpri1_LDADD): Likewise.
7563         (script_test_1_LDADD): Likewise.
7564         (script_test_2_LDADD): Likewise.
7565         (justsyms_LDADD): Likewise.
7566         (binary_test_LDADD): Likewise.
7567         (large_LDADD): Likewise.
7568         * testsuite/Makefile.in: Regenerated.
7569
7570 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7571
7572         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7573         (Symbol_table::override_with_special): Likewise.
7574         (Symbol_table::add_from_object): Likewise.
7575
7576 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7577
7578         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7579         Don't set the data_offset twice.
7580
7581 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7582
7583         * testsuite/Makefile.in: Regenerate.
7584
7585 2009-12-03  Doug Kwan  <dougkwan@google.com>
7586
7587         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7588         (Target_arm::do_finalize_sections): Add parameter for symbol table
7589         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7590         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7591         parameter for symbol table pointer.
7592         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7593         an additional parameter for a pointer to symbol table.
7594         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7595         parameter for a symbol table pointer.
7596         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7597         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7598         Ditto.
7599         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7600         parameter for a symbol table pointer.
7601
7602 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7603
7604         * incremental.cc (Incremental_inputs_header)
7605         (Incremental_inputs_header_write, Incremental_inputs_entry)
7606         (Incremental_inputs_entry_write): Move ...
7607         * incremental.h (Incremental_inputs_header)
7608         (Incremental_inputs_header_write, Incremental_inputs_entry)
7609         (Incremental_inputs_entry_write): here.
7610
7611 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7612
7613         * incremental.cc (make_sized_incremental_binary): Set the target.
7614         Error if it is incompatible.
7615         * output.h (Output_file): Add filename method.
7616
7617 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7618
7619         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7620         from the get_* methods.
7621
7622 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7623
7624         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7625         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7626         Write 0 for the data_offset of scripts.
7627
7628 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7629
7630         * testsuite/Makefile.am: Add the incremental_test.sh test.
7631         * testsuite/incremental_test.sh: New.
7632         * testsuite/incremental_test_1.c: New.
7633         * testsuite/incremental_test_2.c: New.
7634
7635 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7636
7637        * incremental-dump.cc (main): Fix typos.
7638
7639 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7640
7641         PR gold/11025
7642         * incremental-dump.cc (main): Use llu to print 64 bit values.
7643
7644 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7645             H.J. Lu  <hongjiu.lu@intel.com>
7646
7647         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7648         $(LIBDL).
7649         (incremental_dump_LDADD): Likewise.
7650         * Makefile.in: Regenerated.
7651
7652 2009-11-25  Doug Kwan  <dougkwan@google.com>
7653
7654         Revert:
7655
7656         2009-11-25  Doug Kwan  <dougkwan@google.com>
7657
7658                 * arm.cc (Target_arm::Target_arm): Move method definition
7659                 outside of class definition.  Add code to handle
7660                 --target1-rel, --target1-abs and --target2= options.
7661                 (Target_arm::get_reloc_reloc_type): Change method to be
7662                 non-static and const.
7663                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7664                 New data member declaration.
7665                 (Target_arm::Scan::local, Target_arm::Scan::global,
7666                 Target_arm::Relocate::relocate,
7667                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7668                 Adjust call to Target_arm::get_real_reloc_type.
7669                 (Target_arm::get_real_reloc_type): Use command line options
7670                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7671                 * options.h (--target1-rel, --target1-abs, --target2): New
7672                 ARM-only options.
7673
7674 2009-11-25  Doug Kwan  <dougkwan@google.com>
7675
7676         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7677         class definition.  Add code to handle --target1-rel, --target1-abs
7678         and --target2= options.
7679         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7680         and const.
7681         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7682         member declaration.
7683         (Target_arm::Scan::local, Target_arm::Scan::global,
7684         Target_arm::Relocate::relocate,
7685         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7686         call to Target_arm::get_real_reloc_type.
7687         (Target_arm::get_real_reloc_type): Use command line options to
7688         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7689         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7690         options.
7691
7692 2009-11-25  Doug Kwan  <dougkwan@google.com>
7693
7694         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7695         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7696         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7697         formatting.
7698         (Arm_relocate_functions::thm_call): Replace body with a call to
7699         Arm_relocate_functions::thumb_branch_common.
7700         (Arm_relocate_functions::thm_jump24,
7701         Arm_relocate_functions::thm_xpc22): New method definitions.
7702         (Arm_relocate_functions::thumb_branch_common): New method definition.
7703         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7704         operator.
7705         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7706         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7707
7708 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7709
7710         * Makefile.am: Build incremental-dump
7711         * Makefile.in: Regenerate.
7712         * incremental-dump.cc: New.
7713         * incremental.cc (Incremental_inputs_header_data,
7714         Incremental_inputs_entry_data): Move to incremental.h
7715         * incremental.h: (Incremental_inputs_header_data,
7716         Incremental_inputs_entry_data): Move from incremental.cc
7717
7718 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7719
7720         * incremental.cc (Incremental_inputs_header,
7721         Incremental_inputs_header_write, Incremental_inputs_entry,
7722         Incremental_inputs_entry_write): Add a typedef with the data type.
7723
7724 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7725
7726         * incremental.cc (Incremental_inputs_header,
7727         Incremental_inputs_header_write, Incremental_inputs_entry,
7728         Incremental_inputs_entry_write): Update comment about which
7729         type has the filed descriptions.
7730
7731 2009-11-15  Doug Kwan  <dougkwan@google.com>
7732
7733         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7734         (Arm_relocate_functions::arm_branch_common): Change method defintion
7735         in class definition to a method declaration and update list of formal
7736         parameters.
7737         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7738         Arm_relocation_functions::jump24): Adjust call to
7739         Arm_relocate_functions::arm_branch_common.  Update list of formal
7740         parameters.
7741         (Arm_relocate_functions::xpc25): New method definition.
7742         (Arm_relocate_functions::arm_branch_common): Move method defintion
7743         out from class definition.  Use stubs for mode-switching and extending
7744         branch ranges.
7745         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7746         specially.  Change code to enable use of stubs in ARM branches.
7747
7748 2009-11-10  Doug Kwan  <dougkwan@google.com>
7749
7750         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7751         in method declaration.
7752         (Target_arm::relocate_stub): New method declaration.
7753         (Target_arm::default_target): Change to return a pointer instead of
7754         a const reference.
7755         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7756         Target_arm::default_target.
7757         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7758         method definition.
7759         (Target_arm::relocate_section): Adjust view.
7760         (Target_arm::relocate_stub): New method definition.
7761
7762 2009-11-10  Doug Kwan  <dougkwan@google.com>
7763
7764         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7765         a format warning.
7766         * incremental.cc (open_incremental_binary): Initialized local
7767         variables to avoid warnings.
7768         * object.cc (make_elf_object): Ditto.
7769         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7770         a format warning.
7771
7772 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7773
7774         PR gold/10930
7775         * testsuite/plugin_test.c: Include "config.h".
7776
7777 2009-11-09  Doug Kwan  <dougkwan@google.com>
7778
7779         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7780         (arm_symbol_value): Remove.
7781         (Arm_relocate_functions::arm_branch_common,
7782         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7783         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7784         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7785         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7786         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7787         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7788         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7789         Arm_relocate_functions::thm_mobw_abs_nc,
7790         Arm_relocate_functions::thm_mov_abs,
7791         Arm_relocate_functions::movw_prel_nc,
7792         Arm_relocate_functions::thm_movt_abs,
7793         Arm_relocate_functions::movt_prel,
7794         Arm_relocate_functions::thm_movw_prel_nc,
7795         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7796         (Target_arm::Relocate::relocate): Only decompose address into two
7797         parts if relocation type uses the thumb-bit and pass the actual
7798         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7799         calls to methods in Arm_relocate_functions for this change.
7800
7801 2009-11-08  Ian Lance Taylor  <iant@google.com>
7802
7803         PR 10925
7804         * reloc.cc: Instantiate
7805         Sized_relobj::initialize_input_to_output_maps and
7806         Sized_relobj:free_input_to_output_maps.
7807
7808 2009-11-06  Ian Lance Taylor  <iant@google.com>
7809
7810         PR 10876
7811         * defstd.cc (in_segment): Set only_if_ref true for "end".
7812
7813 2009-11-06  Doug Kwan  <dougkwan@google.com>
7814
7815         * arm.cc (class Reloc_stub): Correct a comment.
7816         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7817         (Target_arm::scan_section_for_stubs): New method declaration.
7818         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7819         Change methods from private to protected.
7820         (Target_arm::do_may_relax): New method definition.
7821         (Target_arm::do_relax, Target_arm::group_sections,
7822         Target_arm::scan_reloc_for_stub,
7823         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7824         (Target_arm::arm_input_section_map_): New data member declaration.
7825         (Target_arm::scan_reloc_for_stub,
7826         Target_arm::scan_reloc_section_for_stubs,
7827         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7828         Target_arm::do_relax): New method definitions.
7829
7830 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7831
7832         * configure.ac: Check for (struct stat)::st_mtim
7833         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7834         * config.in: Regenerate.
7835         * configure: Regenerate.
7836
7837 2009-11-05  Ian Lance Taylor  <iant@google.com>
7838
7839         PR 10910
7840         * output.cc (Output_segment::add_output_section): Add missing
7841         return statement.
7842
7843 2009-11-04  Ian Lance Taylor  <iant@google.com>
7844
7845         PR 10880
7846         * object.h (class Object): Add is_needed and set_is_needed
7847         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7848         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7849         defined in a dynamic object and referenced by a regular object,
7850         set is_needed for the dynamic object.
7851         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7852         if the file is marked with as_needed and it is not needed.
7853
7854 2009-11-04  Ian Lance Taylor  <iant@google.com>
7855
7856         PR 10887
7857         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7858         tags if data is discarded by linker script.
7859         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7860         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7861         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7862         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7863
7864 2009-11-04  Ian Lance Taylor  <iant@google.com>
7865
7866         * layout.cc (Layout::get_output_section): Add is_interp and
7867         is_dynamic_linker_section parameters.  Change all callers.
7868         (Layout::choose_output_section): Likewise.
7869         (Layout::make_output_section): Likewise.
7870         (Layout::add_output_section_data): Add is_dynamic_linker_section
7871         parameter.  Change all callers.
7872         * layout.h (class Layout): Update declarations.
7873         * output.h (class Output_section): Add is_interp, set_is_interp,
7874         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7875         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7876         generate_code_fills_at_write_ to a bitfield.
7877         * output.cc (Output_section::Output_sections): Initialize new
7878         fields.
7879         (Output_segment::add_output_section): Add do_sort parameter.
7880         Change all callers.
7881
7882 2009-11-03  Ian Lance Taylor  <iant@google.com>
7883
7884         PR 10860
7885         * options.h (class General_options): Add --warn-common.
7886         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7887         merging two common symbols.
7888         (Symbol_table::should_override): Handle --warn-common when merging
7889         a common symbol with a defined symbol.  Use report_resolve_problem
7890         for multiple definitions.
7891         (Symbol_table::report_resolve_problem): New function.
7892         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7893
7894 2009-11-03  Doug Kwan  <dougkwan@google.com>
7895
7896         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7897         stub_factory_.
7898         (Target_arm::stub_factory): New method definition.
7899         (Target_arm::new_arm_input_section,
7900         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7901         Target_arm::reloc_uses_thumb_bit): New method declarations.
7902         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7903         New type definitions.
7904         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7905         member declarations.
7906         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7907         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7908         New method definitions.
7909
7910 2009-11-03  Ian Lance Taylor  <iant@google.com>
7911
7912         * options.h (class General_options): Add --warn_constructors.
7913
7914 2009-11-03  Ian Lance Taylor  <iant@google.com>
7915
7916         PR 10893
7917         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7918         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7919
7920 2009-11-03  Ian Lance Taylor  <iant@google.com>
7921
7922         PR 10895
7923         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7924         --msgid-bugs-address.
7925         (install-pdf): New target.
7926         (install-data_yes): Look up one directory to find mkinstalldirs.
7927
7928 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7929
7930         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7931         tree.
7932
7933 2009-10-30  Doug Kwan  <dougkwan@google.com>
7934
7935         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7936
7937 2009-10-30  Doug Kwan  <dougkwan@google.com>
7938
7939         * arm.cc (Stub_addend_reader): New struct template definition
7940         and partial specializations.
7941         (Stub_addend_reader::operator()): New method definition for a
7942         partially specialized template.
7943
7944 2009-10-30  Doug Kwan  <dougkwan@google.com>
7945
7946         * arm.cc (Arm_relobj::processor_specific_flags): New method
7947         definition.
7948         (Arm_relobj::do_read_symbols): New method declaration.
7949         (Arm_relobj::processor_specific_flags_): New data member declaration.
7950         (Arm_dynobj): New class definition.
7951         (Target_arm::do_finalize_sections): Add input_objects parameter.
7952         (Target_arm::do_adjust_elf_header): New method declaration.
7953         (Target_arm::are_eabi_versions_compatible,
7954         (Target_arm::merge_processor_specific_flags): New method declaration.
7955         (Target_arm::do_make_elf_object): New overloaded method definitions
7956         and declaration.
7957         (Arm_relobj::do_read_symbols): New method definition.
7958         (Arm_dynobj::do_read_symbols): Ditto.
7959         (Target_arm::do_finalize_sections): Add input_objects parameters.
7960         Merge processor-specific flags from all input objects.
7961         (Target_arm::are_eabi_versions_compatible,
7962         Target_arm::merge_processor_specific_flags,
7963         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7964         New method definitions.
7965         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7966         Input_objects pointer type parameter.
7967         * layout.cc (Layout::finalize): Pass input objects to target's.
7968         finalize_sections function.
7969         * output.cc (Output_file_header::do_sized_write): Set ELF file
7970         header's processor-specific flags.
7971         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7972         Input_objects pointer type parameter.
7973         * sparc.cc (Target_sparc::do_finalize_sections): Same.
7974         * target.h (Input_objects): New forward class declaration.
7975         (Target::processor_specific_flags,
7976         Target::are_processor_specific_flags_sect): New method definitions.
7977         (Target::finalize_sections): Add input_objects parameter.
7978         (Target::Target): Initialize processor_specific_flags_ and
7979         are_processor_specific_flags_set_.
7980         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7981         parameter.
7982         (Target::set_processor_specific_flags): New method definition.
7983         (Target::processor_specific_flags_,
7984         Target::are_processor_specific_flags_set_): New data member
7985         declarations.
7986         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7987         Input_objects pointer type parameter.
7988
7989 2009-10-30  Doug Kwan  <dougkwan@google.com>
7990
7991         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7992
7993 2009-10-28  Ian Lance Taylor  <iant@google.com>
7994
7995         * object.h (class Relobj): Drop options parameter from
7996         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7997         do_scan_relocs, do_relocate.  Change all callers.
7998         (class Sized_relobj): Drop options parameters from
7999         do_gc_process_relocs, do_scan_relocs, do_relocate,
8000         do_relocate_sections, relocate_sections, emit_relocs_scan,
8001         emit_relocs_scan_reltype.  Change all callers.
8002         (struct Relocate_info): Remove options field and all references to
8003         it.
8004         * reloc.h (class Read_relocs): Remove options constructor
8005         parameter and options_ field.  Change all callers.
8006         (class Gc_process_relocs, class Scan_relocs): Likewise.
8007         (class Relocate_task): Likewise.
8008         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8009         all callers.
8010         (scan_relocatable_relocs): Likewise.
8011         * target.h (class Sized_target): Remove options parameter from
8012         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8013         all callers.
8014         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8015         callers.
8016         * arm.cc: Update functions to remove options parameters.
8017         * i386.cc: Likewise.
8018         * powerpc.cc: Likewise.
8019         * sparc.cc: Likewise.
8020         * x86_64.cc: Likewise.
8021         * testsuite/testfile.cc: Likewise.
8022
8023 2009-10-28  Doug Kwan  <dougkwan@google.com>
8024
8025         * arm.cc (Arm_relobj): New class definition.
8026         (Arm_relobj::scan_sections_for_stubs,
8027         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8028         New method definitions.
8029
8030 2009-10-28  Cary Coutant  <ccoutant@google.com>
8031
8032         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8033         (Plugin::cleanup_done_): New member.
8034         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8035         (Plugin_manager::cleanup_done_): Remove.
8036         (Plugin_manager::add_input_file): Edit error message.
8037         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8038         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8039
8040 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8041
8042         * fileread.cc: (File_read::View::~View): Use the new
8043         data_ownership_ filed.
8044         (File_read::~File_read): Dispose the new whole_file_view_.
8045         (File_read::open): Mmap the whole file if needed.
8046         (File_read::open): Use whole_file_view_ instead of contents_.
8047         (File_read::find_view): Use whole_file_view_ if applicable.
8048         (File_read::do_read): Use whole_file_view_ instead of contents_.
8049         (File_read::make_view): Use whole_file_view_ instead of contents_,
8050         update File_read::View::View call.
8051         (File_read::find_or_make_view): Update File_read::View::View
8052         call.
8053         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8054         remove contents_
8055         (File_read::View::Data_ownership): New enum.
8056         (File_read::View::View): Replace bool mapped_ with Data_ownership
8057         argument.
8058         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8059         (File_read::View::data_ownership_): New field.
8060         (File_read::contents_): Remove (replaced by whole_file_view_).
8061         (File_read::whole_file_view_): New field.
8062         * options.h (class General_options): Add --keep-files-mapped.
8063
8064 2009-10-27  Cary Coutant  <ccoutant@google.com>
8065
8066         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8067         * testsuite/Makefile.am (plugin_test_5): New test case.
8068         * testsuite/Makefile.in: Regenerate.
8069
8070 2009-10-25  Doug Kwan  <dougkwan@google.com>
8071
8072         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8073         from private to protected to allow access by child class.
8074         (Sized_relobj::do_relocate_sections): New method declaration.
8075         (Sized_relobj::relocate_sections): Virtualize.
8076         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8077         Sized_relobj::relocate_sections.  Instantiate template explicitly
8078         for different target sizes and endianity.
8079
8080 2009-10-24  Doug Kwan  <dougkwan@google.com>
8081
8082         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8083         (Arm_input_section::as_arm_input_section): New method.
8084         (Arm_output_section): New class definition.
8085         (Arm_output_section::create_stub_group,
8086         Arm_output_section::group_sections): New method definitions.
8087
8088 2009-10-22  Doug Kwan  <dougkwan@google.com>
8089
8090         * arm.cc (Arm_input_section): New class definition.
8091         (Arm_input_section::init, Arm_input_section:do_write,
8092         Arm_input_section::set_final_data_size,
8093         Arm_input_section::do_reset_address_and_file_offset): New method
8094         definitions.
8095
8096 2009-10-21  Doug Kwan  <dougkwan@google.com>
8097
8098         * arm.cc (Stub_table, Arm_input_section): New forward class
8099         declarations.
8100         (Stub_table): New class defintion.
8101         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8102         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8103         New method definition.
8104
8105 2009-10-21  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc: Update copyright comments.
8108         (Target_arm): New forward class template declaration.
8109         (Arm_address): New type.
8110         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8111         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8112         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8113         constants.
8114         (Insn_template): Same.
8115         (DEF_STUBS): New macro.
8116         (Stub_type): New enum type.
8117         (Stub_template): New class definition.
8118         (Stub): Same.
8119         (Reloc_stub): Same.
8120         (Stub_factory): Same.
8121         (Target_arm::Target_arm): Initialize may_use_blx_ and
8122         should_force_pic_veneer_.
8123         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8124         Target_arm::should_force_pic_veneer,
8125         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8126         Target_arm::using_thumb_only, Target_arm:;default_target): New
8127         method defintions.
8128         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8129         New data member declarations.
8130         (Insn_template::size, Insn_template::alignment): New method defintions.
8131         (Stub_template::Stub_template): New method definition.
8132         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8133         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8134         (Stub_factory::Stub_factory): New method definition.
8135         * gold.h (string_hash): New template.
8136         * output.h (Input_section_specifier::hash_value): Use
8137         gold::string_hash.
8138         (Input_section_specifier::string_hash): Remove.
8139         * stringpool.cc (Stringpool_template::string_hash): Use
8140         gold::string_hash.
8141
8142 2009-10-20  Doug Kwan  <dougkwan@google.com>
8143
8144         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8145         symbols of relaxed input sections.
8146         * output.h (Output_section::find_relaxed_input_section): Make
8147         method public.
8148
8149 2009-10-16  Doug Kwan  <dougkwan@google.com>
8150
8151         * dynobj.cc (Versions::Versions): Initialize version_script_.
8152         Only insert base version symbol definition for a shared object
8153         if version script defines any version versions.
8154         (Versions::define_base_version): New method definition.
8155         (Versions::add_def): Check that base version is not needed.
8156         (Versions::add_need): Define base version lazily.
8157         * dynobj.h (Versions::define_base_version): New method declaration.
8158         (Versions::needs_base_version_): New data member declaration.
8159         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8160         (check_DATA): Add no_version_test.stdout.
8161         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8162         New make rules.
8163         * testsuite/Makefile.in: Regenerate.
8164         * testsuite/no_version_test.c: New file.
8165         * testsuite/no_version_test.sh: Ditto.
8166
8167 2009-10-16  Doug Kwan  <dougkwan@google.com>
8168
8169         * expression.cc (class Segment_start_expression): New class definition.
8170         (Segment_start_expression::value): New method definition.
8171         (script_exp_function_segment_start): Return a new
8172         Segment_start_expression.
8173         * gold/script-c.h (script_saw_segment_start_expression): New function
8174         prototype.
8175         * script-sections.cc (Script_sections::Script_sections): Initialize
8176         SAW_SEGMENT_START_EXPRESSION_ to false.
8177         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8178         and -Tbbs options to specify section addresses if given in
8179         command line and no SEGMENT_START expression is seen in a script.
8180         * script-sections.h (Script_sections::saw_segment_start_expression,
8181         Script_sections::set_saw_segment_start_expression): New method
8182         definition.
8183         (Script_sections::saw_segment_start_expression_): New data member
8184         declaration.
8185         * script.cc (script_saw_segment_start_expression): New function.
8186         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8187         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8188         script_test_7.sh and script_test_8.sh.
8189         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8190         script_test_8.stdout.
8191         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8192         (script_test_6, script_test_6.stdout, script_test_7,
8193         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8194         * Makefile.in: Regenerate.
8195         * testsuite/script_test_6.sh: New file.
8196         * testsuite/script_test_6.t: Same.
8197         * testsuite/script_test_7.sh: Same.
8198         * testsuite/script_test_7.t: Same.
8199         * testsuite/script_test_8.sh: Same.
8200
8201 2009-10-16  Doug Kwan  <dougkwan@google.com>
8202
8203         * output.cc (Output_segment::set_section_list_address): Cast
8204         expressions to unsigned long long type to avoid format warnings.
8205
8206 2009-10-15  Ian Lance Taylor  <iant@google.com>
8207
8208         * script.cc (Script_options::add_symbol_assignment): Always add a
8209         dot assignment to script_sections_.
8210         * script-sections.cc (Script_sections::add_dot_assignment):
8211         Initialize if necessary.
8212
8213         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8214         program headers with no load segment if there is a linker script.
8215
8216         * layout.cc (Layout::set_segment_offsets): Align the file offset
8217         to the segment aligment for -N or -n with no load segment.
8218         * output.cc (Output_segment::add_output_section): Don't crash if
8219         the first section is a TLS section.
8220         (Output_segment::set_section_list_addresses): Print an error
8221         message if the address moves backward in a linker script.
8222         * script-sections.cc
8223         (Output_section_element_input::set_section_addresses): Don't
8224         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8225         (Orphan_output_section::set_section_addresses): Likewise.
8226
8227 2009-10-15  Doug Kwan  <dougkwan@google.com>
8228
8229         * layout.cc (Layout::finish_dynamic_section): Generate tags
8230         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8231         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8232         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8233
8234 2009-10-14  Ian Lance Taylor  <iant@google.com>
8235
8236         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8237         fields.
8238         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8239         data_shdr fields of relinfo.
8240         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8241         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8242         R_386_TLS_LDO_32, adjust based on section flags.
8243         (Target_i386::Relocate::fix_up_ldo): Remove.
8244
8245 2009-10-13  Ian Lance Taylor  <iant@google.com>
8246
8247         Add support for -pie.
8248         * options.h (class General_options): Add -pie and
8249         --pic-executable.
8250         (General_options::output_is_position_independent): Test -pie.
8251         (General_options::output_is_executable): Return true if not shared
8252         and not relocatable.
8253         (General_options::output_is_pie): Remove.
8254         * options.cc (General_options::finalize): Reject incompatible uses
8255         of -pie.
8256         * gold.cc (queue_middle_tasks): A -pie link is not static.
8257         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8258         * symtab.cc (Symbol::final_value_is_known): Return false if
8259         output_is_position_independent.
8260         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8261         output_is_position_independent.
8262         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8263         output_is_position_independent.
8264         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8265         output_is_position_independent.
8266         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8267         two_file_pie_test.
8268         (basic_pie_test.o, basic_pie_test): New targets.
8269         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8270         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8271         (two_file_pie_test): New target.
8272         * testsuite/Makefile.in: Rebuild.
8273         * README: Remove note saying that -pie is not supported.
8274
8275 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8276
8277         * options.h (class General_options): Add -init and -fini.
8278         * layout.cc (Layout::finish_dynamic_section): Emit
8279         given init and fini functions.
8280
8281 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8282
8283         * gc.h (gc_process_relocs): Check if icf is enabled using new
8284         function.
8285         * gold.cc (queue_initial_tasks): Likewise.
8286         (queue_middle_tasks): Likewise.
8287         * object.cc (do_layout): Likewise.
8288         * symtab.cc (is_section_folded): Likewise.
8289         * main.cc (main): Likewise.
8290         * reloc.cc (Read_relocs::run): Likewise.
8291         (Sized_relobj::do_scan_relocs): Likewise.
8292         * icf.cc (is_function_ctor_or_dtor): New function.
8293         (Icf::find_identical_sections): Check if function is ctor or dtor when
8294         safe icf is chosen.
8295         * options.h (General_options::icf): Change option to be an enum.
8296         (Icf_status): New enum.
8297         (icf_enabled): New method.
8298         (icf_safe_folding): New method.
8299         (set_icf_status): New method.
8300         (icf_status_): New variable.
8301         * (options.cc) (General_options::finalize): Set icf_status_.
8302         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8303         icf_test and icf_keep_unique_test to use the --icf enum flag.
8304         * testsuite/icf_safe_test.sh: New file.
8305         * testsuite/icf_safe_test.cc: New file.
8306
8307 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8308
8309         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8310         includes to gc.h and icf.h.
8311         * arm.cc: Include gc.h.
8312         * gold.cc: Likewise.
8313         * i386.cc: Likewise.
8314         * powerpc.cc: Likewise.
8315         * sparc.cc: Likewise.
8316         * x86_64.cc: Likewise.
8317         * gc.h: Include icf.h.
8318
8319 2009-10-11  Ian Lance Taylor  <iant@google.com>
8320
8321         * plugin.cc: Include "gold.h" before other header files.
8322
8323 2009-10-10  Chris Demetriou  <cgd@google.com>
8324
8325         * options.h (Input_file_argument::Input_file_type): New enum.
8326         (Input_file_argument::is_lib_): Replace with...
8327         (Input_file_argument::type_): New member.
8328         (Input_file_argument::Input_file_argument): Take Input_file_type
8329         'type' rather than boolean 'is_lib' as second argument.
8330         (Input_file_argument::is_lib): Use type_.
8331         (Input_file_argument::is_searched_file): New function.
8332         (Input_file_argument::may_need_search): Handle is_searched_file.
8333         * options.cc (General_options::parse_library): Support -l:filename.
8334         (General_options::parse_just_symbols): Update for Input_file_argument
8335         changes.
8336         (Command_line::process): Likewise.
8337         * archive.cc (Archive::get_file_and_offset): Likewise.
8338         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8339         * script.cc (read_script_file, script_add_file): Likewise.
8340         * fileread.cc (Input_file::Input_file): Likewise.
8341         (Input_file::will_search_for): Handle is_searched_file.
8342         (Input_file::open): Likewise.
8343         * readsyms.cc (Read_symbols::get_name): Likewise.
8344         * testsuite/Makefile.am (searched_file_test): New test.
8345         * testsuite/Makefile.in: Regenerate.
8346         * testsuite/searched_file_test.cc: New file.
8347         * testsuite/searched_file_test_lib.cc: New file.
8348
8349 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8350             Ian Lance Taylor  <iant@google.com>
8351
8352         * descriptor.cc: Include <cstdio> and "binary-io.h".
8353         (Descriptors::open): Open the files in binary mode always.
8354         * script.cc (Lex::get_token): Treat \r as whitespace.
8355
8356 2009-10-09  Ian Lance Taylor  <iant@google.com>
8357
8358         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8359
8360 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8361             Ian Lance Taylor  <iant@google.com>
8362
8363         * configure.ac: Check for readv function also.
8364         * fileread.cc (readv): Define if not HAVE_READV.
8365         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8366         does not exist.
8367         * config.in: Regenerate.
8368         * configure: Regenerate.
8369
8370 2009-10-09  Doug Kwan  <dougkwan@google.com>
8371
8372         * layout.cc (Layout::make_output_section): Call target hook to make
8373         ordinary output section.
8374         (Layout::finalize): Adjust parameter list of call the
8375         Target::may_relax().
8376         * layout.h (class Layout::section_list): New method.
8377         * merge.h (Output_merge_base::entsize): Change visibility to public.
8378         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8379         New methods.
8380         (Output_merge_string::do_is_string): New method.
8381         * object.cc (Sized_relobj::do_setup): renamed from
8382         Sized_relobj::set_up.
8383         * object.h (Sized_relobj::adjust_shndx,
8384         Sized_relobj::initializ_input_to_output_maps,
8385         Sized_relobj::free_input_to_output_maps): Change visibilities to
8386         protected.
8387         (Sized_relobj::setup): Virtualize.
8388         (Sized_relobj::do_setup): New method declaration.
8389         (Sized_relobj::invalidate_section_offset,
8390         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8391         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8392         * options.cc (parse_int): New function.
8393         * options.h (parse_int): New declaration.
8394         (DEFINE_int): New macro.
8395         (stub_group_size): New option.
8396         * output.cc (Output_section::Output_section): Initialize memebers
8397         merge_section_map_, merge_section_by_properties_map_,
8398         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8399         (Output_section::add_input_section): Handled deferred code-fill
8400         generation and remove an old comment.
8401         (Output_section::add_relaxed_input_section): New method definition.
8402         (Output_section::add_merge_input_section): Use merge section by
8403         properties map to speed to search.  Update merge section maps
8404         as appropriate.
8405         (Output_section::build_relaxation_map): New method definition.
8406         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8407         Same.
8408         (Output_section::relax_input_section): Renamed to
8409         Output_section::convert_input_sections_to_relaxed_sections and change
8410         interface to take a vector of pointers to relaxed sections.
8411         (Output_section::find_merge_section,
8412         Output_section::find_relaxed_input_section): New method definitions.
8413         (Output_section::is_input_address_mapped,
8414         Output_section::output_offset, Output_section::output_address):
8415         Use output section data maps to speed up searching.
8416         (Output_section::find_starting_output_address): Add comments.
8417         (Output_section::do_write,
8418         Output_section::write_to_postprocessing_buffer): Do code-fill
8419         generation as appropriate.
8420         (Output_section::get_input_sections): Invalidate relaxed input section
8421         map.
8422         (Output_section::restore_states): Adjust type of checkpoint .
8423         Invalidate relaxed input section map.
8424         * output.h (Output_merge_base): New class declaration.
8425         (Input_section_specifier): New class defintion.
8426         (class Output_relaxed_input_section) Change base class to
8427         Output_section_data_build.
8428         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8429         base class initializer.
8430         (Output_section::add_relaxed_input_section): New method declaration.
8431         (Output_section::Input_section): Change visibility to protected.
8432         (Output_section::Input_section::relobj,
8433         Output_section::Input_section::shndx): Handle relaxed input sections.
8434         Output_section::input_sections) Change visibility to protected.  Also
8435         define overload to return a non-const pointer.
8436         (Output_section::Merge_section_properties): New class defintion.
8437         (Output_section::Merge_section_by_properties_map,
8438         Output_section::Output_section_data_by_input_section_map,
8439         Output_section::Relaxation_map): New types.
8440         (Output_section::relax_input_section): Rename method to
8441         Output_section::convert_input_sections_to_relaxed_sections and change
8442         interface to take a vector of relaxed section pointers.
8443         (Output_section::find_merge_section,
8444         Output_section::find_relaxed_input_section,
8445         Output_section::build_relaxation_map,
8446         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8447         New method declarations.
8448         (Output_section::merge_section_map_
8449         Output_section::merge_section_by_properties_map_,
8450         Output_section::relaxed_input_section_map_,
8451         Output_section::is_relaxed_input_section_map_valid_,
8452         Output_section::generate_code_fills_at_write_): New data members.
8453         * script-sections.cc
8454         (Output_section_element_input::set_section_addresses): Call
8455         current_data_size and addralign methods of relaxed input sections.
8456         (Orphan_output_section::set_section_addresses): Call current_data_size
8457         and addralign methods of relaxed input sections.
8458         * symtab.cc (Symbol_table::compute_final_value): Extract template
8459         from the body of Symbol_table::sized_finalize_symbol.
8460         (Symbol_table::sized_finalized_symbol): Call
8461         Symbol_table::compute_final_value.
8462         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8463         (Symbol_table::compute_final_value): New templated method declaration.
8464         * target.cc (Target::do_make_output_section): New method defintion.
8465         * target.h (Target::make_output_section): New method declaration.
8466         (Target::relax): Add more parameters for input objects, symbol table
8467         and layout.  Adjust call to do_relax.
8468         (Target::do_make_output_section): New method declaration.
8469         (Target::do_relax): Add parameters for input objects, symbol table
8470         and layout.
8471
8472 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8473
8474         * pread.c: Include stdio.h.
8475
8476 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8477
8478         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8479         defined.
8480
8481 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8482
8483         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8484         Change read_shndx type to unsigned int.
8485         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8486         int.
8487         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8488         * dwarf_reader.h (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         * layout.cc (Layout::create_symtab_sections): Cast the result of
8494         local_symcount * symsize to off_t in the gold_assert.
8495
8496 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8497
8498         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8499         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8500         R_ARM_BASE_ABS.
8501         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8502         (Arm_relocate_functions::thm_abs5): New function.
8503         (Arm_relocate_functions::abs12): New function.
8504         (Arm_relocate_functions::abs16): New function.
8505         (Arm_relocate_functions::base_abs): New function.
8506         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8507         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8508         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8509         R_ARM_BASE_ABS.
8510         (Scan::global): Likewise.
8511         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8512         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8513         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8514         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8515         R_ARM_BASE_ABS.
8516
8517 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8518
8519         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8520         (Arm_relocate_functions::movt_prel): New function.
8521         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8522         (Arm_relocate_functions::thm_movt_prel): New function.
8523         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8524         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8525         (Scan::global, Relocate::relocate): Likewise.
8526         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8527
8528 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8529
8530         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8531         Incremental_checker.
8532         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8533         unsigned int.
8534         (class Incremental_inputs_header): New class.
8535         (Incremental_inputs_header_writer): Edit comment.
8536         (Incremental_inputs_entry): New class.
8537         (Incremental_inputs_entry_writer): Edit comment.
8538         (Sized_incremental_binary::do_find_incremental_inputs_section):
8539         Add *strtab_shndx parameter, fill it.
8540         (Sized_incremental_binary::do_check_inputs): New method.
8541         (Incremental_checker::can_incrementally_link_output_file): Use
8542         Sized_incremental_binary::check_inputs.
8543         (Incremental_inputs::report_command_line): Save command line in
8544         command_line_.
8545         * incremental.h:
8546         (Incremental_binary::find_incremental_inputs_section): New
8547         method.
8548         (Incremental_binary::do_find_incremental_inputs_section): Add
8549         strtab_shndx parameter.
8550         (Incremental_binary::do_check_inputs): New pure virtual method.
8551         (Sized_incremental_binary::do_check_inputs): Declare.
8552         (Incremental_checker::Incremental_checker): Add incremental_inputs
8553         parameter, use it to initialize incremental_inputs_.
8554         (Incremental_checker::incremental_inputs_): New field.
8555         (Incremental_checker::command_line): New method.
8556         (Incremental_checker::inputs): New method.
8557         (Incremental_checker::command_line_): New field.
8558
8559 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8560
8561         * incremental.cc: Include <cstdarg> and "target-select.h".
8562         (vexplain_no_incremental): New function.
8563         (explain_no_incremental): New function.
8564         (Incremental_binary::error): New method.
8565         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8566         method.
8567         (make_sized_incremental_binary): New function.
8568         (open_incremental_binary): New function.
8569         (can_incrementally_link_file): Add checks if output is ELF and has
8570         inputs section.
8571         * incremental.h: Include "elfcpp_file.h" and "output.h".
8572         (Incremental_binary): New class.
8573         (Sized_incremental_binary): New class.
8574         (open_incremental_binary): Declare.
8575         * object.cc (is_elf_object): Use
8576         elfcpp::Elf_recognizer::is_elf_file.
8577         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8578         * output.h (Output_file::filesize): New method.
8579
8580 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8581
8582         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8583         New function.
8584         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8585         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8586         function.
8587         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8588         function.
8589         (Arm_relocate_functions::movw_abs_nc): New function.
8590         (Arm_relocate_functions::movt_abs): New function.
8591         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8592         (Arm_relocate_functions::thm_movt_abs): New function.
8593         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8594         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8595         (Scan::global): Likewise.
8596         (Relocate::relocate): Likewise.
8597         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8598
8599 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8600
8601         * arm.cc (Arm_relocate_functions::got_prel) New function.
8602         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8603         (Relocate::relocate): Likewise.
8604         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8605
8606 2009-10-06  Ian Lance Taylor  <iant@google.com>
8607
8608         * options.h (class General_options): Define
8609         split_stack_adjust_size parameter.
8610         * object.h (class Object): Add uses_split_stack_ and
8611         has_no_split_stack_ fields.  Add uses_split_stack and
8612         has_no_split_stack accessor functions.  Declare
8613         handle_split_stack_section.
8614         (class Reloc_symbol_changes): Define.
8615         (class Sized_relobj): Define Function_offsets.  Declare
8616         split_stack_adjust, split_stack_adjust_reltype, and
8617         find_functions.
8618         * object.cc (Object::handle_split_stack_section): New function.
8619         (Sized_relobj::do_layout): Call handle_split_stack_section.
8620         * dynobj.cc (Sized_dynobj::do_layout): Call
8621         handle_split_stack_section.
8622         * reloc.cc (Sized_relobj::relocate_sections): Call
8623         split_stack_adjust for executable sections in split_stack
8624         objects.  Pass reloc_map to relocate_section.
8625         (Sized_relobj::split_stack_adjust): New function.
8626         (Sized_relobj::split_stack_adjust_reltype): New function.
8627         (Sized_relobj::find_functions): New function.
8628         * target-reloc.h: Include "object.h".
8629         (relocate_section): Add reloc_symbol_changes parameter.  Change
8630         all callers.
8631         * target.h (class Target): Add calls_non_split method.  Declare
8632         do_calls_non_split virtual method.  Declare match_view and
8633         set_view_to_nop.
8634         * target.cc: Include "elfcpp.h".
8635         (Target::do_calls_non_split): New function.
8636         (Target::match_view): New function.
8637         (Target::set_view_to_nop): New function.
8638         * gold.cc (queue_middle_tasks): Give an error if mixing
8639         split-stack and non-split-stack objects with -r.
8640         * i386.cc (Target_i386::relocate_section): Add
8641         reloc_symbol_changes parameter.
8642         (Target_i386::do_calls_non_split): New function.
8643         * x86_64.cc (Target_x86_64::relocate_section): Add
8644         reloc_symbol_changes parameter.
8645         (Target_x86_64::do_calls_non_split): New function.
8646         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8647         parameter.
8648         * powerpc.cc (Target_powerpc::relocate_section): Add
8649         reloc_symbol_changes parameter.
8650         * sparc.cc (Target_sparc::relocate_section): Add
8651         reloc_symbol_changes parameter.
8652         * configure.ac: Call AM_CONDITIONAL for the default target.
8653         * configure: Rebuild.
8654         * testsuite/Makefile.am (TEST_AS): New variable.
8655         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8656         (check_DATA): Add split_i386 and split_x86_64 files.
8657         (SPLIT_DEFSYMS): Define.
8658         (split_i386_[1234n].o): New targets.
8659         (split_i386_[124]): New targets.
8660         (split_i386_[1234r].stdout): New targets.
8661         (split_x86_64_[1234n].o): New targets.
8662         (split_x86_64_[124]): New targets.
8663         (split_x86_64_[1234r].stdout): New targets.
8664         (MOSTLYCLEANFILES): Add new executables.
8665         * testsuite/split_i386.sh: New file.
8666         * testsuite/split_x86_64.sh: New file.
8667         * testsuite/split_i386_1.s: New file.
8668         * testsuite/split_i386_2.s: New file.
8669         * testsuite/split_i386_3.s: New file.
8670         * testsuite/split_i386_4.s: New file.
8671         * testsuite/split_i386_n.s: New file.
8672         * testsuite/split_x86_64_1.s: New file.
8673         * testsuite/split_x86_64_2.s: New file.
8674         * testsuite/split_x86_64_3.s: New file.
8675         * testsuite/split_x86_64_4.s: New file.
8676         * testsuite/split_x86_64_n.s: New file.
8677         * testsuite/testfile.cc (Target_test): Update relocation_section
8678         function.
8679         * testsuite/Makefile.in: Rebuild.
8680
8681 2009-10-06  Ian Lance Taylor  <iant@google.com>
8682
8683         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8684         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8685         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8686         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8687         the address on ldo_addrs_.
8688         (Target_i386::Relocate::fix_up_ldo): New function.
8689
8690 2009-10-06   Rafael Espindola  <espindola@google.com>
8691
8692         * plugin.cc (add_input_library): New.
8693         (Plugin::load): Add add_input_library to tv.
8694         (Plugin_manager::add_input_file): Add the is_lib argument.
8695         (add_input_file): Update call to Plugin_manager::add_input_file.
8696         (add_input_library): New.
8697         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8698
8699 2009-09-30  Doug Kwan  <dougkwan@google.com>
8700
8701         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8702         symbol and call Symbol::may_need_copy_reloc to determine if
8703         a copy reloc is needed.
8704         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8705         nocopyreloc is given in command line.
8706         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8707         given in command line.
8708         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8709         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8710         of the removed Target_i386::may_need_copy_reloc.
8711         * options.h (copyreloc): New option with default value false.
8712         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8713         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8714         instead of the removed Target_powerpc::may_need_copy_reloc.
8715         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8716         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8717         instead of the removed Target_sparc::may_need_copy_reloc.
8718         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8719         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8720         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8721         instead of the removed Target_x86_64::may_need_copy_reloc.
8722
8723 2009-09-30  Ian Lance Taylor  <iant@google.com>
8724
8725         * object.h (class Object): Remove target_ field, and target,
8726         sized_target, and set_target methods.
8727         (Object::sized_target): Remove.
8728         (class Sized_relobj): Update declarations.  Remove sized_target.
8729         * object.cc (Sized_relobj::setup): Remove target parameter.
8730         Change all callers.
8731         (Input_objects::add_object): Don't do anything with the target.
8732         (make_elf_sized_object): Add punconfigured parameter.  Change all
8733         callers.  Set or test parameter target.
8734         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8735         Change all callers.
8736         * parameters.cc (Parameters::set_target): Change parameter type to
8737         be non-const.
8738         (Parameters::default_target): Remove.
8739         (set_parameters_target): Change parameter type to be non-const.
8740         (parameters_force_valid_target): New function.
8741         (parameters_clear_target): New function.
8742         * parameters.h (class Parameters): Update declarations.  Remove
8743         default_target method.  Add sized_target and clear_target
8744         methods.  Change target_ to be non-const.
8745         (set_parameters_target): Update declaration.
8746         (parameters_force_valid_target): Declare.
8747         (parameters_clear_target): Declare.
8748         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8749         as NULL if we aren't searching.
8750         (Add_symbols::run): Don't check for compatible target.
8751         * fileread.cc (Input_file::open_binary): Call
8752         parameters_force_valid_target.
8753         * gold.cc (queue_middle_tasks): Likewise.
8754         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8755         set_target on object.
8756         * dynobj.h (class Sized_dynobj): Update declarations.
8757         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8758         make_elf_object returns NULL.
8759         (Archive::include_member): Don't check whether object target is
8760         compatible.
8761         * output.cc (Output_section::add_input_section): Get target from
8762         parameters.
8763         (Output_section::relax_input_section): Likewise.
8764         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8765         parameters.
8766         (Sized_relobj::do_scan_relocs): Likewise.
8767         (Sized_relobj::relocate_sections): Likewise.
8768         * resolve.cc (Symbol_table::resolve): Likewise.
8769         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8770         parameter.  Change all callers.
8771         (Symbol_table::add_from_object): Get target from parameters.
8772         (Symbol_table::add_from_relobj): Don't check object target.
8773         (Symbol_table::add_from_dynobj): Likewise.
8774         (Symbol_table::define_special_symbol): Get target from
8775         parameters.
8776         * symtab.h (class Symbol_table): Update declaration.
8777         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8778         parameter.  Change all callers.  Clear parameter target.
8779         (Binary_test): Test target here.
8780         * testsuite/object_unittest.cc (gold_testsuite): Remove
8781         target_test_pointer parameter.  Change all callers.
8782         (Object_test): Test target here.
8783
8784 2009-09-26  Ian Lance Taylor  <iant@google.com>
8785
8786         * testsuite/initpri1.c: Don't try to use constructor priorities if
8787         compiling with gcc before 4.3.
8788
8789 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8790
8791         * testsuite/retain_symbols_file_test.sh (check_present): Change
8792         output file name to retain_symbols_file_test.stdout.
8793         (check_absent): Likewise.
8794
8795 2009-09-18  Craig Silverstein  <csilvers@google.com>
8796
8797         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8798         * options.cc: Include <cerrno> and <fstream>.
8799         (General_options::finalize): Parse -retain-symbols-file tag.
8800         * options.h: New flag.
8801         (General_options): New method should_retain_symbol, new
8802         variable symbols_to_retain.
8803         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8804         should_retain_symbol map.
8805         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8806         * testsuite/Makefile.in: Regenerate.
8807         * testsuite/retain_symbols_file_test.sh: New file.
8808
8809 2009-09-18  Nick Clifton  <nickc@redhat.com>
8810
8811         * po/es.po: Updated Spanish translation.
8812
8813 2009-09-17  Doug Kwan  <dougkwan@google.com>
8814
8815         * debug.h (DEBUG_RELAXATION): New constant.
8816         (DEBUG_ALL): Add DEBUG_RELAXATION.
8817         (debug_string_to_enum): Add relaxation debug option.
8818         * layout.cc
8819         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8820         Layout::Relaxation_debug_check::read_sections,
8821         Layout::Relaxation_debug_check::read_sections): New method definitions.
8822         (Layout::Layout): Initialize data members
8823         record_output_section_data_from_scrips_,
8824         script_output_section_data_list_ and relaxation_debug_check_.
8825         (Layout::save_segments, Layout::restore_segments,
8826         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8827         Layout::relaxation_loop_body): New method definitions.
8828         (Layout::finalize): Support relaxation.  Move section layout code to
8829         Layout::relaxation_loop_body.
8830         (Layout::set_asection_address_from_script): Move code for orphan
8831         section placement out.
8832         (Layout::place_orphan_sections_in_script): New method definition.
8833         * layout.h (Output_segment_headers, Output_file_header):
8834         New forward class declarations.
8835         (Layout::~Layout): Define.
8836         (Layout::new_output_section_data_from_script): New method definition.
8837         (Layout::place_orphan_sections_in_script): New method declaration.
8838         (Layout::Segment_states): New type declaration.
8839         (Layout::save_segments, Layout::restore_segments,
8840         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8841         Layout::relaxation_loop_body): New method declarations.
8842         (Layout::Output_section_data_list): New type declaration.
8843         (Layout::Relaxation_debug_check): New class definition.
8844         (Layout::record_output_section_data_from_script_,
8845         Layout::script_output_section_data_list_, Layout::segment_states_,
8846         Layout::relaxation_debug_check_): New data members.
8847         * output.cc: (Output_section_headers::do_size): New method definition.
8848         (Output_section_headers::Output_section_headers): Move size
8849         computation to Output_section_headers::do_size.
8850         (Output_segment_headers::do_size): New method definition.
8851         (Output_file_header::Output_file_header): Move size computation to
8852         Output_file_header::do_size and call it.
8853         (Output_file_header::do_size): New method definition.
8854         (Output_data_group::Output_data_group): Adjust call to
8855         Output_section_data.
8856         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8857         (Output_symtab_xindex::do_write): Add array bound check.
8858         (Output_section::Input_section::print_to_mapfile): Handle
8859         RELAXED_INPUT_SECTION_CODE.
8860         (Output_section::Output_section): Initialize data member checkpoint_.
8861         (Output_section::~Output_section): Delete checkpoint object pointed
8862         by checkpoint_.
8863         (Output_section::add_input_section): Always add an Input_section if
8864         relaxing.
8865         (Output_section::add_merge_input_section): Add assert.
8866         (Output_section::relax_input_section): New method definition.
8867         (Output_section::set_final_data_size): Set load address to zero for
8868         an unallocated section.
8869         (Output_section::do_address_and_file_offset_have_reset_values):
8870         New method definition.
8871         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8872         Handle relaxed input section.
8873         (Output_section::sort_attached_input_sections): Checkpoint input
8874         section list lazily.
8875         (Output_section::get_input_sections): Change type of input_sections to
8876         list of Simple_input_section pointers.  Checkpoint input section list
8877         lazily.  Also handle relaxed input sections.
8878         (Output_section::add_input_section_for_script): Take a reference to
8879         a Simple_input_section object instead of Relobj pointer and section
8880         index as parameter.  Handle relaxed input sections.
8881         (Output_section::save_states, Output_section::restore_states): New
8882         method definitions.
8883         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8884         (Output_data::is_data_size_fixed): New method definition.
8885         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8886         if it is fixed.
8887         (Output_data::address_and_file_offset_have_reset_values): New method
8888         definition.
8889         (Output_data::do_address_and_file_offset_have_reset_values): New method
8890         definition.
8891         (Output_data::set_data_size): Check that data size is not fixed.
8892         (Output_data::fix_data_size): New method definition.
8893         (Output_data::is_data_size_fixed_): New data member.
8894         (Output_section_headers::set_final_data_size): New method definition.
8895         (Output_section_headers::do_size): New method declaration.
8896         (Output_segment_headers::set_final_data_size): New method definition.
8897         (Output_segment_headers::do_size): New method declaration.
8898         (Output_file_header::set_final_data_size)::New method definition.
8899         (Output_file_header::do_size)::New method declaration.
8900         (Output_section_data::Output_section_data): Add new parameter
8901         is_data_size_fixed and use it to fix data size.
8902         (Output_data_const::Output_data_const): Adjust call to base class
8903         constructor and fix data size.
8904         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8905         base class constructor and fix data size.
8906         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8907         base class constructor and fix data size.
8908         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8909         class constructor and fix data size.
8910         (Output_data_group::set_final_data_size): New method definition.
8911         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8912         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8913         class constructor and fix data size.
8914         (Output_relaxed_input_section): New class definition.
8915         (Output_section::Simple_input_section): New class definition.
8916         (Output_section::get_input_sections): Adjust parameter list.
8917         (Output_section::add_input_section_for_script): Same.
8918         (Output_section::save_states, Output_section::restore_states,
8919         Output_section::do_address_and_file_offset_have_reset_values,
8920         (Output_section::Input_section::Input_section): Handle
8921         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8922         Output_relaxed_input_section.
8923         (Output_section::Input_section::is_input_section,
8924         Output_section::Input_section::set_output_section): Handle relaxed
8925         input section.
8926         (Output_section::Input_section::is_relaxed_input_section,
8927         Output_section::Input_section::output_section_data,
8928         Output_section::Input_section::relaxed_input_section): New method
8929         definitions.
8930         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8931         value.
8932         (Output_section::Input_section::u1_): Update comments.
8933         (Output_section::Input_section::u2_): Add new union member poris.
8934         (Output_section::Checkpoint_output_section): New classs definition.
8935         (Output_section::relax_input_section): New method declaration.
8936         (Output_section::checkpoint_): New data member.
8937         (Output_segment): Update comments.
8938         (Output_segment::Output_segment): Un-privatize copy constructor.
8939         (Output_segment::operator=): Un-privatize.
8940         * script-sections.cc (Output_section_element::Input_section_list):
8941         Change element type to Output_section::Simple_input_section.
8942         (Output_section_element_dot_assignment::set_section_addresses):
8943         Register output section data for relaxation clean up.
8944         (Output_data_exression::Output_data_expression): Adjust call to base
8945         constructor to fix data size.
8946         (Output_section_element_data::set_section_addresses): Register
8947         Output_data_expression object for relaxation clean up.
8948         (struct Input_section_info): Replace Relobj pointer and section index
8949         pair with Output_section::Simple_input_section and Convert struct to a
8950         class.
8951         (Input_section_sorter::operator()): Adjust access to
8952         Input_section_info data member to use accessors.
8953         (Output_section_element_input::set_section_addresses): Use layout
8954         parameter.  Adjust code to use Output_section::Simple_input_section
8955         and Input_secction_info classes.  Register filler for relaxation
8956         clean up.
8957         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8958         and section index pair with Output_section::Simple_input_section
8959         class.  Adjust code accordingly.
8960         (Phdrs_element::release_segment): New method definition.
8961         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8962         segment list.
8963         (Script_sections::release_segments): New method definition.
8964         * gold/script-sections.h (Script_sections::release_segments): New
8965         method declaration.
8966         * gold/target.h (Target::may_relax, Target::relax,
8967         Target::do_may_relax, Target::do_relax): New method definitions.
8968
8969 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8970
8971         * arm.cc (has_signed_unsigned_overflow): New function.
8972         (Arm_relocate_functions::abs8): New function.
8973         (Target_arm::Scan::local): Handle R_ARM_ABS8.
8974         (Target_arm::Scan::global): Likewise.
8975         (Target_arm::relocate::relocate): Likewise.
8976         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8977         Likewise.
8978
8979 2009-09-16  Cary Coutant  <ccoutant@google.com>
8980
8981         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8982         * testsuite/Makefile.in: Regenerate.
8983
8984 2009-09-11  Nick Clifton  <nickc@redhat.com>
8985
8986         * po/gold.pot: Updated by the Translation project.
8987
8988 2009-09-08  Cary Coutant  <ccoutant@google.com>
8989
8990         * output.cc (Output_file::open): Add execute permission to empty file.
8991         * testsuite/Makefile.am (permission_test): New test.
8992         * testsuite/Makefile.in: Regenerate.
8993
8994 2009-09-02  Ian Lance Taylor  <iant@google.com>
8995
8996         * output.cc (Output_file::resize): Call map_no_anonymous rather
8997         than map.
8998
8999 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9000
9001         * gold.cc: Include "incremental.h".
9002         (queue_initial_tasks): Call Incremental_checker methods.
9003         * incremental.cc: Include "output.h".
9004         (Incremental_checker::can_incrementally_link_output_file): New
9005         method.
9006         * incremental.h (Incremental_checker): New class.
9007
9008         * output.cc (Output_file::open_for_modification): New method.
9009         (Output_file::map_anonymous): Changed return type to bool.  Record
9010         map in base_ field.
9011         (Output_file::map_no_anonymous): New method, broken out of map.
9012         (Output_file::map): Use map_no_anonymous and map_anonymous.
9013         * output.h (class Output_file): Update declarations.
9014
9015 2009-08-24  Cary Coutant  <ccoutant@google.com>
9016
9017         * options.h (Command_line::Pre_options): New class.
9018         (Command_line::pre_options): New member.
9019         * options.cc (gold::options::ready_to_register): New variable.
9020         (One_option::register_option): Do nothing if not registering options.
9021         Assert if same short option registered twice.
9022         (General_options::General_options): Turn off option registration when
9023         done constructing.
9024         (Command_line::Pre_options::Pre_options): New constructor.
9025
9026 2009-08-24  Cary Coutant  <ccoutant@google.com>
9027
9028         * options.h (General_options::no_keep_memory): Remove incorrect
9029         short option.
9030
9031 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9032
9033         * Makefile.am (am__skiplex, am__skipyacc): New.
9034         * Makefile.in: Regenerate.
9035
9036 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9037
9038         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9039         (INCLUDES): ... this.
9040         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9041         (AM_CPPFLAGS): Renamed from ...
9042         (INCLUDE): ... this.
9043         * Makefile.in, testsuite/Makefile.in: Regenerate.
9044
9045         * Makefile.in: Regenerate.
9046         * aclocal.m4: Likewise.
9047         * config.in: Likewise.
9048         * configure: Likewise.
9049         * testsuite/Makefile.in: Likewise.
9050
9051         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9052         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9053         * Makefile.in: Regenerate.
9054         * testsuite/Makefile.in: Regenerate.
9055
9056 2009-08-19  Cary Coutant  <ccoutant@google.com>
9057
9058         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9059         symbols in shared libraries overridden by hidden or internal symbols
9060         in the main program.
9061
9062 2009-08-19  Chris Demetriou  <cgd@google.com>
9063
9064         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9065         checking source file names in error messages.
9066
9067 2009-08-18  Doug Kwan  <dougkwan@google.com>
9068
9069         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9070         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9071         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9072         an elfcpp::Ehdr as parameter.
9073         * object.cc (Object::set_target): Remove the version that looks up
9074         a target and sets it.
9075         (Sized_relobj::setup): Take a Target object instead of
9076         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9077         (make_elf_sized_object): Find target and ask target to
9078         make an ELF object.
9079         * object.h: (Object::set_target): Remove the version that looks up
9080         a target and sets it.
9081         (Sized_relobj::setup): Take a Target object instead of
9082         an elfcpp:Ehdr as parameter.
9083         * target.cc: Include dynobj.h.
9084         (Target::do_make_elf_object_implementation): New.
9085         (Target::do_make_elf_object): New.
9086         * target.h (Target::make_elf_object): New template declaration.
9087         (Target::do_make_elf_object): New method declarations.
9088         (Target::do_make_elf_object_implementation): New template declaration.
9089
9090 2009-08-14  Ian Lance Taylor  <iant@google.com>
9091
9092         * gold.h (FUNCTION_NAME): Define.
9093         (gold_unreachable): Use FUNCTION_NAME.
9094
9095 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9096
9097         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9098         symbol in the --keep-unique list is not found.
9099
9100 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9101
9102         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9103         been maked as --keep-unique.
9104         (Icf::unfold_section): New function.
9105         * icf.h (Icf::unfold_section): New function.
9106         * options.h (General_options::keep_unique): New option.
9107         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9108         * testsuite/Makefile.in: Regenerate.
9109         * testsuite/icf_keep_unique_test.sh: New file.
9110         * testsuite/icf_keep_unique_test.cc: New file.
9111
9112 2009-08-12  Cary Coutant  <ccoutant@google.com>
9113
9114         PR 10471
9115         * resolve.cc (Symbol_table::resolve): Check for references from
9116         dynamic objects to hidden and internal symbols.
9117         * testsuite/Makefile.am (hidden_test.sh): New test.
9118         * testsuite/Makefile.in: Regenerate.
9119         * testsuite/hidden_test.sh: New script.
9120         * testsuite/hidden_test_1.c: New test source.
9121         * testsuite/hidden_test_main.c: New test source.
9122
9123 2009-08-11  Doug Kwan  <dougkwan@google.com>
9124
9125         * arm.cc: Update comments.
9126         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9127         segment to locate the .ARM.exidx section if present.
9128
9129 2009-08-09  Doug Kwan  <dougkwan@google.com>
9130
9131         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9132         patch.
9133
9134 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9135         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9136         compiler warnings.
9137
9138 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9139
9140         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9141         valid tls_segment only for non-debug-section relocations.
9142         * testsuite/Makefile.am: Add gc_tls_test.
9143         * testsuite/Makefile.in: Regenerate.
9144         * testsuite/gc_tls_test.cc: New file.
9145         * testsuite/gc_tls_test.sh: New file.
9146
9147 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9148
9149         * icf.cc: New file.
9150         * icf.h: New file.
9151         * Makefile.am (CCFILES): Add icf.cc.
9152         (HFILES): Add icf.h
9153         * Makefile.in: Regenerate.
9154         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9155         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9156         section, symbol and addend information for the relocs.
9157         * gold.cc (queue_middle_tasks): Call identical code folding.
9158         * gold.h: Add defines for multimap.
9159         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9160         to the call of finalize_local_symbols.
9161         * main.cc (main): Create object of class Icf.
9162         * object.cc (Sized_relobj::do_layout): Allow this function to be
9163         called twice during icf.
9164         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9165         to sections marked as identical by icf.
9166         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9167         when available.
9168         (Sized_relobj::do_section_entsize): New function.
9169         * object.h (Object::section_entsize): New function.
9170         (Object::do_section_entsize): New pure virtual function.
9171         (Relobj::finalize_local_symbols): Add new parameter.
9172         (Relobj::do_section_entsize): New function.
9173         * options.h (General_options::icf): New option.
9174         (General_options::icf_iterations): New option.
9175         (General_options::print_icf_sections): New option.
9176         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9177         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9178         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9179         icf.
9180         * symtab.cc (Symbol_table::is_section_folded): New function.
9181         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9182         to sections marked as identical by icf.
9183         * symtab.h (Symbol_table::set_icf): New function.
9184         (Symbol_table::icf): New function.
9185         (Symbol_table::is_section_folded): New function.
9186         (Symbol_table::icf_): New data member.
9187         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9188         * testsuite/Makefile.am: Add commands to build icf_test.
9189         * testsuite/Makefile.in: Regenerate.
9190         * testsuite/icf_test.sh: New file.
9191         * testsuite/icf_test.cc: New file.
9192
9193 2009-07-24  Chris Demetriou  <cgd@google.com>
9194
9195         * layout.cc (is_compressible_debug_section): Fix incorrect
9196         comment about compressed section names.
9197
9198 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9199
9200         PR 10419
9201         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9202
9203 2009-07-16  Ian Lance Taylor  <iant@google.com>
9204
9205         PR 10400
9206         * layout.h: #include <map>.
9207         (class Kept_section): Change from struct to class.  Add accessors
9208         and setters.  Add section size to Comdat_group mapping.  Change
9209         Comdat_group to std::map.  Add is_comdat_ field.  Add
9210         linkonce_size field in union.
9211         (class Layout): Update declaration of find_or_add_kept_section.
9212         Don't declare find_kept_object.
9213         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9214         parameter.  Add object, shndx, is_comdat, and is_group_name
9215         parameters.  Change all callers.  Adjust for new Kept_section.
9216         (Layout::find_kept_object): Remove.
9217         * object.cc (Sized_relobj::include_section_group): Update use of
9218         Kept_section.  Rename secnum to shndx.  Only record
9219         Kept_comdat_section if sections are the same size.
9220         (Sized_relobj::include_linkonce_section): Update use of
9221         Kept_section.  Only record Kept_comdat_section if sections are the
9222         same size.  Set size of linkonce section.
9223         (Sized_relobj::map_to_kept_section): Update call to
9224         get_kept_comdat_section.
9225         * object.h (class Sized_relobj): Rename fields in
9226         Kept_comdat_section to drop trailing underscores; change object
9227         field to Relobj*.  Change Kept_comdat_section_table to store
9228         struct rather than pointer.
9229         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9230         Add kept_object and kept_shndx parameters.  Change all callers.
9231         (Sized_relobj::get_kept_comdat_section): Change return type to
9232         bool.  Add kept_object and kept_shndx parameters.  Change all
9233         callers.
9234         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9235         Layout::find_or_add_kept_section.
9236
9237 2009-07-09  Ian Lance Taylor  <iant@google.com>
9238
9239         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9240         Reserve space in the hash table.
9241
9242 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9243
9244         * fileread.cc (File_read::get_mtime): New method.
9245         * fileread.h (Timespec): New structure.
9246         (File_read::get_mtime): New method.
9247         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9248         Renamed from timestamp_nsec.
9249         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9250         Elf_Xword.
9251         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9252         timestamp_nsec.
9253         (Incremental_inputs::report_archive): Save mtime; style fix.
9254         (Incremental_inputs::report_obejct): Save mtime; style fix.
9255         (Incremental_inputs::report_script): Save mtime; style fix.
9256         (Incremental_inputs::finalize_inputs): Style fix.
9257         (Incremental_inputs::finalize): Style fix.
9258         (Incremental_inputs::create_input_section_data): Store inputs
9259         mtime.
9260         * incremental.h (Incremental_inputs::report_script): Add mtime
9261         argument.
9262         (Incremental_inputs::Input_info::Input_info): Intialize only one
9263         union member.
9264         (Incremental_inputs::Input_info::archive): Move to nameless
9265         union.
9266         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9267         (Incremental_inputs::Input_info::script): Move to nameless union.
9268         (Incremental_inputs::mtime): New field.
9269         * script.cc (read_input_script): Pass file mtime to
9270         Incremental_input.
9271         * script.h (Script_info::inputs): Style fix.
9272
9273 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9274
9275         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9276         instead of 32.
9277
9278 2009-06-24  Ian Lance Taylor  <iant@google.com>
9279
9280         PR 10156
9281         * layout.cc (Layout::choose_output_section): If we find an
9282         existing section, update the flags.
9283         (Layout::create_notes): New function, broken out of
9284         Layout::finalize.
9285         (Layout::finalize): Don't create note sections.
9286         (Layout::create_note): Don't crash if linker script discards
9287         section.
9288         (Layout::create_gold_note): Likewise.
9289         (Layout::create_build_id): Likewise.  Don't set
9290         after_input_sections on the section.
9291         (Layout::create_executable_stack_info): Remove target parameter.
9292         Change caller.
9293         * layout.h (class Layout): Declare create_notes.  Update
9294         declaration of create_executable_stack_info.
9295         * gold.cc (queue_middle_tasks): Call create_notes.
9296         * output.cc (Output_section::update_flags_for_input_section): Move
9297         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9298         invalid.
9299         * output.h (Output_data::mark_address_invalid): New function.
9300         (class Output_section): Only declare, not define,
9301         update_flags_for_input_section.  Remove set_flags.
9302
9303 2009-06-24  Ian Lance Taylor  <iant@google.com>
9304
9305         * script-sections.cc (Output_section_definition::
9306         set_section_addresses): Rename shadowing local load_address to
9307         laddr.
9308
9309 2009-06-24  Ian Lance Taylor  <iant@google.com>
9310
9311         PR 10244
9312         * reloc.cc (relocate_sections): Skip empty relocation sections.
9313
9314 2009-06-23  Ian Lance Taylor  <iant@google.com>
9315
9316         PR 10156
9317         * layout.cc (Layout::create_note): Use choose_output_section
9318         rather than make_output_section.
9319
9320 2009-06-23  Ian Lance Taylor  <iant@google.com>
9321
9322         PR 10237
9323         * options.cc (General_options::parse_V): Set printed_version_.
9324         (General_options::General_options): Initialize printed_version_.
9325         * options.h (class General_options): Add printed_version_ field.
9326         * gold.cc (queue_initial_tasks): If there are no input files,
9327         don't give a fatal error if we printed the version information.
9328         (queue_middle_tasks): If using -r with a shared object, give a
9329         fatal error rather than an ordinary error.
9330
9331 2009-06-23  Ian Lance Taylor  <iant@google.com>
9332
9333         PR 10219
9334         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9335         (Layout::make_output_section): Set have_stabstr_section_ if we see
9336         a .stab*str section.
9337         (Layout::finalize): Call link_stabs_sections.
9338         (Layout::link_stabs_sections): New file.
9339         * layout.h (class Layout): Add have_stabstr_section_ field.
9340         Declare link_stabs_sections.
9341
9342 2009-06-23  Doug Kwan  <dougkwan@google.com>
9343
9344         * Makefile.am (libgold_a_LIBADD): New.
9345         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9346         * Makefile.in: Regenerate.
9347         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9348         * configure: Regenerate.
9349         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9350         * fileread.cc: Include sys/state.h
9351         * gold.h: Declare memmem and strndup if found missing.
9352         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9353
9354 2009-06-23  Ian Lance Taylor  <iant@google.com>
9355
9356         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9357         * configure: Rebuild.
9358
9359 2009-06-23  Ian Lance Taylor  <iant@google.com>
9360
9361         PR 10147
9362         * object.cc (Object::section_contents): Don't try to get a view if
9363         the section has length zero.
9364         (Object::handle_gnu_warning_section): If the section is empty, use
9365         the name of the section as the warning.
9366
9367 2009-06-23  Ian Lance Taylor  <iant@google.com>
9368
9369         PR 10133
9370         * stringpool.h (class Stringpool_template): Add optimize_ field.
9371         (Stringpool_template::set_optimize): New function.
9372         * stringpool.cc (Stringpool_template::Stringpool_template):
9373         Initialize optimize_ field.
9374         (Stringpool_template::set_string_offsets): Test local optimize
9375         fild rather than parameter.
9376         * layout.cc (Layout::Layout): Call set_optimize on the section
9377         name stringpool.
9378
9379 2009-06-22  Ian Lance Taylor  <iant@google.com>
9380
9381         PR 10030
9382         * yyscript.y: Parse TARGET.
9383         * script.cc (script_set_target): New function.
9384         * script-c.h (script_set_target): Declare.
9385         * options.cc (General_options::string_to_object_format): Rename
9386         from string_to_object_format in anonymous namespace.  Change
9387         callers.
9388         * options.h (class General_options): Declare
9389         string_to_object_format.
9390
9391 2009-06-22  Ian Lance Taylor  <iant@google.com>
9392
9393         * script-sections.cc (Script_sections::create_segments): Don't put
9394         program headers in a PT_LOAD segment if -n or -N.
9395
9396 2009-06-22  Ian Lance Taylor  <iant@google.com>
9397
9398         PR 10141
9399         * options.h (class General_options): Add -z lazy and -z now.  Sort
9400         -z options into alphabetical order.
9401         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9402
9403 2009-06-21  Ian Lance Taylor  <iant@google.com>
9404
9405         * layout.cc (Layout::make_output_section): Call
9406         Target::new_output_section.
9407         (Layout::attach_allocated_section_to_segment): Put large section
9408         sections in a separate load segment with the large segment flag
9409         set.
9410         (Layout::segment_precedes): Sort large data segments after other
9411         load segments.
9412         (align_file_offset): New static function.
9413         (Layout::set_segment_offsets): Use align_file_offset.
9414         * output.h (class Output_section): Add is_small_section_ and
9415         is_large_section_ fields.
9416         (Output_section::is_small_section): New function.
9417         (Output_section::set_is_small_section):  New function.
9418         (Output_section::is_large_section): New function.
9419         (Output_section::set_is_large_section): New function.
9420         (Output_section::is_large_data_section): New function.
9421         (class Output_segment): Add is_large_data_segment_ field.
9422         (Output_segment::is_large_data_segment): New function.
9423         (Output_segment::set_is_large_data_segment): New function.
9424         * output.cc (Output_section::Output_section): Initialize new
9425         fields.
9426         (Output_segment::Output_segment): Likewise.
9427         (Output_segment::add_output_section): Add assertion that large
9428         data sections always go in large data segments.  Force small data
9429         sections to the end of the list of data sections.  Force small BSS
9430         sections to the start of the list of BSS sections.  For large BSS
9431         sections to the end of the list of BSS sections.
9432         * symtab.h (class Symbol): Declare is_common_shndx.
9433         (Symbol::is_defined): Check Symbol::is_common_shndx.
9434         (Symbol::is_common): Likewise.
9435         (class Symbol_table): Define enum Commons_section_type.  Update
9436         declarations.  Add small_commons_ and large_commons_ fields.
9437         * symtab.cc (Symbol::is_common_shndx): New function.
9438         (Symbol_table::Symbol_table): Initialize new fields.
9439         (Symbol_table::add_from_object): Put small and large common
9440         symbols in the right list.
9441         (Symbol_table::sized_finalized_symbol): Check
9442         Symbol::is_common_shndx.
9443         (Symbol_table::sized_write_globals): Likewise.
9444         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9445         common symbol lists.  Don't call do_allocate_commons_list if the
9446         list is empty.
9447         (Symbol_table::do_allocate_commons_list): Remove is_tls
9448         parameter.  Add comons_section_type parameter.  Change all
9449         callers.  Handle small and large common symbols.
9450         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9451         Symbol::is_common_shndx.
9452         * resolve.cc (symbol_to_bits): Likewise.
9453         * target.h (Target::small_common_shndx): New function.
9454         (Target::small_common_section_flags): New function.
9455         (Target::large_common_shndx): New function.
9456         (Target::large_common_section_flags): New function.
9457         (Target::new_output_section): New function.
9458         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9459         small_common_section_flags, and large_common_section_flags
9460         fields.
9461         (Target::do_new_output_section): New virtual function.
9462         * arm.cc (Target_arm::arm_info): Initialize new fields.
9463         * i386.cc (Target_i386::i386_info): Likewise.
9464         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9465         Likewise.
9466         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9467         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9468         (Target_x86_64::do_new_output_section): New function.
9469         * configure.ac: Define conditional MCMODEL_MEDIUM.
9470         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9471         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9472         (large_LDFLAGS): Define.
9473         * testsuite/large.c: New file.
9474         * testsuite/testfile.cc (Target_test::test_target_info):
9475         Initialize new fields.
9476         * configure, testsuite/Makefile.in: Rebuild.
9477
9478 2009-06-05  Doug Kwan  <dougkwan@google.com>
9479
9480         * Makefile.am (CCFILES): Add target.cc.
9481         * Makefile.in: Regenerate.
9482         * i386.cc (class Target_i386): Define new virtual method to
9483         override do_is_local_label_name in parent.
9484         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9485         local symbols if --discard-locals or -X is given.
9486         * options.h (class General_options): Declare new options
9487         '--discard-locals' and '-X' for discarding locals.
9488         * target.h (class Target): Define new methods is_local_label_name.
9489         Declare new virtual method do_is_local_label_name.
9490         * target.cc: New file.
9491         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9492         (check_SCRIPTS): Add discard_locals_test.sh.
9493         (check_DATA): Add discard_local_tests.syms.
9494         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9495         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9496         * testsuite/Makefile.in: Regenerate.
9497         * testsuite/discard_locals_test.c: New file.
9498         * testsuite/discard_locals_test.sh: Same.
9499
9500 2009-06-05  Doug Kwan  <dougkwan@google.com>
9501
9502         * object.cc (Sized_relobj::Sized_relobj): Initialize
9503         discarded_eh_frame_shndx_ to -1U.
9504         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9505         section.
9506         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9507         a discarded .eh_frame section.
9508         (Sized_relobj::do_finalize_local_symbols): Ditto.
9509         * object.h (class Sized_relobj): Declare new member
9510         discarded_eh_frame_shndx_.
9511         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9512         (local_labels_test.o, local_labels_test): New rules.
9513         * testsuite/Makefile.in: Regenerate.
9514
9515 2009-06-04  Doug Kwan  <dougkwan@google.com>
9516
9517         * layout.cc (Layout::section_name_mapping): Add mapping for
9518         special ARM sections.
9519
9520 2009-06-03  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9523         (utils::has_overflow): Same.
9524
9525 2009-06-03  Ian Lance Taylor  <iant@google.com>
9526
9527         * layout.cc (Layout::section_name_mapping): New array, replacing
9528         Layout::linkonce_mapping.
9529         (Layout::section_name_mapping_count): New variable, replacing
9530         Layout::linkonce_mapping_count.
9531         (Layout::linkonce_output_name): Remove.
9532         (Layout::output_section_name): Rewrite.
9533         * layout.h (class Layout): Rename Linkonce_mapping to
9534         Section_name_mapping, linkonce_mapping to section_name_mapping,
9535         linkonce_mapping_count to section_name_mapping_count.  Don't
9536         declare linkonce_output_name.
9537
9538 2009-06-03  Doug Kwan  <dougkwan@google.com>
9539
9540         * gold/arm.cc (namespace utils): New.
9541         (Target_arm::reloc_is_non_pic): Define new method.
9542         (class Arm_relocate_functions): New.
9543         (Target_arm::Relocate::relocate): Handle relocation types used by
9544         Android.
9545
9546 2009-06-03  Ian Lance Taylor  <iant@google.com>
9547
9548         * arm.cc (Target_arm::scan::global): Use || instead of |.
9549
9550 2009-06-02  Doug Kwan  <dougkwan@google.com>
9551
9552         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9553         issued_non_pic_error_.
9554         (class Target_arm::Scan): Declare new method check_non_pic.
9555         Define new method symbol_needs_plt_entry.
9556         Declare new data member issued_non_pic_error_.
9557         (class Target_arm::Relocate): Declare new method
9558         should_apply_static_reloc.
9559         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9560         (Target_arm::Scan::check_non_pic): Define new method.
9561         (Target_arm::Scan::local): Handle a small subset of reloc types used
9562         by Android.
9563         (Target_arm::Scan::local): Same.
9564         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9565
9566 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9567
9568         * incremental.cc (Incremental_inputs::report_command_line): Filter
9569         out --incremental-* options.
9570
9571 2009-05-29  Doug Kwan  <dougkwan@google.com>
9572
9573         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9574         template class.
9575         (class Target_arm): Update comment.
9576         (Target_arm::Target_arm): Initialize new data members GOT_,
9577         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9578         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9579         and Target_arm::rel_dyn_section.
9580         Declare new_enum Target_arm::Got_type.
9581         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9582         and DYNBSS_.
9583         Update commments for member do_dynsym_value.
9584         (Target_arm::got_size, Target_arm::plt_section,
9585         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9586         new methods inside class defintion.
9587         (Target_arm::got_section): Define new method.
9588         (Target_arm::rel_dyn_section): Same.
9589         (Output_data_plt_arm): New template class.
9590         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9591         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9592         (Output_data_plt_arm::add_entry): Same.
9593         (Output_data_plt_arm::first_plt_entry): Define new
9594         static data member for PLT instruction template.
9595         (Output_data_plt_arm::plt_entry): Same.
9596         (Output_data_plt_arm::do_write): Define new method.
9597         (Target_arm::make_plt_entry): Same.
9598         (Target_arm::do_finalize_sections): Same.
9599         (Target_arm::do_dynsym_value): Same.
9600
9601 2009-05-28  Doug Kwan  <dougkwan@google.com>
9602
9603         * Makefile.am (TARGETSOURCES): Add arm.cc.
9604         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9605         * Makefile.in: Regenerate.
9606         * arm.cc: New file.
9607         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9608
9609 2009-05-26  Doug Kwan  <dougkwan@google.com>
9610
9611         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9612         (General_options::check_excluded_libs): Strip off directories in
9613         archive name before matching like GNU ld does.
9614         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9615         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9616         (exclude_libs_test_LDFLAGS): Add linker option
9617         -Wl,--exclude-libs,libexclude_libs_test_3
9618         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9619         an explicit archive without using -l.
9620         (alt/libexclude_libs_test_3.a): New make rule.
9621         * testsuite/Makefile.in: Regenerate.
9622         * testsuite/exclude_libs_test.c : Declare lib3_default().
9623         (main): Call it.
9624         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9625         * exclude_libs_test_3.c: New file.
9626
9627 2009-05-26  Nick Clifton  <nickc@redhat.com>
9628
9629         * po/id.po: New Indonesian translation.
9630         * po/gold.pot: Updated template file.
9631
9632 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9633
9634         * testsuite/Makefile.am: Add -ffunction-sections to compile
9635         gc_comdat_test files.  Add -Wl,--gc-sections to build
9636         gc_comdat_test.
9637         * testsuite/Makefile.in: Regenerate.
9638         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9639
9640 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9641
9642         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9643         kept comdat section was garbage collected.
9644         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9645         * testsuite/Makefile.in: Regenerate.
9646         * testsuite/gc_comdat_test.sh: New file.
9647         * testsuite/gc_comdat_test_1.cc: New file.
9648         * testsuite/gc_comdat_test_2.cc: New file.
9649
9650 2009-05-19  Doug Kwan  <dougkwan@google.com>
9651
9652         * archive.cc (Archive::Archive): Move constructor from archive.h
9653         to here.  Initialize no_export_.
9654         (Archive::get_elf_object_for_member): Set no_export flag of object.
9655         * archive.h (Archive::Archive): Move constructor body to
9656         archive.cc.
9657         (Archive::no_export): New method.
9658         (Archive::no_export_): New field.
9659         * object.h (Object::Object): Initialize no_export_ to false.
9660         (Object::no_export, Object::set_no_export): New methods.
9661         (Object::no_export_): New field.
9662         * options.cc (General_options::parse_exclude_libs): New method.
9663         (General_options::check_excluded_libs) Same.
9664         * options.h (exclude_libs): New option.
9665         (General_options::check_excluded_libs): New method declaration.
9666         (General_options::excluded_libs_): New field.
9667         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9668         default or protected visibility if an object has no-export flag set.
9669         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9670         (check_SCRIPTS): Add exclude_libs_test.sh.
9671         (check_DATA): Add exclude_libs_test.syms.
9672         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9673         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9674         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9675         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9676         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9677         libexclude_libs_test_2.a): New rules.
9678         * testsuite/Makefile.in: Regenerate.
9679         * testsuite/exclude_libs_test.c: New file.
9680         * testsuite/exclude_libs_test.sh: Ditto.
9681         * testsuite/exclude_libs_test_1.c: Ditto.
9682         * testsuite/exclude_libs_test_2.c: Ditto.
9683
9684 2009-05-15  Ian Lance Taylor  <iant@google.com>
9685
9686         * configure.ac: Check for declarations for cases where libiberty.h
9687         checks HAVE_DECL_xxx.
9688         * configure, config.in: Rebuild.
9689
9690 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9691
9692         * gold.h (Incremental_argument_list): Remove (invalid) forward
9693         declaration.
9694         * incremental.cc (Incremental_inputs::report_achive): New method.
9695         (Incremental_inputs::report_object): New method.
9696         (Incremental_inputs::report_script): New method.
9697         (Incremental_inputs::finalize_inputs): New method.
9698         (Incremental_inputs::finalize): Call finalize_inputs().
9699         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9700         Create inputs entries.
9701         * incremental.h (Incremental_input_type): New enum.
9702         (Incremental_inputs::Incremental_input): Initialize new fields.
9703         (Incremental_inputs::report_inputs): New method.
9704         (Incremental_inputs::report_achive): New method.
9705         (Incremental_inputs::report_object): New method.
9706         (Incremental_inputs::report_script): New method.
9707         (Incremental_inputs::finalize_inputs): New method.
9708         (Incremental_inputs::Input_info): New struct.
9709         (Incremental_inputs::Input_info_map): New typedef.
9710         (Incremental_inputs::lock_): New field.
9711         (Incremental_inputs::Inputs_): New field.
9712         (Incremental_inputs::Inputs_map): New field.
9713         * main.cc (main): Call Incremental_input::report_inputs.
9714         * options.h (Input_argument_list): Typedef moved from
9715         Input_arguments.
9716         (Input_file_group::Files): Remove, use ::Input_argument_list.
9717         (Input_file_group::Input_argument_list): Remove, use
9718         ::Input_argument_list.
9719         * plugin.cc (Plugin_manager::add_input_file): Add error in
9720         incremental build.
9721         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9722         functions.
9723         * script.cc (read_input_script): Call
9724         Incremental_input::report_script.
9725         * script.h (Script_info): New class.
9726
9727 2009-04-27  Ian Lance Taylor  <iant@google.com>
9728
9729         * x86_64.cc (do_adjust_output_section): Set entsize to
9730         plt_entry_size.
9731
9732 2009-04-23  Elliott Hughes  <enh@google.com>
9733
9734         * output.cc (Output_file::close): After short writes, continue
9735         writing from the correct offset in the buffer being written.
9736
9737 2009-04-23  Chris Demetriou  <cgd@google.com>
9738
9739         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9740         * configure: Regenerate.
9741         * config.in: Regenerate.
9742         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9743         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9744
9745 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9746
9747         * incremental.cc (Incremental_inputs_header_data): Renamed from
9748         Incremental_input_header_data.
9749         (Incremental_inputs_header_data::data_size): New field.
9750         (Incremental_inputs_header_data::put_input_file_count): Renamed
9751         from input_file_count.
9752         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9753         from command_line_offset.
9754         (Incremental_inputs_header_data::put_reserved): Renamed from
9755         put_reserved.
9756         (Incremental_inputs_entry_data): Renamed from
9757         Incremental_input_entry_data.
9758         (Incremental_inputs_entry_data::data_size): New field.
9759         (Incremental_inputs::report_command_line): New method.
9760         (Incremental_inputs::finalize): New method.
9761         (Incremental_inputs::create_incremental_inputs_data): New method.
9762         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9763         * incremental.h: New file.
9764         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9765        (Layout::finalize): Create incremental inputs section in
9766         incremental builds.
9767        (Layout::create_incremental_info_sections): New method.
9768         * layout.h (Layout::incremental_inputs): New method.
9769        (Layout::create_incremental_info_sections): New method.
9770        (Layout::incremental_inputs_): New field.
9771         * main.cc (main): Notify Incremental_input of the command line.
9772
9773 2009-04-01  Ian Lance Taylor  <iant@google.com>
9774             Mikolaj Zalewski  <mikolajz@google.com>
9775
9776         * gold.h (reserve_unordered_map): Define, three versions, one for
9777         each version of Unordered_map.
9778         * layout.cc (Layout::Layout): Remove options parameter.  Add
9779         number_of_input_files parameter.  Don't initialize options_.
9780         Initialize number_of_input_files_ and resized_signatures_.  Move
9781         sections_are_attached_.
9782         (Layout::layout_group): Reserve space for group_signatures_.
9783         (Layout::find_or_add_kept_section): Change name parameter to be a
9784         reference.  Resize signatures_ map when it gets large enough.
9785         (Layout::layout_eh_frame): Use parameters->options() instead of
9786         this->options_.
9787         (Layout::make_output_section): Likewise.
9788         (Layout::attach_allocated_section_to_segment): Likewise.
9789         (Layout::finalize, Layout::create_executable_stack): Likewise.
9790         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9791         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9792         * layout.h (class Layout): Update declarations.  Remove options_
9793         field.  Add number_of_input_files_ and resized_signatures_
9794         fields.  Move sections_are_attached_ field.
9795         * main.cc (main): Pass number of input files to Layout
9796         constructor.  Don't pass options.
9797
9798 2009-03-30  Ian Lance Taylor  <iant@google.com>
9799
9800         * ffsll.c (ffsll): Correct implementation.
9801
9802 2009-03-27  Ian Lance Taylor  <iant@google.com>
9803
9804         * ffsll.c: New file.
9805         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9806         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9807         * ftruncate.c (ftruncate): Declare before definition.
9808         * mremap.c (mremap): Likewise.
9809         * pread.c (pread): Likewise.
9810         * configure, Makefile.in, config.in: Rebuild.
9811
9812         * mremap.c: New file.
9813         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9814         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9815         (mremap): Declare if HAVE_MREMAP is not defined.
9816         * configure, Makefile.in, config.in: Rebuild.
9817
9818 2009-03-27  Cary Coutant  <ccoutant@google.com>
9819
9820         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9821         position independent.
9822         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9823         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9824
9825 2009-03-24  Cary Coutant  <ccoutant@google.com>
9826
9827         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9828         an executable.
9829         (needs_dynamic_reloc): Likewise.
9830
9831 2009-03-24  Ian Lance Taylor  <iant@google.com>
9832
9833         * yyscript.y (file_cmd): Recognize EXTERN.
9834         (extern_name_list, extern_name_list_body): New nonterminals.
9835         * script.cc (script_add_extern): Define.
9836         * script-c.h (script_add_extern): Declare.
9837
9838 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9839
9840         * object.cc (is_elf_object): Define.
9841         * object.h (is_elf_object): Declare.
9842         * archive.cc (Archive::get_elf_object_for_member): Call
9843         is_elf_object.
9844         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9845
9846 2009-03-24  Elliott Hughes  <enh@google.com>
9847
9848         * output.cc (Output_file::map_anonymous): Define.
9849         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9850         try an anonymous one.  Report the size if the mmap fails.
9851         * output.h (class Output_file): Declare map_anonymous.
9852
9853 2009-03-24  Ian Lance Taylor  <iant@google.com>
9854
9855         * target-select.cc (instantiate_target): Don't acquire the lock if
9856         the instantiated_target_ field has already been set.
9857
9858 2009-03-23  Ian Lance Taylor  <iant@google.com>
9859
9860         * gold-threads.h (class Initialize_lock): Define.
9861         * gold-threads.cc (class Initialize_lock_once): Define.
9862         (initialize_lock_control): New static variable.
9863         (initialize_lock_pointer): New static variable.
9864         (initialize_lock_once): New static function.
9865         (Initialize_lock::Initialize_lock): Define.
9866         (Initialize_lock::initialize): Define.
9867         * target-select.h: Include "gold-threads.h".
9868         (class Target_selector): Add lock_ and initialize_lock_ fields.
9869         Don't define instantiate_target, just declare it.
9870         * target-select.cc (Target_selector::Target_selector): Initialize
9871         new fields.
9872         (Target_selector::instantiate_target): Define.
9873         * descriptors.h: Include "gold-threads.h".
9874         (class Descriptors): Add initialize_lock_ field.
9875         * descriptors.cc (Descriptors::Descriptors): Initialize new
9876         field.
9877         (Descriptors::open): Use initialize_lock_ field
9878         * errors.h (class Errors): Add initialize_lock_ field.
9879         * errors.cc (Errors::Errors): Initialize new field.
9880         (Errors::initialize_lock): Use initialize_lock_ field.
9881         * powerpc.cc (class Target_selector_powerpc): Remove
9882         instantiated_target_ field.  In do_recognize call
9883         instantiate_target rather than do_instantiate_target.  In
9884         do_instantiate_target just allocate a new target.
9885         * sparc.cc (class Target_selector_sparc): Likewise.
9886
9887         * freebsd.h: New file.
9888         * i386.cc: Include "freebsd.h".
9889         (Target_i386): Derive from Target_freebsd rather than
9890         Sized_target.
9891         (Target_selector_i386): Derive from Target_selector_freebsd rather
9892         than Target_selector.
9893         * x86_64.cc: Include "freebsd.h".
9894         (Target_x86_64): Derive from Target_freebsd rather than
9895         Sized_target.
9896         (Target_selector_x86_64): Derive from Target_selector_freebsd
9897         rather than Target_selector.
9898         * target.h (class Target): Add adjust_elf_header and
9899         do_adjust_elf_header.
9900         * output.cc (Output_file_header:: do_sized_write): Call target
9901         adjust_elf_header routine.
9902         * configure.tgt: Set targ_osabi.
9903         * configure.ac: Define GOLD_DEFAULT_OSABI.
9904         * parameters.cc (Parameters::default_target): Pass
9905         GOLD_DEFAULT_OSABI to select_target.
9906         * target-select.h (class Target_selector): Make instantiate_target
9907         protected rather than private.
9908         * Makefile.am (HFILES): Add freebsd.h.
9909         * configure, Makefile.in, config.in: Rebuild.
9910
9911         * merge.cc (do_add_input_section): Correct pend value.  Change
9912         message about last entry not being null terminated from error to
9913         warning.
9914
9915 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9916
9917         * incremental.cc: New file.
9918         * Makefile.am (CCFILES): Add incremental.cc.
9919         * Makefile.in: Rebuild.
9920
9921 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9922
9923         * layout.cc (Layout::output_section_name): Preserve names
9924         of '.note.' sections.
9925
9926 2009-03-19  Ian Lance Taylor  <iant@google.com>
9927
9928         * descriptors.cc (Descriptors::open): Check that the options are
9929         valid before using them.
9930
9931 2009-03-18  Ian Lance Taylor  <iant@google.com>
9932
9933         * script-sections.h: Include <list>.
9934         (class Script_sections): Change Sections_elements from std::vector
9935         to std::list.  Typedef public Elements_iterator.  Add
9936         orphan_section_placement_, data_segment_align_start_, and
9937         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9938         field.
9939         * script-sections.cc (class Orphan_section_placement): New class.
9940         (class Sections_element): Add virtual functions is_relro and
9941         orphan_section_init.  Remove virtual function place_orphan_here.
9942         (class Output_section_definition): Add is_relro and
9943         orphan_section_init.  Remove place_orphan_here.
9944         (class Orphan_output_section): Likewise.
9945         (Script_sections::Script_sections): Update for field changes.
9946         (Script_sections::data_segment_align): Set saw_data_segment_align_
9947         and data_segment_align_start_, not data_segment_align_index.
9948         (Script_sections::data_segment_relro_end): Check
9949         saw_data_segment_align_.  Use data_segment_align_start_ rather
9950         than data_segment_align_index_.
9951         (Script_sections::place_orphan): Rewrite to use
9952         Orphan_section_placement.
9953
9954 2009-03-17  Ian Lance Taylor  <iant@google.com>
9955
9956         * archive.cc (Archive::add_symbols): Check for a version attached
9957         to the symbol name in the archive map.
9958         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9959         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9960         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9961         (ver_test_11.a): New target.
9962         * testsuite/Makefile.in: Rebuild.
9963
9964         * configure.ac: Check for chsize and posix_fallocate.  Replace
9965         ftruncate.
9966         * ftruncate.c: New file, from gnulib.
9967         * output.cc (posix_fallocate): Define dummy version if not
9968         HAVE_POSIX_FALLOCATE.
9969         (Output_file::map): Call posix_fallocate rather than lseek and
9970         write.
9971         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9972         * configure, Makefile.in, config.in: Rebuild.
9973
9974 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
9975
9976         * layout.h (Layout::create_note): Add section_name parameter.
9977         * layout.cc (Layout::create_note): Likewise.
9978         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9979
9980 2009-03-17  Ian Lance Taylor  <iant@google.com>
9981
9982         * descriptors.cc: Include "options.h".
9983         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9984         (Descriptors::open): Always use O_CLOEXEC when opening a new
9985         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
9986         then set FD_CLOEXEC.
9987
9988         * sparc.cc (class Target_sparc): Add has_got_section.
9989         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9990         make sure we have a GOT section.
9991
9992         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9993         (Target_sparc::Scan::local): Likewise.
9994         (Target_sparc::Scan::global): Likewise.
9995         (Target_sparc::Relocate::relocate): Likewise.
9996         (Target_sparc::Relocate::relocate_tls): Likewise.
9997
9998         * symtab.cc (Symbol_table::define_default_version): New function,
9999         broken out of add_from_object.
10000         (Symbol_table::add_from_object): Call define_default_version.
10001         (Symbol_table::define_special_symbol): Add resolve_oldsym
10002         parameter.  Change all callers.  If the version for a symbol comes
10003         from a version script, resolve it with the symbol with the same
10004         name with no version.  Also add the symbol without a version if
10005         appropriate.
10006         (do_define_in_output_data): If resolving with oldsym, don't delete
10007         sym.
10008         (do_define_in_output_segment): Likewise.
10009         (do_define_as_constant): Likewise.
10010         * symtab.h (class Symbol_table): Update declarations.
10011
10012 2009-03-13  Ian Lance Taylor  <iant@google.com>
10013
10014         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10015         (Read_symbols::requeue): New function.
10016         (Read_symbols::do_read_symbols): If make_elf_object fails because
10017         the target type is not configured, and the file was searched for,
10018         issue a warning and retry with the next directory.
10019         (Add_symbols::run): If the file has an incompatible format, and
10020         it was searched for, requeue the Read_symbols task.  On error,
10021         release the object.
10022         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10023         dirindex parameter to constructor.  Change all callers.  Declare
10024         incompatible_warning and requeue.
10025         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10026         input_argument_ and input_group_ fields.  Add them to
10027         constructor.  Change all callers.
10028         (class Read_script): Add dirindex_ field.  Add it to constructor.
10029         Change all callers.
10030         * archive.cc (Archive::setup): Remove input_objects parameter.
10031         Change all callers.
10032         (Archive::get_file_and_offset): Likewise.
10033         (Archive::read_all_symbols): Likewise.
10034         (Archive::read_symbols): Likewise.
10035         (Archive::get_elf_object_for_member): Remove input_objects
10036         parameter.  Add punconfigured parameter.  Change all callers.
10037         (Archive::add_symbols): Change return type to bool.  Check return
10038         value of include_member.
10039         (Archive::include_all_members): Likewise.
10040         (Archive::include_member): Change return type to bool.  Return
10041         false if first included object has incompatible target.  Set
10042         included_member_ field.
10043         (Add_archive_symbols::run): If add_symbols returns false, requeue
10044         Read_symbols task.
10045         * archive.h (class Archive): Add included_member_ field.
10046         Initialize it in constructor.  Add input_file and searched_for
10047         methods.  Update declarations.
10048         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10049         input_argument_ fields.  Add them to constructor.  Change all
10050         callers.
10051         * script.cc: Include "target-select.h".
10052         (class Parser_closure): Add skip_on_incompatible_target_ and
10053         found_incompatible_target_ fields.  Add
10054         skip_on_incompatible_target parameter to constructor.  Change all
10055         callers.  Add methods skip_on_incompatible_target,
10056         clear_skip_on_incompatible_target, found_incompatible_target, and
10057         set_found_incompatible_target.
10058         (read_input_script): Add dirindex parameter.  Change all callers.
10059         If parser finds an incompatible target, requeue Read_symbols
10060         task.
10061         (script_set_symbol): Clear skip_on_incompatible_target in
10062         closure.
10063         (script_add_assertion, script_parse_option): Likewise.
10064         (script_start_sections, script_add_phdr): Likewise.
10065         (script_check_output_format): New function.
10066         * script.h (read_input_script): Update declaration.
10067         * script-c.h (script_check_output_format): Declare.
10068         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10069         (ignore_cmd): Remove OUTPUT_FORMAT.
10070         * fileread.cc (Input_file::Input_file): Add explicit this.
10071         (Input_file::will_search_for): New function.
10072         (Input_file::open): Add pindex parameter.  Change all callers.
10073         * fileread.h (class Input_file): Add input_file_argument method.
10074         Declare will_search_for.  Update declarations.
10075         * object.cc (make_elf_object): Add punconfigured parameter.
10076         Change all callers.
10077         * object.h (class Object): Make input_file public.  Add
10078         searched_for method.
10079         (make_elf_object): Update declaration.
10080         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10081         restart search.
10082         * dirsearch.h (class Dirsearch): Update declaration.
10083         * options.h (class General_options): Add --warn-search-mismatch.
10084         * parameters.cc (Parameters::is_compatible_target): New function.
10085         * parameters.h (class Parameters): Declare is_compatible_target.
10086         * workqueue.cc (Workqueue::add_blocker): New function.
10087         * workqueue.h (class Workqueue): Declare add_blocker.
10088
10089         * fileread.cc (Input_file::open): Remove options parameter.
10090         Change all callers.
10091         (Input_file::open_binary): Likewise.
10092         * script.cc (read_input_script): Likewise.
10093         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10094         options parameter from constructor.  Change all callers.
10095         (class Read_script): Likewise.
10096         * fileread.h (class Input_file): Update declarations.
10097         * script.h (read_input_script): Update declaration.
10098
10099 2009-03-10  Nick Clifton  <nickc@redhat.com>
10100
10101         * po/es.po: New Spanish translation.
10102
10103 2009-03-06  Cary Coutant  <ccoutant@google.com>
10104
10105         * options.cc (parse_short_option): Keep dash_z from registering itself.
10106
10107 2009-03-03  Ian Lance Taylor  <iant@google.com>
10108
10109         PR 9918
10110         * target-reloc.h (relocate_section): Pass output_section to
10111         relocate.
10112         * i386.cc (Target_i386::should_apply_static_reloc): Add
10113         output_section parameter.  Change all callers.
10114         (Target_i386::Relocate::relocate): Add output_section parameter.
10115         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10116         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10117         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10118         * testsuite/two_file_shared.sh: New script.
10119         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10120         (check_DATA): Add two_file_shared.dbg.
10121         (two_file_shared.dbg): New target.
10122         * testsuite/Makefile.in: Rebuild.
10123
10124 2009-03-01  Ian Lance Taylor  <iant@google.com>
10125
10126         * configure.ac: Check for byteswap.h.
10127         * configure: Rebuild.
10128         * config.in: Rebuild.
10129
10130 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10131
10132         * layout.cc (Layout::find_or_add_kept_section): New function.
10133         (Layout::add_comdat): Removed.
10134         * layout.h (struct Kept_section): Move out of class Layout.
10135         Remove trailing underscores from field names.  Add group_sections
10136         field.  Rename group_ field to is_group.  Change all uses.
10137         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10138         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10139         comdat_groups_ field.
10140         (Sized_relobj::include_section_group): Use
10141         find_or_add_kept_section and Kept_section::group_sections.
10142         (Sized_relobj::include_linkonce_section): Likewise.
10143         * object.cc (class Sized_relobj): Don't define Comdat_group or
10144         Comdat_group_table.  Remove find_comdat_group and
10145         add_comdat_group.  Remove comdat_groups_ field.
10146         * plugin.cc (include_comdat_group): Use
10147         Layout::find_or_add_kept_section.
10148
10149 2009-02-28  Ian Lance Taylor  <iant@google.com>
10150
10151         * README: --gc-sections and map files are now supported.  Document
10152         some build requirements.
10153
10154         PR 6992
10155         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10156         relocatable link set the value of the section symbol to zero.
10157         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10158         relocatable link don't include the section address in the local
10159         symbol value.
10160
10161 2009-02-27  Ian Lance Taylor  <iant@google.com>
10162
10163         PR 6811
10164         * options.h (class Search_directory): Add is_system_directory.
10165         (class General_options): Declare is_in_system_directory.
10166         * options.cc (get_relative_sysroot): Make static.
10167         (get_default_sysroot): Make static.
10168         (General_optoins::is_in_system_directory): New function.
10169         * fileread.cc (Input_file::is_in_system_directory): New function.
10170         * fileread.h (class Input_file): Declare is_in_system_directory.
10171         * object.h (class Object): Add is_in_system_directory.
10172         (class Input_objects): Remove system_library_directory_ field.
10173         * object.cc (Input_objects::add_object): Don't set
10174         system_library_directory_.
10175         (input_objects::found_in_system_library_directory): Remove.
10176         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10177         parameter.  Change all callers.
10178         (Symbol_table::sized_write_globals): Likewise.
10179         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10180         Call Object::is_in_system_directory.
10181         * symtab.h (class Symbol_table): Update declarations.
10182
10183         PR 5990
10184         * descriptors.h (Open_descriptor): Add is_on_stack field.
10185         * descriptors.cc (Descriptors::open): If the descriptor is on the
10186         top of the stack, remove it.  Initialize is_on_stack field.
10187         (Descriptors::release): Only add pod to stack if it is not on the
10188         stack already.
10189         (Descriptors::close_some_descriptor): Clear stack_next and
10190         is_on_stack fields.
10191
10192         PR 7091
10193         * output.cc (Output_section::find_starting_output_address): Rename
10194         from starting_output_address; add PADDR parameter; change return
10195         type.
10196         * output.h (class Output_section): Declare
10197         find_starting_output_address instead of starting_output_address.
10198         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10199         section symbol for which we can't find a merge section.
10200
10201         PR 9836
10202         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10203         hidden or internal, force the symbol to be local.
10204         * resolve.cc (Symbol::override_visibility): Define.
10205         (Symbol::override_base): Use override_visibility.
10206         (Symbol_table::resolve): Likewise.
10207         (Symbol::override_base_with_special): Likewise.
10208         (Symbol_table::override_with_special): If the visibility is hidden
10209         or internal, force the symbol to be local.
10210         * symtab.h (class Symbol): Add set_visibility and
10211         override_visibility.
10212         * testsuite/ver_test_1.sh: New file.
10213         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10214         (check_DATA): Add ver_test_1.syms.
10215         (ver_test_1.syms): New target.
10216         * testsuite/Makefile.in: Rebuild.
10217
10218 2009-02-25  Cary Coutant  <ccoutant@google.com>
10219
10220         * layout.cc (Layout::choose_output_section): Don't rename sections
10221         when using a linker script that has a SECTIONS clause.
10222         * Makefile.in: Regenerate.
10223
10224         * testsuite/Makefile.am (script_test_5.sh): New test case.
10225         * testsuite/Makefile.in: Regenerate.
10226         * testsuite/script_test_5.cc: New file.
10227         * testsuite/script_test_5.sh: New file.
10228         * testsuite/script_test_5.t: New file.
10229
10230 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10231
10232         * archive.cc (Archive::include_member): Update calls to add_symbols.
10233         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10234         the Layout argument.
10235         * dynobj.h (do_add_symbols): Add the Layout argument.
10236         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10237         Layout argument.
10238         * object.h (Object::add_symbols): Add the Layout argument.
10239         (Object::do_add_symbols): Add the Layout argument.
10240         (Sized_relobj::do_add_symbols): Add the Layout argument.
10241         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10242         Unify the two versions.
10243         (Add_plugin_symbols): Remove.
10244         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10245         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10246         (Add_plugin_symbols): Remove.
10247         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10248         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10249         (Add_symbols::run): Make it work with Pulginobj.
10250
10251 2009-02-06  Ian Lance Taylor  <iant@google.com>
10252
10253         * object.cc (Sized_relobj::do_layout): Make info message start
10254         with lower case letter.
10255
10256 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10257
10258         * binary.cc: Fix file comment.
10259
10260         * options.h (enum Incremental_disposition): Define.
10261         (class General_options): Add new options: --incremental,
10262         --incremental_changed, --incremental_unchanged,
10263         --incremental_unknown.  Add incremental_disposition_ and
10264         implicit_incremental_ fields.
10265         (General_options::incremental_disposition): New function.
10266         (class Position_dependent_options): Add incremental_disposition
10267         option.
10268         (Position_dependent_options::copy_from_options): Set incremental
10269         dispositions.
10270         * options.cc (General_options::parse_incremental_changed): New
10271         function.
10272         (General_options::parse_incremental_unchanged): New function.
10273         (General_options::parse_incremental_unknown): New function.
10274         (General_options::General_options): Initialize new fields
10275         incremental_disposition_ and implicit_incremental_.
10276         (General_options::finalize): Check for uasge of --incremental-*
10277         without --incremental.
10278
10279 2009-02-06  Chris Demetriou  <cgd@google.com>
10280
10281         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10282         pointer and to report location as the file name associated with
10283         the symbol.
10284         (gold_undefined_symbol_at_location): New function to replace the
10285         old gold_undefined_symbol functionality.
10286         * target-reloc.h (relocate_section): Update to use
10287         gold_undefined_symbol_at_location.
10288         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10289         Call gold_undefined_symbol function rather than gold_error.
10290         * errors.h (Errors::undefined_symbol): Take location as a
10291         string, rather than calculating it from a relocation.
10292         * errors.cc (Errors::fatal): Print "fatal error:" before the
10293         formatted message.
10294         (Errors::error, Errors::error_at_location): Print "error: "
10295         before the formatted message.
10296         (Errors::undefined_symbol): Take location as a string, rather
10297         than calculating it from a relocation.
10298         (gold_undefined_symbol_at_location): New function akin to
10299         old gold_undefined_symbol, calculates location from relocation.
10300         (gold_undefined_symbol): Change to take only a Symbol pointer
10301         and to report location as the file name associated with the symbol.
10302         * testsuite/debug_msg.sh: Update for changed error messages.
10303         * testsuite/undef_symbol.sh: Likewise.
10304
10305 2009-02-04  Duncan Sands  <baldrick@free.fr>
10306
10307         PR 9812
10308         * reduced_debug_output.h
10309         (Output_reduced_debug_abbrev_section::failed): Use format for
10310         gold_warning.
10311         (Output_reduced_debug_info_section::faild): Likewise.
10312
10313 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10314
10315         * script.cc (Lazy_demangler): New class.
10316         (Version_script_info::get_symbol_version_helper): Demangle a
10317         symbol only once.
10318
10319 2009-01-29  Cary Coutant  <ccoutant@google.com>
10320
10321         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10322         to __tls_get_addr.
10323         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10324
10325 2009-01-28  Ian Lance Taylor  <iant@google.com>
10326
10327         * version.cc (version_string): Bump to 1.9.
10328
10329         * gold.h: Include <cstring> and <stdint.h>.
10330         * version.cc: Include <cstdio>.
10331         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10332         warning.
10333         * reduced_debug_output.cc (insert_into_vector): Rename from
10334         Insert_into_vector; change all callers.  Use Swap_unaligned to
10335         avoid aliasing issue; remove union since it is unnecessary.
10336
10337 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10338
10339         * Makefile.am (CCFILES): Add gc.cc.
10340         (HFILES): Add gc.h.
10341         * Makefile.in: Regenerate.
10342         * gold.cc (Gc_runner): New class.
10343         (queue_initial_tasks): Call garbage collection related tasks
10344         when corresponding options are invoked.
10345         (queue_middle_gc_tasks): New function.
10346         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10347         processed early before laying out sections during garbage collection.
10348         * gold.h (queue_middle_gc_tasks): New function.
10349         (is_prefix_of): Move from "layout.cc".
10350         * i386.cc (Target_i386::gc_process_relocs): New function.
10351         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10352         * main.cc (main): Create object of class "Garbage_collection".
10353         * object.cc (Relobj::copy_symbols_data): New function.
10354         (Relobj::is_section_name_included): New function.
10355         (Sized_relobj::do_layout): Allow this function to be called twice
10356         during garbage collection and defer layout of section during the
10357         first call.
10358         * object.h (Relobj::get_symbols_data): New function.
10359         (Relobj::is_section_name_included): New function.
10360         (Relobj::copy_symbols_data): New function.
10361         (Relobj::set_symbols_data): New function.
10362         (Relobj::get_relocs_data): New function.
10363         (Relobj::set_relocs_data): New function.
10364         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10365         (Relobj::gc_process_relocs): New function.
10366         (Relobj::do_gc_process_relocs): New pure virtual function.
10367         (Relobj::sd_): New data member.
10368         (Sized_relobj::is_output_section_offset_invalid): New function.
10369         (Sized_relobj::do_gc_process_relocs): New function.
10370         * options.h (General_options::gc_sections): Modify to not be a no-op.
10371         (General_options::print_gc_sections): New option.
10372         * plugin.cc (Plugin_finish::run): Remove function call to
10373         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10374         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10375         * reloc.cc (Read_relocs::run): Add task to process relocs and
10376         determine unreferenced sections when doing garbage collection.
10377         (Gc_process_relocs): New class.
10378         (Sized_relobj::do_gc_process_relocs): New function.
10379         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10380         sections that are garbage collected.
10381         * reloc.h (Gc_process_relocs): New class.
10382         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10383         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10384         symbols whose corresponding sections are garbage collected.
10385         (Symbol_table::Symbol_table): Add new parameter for the garbage
10386         collection object.
10387         (Symbol_table::gc_mark_undef_symbols): New function.
10388         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10389         (Symbol_table::gc_mark_dyn_syms): New function.
10390         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10391         as garbage.
10392         (Symbol_table::add_from_object): Likewise.
10393         (Symbol_table::add_from_relobj): When building shared objects, do not
10394         treat externally visible symbols as garbage.
10395         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10396         table information for static and relocatable links.
10397         * symtab.h (Symbol_table::set_gc): New function.
10398         (Symbol_table::gc): New function.
10399         (Symbol_table::gc_mark_undef_symbols): New function.
10400         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10401         (Symbol_table::gc_mark_dyn_syms): New function.
10402         (Symbol_table::gc_): New data member.
10403         * target.h (Sized_target::gc_process_relocs): New pure virtual
10404         function.
10405         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10406         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10407
10408 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10409
10410         * options.h (General_options::gc_sections): Define as a no-op for now.
10411         (General_options::no_keep_memory): Ditto.
10412         (General_options::Bshareable): Define.
10413         * options.cc (General_options::finalize): Honor -Bshareable.
10414
10415 2009-01-20  Andreas Schwab  <schwab@suse.de>
10416
10417         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10418         read the value in the contents, since we don't use it.  Use the
10419         template endianness when writing.
10420         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10421
10422 2009-01-19  Andreas Schwab  <schwab@suse.de>
10423
10424         * configure.tgt (powerpc64-*): Fix targ_obj.
10425
10426 2009-01-15  Ian Lance Taylor  <iant@google.com>
10427
10428         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10429         local symbols when stripping all symbols.
10430
10431 2009-01-14  Cary Coutant  <ccoutant@google.com>
10432
10433         * output.cc (Output_reloc): Add explicit instantiations.
10434
10435 2009-01-14  Cary Coutant  <ccoutant@google.com>
10436
10437         * archive.cc (Archive::get_elf_object_for_member): Remove call
10438         to File_read::claim_for_plugin.
10439         * descriptors.cc (Descriptors::open): Remove reference to
10440         is_claimed.
10441         (Descriptors::claim_for_plugin): Remove.
10442         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10443         (Descriptors::is_claimed): Remove.
10444         (claim_descriptor_for_plugin): Remove.
10445         * fileread.cc (File_read::claim_for_plugin): Remove.
10446         * fileread.h (File_read::claim_for_plugin): Remove.
10447         (File_read::descriptor): Reopen descriptor if necessary.
10448         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10449         (Plugin_manager::all_symbols_read): Add task parameter. Change
10450         all callers.
10451         (Plugin_manager::get_input_file): New function.
10452         (Plugin_manager::release_input_file): New function.
10453         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10454         corresponding data member.
10455         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10456         and pass to base constructor. Change all callers.
10457         (get_input_file, release_input_file): New functions.
10458         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10459         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10460         (Plugin_manager::all_symbols_read): Add task parameter.
10461         (Plugin_manager::get_input_file): New function.
10462         (Plugin_manager::release_input_file): New function.
10463         (Plugin_manager::task_): New data member.
10464         (Pluginobj::Pluginobj): Add filesize parameter.
10465         (Pluginobj::filename): New function.
10466         (Pluginobj::descriptor): New function.
10467         (Pluginobj::filesize): New function.
10468         (Pluginobj::filesize_): New data member.
10469         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10470         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10471         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10472
10473         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10474         with archive libraries.
10475         * testsuite/Makefile.in: Regenerate.
10476         * testsuite/plugin_test.c (struct sym_info): New type.
10477         (get_input_file, release_input_file): New static variables.
10478         (onload): Capture new transfer vector entries.
10479         (claim_file_hook): Stop reading at end of file according to filesize.
10480         Factor out parsing of readelf output into separate function.
10481         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10482         APIs and get the source file name from the symbol table.  Convert
10483         source file name to corresponding object file name.  Print info
10484         message when adding new input files.
10485         (parse_readelf_line): New function.
10486         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10487         * testsuite/plugin_test_2.sh: Likewise.
10488         * testsuite/plugin_test_3.sh: Likewise.
10489         * testsuite/plugin_test_4.sh: New test case.
10490
10491 2009-01-07  Ian Lance Taylor  <iant@google.com>
10492
10493         * version.cc (version_string): Bump to 1.8.
10494
10495 2008-12-23  Cary Coutant  <ccoutant@google.com>
10496
10497         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10498         * plugin.cc (Plugin_manager::finish): Rename as
10499         layout_deferred_objects.  Move cleanup to separate function.
10500         (Plugin_manager::cleanup): New function.
10501         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10502         separately.
10503         * plugin.h (Plugin_manager::finish): Rename as
10504         layout_deferred_objects.
10505         (Plugin_manager::cleanup): New function.
10506         (Plugin_manager::cleanup_done): New field.
10507
10508 2008-12-23  Cary Coutant  <ccoutant@google.com>
10509
10510         * plugin.cc (is_visible_from_outside): New function.
10511         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10512         so we don't return "IR only" status for exported symbols or -r links.
10513
10514         * testsuite/Makefile.am (plugin_test_3): New test case.
10515         * testsuite/Makefile.in: Regenerate.
10516         * testsuite/plugin_test_3.sh: New file.
10517
10518 2008-12-22  Cary Coutant  <ccoutant@google.com>
10519
10520         * object.cc (Sized_relobj::layout_section): New function.
10521         (Sized_relobj::do_layout): Defer layout of input sections until after
10522         plugin has provided replacement files.
10523         (Sized_relobj::do_layout_deferred_sections): New function.
10524         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10525         (Relobj::layout_deferred_sections): New function.
10526         (Relobj::do_layout_deferred_sections): New function.
10527         (Sized_relobj::do_layout_deferred_sections): New function.
10528         (Sized_relobj::layout_section): New function.
10529         (Sized_relobj::Deferred_layout): New structure.
10530         (Sized_relobj::deferred_layout_): New field.
10531         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10532         Change all callers.  Layout deferred sections.
10533         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10534         references.
10535         (Plugin_hook::run): Move code from do_plugin_hook inline.
10536         (Plugin_hook::do_plugin_hook): Remove.
10537         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10538         (Plugin_manager::finish): Renamed, was cleanup.
10539         (Plugin_manager::should_defer_layout): New function.
10540         (Plugin_manager::add_deferred_layout_object): New function.
10541         (Plugin_manager::Deferred_layout_list): New type.
10542         (Plugin_manager::deferred_layout_objects_): New field.
10543         (Plugin_hook::do_plugin_hook): Remove.
10544
10545 2008-12-17  Ian Lance Taylor  <iant@google.com>
10546
10547         * options.h (class General_options): Add --no case for
10548         --export-dynamic.
10549
10550 2008-12-16  Cary Coutant  <ccoutant@google.com>
10551
10552         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10553         vector.
10554         (Plugin_manager::claim_file): Create plugin object even if
10555         plugin did not call the add_symbols callback.
10556         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10557         asking for more symbols than were added.
10558         * testsuite/Makefile.am (plugin_test_1): Add test case with
10559         no global symbols.
10560         (empty.syms): New target.
10561         * testsuite/Makefile.in: Regenerate.
10562         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10563         message. Don't call add_symbols if no globals.
10564         (all_symbols_read_hook): Don't provide replacement for empty
10565         claimed file.
10566
10567 2008-12-12  Ian Lance Taylor  <iant@google.com>
10568
10569         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10570         r_type == 0 for a local symbol with r_sym == 0.
10571         (scan_relocatable_relocs): Pass r_sym to
10572         local_non_section_strategy.
10573         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10574         r_sym parameter.
10575
10576         * configure.ac: Update test for TLS descriptors: they are
10577         supported as of glibc 2.9.
10578         * configure: Rebuild.
10579
10580 2008-12-11  Ian Lance Taylor  <iant@google.com>
10581
10582         PR 7091
10583         * target-reloc.h (Default_scan_relocatable_relocs): For each
10584         function, map r_type == 0 to RELOC_DISCARD.
10585
10586 2008-12-10  Cary Coutant  <ccoutant@google.com>
10587
10588         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10589         object to override a kept COMDAT group from a plugin object.
10590
10591 2008-12-09  Ian Lance Taylor  <iant@google.com>
10592
10593         PR 7088
10594         * yyscript.y (file_cmd): Handle INPUT.
10595
10596         * testsuite/initpri1.c: Change all declarations to be full
10597         prototypes by adding void, to avoid compiler warnings.
10598
10599 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10600
10601         * options.cc (General_options::parse_plugin_opt): New.
10602         (General_options::add_plugin): The argument now is just the filename.
10603         (General_options::add_plugin_option): New.
10604         * options.h (plugin_opt): New.
10605         (add_plugin): Change argument name.
10606         (add_plugin_option): New.
10607         * plugin.cc (Plugin::load): Don't parse the plugin option.
10608         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10609         (Plugin::add_option): New.
10610         (Plugin::args_): Change type.
10611         (Plugin::filename_): New.
10612         (Plugin_manager::add_plugin_option): New.
10613         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10614         * testsuite/Makefile.in: Regenerate.
10615
10616 2008-12-05  Cary Coutant  <ccoutant@google.com>
10617
10618         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10619         Handle --strip-lto-sections option.
10620         * options.h (strip_lto_sections): New option.
10621
10622 2008-12-01  Cary Coutant  <ccoutant@google.com>
10623
10624         * plugin.cc (ld_plugin_message): Change format parameter to const.
10625         Fix mismatch between new[] and delete.
10626
10627 2008-11-14  Cary Coutant  <ccoutant@google.com>
10628
10629         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10630         instead of -1U.
10631
10632 2008-11-05  Craig Silverstein  <csilvers@google.com>
10633
10634         * options.cc (General_options::parse_dynamic_list): New function.
10635         * options.h (General_options): New flags dynamic_list,
10636         dynamic_list_data, dynamic_list_cpp_new, and
10637         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10638         (General_options::in_dynamic_list): New function.
10639         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10640         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10641         (Lex::can_continue_name): Likewise.
10642         (yylex): Likewise.
10643         (read_script_file): New parameter script_options.
10644         (read_dynamic_list): New function.
10645         (Script_options::define_dynamic_list): New function.
10646         (dynamic_list_keyword_parsecodes): New variable.
10647         (dynamic_list_keywords): New variable.
10648         * script.h (Script_options::define_dynamic_list): New function
10649         prototype.
10650         (read_dynamic_list): New function prototype.
10651         * symtab.cc (strprefix): New macro.
10652         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10653         dynamic_list_data, dynamic_list_cpp_new, and
10654         dynamic_list_cpp_typeinfo.
10655         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10656         (dynamic_list_expr): New rule.
10657         (dynamic_list_nodes): Likewise.
10658         (dynamic_list_node): Likewise.
10659         * testsuite/Makefile.am (dynamic_list): New test.
10660         * testsuite/Makefile.in: Regenerated.
10661         * testsuite/dynamic_list.t: New file.
10662         * testsuite/dynamic_list.sh: New file.
10663
10664 2008-11-05  Craig Silverstein  <csilvers@google.com>
10665
10666         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10667         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10668         (t11_last): Likewise.
10669         * testsuite/ver_test_6.c (main): Likewise.
10670
10671 2008-10-07  Cary Coutant  <ccoutant@google.com>
10672
10673         * options.c (General_options::finalize): Add check for -static and
10674         -shared.
10675         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10676         is not empty.
10677
10678 2008-10-02  Cary Coutant  <ccoutant@google.com>
10679
10680         * plugin.cc (make_sized_plugin_object): Fix conditional
10681         compilation to work when not all targets are enabled.
10682
10683 2008-09-29  Cary Coutant  <ccoutant@google.com>
10684
10685         * archive.cc (Archive::get_file_and_offset): Use filename instead
10686         of name to get library path.
10687         (Archive::include_member): Unlock external member of a thin archive.
10688
10689         * testsuite/Makefile.am (TEST_AR): New variable.
10690         (thin_archive_test_1): New test.
10691         (thin_archive_test_2): New test.
10692         * testsuite/Makefile.in: Regenerate.
10693         * testsuite/thin_archive_main.cc: New file.
10694         * testsuite/thin_archive_test_1.cc: New file.
10695         * testsuite/thin_archive_test_2.cc: New file.
10696         * testsuite/thin_archive_test_3.cc: New file.
10697         * testsuite/thin_archive_test_4.cc: New file.
10698
10699 2008-09-29  Cary Coutant  <ccoutant@google.com>
10700
10701         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10702         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10703         instead of -1U.
10704         (Sized_relobj::do_finalize_local_symbols): Likewise.
10705         (Sized_relobj::map_to_kept_section): Likewise.
10706         * object.h (Sized_relobj::invalid_address): New constant.
10707         (Sized_relobj::do_output_section_offset): Check for invalid_address
10708         and return -1ULL.
10709         * output.cc (Output_reloc::local_section_offset): Use constant
10710         invalid_address instead of -1U.
10711         (Output_reloc::get_address): Likewise.
10712         (Output_section::output_address): Change -1U to -1ULL.
10713         * output.h (Output_reloc::invalid_address): New constant.
10714         * reloc.cc (Sized_relobj::write_sections): Use constant
10715         invalid_address instead of -1U.
10716         (Sized_relobj::relocate_sections): Likewise.
10717         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10718         values for merge sections.
10719         * target-reloc.h (relocate_for_relocatable): Use constant
10720         invalid_address instead of -1U.
10721
10722 2008-09-19  Cary Coutant  <ccoutant@google.com>
10723
10724         Add plugin functionality for link-time optimization (LTO).
10725         * configure.ac (plugins): Add --enable-plugins option.
10726         * configure: Regenerate.
10727         * config.in: Regenerate.
10728         * Makefile.am (LIBDL): New variable.
10729         (CCFILES): Add plugin.cc.
10730         (HFILES): Add plugin.h.
10731         (ldadd_var): Add LIBDL.
10732         * Makefile.in: Regenerate.
10733
10734         * archive.cc: Include "plugin.h".
10735         (Archive::setup): Don't preread archive symbols when using a plugin.
10736         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10737         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10738         files.
10739         (Archive::include_member): Add symbols from plugin objects.
10740         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10741         * descriptors.cc (Descriptors::open): Check for file descriptors
10742         abandoned by plugins.
10743         (Descriptors::claim_for_plugin): New function.
10744         * descriptors.h (Descriptors::claim_for_plugin): New function.
10745         (Open_descriptor::is_claimed): New field.
10746         (claim_descriptor_for_plugin): New function.
10747         * fileread.cc (File_read::claim_for_plugin): New function.
10748         * fileread.h (File_read::claim_for_plugin): New function.
10749         (File_read::descriptor): New function.
10750         * gold.cc: Include "plugin.h".
10751         (queue_initial_tasks): Add task to call plugin hooks for generating
10752         new object files.
10753         * main.cc: Include "plugin.h".
10754         (main): Load plugin libraries.
10755         * object.h (Pluginobj): Declare.
10756         (Object::pluginobj): New function.
10757         (Object::do_pluginobj): New function.
10758         (Object::set_target): New function.
10759         * options.cc: Include "plugin.h".
10760         (General_options::parse_plugin): New function.
10761         (General_options::General_options): Initialize plugins_ field.
10762         (General_options::add_plugin): New function.
10763         * options.h (Plugin_manager): Declare.
10764         (General_options): Add --plugin option.
10765         (General_options::has_plugins): New function.
10766         (General_options::plugins): New function.
10767         (General_options::add_plugin): New function.
10768         (General_options::plugins_): New field.
10769         * plugin.cc: New file.
10770         * plugin.h: New file.
10771         * readsyms.cc: Include "plugin.h".
10772         (Read_symbols::do_read_symbols): Check for archive before checking
10773         for ELF file.  Call plugin hooks to claim files.
10774         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10775         from a real object file; force override when processing replacement
10776         files.
10777         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10778         (Symbol::init_base_object): Likewise.
10779         (Symbol::init_base_output_data): Likewise.
10780         (Symbol::init_base_output_segment): Likewise.
10781         (Symbol::init_base_constant): Likewise.
10782         (Symbol::init_base_undefined): Likewise.
10783         (Symbol::output_section): Assert that object is not a plugin.
10784         (Symbol_table::add_from_pluginobj): New function.
10785         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10786         undefined.
10787         (Symbol_table::sized_write_globals): Likewise.
10788         (Symbol_table::add_from_pluginobj): Instantiate template.
10789         * symtab.h (Sized_pluginobj): Declare.
10790         (Symbol::in_real_elf): New function.
10791         (Symbol::set_in_real_elf): New function.
10792         (Symbol::in_real_elf_): New field.
10793         (Symbol_table::add_from_pluginobj): New function.
10794
10795         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10796         (LIBDL): New variable.
10797         (LDADD): Add LIBDL.
10798         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10799         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10800         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10801         (MOSTLYCLEANFILES): Likewise.
10802         * testsuite/Makefile.in: Regenerate.
10803         * testsuite/plugin_test.c: New file.
10804         * testsuite/plugin_test_1.sh: New file.
10805         * testsuite/plugin_test_2.sh: New file.
10806
10807 2008-09-16  Ian Lance Taylor  <iant@google.com>
10808
10809         * target-reloc.h (relocate_section): Check whether a symbol is
10810         defined by the ABI before reporting an undefined symbol error.
10811         * target.h (Target::is_defined_by_abi): Make parameter const.
10812         (Target::do_is_defined_by_abi): Likewise.
10813         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10814         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10815         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10816         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10817         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10818         * testsuite/Makefile.in: Rebuild.
10819
10820         * fileread.cc (make_view): Add casts to avoid warning.
10821
10822 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10823
10824         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10825         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10826
10827 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10828
10829         * options.h (General_options::output_is_executable): New.
10830         (General_options::output_is_pie): New.
10831         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10832         for shared libraries.
10833         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10834
10835 2008-09-11  Chris Demetriou  <cgd@google.com>
10836
10837         * options.h (origin): New -z option.
10838         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10839         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10840         in DT_FLAGS_1.
10841
10842 2008-09-05  Cary Coutant  <ccoutant@google.com>
10843
10844         * fileread.cc (File_read::make_view): Add check for attempt to map
10845         beyond end of file.
10846
10847 2008-09-05  Cary Coutant  <ccoutant@google.com>
10848
10849         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10850         explicit instantiations.
10851
10852 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10853
10854         PR gold/6858
10855         * options.cc (General_options::finalize): Allow undefined symbols
10856         in shlibs if linking -shared.
10857
10858         PR gold/6859
10859         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10860         symbols as not needing a dynsym entry.
10861
10862 2008-08-20  Craig Silverstein  <csilvers@google.com>
10863
10864         * fileread.cc (File_read::open): Do not lock the file unless it
10865         was successfully opened.
10866
10867 2008-08-14  Cary Coutant  <ccoutant@google.com>
10868
10869         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10870         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10871         * testsuite/tls_test.cc (struct int128): 128-bit struct
10872         for testing TLS relocs with non-zero addend.
10873         (v12): New TLS variable.
10874         (t12): New test.
10875         (t_last): Add check for v12.
10876         * testsuite/tls_test.h (t12): New function.
10877         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10878
10879 2008-08-13  Ian Lance Taylor  <iant@google.com>
10880
10881         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10882         set tls_segment_ or relro_segment_.
10883         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10884         when appropriate.
10885         * output.h (Output_section::clear_is_relro): New function.
10886         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10887         sections specially even when output_data_ is empty.
10888         (Output_segment::maximum_alignment): When first section is relro,
10889         only force alignment for PT_LOAD segments.
10890         * script.cc (script_data_segment_align): New function.
10891         (script_data_segment_relro_end): New function.
10892         * script-c.h (script_data_segment_align): Declare.
10893         (script_data_segment_relro_end): Declare.
10894         * script-sections.h (class Script_sections): Declare
10895         data_segment_align and data_segment_relro_end.  Add fields
10896         segment_align_index_ and saw_relro_end_.
10897         * script-sections.cc (class Sections_element): Add set_is_relro
10898         virtual function.  Add new bool* parameter to place_orphan_here.
10899         Add get_output_section virtual function.
10900         (class Output_section_definition): Add set_is_relro.  Add new
10901         bool* parameter to place_orphan_here.  Add get_output_section.
10902         Add is_relro_ field.
10903         (Output_section_definition::Output_section_definition): Initialize
10904         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10905         and is_relro_ fields.
10906         (Output_section_definition::place_orphan_here): Add is_relro
10907         parameter.
10908         (Output_section_definition::set_section_addresses): Set relro for
10909         output section.
10910         (Output_section_definition::alternate_constraint): Likewise.
10911         (class Orphan_output_section): Add new bool* parameter to
10912         place_orphan_here.  Add get_output_section.
10913         (Orphan_output_section::place_orphan_here): Add is_relro
10914         parameter.
10915         (Script_sections::Script_sections): Initialize
10916         data_segment_align_index_ and saw_relro_end_.
10917         (Script_sections::data_segment_align): New function.
10918         (Script_sections::data_segment_relro_end): New function.
10919         (Script_sections::place_orphan): Set or clear is_relro.
10920         (Script_sections::set_section_addresses): Force alignment of first
10921         TLS section.
10922         * yyscript.y (exp): Call script_data_segment_align and
10923         script_data_segment_relro_end.
10924         * testsuite/relro_script_test.t: New file.
10925         * testsuite/relro_test.cc (using_script): Declare.
10926         (t1, t2): Test using_script.
10927         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10928         (relro_script_test_SOURCES): Define.
10929         (relro_script_test_DEPENDENCIES): Define.
10930         (relro_script_test_LDFLAGS): Define.
10931         (relro_script_test_LDADD): Define.
10932         (relro_script_test.so): New target.
10933         * testsuite/Makefile.in: Rebuild.
10934
10935 2008-08-06  Cary Coutant <ccoutant@google.com>
10936
10937         * archive.cc (Archive::total_archives, Archive::total_members)
10938         (Archive::total_members_loaded): New variables.
10939         (Archive::setup): Add parameter.  Add option to preread
10940         archive symbols.
10941         (Archive::read_armap): Add counter.
10942         (Archive::get_file_and_offset): New function.
10943         (Archive::get_elf_object_for_member): New function.
10944         (Archive::read_all_symbols): New function.
10945         (Archive::read_symbols): New function.
10946         (Archive::add_symbols): Add counters.
10947         (Archive::include_all_members): Use armap to find members if it's
10948         already built.
10949         (Archive::include_member): Skip reading symbols if already read.
10950         Factored code into Archive::get_file_and_offset and
10951         Archive::get_elf_object_for_member.  Changed call to
10952         Mapfile::report_include_archive_member.
10953         (Archive::print_stats): New function.
10954         * archive.h: Declare Object and Read_symbols_data classes.
10955         (Archive::Archive): Add initializers for new members.
10956         (Archive::setup): Add parameter.
10957         (Archive::print_stats): New function.
10958         (Archive::total_archives, Archive::total_members)
10959         (Archive::total_members_loaded): New variables.
10960         (Archive::get_file_and_offset): New function.
10961         (Archive::get_elf_object_for_member): New function.
10962         (Archive::read_all_symbols): New function.
10963         (Archive::read_symbols): New function.
10964         (Archive::Archive_member): New class.
10965         (Archive::members_): New member.
10966         (Archive::num_members_): New member.
10967         * main.cc: Include archive.h.
10968         (main): Call Archive::print_stats.
10969         * mapfile.cc (Mapfile::report_include_archive_member): Delete
10970         archive parameter; member_name is now the fully-decorated name.
10971         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10972         * options.h: (General_options): Add --preread-archive-symbols option.
10973         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10974         Archive::setup.
10975
10976 2008-08-04  Ian Lance Taylor  <iant@google.com>
10977
10978         * symtab.h (Symbol::use_plt_offset): New function.
10979         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10980         * powerpc.cc (Relocate::relocate): Likewise.
10981         * sparc.cc (Relocate::relocate): Likewise.
10982         * x86_64.cc (Relocate::relocate): Likewise.
10983         * testsuite/weak_plt.sh: New test.
10984         * testsuite/weak_plt_main.cc: New test.
10985         * testsuite/weak_plt_shared.cc: New test.
10986         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10987         (check_PROGRAMS): Add weak_plt.
10988         (check_DATA): Add weak_plt_shared.so.
10989         (weak_plt_main_pic.o, weak_plt): New targets.
10990         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10991         * testsuite/Makefile.in: Rebuild.
10992
10993         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10994         gcctestdir/ld.
10995         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10996         * testsuite/Makefile.in: Rebuild.
10997
10998 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
10999
11000         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11001         * Makefile.in: Regenerate.
11002         * po/POTFILES.in: Regenerate.
11003
11004 2008-07-29  Ian Lance Taylor  <iant@google.com>
11005
11006         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11007         symbols before other symbols.
11008         * testsuite/script_test_2.cc (test_addr): Declare.
11009         (test_addr_alias): Declare.
11010         (main): Check that test_addr and test_addr_alias have the right
11011         values.
11012         * testsuite/script_test_2.t: Define test_addr_alias and
11013         test_addr.
11014
11015 2008-07-24  Ian Lance Taylor  <iant@google.com>
11016
11017         PR 5990
11018         * descriptors.cc: New file.
11019         * descriptors.h: New file.
11020         * gold-threads.h (class Hold_optional_lock): New class.
11021         * fileread.cc: Include "descriptors.h".
11022         (File_read::~File_read): Release descriptor rather than closing
11023         it.
11024         (File_read::open) [file]: Call open_descriptor rather than open.
11025         Set is_descriptor_opened_.
11026         (File_read::open) [memory]: Assert that descriptor is not open.
11027         (File_read::reopen_descriptor): New function.
11028         (File_read::release): Release descriptor.
11029         (File_read::do_read): Make non-const.  Reopen descriptor.
11030         (File_read::read): Make non-const.
11031         (File_read::make_view): Reopen descriptor.
11032         (File_read::do_readv): Likewise.
11033         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11034         Update declarations.
11035         * layout.cc: Include "descriptors.h".
11036         (Layout::create_build_id): Use open_descriptor rather than open.
11037         * output.cc: Include "descriptors.h".
11038         (Output_file::open): Use open_descriptor rather than open.
11039         * archive.cc (Archive::const_iterator): Change Archive to be
11040         non-const.
11041         (Archive::begin, Archive::end): Make non-const.
11042         (Archive::count_members): Likewise.
11043         * archive.h (class Archive): Update declarations.
11044         * object.h (Object::read): Make non-const.
11045         * Makefile.am (CCFILES): Add descriptors.cc.
11046         (HFILES): Add descriptors.h.
11047         * Makefile.in: Rebuild.
11048
11049         PR 6716
11050         * gold.h: Always include <clocale>.  Add Solaris workarounds
11051         following code in binutils/sysdep.h.
11052
11053         PR 6048
11054         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11055         this->eh_frame_hdr_ is NULL before using it.
11056
11057         * dynobj.cc (Versions::Versions): Update comment.
11058
11059         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11060         the base version name.
11061
11062         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11063         array size plus one.
11064         (Stringpool_template::set_string_offsets): Subtract one from key
11065         before using it as an array index.
11066         (Stringpool_template::get_offset_with_length): Likewise.
11067         (Stringpool_template::write_to_buffer): Likewise.
11068         * stringpool.h (Stringpool_template::get_offset_from_key):
11069         Likewise.
11070
11071 2008-07-23  Ian Lance Taylor  <iant@google.com>
11072
11073         PR 6658
11074         * object.h (Merged_symbol_value::value): Do our best to handle a
11075         negative addend.
11076
11077         PR 6647
11078         * script.cc (Version_script_info::get_versions): Don't add empty
11079         version tag to return value.
11080         (Version_script_info::get_symbol_version_helper): Change return
11081         type to bool.  Add pversion parameter.  Change all callers.
11082         (script_register_vers_node): Don't require a non-NULL tag.
11083         * script.h (class Version_script_info): Update declarations.
11084         (Version_script_info::get_symbol_version): Change return type to
11085         bool.  Add version parameter.  Change all callers.
11086         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11087         handling.  Handle an empty version from a version script.
11088         (Symbol_table::define_special_symbol): Likewise.
11089         * testsuite/ver_test_10.script: New file.
11090         * testsuite/ver_test_10.sh: New file.
11091         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11092         (check_DATA): Add ver_test_10.syms.
11093         (ver_test_10.syms, ver_test_10.so): New target.
11094         * testsuite/Makefile.in: Rebuild.
11095
11096 2008-07-23  Simon Baldwin  <simonb@google.com>
11097
11098         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11099         to zero for undefined symbols from dynamic libraries.
11100
11101 2008-07-23  Ian Lance Taylor  <iant@google.com>
11102
11103         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11104         Change all callers.
11105         * symtab.h (class Symbol_table): Update declaration.
11106         * testsuite/ver_test_9.cc: New file.
11107         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11108         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11109         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11110         (ver_test_9.so, ver_test_9.o): New targets.
11111         * testsuite/Makefile.in: Rebuild.
11112
11113 2008-07-22  Ian Lance Taylor  <iant@google.com>
11114
11115         * options.h (class General_options): Define --check-sections.
11116         * layout.cc (Layout::set_segment_offsets): Handle
11117         --check-sections.
11118
11119         * options.h (class General_options): Define -n/--nmagic and
11120         -N/--omagic.
11121         * options.cc (General_options::finalize): For -n/--nmagic or
11122         -N/--omagic, set -static.
11123         * layout.cc (Layout::attach_allocated_section_to_segment): If
11124         -N/--omagic, don't put read-only and read-write sections in
11125         different segments.
11126         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11127         finding a read-only segment.
11128         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11129         don't set the minimum segment alignment to the common page size,
11130         and don't set the file offset to the address modulo the page size.
11131         * script-sections.cc (Script_sections::create_segments): If
11132         -n/--omagic, don't put read-only and read-write sections in
11133         different segments.
11134
11135         * cref.cc: New file.
11136         * cref.h: New file.
11137         * options.h (class General_options): Add --print-symbol-counts.
11138         * main.cc (main): Issue defined symbol report if requested.
11139         * archive.cc (Archive::interpret_header): Make into a const member
11140         function.
11141         (Archive::add_symbols): Call Input_objects::archive_start and
11142         archive_stop.
11143         (Archive::const_iterator): Define new class.
11144         (Archive::begin, Archive::end): New functions.
11145         (Archive::include_all_members): Rewrite to use iterator.
11146         (Archive::count_members): New function.
11147         * archive.h (class Archive): Update declarations.
11148         (Archive::filename): New function.
11149         * object.cc: Include "cref.h".
11150         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11151         (Sized_relobj::do_get_global_symbol_counts): New function.
11152         (Input_objects::add_object): Add object to cross-referencer.
11153         (Input_objects::archive_start): New function.
11154         (Input_objects::archive_stop): New function.
11155         (Input_objects::print_symbol_counts): New function.
11156         * object.h: Declare Cref and Archive.
11157         (Object::get_global_symbol_counts): New function.
11158         (Object::do_get_global_symbol_counts): New pure virtual function.
11159         (class Sized_relobj): Add defined_count_ field.  Update
11160         declarations.
11161         (class Input_objects): Add cref_ field.  Update constructor.
11162         Update declarations.
11163         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11164         defined_count_.
11165         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11166         symbol counts.
11167         (Sized_dynobj::do_get_global_symbol_counts): New function.
11168         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11169         defined_count_.  Update declarations.  Define Symbols typedef.
11170         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11171         parameter.  Change all callers.
11172         (Symbol_table::add_from_dynobj): Add sympointers and defined
11173         parameters.  Change all callers.
11174         * symtab.h (class Symbol_table): Update declarations.
11175         * Makefile.am (CCFILES): Add cref.cc.
11176         (HFILES): Add cref.h.
11177         * Makefile.in: Rebuild.
11178
11179 2008-07-22  Simon Baldwin  <simonb@google.com>
11180
11181         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11182         to zero when writing undefined symbols.
11183
11184 2008-07-22  Ian Lance Taylor  <iant@google.com>
11185
11186         * output.cc (Output_section::add_input_section): Don't try to
11187         merge empty merge sections.
11188
11189 2008-07-21  Craig Silverstein  <csilvers@google.com>
11190
11191         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11192         Include symbol version in error message.
11193
11194 2008-07-20  Chris Demetriou  <cgd@google.com>
11195
11196         * configure.ac (gold_cv_c_random_seed): New configured variable.
11197         (RANDOM_SEED_CFLAGS): New substituted variable.
11198         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11199         * configure: Rebuild.
11200         * Makefile.in: Likewise.
11201         * testsuite/Makefile.in: Likewise.
11202
11203 2008-07-18  Ian Lance Taylor  <iant@google.com>
11204
11205         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11206         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11207         * testsuite/ver_test_main.cc (main): Call t4.
11208         (t4, t4_2a): Define.
11209         * testsuite/ver_test_2.cc (t4_2): Define.
11210         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11211         * testsuite/ver_test_4.cc (t4_2a): Define.
11212         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11213         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11214
11215 2008-07-17  Ian Lance Taylor  <iant@google.com>
11216
11217         * dynobj.cc (Versions::add_def): If we give an error about a
11218         missing version, go ahead and create the version anyhow.
11219
11220 2008-07-10  Ian Lance Taylor  <iant@google.com>
11221
11222         Handle output sections with more than 0x7fffffff bytes.
11223         * object.h (class Relobj): Change map_to_output_ to
11224         output_sections_, and just keep a section pointer.  Change all
11225         uses.  Move comdat group support to Sized_relobj.
11226         (Relobj::is_section_specially_mapped): Remove.
11227         (Relobj::output_section): Remove poff parameter.  Change all
11228         callers.
11229         (Relobj::output_section_offset): New function.
11230         (Relobj::set_section_offset): Rewrite.
11231         (Relobj::map_to_output): Remove.
11232         (Relobj::output_sections): New function.
11233         (Relobj::do_output_section_offset): New pure virtual function.
11234         (Relobj::do_set_section_offset): Likewise.
11235         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11236         group support from Relobj.  Update declarations.
11237         (Sized_relobj::get_output_section_offset): New function.
11238         (Sized_relobj::do_output_section_offset): New function.
11239         (Sized_relobj::do_set_section_offset): New function.
11240         * object.cc (Relobj::output_section_address): Remove.
11241         (Sized_relobj::Sized_relobj): Initialize new fields.
11242         (Sized_relobj::include_section_group): Cast find_kept_object to
11243         Sized_relobj.
11244         (Sized_relobj::include_linkonce_section): Likewise.
11245         (Sized_relobj::do_layout): Use separate arrays for output section
11246         and output offset.
11247         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11248         output_sections.
11249         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11250         output_sections and section_offsets.
11251         (Sized_relobj::write_local_symbols): Likewise.
11252         (map_to_kept_section): Compute output address directly.
11253         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11254         output_sections and section_offsets.
11255         (Sized_relobj::write_sections): Likewise.
11256         (Sized_relobj::relocate_sections): Likewise.
11257         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11258         * output.h (class Output_reloc): Update declarations.  Change
11259         u2_.relobj to Sized_relobj*.
11260         (class Output_data_reloc): Change add functions to use
11261         Sized_relobj*.
11262         * output.cc (Output_reloc::Output_reloc): Change relobj to
11263         Sized_relobj*.
11264         (Output_reloc::local_section_offset): Change return type to
11265         Elf_Addr.  Use get_output_section_offset.
11266         (Output_reloc::get_address): Likewise.
11267         (Output_section::is_input_address_mapped): Don't call
11268         is_section_specially_mapped.
11269         (Output_section::output_offset): Likewise.
11270         (Output_section::output_address): Likewise.
11271         (Output_section::starting_output_address): Likewise.
11272         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11273         parameter to Sized_relobj*.
11274         (Copy_relocs::need_copy_reloc): Likewise.
11275         (Copy_relocs::save): Likewise.
11276         * copy-relocs.h (class Copy_relocs): Update declarations.
11277         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11278         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11279         * target-reloc.h (relocate_for_relocatable): Change
11280         offset_in_output_section type to Elf_Addr.  Change code that uses
11281         it as well.
11282         * layout.cc (Layout::layout): Always set *off.
11283         * mapfile.cc (Mapfile::print_input_section): Use
11284         output_section_offset.
11285         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11286         Sized_relobj*.
11287         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11288         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11289         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11290
11291 2008-07-03  Ian Lance Taylor  <iant@google.com>
11292
11293         * layout.cc (Layout::include_section): Do not discard unrecognized
11294         SHT_STRTAB sections.
11295
11296 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11297
11298         * script.cc (Lex::can_continue_name): Make '?' allowable in
11299         version-script names.
11300         * testsuite/version_script.map: Change glob pattern to use '?'
11301
11302 2008-06-30  Manish Singh  <yosh@gimp.org>
11303
11304         PR 6585
11305         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11306         Correct typo.
11307
11308 2008-06-30  Ian Lance Taylor  <iant@google.com>
11309
11310         PR 6660
11311         PR 6682
11312         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11313         versions]: Don't try to read the value in the contents, since we
11314         don't use it.  Use the template endianness when writing.
11315
11316 2008-06-25  Cary Coutant  <ccoutant@google.com>
11317
11318         * fileread.cc (File_read::make_view): Assert on zero-length view.
11319         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11320         symbol table when there are no symbols to read.
11321
11322 2008-06-23  Craig Silverstein  <csilvers@google.com>
11323
11324         * version.cc (version_string): Bump to 1.7
11325
11326 2008-06-18  Craig Silverstein  <csilvers@google.com>
11327
11328         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11329         constant 0xFFFF to type Valtype.
11330         (Powerpc_relocate_functions::rel16_ha): Likewise.
11331
11332 2008-06-17  Ian Lance Taylor  <iant@google.com>
11333
11334         * output.h (Output_section::Input_section): Initialize p2align_ to
11335         zero for Output_section_data constructors.
11336         (Output_section::Input_section::addralign): If not an input
11337         section, return the alignment of the Output_section_data.
11338         * testsuite/copy_test.cc: New file.
11339         * testsuite/copy_test_1.cc: New file.
11340         * testsuite/copy_test_2.cc: New file.
11341         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11342         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11343         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11344         (copy_test_1_pic.o, copy_test_1.so): New targets.
11345         (copy_test_2_pic.o, copy_test_2.so): New targets.
11346         * testsuite/Makefile.in: Rebuild.
11347
11348         * script-sections.cc (Script_sections::place_orphan): Initialize
11349         local variable exact.
11350
11351 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11352
11353         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11354
11355 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11356             David S. Miller  <davem@davemloft.net>
11357
11358         * powerpc.cc: New file.
11359         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11360         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11361         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11362         * Makefile.in: Rebuild.
11363
11364 2008-06-09  Ian Lance Taylor  <iant@google.com>
11365
11366         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11367         <exception>.
11368         (throwing, orig_terminate): New static variables.
11369         (terminate_handler): New static function.
11370         (t2): Set terminate handler.
11371
11372 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11373
11374         PR 6584
11375         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11376         alignment.
11377
11378 2008-05-30  Cary Coutant  <ccoutant@google.com>
11379
11380         * archive.cc (Archive::include_all_members) Correct to step
11381         over symbol table and extended name table in thin archives.
11382
11383 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11384
11385         PR 6407
11386         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11387         calculation.
11388
11389 2008-05-28  Caleb Howe  <cshowe@google.com>
11390
11391         * reduced_debug_output.cc: New file.
11392         * reduced_debug_output.h: New file.
11393         * options.h (class General_options): Add --strip-debug-non-line.
11394         * options.cc (General_options::finalize): Add strip_debug_non_line
11395         to the strip heirarchy.
11396         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11397         fields.
11398         * layout.cc: Include "reduced_debug_output.h".
11399         (Layout::Layout): Initialize new fields.
11400         (line_only_debug_sections): New static array.
11401         (is_lines_only_debug_sections): New static inline function.
11402         (Layout::include_section): Handle --strip-debug-non-line.
11403         (Layout::make_output_section): If --strip-debug-non-line, build
11404         new output sections for .debug_abbrev and .debug_info.
11405         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11406         gold.  Warn about possible overflow.
11407         (read_signed_LEB_128): Likewise.
11408         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11409         (read_signed_LEB_128): Declare.
11410         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11411         (HFILES): Add reduced_debug_output.h.
11412         * Makefile.in: Rebuild.
11413
11414 2008-05-21  Ian Lance Taylor  <iant@google.com>
11415
11416         * mapfile.cc: New file.
11417         * mapfile.h: New file.
11418         * options.h (class General_options): Add -M/--print-map and -Map.
11419         * options.cc (General_options::finalize): Make -M equivalent to
11420         -Map -.
11421         * main.cc: Include <cstdio> and "mapfile.h".
11422         (main): Open mapfile if requested.
11423         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11424         constructor.  Change caller.
11425         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11426         (queue_middle_tasks): Likewise.
11427         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11428         declarations.
11429         * archive.cc: Include "mapfile.h".
11430         (Archive::add_symbols): Add mapfile parameter.  Change all
11431         callers.  Pass mapfile, symbol, and reason to include_member.
11432         (Archive::include_all_members): Add mapfile parameter.  Change all
11433         callers.
11434         (Archive::include_member): Add mapfile, sym, and why parameters.
11435         Change all callers.  Report inclusion to map file.
11436         * archive.h: Include "fileread.h".
11437         (class Archive): Update declarations.
11438         (Archive::file): New const method.
11439         (class Add_archive_symbols): Add mapfile_ field.  Update
11440         constructor.  Change all callers.
11441         * readsyms.h (class Read_symbols): Likewise.
11442         (class Finish_group): Likewise.
11443         (class Read_script): Likewise.
11444         * common.cc: Include "mapfile.h".
11445         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11446         all callers.
11447         (Symbol_table::do_allocate_commons): Likewise.
11448         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11449         symbol allocation to mapfile.
11450         * common.h (class Allocate_commons_task): Add mapfile_ field.
11451         Update constructor.  Change all callers.
11452         * symtab.h (class Symbol_table): Update declarations.
11453         * layout.cc: Include "mapfile.h".
11454         (Layout_task_runner::run): Print information to mapfile.
11455         (Layout::create_gold_note): Change Output_data_fixed_space to
11456         Output_data_zero_fill.
11457         (Layout::create_build_id): Likewise.
11458         (Layout::print_to_mapfile): New function.
11459         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11460         constructor.  Change caller.
11461         (class Layout): Declare print_to_mapfile.
11462         * output.cc (Output_section::Input_section::print_to_mapfile): New
11463         function.
11464         (Output_section::add_input_section): If producing a map, always
11465         add to input_sections_ list.
11466         (Output_section::do_print_to_mapfile): New function.
11467         (Output_segment::print_sections_to_mapfile): New function.
11468         (Output_segment::print_section_list_to_mapfile): New function.
11469         * output.h: Include "mapfile.h".
11470         (Output_data::print_to_mapfile): New function.
11471         (Output_data::do_print_to_mapfile): New virtual function.
11472         (Output_segment_headers::do_print_to_mapfile): New function.
11473         (Output_file_header::do_print_to_mapfile): New function.
11474         (Output_data_const::do_print_to_mapfile): New function.
11475         (class Output_data_const_buffer): Add map_name_ field.  Update
11476         constructor.  Change all callers.  Add do_print_to_mapfile
11477         function.
11478         (class Output_data_fixed_space): Likewise.
11479         (class Output_data_space): Likewise.
11480         (class Output_data_zero_fill): New class.
11481         (Output_data_strtab::do_print_to_mapfile): New function.
11482         (Output_data_reloc_base::do_print_to_mapfile): New function.
11483         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11484         (Output_data_group::do_print_to_mapfile): New function.
11485         (Output_data_got::do_print_to_mapfile): New function.
11486         (Output_data_dynamic::do_print_to_mapfile): New function.
11487         (Output_symtab_xindex::do_print_to_mapfile): New function.
11488         (class Output_section): Declare do_print_to_mapflie.  Declare
11489         print_to_mapfile in Input_section.
11490         (class Output_segment): Declare new functions.
11491         * object.h (Sized_relobj::symbol_count): New function.
11492         * script-sections.cc
11493         (Output_section_element_dot_assignment::set_section_addresses):
11494         Change Output_data_fixed_space to Output_data_zero_fill.
11495         (Output_data_expression::do_print_to_mapfile): New function.
11496         * script.cc (read_input_script): Add mapfile parameter.  Change
11497         all callers.
11498         * script.h (read_input_script): Update declaration.
11499         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11500         (Eh_frame::do_print_to_mapfile): New function.
11501         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11502         (Output_merge_string::do_print_to_mapfile): New function.
11503         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11504         function.
11505         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11506         function.
11507         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11508         function.
11509         * Makefile.am (CCFILES): Add mapfile.cc.
11510         (HFILES): Add mapfile.h.
11511         * Makefile.in: Rebuild.
11512
11513 2008-05-19  Ian Lance Taylor  <iant@google.com>
11514
11515         * options.h (class General_options): Add -z relro.
11516         * layout.cc (Layout::Layout): Initialize relro_segment_.
11517         (Layout::add_output_section_data): Return the output section.
11518         (Layout::make_output_section): Rcognize relro sections and mark
11519         them appropriately.
11520         (Layout::attach_allocated_section_to_segment): Put relro sections
11521         in a PT_GNU_RELRO segment.
11522         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11523         section as relro.
11524         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11525         PT_TLS segments.
11526         (Layout::linkonce_mapping): Map d.rel.ro.local to
11527         .data.rel.ro.local.
11528         (Layout::output_section_name): Us .data.rel.ro.local for any
11529         section which begins with that.
11530         * layout.h (class Layout): Update add_output_section_data
11531         declaration.  Add relro_segment_ field.
11532         * output.cc (Output_section::Output_section): Initialize is_relro_
11533         and is_relro_local_ fields.
11534         (Output_segment::add_output_section): Group relro sections.
11535         (Output_segment::is_first_section_relro): New function.
11536         (Output_segment::maximum_alignment): If there is a relro section,
11537         align the segment to the common page size.
11538         (Output_segment::set_section_addresses): Track whether we are
11539         looking at relro sections.  If the last section is a relro
11540         section, align to the common page size.
11541         (Output_segment::set_section_list_addresses): Add in_relro
11542         parameter.  Change all callers.  Align to the page size when
11543         moving from relro to non-relro section.
11544         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11545         segment.
11546         * output.h (class Output_section): Add is_relro_ and
11547         is_relro_local_ fields.
11548         (Output_section::is_relro): New function.
11549         (Output_section::set_is_relro): New function.
11550         (Output_section::is_relro_local): New function.
11551         (Output_section::set_is_relro_local): New function.
11552         (class Output_segment): Update declarations.
11553         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11554         * sparc.cc (Target_sparc::got_section): Likewise.
11555         * x86_64.cc (Target_x86_64::got_section): Likewise.
11556         * testsuite/relro_test_main.cc: New file.
11557         * testsuite/relro_test.cc: New file.
11558         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11559         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11560         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11561         (relro_test.so, relro_test_pic.o): New targets.
11562         * testsuite/Makefile.in: Rebuild.
11563
11564 2008-05-16  Ian Lance Taylor  <iant@google.com>
11565
11566         * output.cc (Output_segment::add_output_section): Remove front
11567         parameter.
11568         * output.h (class Output_segment): Remove
11569         add_initial_output_section and overloaded add_output_section.
11570         Update declaration of remaining add_output_section.
11571         * layout.cc (Layout::create_interp): Call add_output_section
11572         rather than add_initial_output_section.
11573         (Layout::finish_dynamic_section): Likewise.
11574
11575         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11576         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11577         know the dynamic type.
11578         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11579         field.  Initialize it in constructor.
11580         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11581         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11582         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11583         reloc.
11584
11585         * output.cc (Output_reloc::get_address): Change return type to
11586         Elf_Addr.
11587         * output.h (class Output_reloc): Update get_address declaration.
11588         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11589         for section addresses.
11590
11591 2008-05-09  Ian Lance Taylor  <iant@google.com>
11592
11593         PR 6493
11594         * gold.cc (gold_nomem): Use return value of write.
11595
11596 2008-05-08  Ian Lance Taylor  <iant@google.com>
11597
11598         * symtab.c (Symbol::init_base_output_data): Add version
11599         parameter.  Change all callers.
11600         (Symbol::init_base_output_segment): Likewise.
11601         (Symbol::init_base_constant): Likewise.
11602         (Symbol::init_base_undefined): Likewise.
11603         (Sized_symbol::init_output_data): Likewise.
11604         (Sized_symbol::init_output_segment): Likewise.
11605         (Sized_symbol::init_constant): Likewise.
11606         (Sized_symbol::init_undefined): Likewise.
11607         (Symbol_table::do_define_in_output_data): If the new symbol has a
11608         version, mark it as the default.
11609         (Symbol_table::do_define_in_output_segment): Likewise.
11610         (Symbol_table::do_define_as_constant): Likewise.
11611         * symtab.h (class Symbol): Update declarations.
11612         (class Sized_symbol): Likewise.
11613         * resolve.cc (Symbol::override_version): New function.
11614         (Symbol::override_base): Call override_version.
11615         (Symbol::override_base_with_special): Likewise.
11616         * testsuite/ver_script_8.script: New file.
11617         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11618         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11619         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11620         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11621
11622 2008-05-06  Ian Lance Taylor  <iant@google.com>
11623
11624         PR 6049
11625         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11626         functions.
11627         (class General_options): Remove existing --undefined, and add
11628         --no-undefined instead.  Add new --undefined as synonym for -u.
11629         * archive.cc (Archive::add_symbols): Check whether symbol was
11630         named with -u.
11631         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11632         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11633         all uses.  Add IS_UNDEFINED.  Update declarations to split
11634         different versions of init_base.  Declare init_base_undefined.
11635         (Symbol::is_defined): Handle IS_UNDEFINED.
11636         (Symbol::is_undefined): Likewise.
11637         (Symbol::is_weak_undefined): Call is_undefined.
11638         (Symbol::is_absolute): Handle IS_CONSTANT.
11639         (class Sized_symbol): Update declarations to split different
11640         versions of init.  Declare init_undefined.
11641         (class Symbol_table): Declare new functions.
11642         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11643         Change all callers.
11644         (Symbol::init_base_output_data): Likewise.
11645         (Symbol::init_base_output_segment): Likewise.
11646         (Symbol::init_base_constant): Likewise.
11647         (Symbol::init_base_undefined): New function.
11648         (Sized_symbol::init_object): Rename from init.  Change all
11649         callers.
11650         (Sized_symbol::init_output_data): Likewise.
11651         (Sized_symbol::init_output_segment): Likewise.
11652         (Sized_symbol::init_constant): Likewise.
11653         (Sized_symbol::init_undefined): New function.
11654         (Symbol_table::add_undefined_symbols_from_command_line): New
11655         function.
11656         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11657         function.
11658         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11659         (Symbol::output_section): Likewise.
11660         (Symbol::set_output_section): Likewise.
11661         (Symbol_table::sized_finalize_symbol): Likewise.
11662         (Symbol_table::sized_write_globals): Likewise.
11663         * resolve.cc (Symbol_table::should_override): Likewise.
11664         (Symbol::override_base_with_special): Likewise.
11665
11666         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11667         symbol, change it to have default visibility.
11668         * testsuite/protected_1.cc: New file.
11669         * testsuite/protected_2.cc: New file.
11670         * testsuite/protected_3.cc: New file.
11671         * testsuite/protected_main_1.cc: New file.
11672         * testsuite/protected_main_2.cc: New file.
11673         * testsuite/protected_main_3.cc: New file.
11674         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11675         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11676         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11677         (protected_1.so): New target.
11678         (protected_1_pic.o, protected_2_pic.o): New targets.
11679         (protected_3_pic.o): New target.
11680         (check_PROGRAMS): Add protected_2.
11681         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11682         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11683         * testsuite/Makefile.in: Rebuild.
11684
11685         * options.h (DEFINE_var): Add set_user_set_##varname__.
11686         (DEFINE_bool_alias): New macro.
11687         (class General_options): Define -Bstatic using DEFINE_bool_alias
11688         rather than DEFINE_special.  Add --undefined as an alias for -z
11689         defs.
11690         * options.cc (General_options::parse_Bstatic): Remove.
11691
11692         * options.h (class General_options): Add --fatal-warnings.
11693         * main.cc (main): Implement --fatal-warnings.
11694         * errors.h (Errors::warning_count): New function.
11695
11696         * options.h (class General_options): Add -Bsymbolic-functions.
11697         * symtab.h (Symbol::is_preemptible): Check for
11698         -Bsymbolic-functions.
11699
11700 2008-05-05  Ian Lance Taylor  <iant@google.com>
11701
11702         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11703         as noVARNAME rather than no-VARNAME.
11704         (class General_options): Add option -z combreloc.
11705         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11706         get_address.
11707         (Output_reloc::sort_before) [SHT_REL]: New function.
11708         (Output_reloc::sort_before) [SHT_RELA]: New function.
11709         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11710         Sort_relocs_comparison.
11711         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11712         parameter.  Change all callers.
11713         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11714         sort_relocs parameter.  Change all callers.
11715         * output.cc (Output_reloc::get_address): New function, broken out
11716         of write_rel.
11717         (Output_reloc::write_rel): Call it.
11718         (Output_reloc::compare): New function.
11719         (Output_data_reloc_base::do_write): Optionally sort relocs.
11720
11721         * configure.ac: If targ_extra_obj is set, link it in.
11722         * configure.tgt: Initialize all variables.
11723         (x86_64*): Set targ_extra_obj and targ_extra_size.
11724         * configure: Rebuild.
11725
11726         * object.cc (Sized_relobj::include_section_group): Adjust section
11727         indexes read from group data.  Build vector to pass to
11728         layout_group.
11729         * layout.cc (Layout::layout_group): Add flags and shndxes
11730         parameters.  Remove contents parameter.  Change caller.  Update
11731         explicit instantiations.
11732         * layout.h (class Layout): Update layout_group declaration.
11733         * output.cc (Output_data_group::Output_data_group): Add flags and
11734         input_shndxes parameters.  Remove contents parameter.  Change
11735         caller.
11736         (Output_data_group::do_write): Change input_sections_ to
11737         input_shndxes_.
11738         * output.h (class Output_data_group): Update constructor
11739         declaration.  Rename input_sections_ to input_shndxes_.
11740         * testsuite/many_sections_test.cc: Add template.
11741
11742 2008-04-30  Cary Coutant  <ccoutant@google.com>
11743
11744         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11745
11746         * layout.cc (Layout::include_section): Refactored check for debug
11747         info section.
11748         (Layout::add_comdat): Add new parameters.  Change type
11749         of signature parameter.  Add object and shndx to signatures table.
11750         (Layout::find_kept_object): New function.
11751         * layout.h: Include <cstring>.
11752         (Layout::is_debug_info_section): New function.
11753         (Layout::add_comdat): Add new parameters.
11754         (Layout::find_kept_object): New function.
11755         (Layout::Kept_section): New struct.
11756         (Layout::Signatures): Change type of map range.
11757         * object.cc (Relobj::output_section_address): New function.
11758         (Sized_relobj::include_section_group): Add new parameters.  Change
11759         calls to Layout::add_comdat.  Change to build table of kept comdat
11760         groups and table mapping discarded sections to kept sections.
11761         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11762         (Sized_relobj::do_layout): Change calls to include_section_group and
11763         include_linkonce_section.
11764         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11765         value to zero when section is discarded.
11766         (Sized_relobj::map_to_kept_section): New function.
11767         * object.h (Relobj::output_section_address): New function.
11768         (Relobj::Comdat_group): New type.
11769         (Relobj::find_comdat_group): New function.
11770         (Relobj::Comdat_group_table): New type.
11771         (Relobj::Kept_comdat_section): New type.
11772         (Relobj::Kept_comdat_section_table): New type.
11773         (Relobj::add_comdat_group): New function.
11774         (Relobj::set_kept_comdat_section): New function.
11775         (Relobj::get_kept_comdat_section): New function.
11776         (Relobj::comdat_groups_): New field.
11777         (Relobj::kept_comdat_sections_): New field.
11778         (Symbol_value::input_value): Update comment.
11779         (Sized_relobj::map_to_kept_section) New function.
11780         (Sized_relobj::include_linkonce_section): Add new parameter.
11781         * target-reloc.h (Comdat_behavior): New type.
11782         (get_comdat_behavior): New function.
11783         (relocate_section): Add code to map a discarded section to the
11784         corresponding kept section when applying a relocation.
11785
11786 2008-04-30  Craig Silverstein  <csilvers@google.com>
11787
11788         * dwarf_reader.cc (next_generation_count): New static var.
11789         (Addr2line_cache_entry): New struct.
11790         (addr2line_cache): New static var.
11791         (Dwarf_line_info::one_addr2line): Added caching.
11792         (Dwarf_line_info::clear_addr2line_cache): New function.
11793         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11794         cache-size parameter.
11795         (Dwarf_line_info::one_addr2line_cache): New function.
11796         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11797         new cache-size argument to one_addr2line(), and clear cache.
11798
11799 2008-04-28  Cary Coutant  <ccoutant@google.com>
11800
11801         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11802         R_386_PC8 relocations.
11803
11804 2008-04-23  Ian Lance Taylor  <iant@google.com>
11805
11806         * object.cc (Sized_relobj::include_section_group): Check for
11807         invalid section group.
11808
11809         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11810         header size.
11811
11812         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11813         than read for file header.
11814         * archive.cc (Archive::include_member): Likewise.
11815
11816 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11817
11818         * aclocal.m4: Regenerate.
11819         * configure: Regenerate.
11820
11821 2008-04-19  Ian Lance Taylor  <iant@google.com>
11822
11823         * version.cc (version_string): Bump to 1.6.
11824
11825         * testsuite/Makefile.am (many_sections_r_test): New target.
11826         (many_sections_r_test_SOURCES): Remove.
11827         (many_sections_r_test_DEPENDENCIES): Remove.
11828         (many_sections_r_test_LDFLAGS): Remove.
11829         (many_sections_r_test_LDADD): Remove.
11830
11831         * object.cc (Sized_relobj::do_add_symbols): Always pass
11832         local_symbol_count_ to add_from_relobj.
11833
11834         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11835         every thousand variables.
11836         * testsuite/Makefile.in: Rebuild.
11837
11838         * object.cc (Xindex::initialize_symtab_xindex): New function.
11839         (Xindex::read_symtab_xindex): New function.
11840         (Xindex::sym_xindex_to_shndx): New function.
11841         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11842         available.
11843         (Sized_relobj::do_initialize_xindex): New function.
11844         (Sized_relobj::do_read_symbols): Adjust section links.
11845         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11846         parameter.  Change all callers.
11847         (Sized_relobj::include_section_group): Adjust section links and
11848         symbol section indexes.
11849         (Sized_relobj::do_layout): Adjust section links.
11850         (Sized_relobj::do_count_local_symbols): Adjust section links and
11851         symbol section indexes.
11852         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11853         ordinary and special symbols.
11854         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11855         dynsym_xindex parameters.  Change all callers.  Adjust section
11856         links.  Use SHN_XINDEX when needed.
11857         (Sized_relobj::get_symbol_location_info): Adjust section links.
11858         Don't get fooled by special symbols.
11859         * object.h (class Xindex): Define.
11860         (class Object): Add xindex_ parameter.  Declare virtual functoin
11861         do_initialize_xindex.
11862         (Object::adjust_sym_shndx): New function.
11863         (Object::set_xindex): New protected function.
11864         (class Symbol_value): Add is_ordinary_shndx_ field.
11865         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11866         (Symbol_value::value): Assert ordinary section.
11867         (Symbol_value::initialize_input_to_output_map): Likewise.
11868         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11869         Change all callers.
11870         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11871         all callers.
11872         (class Sized_relobj): Update declarations.
11873         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11874         parameter.  Change all callers.
11875         (Sized_relobj::adjust_shndx): New function.
11876         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11877         field.
11878         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11879         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11880         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11881         (Sized_dynobj::read_dynsym_section): Adjust section links.
11882         (Sized_dynobj::read_dynamic): Likewise.
11883         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11884         section links.
11885         (Sized_dynobj::do_initialize_xindex): New function.
11886         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11887         do_initialize_xindex.
11888         (Sized_dynobj::adjust_shndx): New function.
11889         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11890         dynsym_xindex_ fields.
11891         (Layout::finalize): Add a call to set_section_indexes before
11892         creating the symtab sections.
11893         (Layout::set_section_indexes): Don't do anything if the section
11894         already has a section index.
11895         (Layout::create_symtab_sections): Add shnum parameter.  Change
11896         caller.  Create .symtab_shndx section if needed.
11897         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11898         caller.
11899         (Layout::allocated_output_section_count): New function.
11900         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11901         needed.
11902         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11903         fields.  Update declarations.
11904         (Layout::symtab_xindex): New function.
11905         (Layout::dynsym_xindex): New function.
11906         (class Write_symbols_task): Add layout_ field.
11907         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11908         Change caller.
11909         * output.cc (Output_section_headers::Output_section_headers): Add
11910         shstrtab_section parameter.  Change all callers.
11911         (Output_section_headers::do_sized_write): Store overflow values
11912         for section count and section string table section index in
11913         section header zero.
11914         (Output_file_header::do_sized_write): Check for overflow of
11915         section count and section string table section index.
11916         (Output_symtab_xindex::do_write): New function.
11917         (Output_symtab_xindex::endian_do_write): New function.
11918         * output.h (class Output_section_headers): Add shstrtab_section_.
11919         Update declarations.
11920         (class Output_symtab_xindex): Define.
11921         (Output_section::has_out_shndx): New function.
11922         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11923         field.
11924         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11925         Change all callers.
11926         (Sized_symbol::init): Likewise.
11927         (Symbol::output_section): Check for ordinary symbol.
11928         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11929         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11930         callers.
11931         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11932         Change all callers.  Simplify handling of symbols from sections
11933         not included in the link.
11934         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11935         distinction.
11936         (Weak_alias_sorter::operator()): Assert that symbols are
11937         ordinary.
11938         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11939         distinction.
11940         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11941         parameters.  Change all callers.
11942         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11943         symbol distinction.  Use SHN_XINDEX when needed.
11944         (Symbol_table::write_section_symbol): Add symtab_xindex
11945         parameter.  Change all callers.
11946         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11947         SHN_XINDEX when needed.
11948         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11949         declarations.
11950         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11951         (Symbol::is_defined): Check is_ordinary.
11952         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11953         (Symbol::is_absolute, Symbol::is_common): Likewise.
11954         (class Sized_symbol): Update declarations.
11955         (class Symbol_table): Update declarations.
11956         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11957         parameters.  Change all callers.
11958         (Sized_symbol::override): Likewise.
11959         (Symbol_table::override): Likewise.
11960         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11961         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11962         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11963         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11964         to be in an ordinary section.
11965         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11966         object and is_ordinary parameters.  Change all callers.
11967         (Sized_dwarf_line_info::read_relocs): Add object parameter.
11968         Change all callers.  Don't add undefined or non-ordinary symbols
11969         to reloc_map_.
11970         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11971         Change all callers.
11972         * dwarf_reader.h (class Sized_dwarf_line_info): Update
11973         declarations.
11974         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11975         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11976         (Sized_relobj::relocate_sections): Likewise.
11977         * target-reloc.h (scan_relocs): Adjust section symbol index.
11978         (scan_relocatable_relocs): Likewise.
11979         * i386.cc (Scan::local): Check for ordinary symbols.
11980         * sparc.cc (Scan::local): Likewise.
11981         * x86_64.cc (Scan::local): Likewise.
11982         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11983         to symbol_section_and_value.
11984         * testsuite/many_sections_test.cc: New file.
11985         * testsuite/Makefile.am (BUILT_SOURCES): Define.
11986         (check_PROGRAMS): Add many_sections_test.
11987         (many_sections_test_SOURCES): Define.
11988         (many_sections_test_DEPENDENCIES): Define.
11989         (many_sections_test_LDFLAGS): Define.
11990         (BUILT_SOURCES): Add many_sections_define.h.
11991         (many_sections_define.h): New target.
11992         (BUILT_SOURCES): Add many_sections_check.h.
11993         (many_sections_check.h): New target.
11994         (check_PROGRAMS): Add many_sections_r_test.
11995         (many_sections_r_test_SOURCES): Define.
11996         (many_sections_r_test_DEPENDENCIES): Define.
11997         (many_sections_r_test_LDFLAGS): Define.
11998         (many_sections_r_test_LDADD): Define.
11999         (many_sections_r_test.o): New target.
12000         * testsuite/Makefile.in: Rebuild.
12001
12002 2008-04-17  Cary Coutant  <ccoutant@google.com>
12003
12004         * errors.cc (Errors::info): New function.
12005         (gold_info): New function.
12006         * errors.h (Errors::info): New function.
12007         * gold.h (gold_info): New function.
12008         * object.cc (Input_objects::add_object): Print trace output.
12009         * options.cc (options::parse_set): New function.
12010         (General_options::parse_wrap): Deleted.
12011         (General_options::General_options): Deleted initializer.
12012         * options.h (options::String_set): New typedef.
12013         (options::parse_set): New function.
12014         (DEFINE_set): New macro.
12015         (General_options::wrap): Changed to use DEFINE_set. Changed
12016         callers of any_wrap_symbols and is_wrap_symbol.
12017         (General_options::trace, General_options::trace_symbol):
12018         New options.
12019         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12020         (General_options::wrap_symbols_): Deleted.
12021         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12022
12023 2008-04-17  David S. Miller  <davem@davemloft.net>
12024
12025         * options.cc (General_options::parse_V): New function.
12026         * options.h: Add entries for -V and -Qy.
12027
12028 2008-04-17  Ian Lance Taylor  <iant@google.com>
12029
12030         * common.cc (Symbol_table::allocate_commons): Remove options
12031         parameter.  Change caller.
12032         (Symbol_table::do_allocate_commons): Remove options parameter.
12033         Change caller.  Just call do_allocate_commons_list twice.
12034         (Symbol_table::do_allocate_commons_list): New function, broken out
12035         of do_allocate_commons.
12036         * common.h (class Allocate_commons_task): Remove options_ field.
12037         Update constructor.
12038         * symtab.cc (Symbol_table::Symbol_table): Initialize
12039         tls_commons_.
12040         (Symbol_table::add_from_object): Put TLS common symbols on
12041         tls_commons_ list.
12042         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12043         which are IN_OUTPUT_DATA.
12044         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12045         allocate_commons and do_allocate_commons declarations.  Declare
12046         do_allocate_commons_list.
12047         * gold.cc (queue_middle_tasks): Update creation of
12048         Allocate_commons_task to not pass options.
12049         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12050         (TLS_TEST_C_FLAGS): New variable.
12051         (tls_test_c_pic.o): New target.
12052         (tls_test_shared.so): Link in tls_test_c_pic.o.
12053         (tls_test_c_pic_ie.o): New target.
12054         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12055         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12056         (tls_test_c.o): New target.
12057         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12058         (tls_pic_test_LDADD): Likewise.
12059         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12060         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12061         (tls_test_c_gnu2.o): New target.
12062         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12063         tls_test_c_gnu2.o.
12064         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12065         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12066         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12067         * testsuite/tls_test.cc: Include "config.h".
12068         (t_last): Call t11_last.
12069         * testsuite/tls_test.h (t11, t11_last): Declare.
12070         * testsuite/tls_test_c.c: New file.
12071         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12072         * configure.ac: Check for OpenMP support.
12073         * configure, config.in, Makefile.in: Rebuild.
12074         * testsuite/Makefile.in: Rebuild.
12075
12076 2008-04-16  Cary Coutant  <ccoutant@google.com>
12077
12078         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12079         (Target_i386::tls_base_symbol_defined_): New field.
12080         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12081         (Target_i386::Scan::global): Likewise.
12082         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12083         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12084         (Target_x86_64::tls_base_symbol_defined_): New field.
12085         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12086         (Target_x86_64::Scan::global): Likewise.
12087
12088 2008-04-16  Cary Coutant  <ccoutant@google.com>
12089
12090         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12091         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12092         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12093         building shared libraries.
12094         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12095         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12096         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12097         * testsuite/Makefile.in: Rebuild.
12098         * testsuite/weak_undef.h: New file.
12099         * testsuite/weak_undef_file1.cc: Add extra test cases.
12100         * testsuite/weak_undef_file2.cc: Likewise.
12101         * testsuite/weak_undef_test.cc: Likewise.
12102
12103 2008-04-16  David S. Miller  <davem@davemloft.net>
12104
12105         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12106         Add issued_non_pic_error_ field.  Declare check_non_pic.
12107         (Target_sparc::Scan::check_non_pic): New function.
12108         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12109         (Target_sparc::Scan::global): Likewise.
12110
12111         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12112         * configure: Rebuild.
12113
12114         * options.h (DEFINE_enable): New macro.
12115         (new_dtags): New enable option.
12116         (initfirst, interpose, loadfltr, nodefaultlib,
12117         nodelete, nodlopen, nodump): New -z options.
12118         * layout.cc (Layout:finish_dynamic_section): If new
12119         dtags enabled, emit DT_RUNPATH.  Also, emit a
12120         DT_FLAGS_1 containing any specified -z flags.
12121
12122 2008-04-16  Ian Lance Taylor  <iant@google.com>
12123
12124         * copy-relocs.cc: New file.
12125         * copy-relocs.h: New file.
12126         * reloc.cc: Remove Copy_relocs code.
12127         * reloc.h: Likewise.
12128         * reloc-types.h (struct Reloc_types) [both versions]: Add
12129         get_reloc_addend_noerror.
12130         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12131         variants of add_global which take an addend which must be zero.
12132         * i386.cc: Include "copy-relocs.h".
12133         (class Target_i386): Change type of copy_relocs_ to variable,
12134         update initializer.
12135         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12136         Change all callers.
12137         (Target_i386::do_finalize_sections): Change handling of
12138         copy_relocs_.
12139         * sparc.cc: Include "copy-relocs.h".
12140         (class Target_sparc): Change type of copy_relocs_ to variable,
12141         update initializer.
12142         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12143         Change all callers.
12144         (Target_sparc::do_finalize_sections): Change handling of
12145         copy_relocs_.
12146         * x86_64.cc: Include "copy-relocs.h".
12147         (class Target_x86_64): Change type of copy_relocs_ to variable,
12148         update initializer.
12149         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12150         class.  Change all callers.
12151         (Target_x86_64::do_finalize_sections): Change handling of
12152         copy_relocs_.
12153         * Makefile.am (CCFILES): Add copy-relocs.cc.
12154         (HFILES): Add copy-relocs.h.
12155
12156         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12157
12158         * testsuite/script_test_4.sh: Permit leading zeroes.
12159
12160 2008-04-15  Ian Lance Taylor  <iant@google.com>
12161
12162         * script-sections.cc (Script_sections::create_segments): Use
12163         header_size_adjustment even when there is enough room for the
12164         headers.
12165         * testsuite/script_test_4.sh: New file.
12166         * testsuite/script_test_4.t: New file.
12167         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12168         (check_DATA): Add script_test_4.stdout.
12169         (MOSTLYCLEANFILES): Likewise.
12170         (script_test_4): New target.
12171         (script_test_4.stdout): New target.
12172         * testsuite/Makefile.in: Rebuild.
12173
12174         * sparc.cc: Add definitions for Output_data_plt_sparc class
12175         constants.
12176
12177 2008-04-14  David S. Miller  <davem@davemloft.net>
12178
12179         * sparc.cc: New file.
12180         * Makefile.am (TARGETSOURCES): Add sparc.cc
12181         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12182         * configure.tgt: Document targ_extra_size and
12183         targ_extra_big_endian.  Add entries for sparc-* and
12184         sparc64-*.
12185         * configure.ac: Handle targ_extra_size and
12186         targ_extra_big_endian.
12187         * Makefile.in: Rebuild.
12188         * configure: Likewise.
12189         * po/POTFILES.in: Likewise.
12190         * po/gold.pot: Likewise.
12191
12192 2008-04-14  Ian Lance Taylor  <iant@google.com>
12193
12194         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12195         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12196         in the name/type/flags to section mapping.  Don't call
12197         allocate_output_section.
12198         (Layout::choose_output_section): Change parameter from adjust_name
12199         to is_input_section.  Don't permit input sections after sections
12200         are attached to segments.  Don't call allocate_output_section.
12201         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12202         not write_enable_output_section.
12203         (Layout::make_output_section): Don't push to
12204         unattached_section_list_ nor call attach_to_segment.  Call
12205         attach_section_to_segment if sections are attached.
12206         (Layout::attach_sections_to_segments): New function.
12207         (Layout::attach_section_to_segment): New function.
12208         (Layout::attach_allocated_section_to_segment): Rename from
12209         attach_to_segment.  Remove flags parameter.
12210         (Layout::allocate_output_section): Remove function.
12211         (Layout::write_enable_output_section): Remove function.
12212         * layout.h (class Layout): Update for above changes.  Add new
12213         field sections_are_attached_.
12214         * output.h (Output_section::update_flags_for_input_section): New
12215         function.
12216         * output.cc (Output_section::add_input_section): Call
12217         update_flags_for_input_section.
12218         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12219
12220 2008-04-11  Cary Coutant  <ccoutant@google.com>
12221
12222         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12223         thought unnecessary.
12224         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12225
12226 2008-04-11  Ian Lance Taylor  <iant@google.com>
12227
12228         * output.h (class Output_section_data): Remove inline definition
12229         of set_addralign.
12230         * output.cc (Output_section_data::set_addralign): New function.
12231
12232 2008-04-11  Cary Coutant  <ccoutant@google.com>
12233
12234         Add support for TLS descriptors for i386 and x86_64.
12235         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12236         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12237         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12238         GOT_TYPE_TLS_DESC.
12239         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12240         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12241         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12242         relocations.
12243         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12244         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12245         Fix problem with initial-exec relocations.
12246         (Target_i386::Relocate::relocate_tls): Likewise.
12247         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12248         relaxation.
12249         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12250         support for section-plus-offset dynamic table entries.
12251         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12252         (Output_data_dynamic::Dynamic_entry): Add support for
12253         section-plus-offset dynamic table entries.
12254         (Output_data_dynamic::Classification): Likewise.
12255         (Output_data_dynamic::classification_): Renamed offset_.
12256         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12257         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12258         (Target_x86_64::make_plt_section): New function.
12259         (Target_x86_64::reserve_tlsdesc_entries): New function.
12260         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12261         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12262         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12263         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12264         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12265         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12266         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12267         add extra PLT entry for TLS descriptors.
12268         (Output_data_plt_x86_64::got_): New field.
12269         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12270         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12271         fields.
12272         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12273         descriptors.
12274         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12275         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12276         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12277         R_386_TLS_DESC_CALL relocations.
12278         (Target_x86_64::Scan::global): Likewise.
12279         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12280         for TLS descriptors.
12281         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12282         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12283         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12284         GD-to-IE relaxation.
12285         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12286         and TLS_DESCRIPTORS.
12287         * Makefile.in: Rebuild.
12288         * configure: Rebuild.
12289         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12290         (tls_test_shared2.so): New target.
12291         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12292         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12293         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12294         (tls_shared_gd_to_ie_test_LDADD): New variable.
12295         (tls_shared_gnu2_gd_to_ie_test): New target.
12296         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12297         New targets.
12298         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12299         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12300         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12301         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12302         (tls_shared_gnu2_test): New target.
12303         (tls_test_gnu2_shared.so): New target.
12304         (tls_shared_gnu2_test_SOURCES): New variable.
12305         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12306         (tls_shared_gnu2_test_LDFLAGS): New variable.
12307         (tls_shared_gnu2_test_LDADD): New variable.
12308         * testsuite/Makefile.in: Rebuild.
12309         * testsuite/Makefile.
12310
12311 2008-04-11  Ian Lance Taylor  <iant@google.com>
12312
12313         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12314         justsyms.t.
12315         * testsuite/Makefile.in: Rebuild.
12316
12317         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12318         long.
12319         * testsuite/script_test_2.cc (main): Adjust test.
12320
12321 2008-04-11  David S. Miller  <davem@davemloft.net>
12322             Ian Lance Taylor  <iant@google.com>
12323
12324         * options.h (General_options): Add entries for '-Y' and
12325         '-relax'.
12326         * options.cc (General_options:finalize): If -Y was used, add those
12327         entries to the library path instead of the default "/lib" and
12328         "/usr/lib".
12329
12330 2008-04-11  David S. Miller  <davem@davemloft.net>
12331
12332         * testsuite/justsyms.t: Start at 0x100.
12333         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12334         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12335         long.
12336         * testsuite/script_test_2.cc: Adjust string and section length
12337         checks.
12338
12339 2008-04-09  Ian Lance Taylor  <iant@google.com>
12340
12341         PR gold/5996
12342         * script-sections.cc (Sections_element::allocate_to_segment): Add
12343         orphan parameter.
12344         (Output_section_definition::allocate_to_segment): Likewise.
12345         (Orphan_output_section::allocate_to_segment): Likewise.
12346         (Script_sections::attach_sections_using_phdrs_clause): Don't
12347         propagate non-PT_LOAD segments to orphan sections.
12348         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12349         readelf rather than objdump.
12350         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12351         .interp section and PT_INTERP segment are the same size.
12352         * testsuite/Makefile.in: Rebuild.
12353
12354         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12355         aliases for symbols defined in the same object.
12356         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12357         (weak_alias_test_SOURCES): New variable.
12358         (weak_alias_test_DEPENDENCIES): New variable.
12359         (weak_alias_test_LDFLAGS): New variable.
12360         (weak_alias_test_LDADD): New variable.
12361         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12362         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12363         (weak_alias_test_3.o): New target.
12364         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12365         * testsuite/weak_alias_test_main.cc: New file.
12366         * testsuite/weak_alias_test_1.cc: New file.
12367         * testsuite/weak_alias_test_2.cc: New file.
12368         * testsuite/weak_alias_test_3.cc: New file.
12369
12370 2008-04-08  Ian Lance Taylor  <iant@google.com>
12371
12372         * options.h (class General_options): Add --noinhibit-exec option.
12373         * main.cc (main): Check --noinhibit-exec.
12374
12375         * options.h (class General_options): Define --wrap as a special
12376         option.  Add wrap_symbols_ field.
12377         (General_options::any_wrap_symbols): New function.
12378         (General_options::is_wrap_symbol): New function.
12379         * options.cc (General_options::parse_wrap): New function.
12380         (General_options::General_options): Initialize wrap_symbols_.
12381         * symtab.cc (Symbol_table::wrap_symbol): New function.
12382         (Symbol_table::add_from_object): Handle --wrap.
12383         * symtab.h (class Symbol_table): Declare wrap_symbol.
12384         * target.h (Target::wrap_char): New function.
12385         (Target::Target_info): Add wrap_char field.
12386         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12387         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12388         * testsuite/testfile.cc (Target_test::test_target_info):
12389         Likewise.
12390
12391         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12392         there is one.
12393
12394         * layout.h (class Layout): Add added_eh_frame_data_ field.
12395         * layout.cc (Layout::Layout): Initialize new field.
12396         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12397         output section until we find a section we merged successfully.
12398         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12399         that the size be non-zero.
12400
12401         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12402         qualifier.
12403
12404 2008-04-08  Craig Silverstein  <csilvers@google.com>
12405
12406         * configure.ac: Export new conditional variable HAVE_ZLIB.
12407         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12408         on HAVE_ZLIB.
12409         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12410         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12411
12412 2008-04-07  Ian Lance Taylor  <iant@google.com>
12413
12414         * version.cc (version_string): Set to "1.5".
12415
12416         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12417         Add issued_non_pic_error_ field.  Declare check_non_pic.
12418         (Target_x86_64::Scan::check_non_pic): New function.
12419         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12420         (Target_x86_64::Scan::global): Likewise.
12421
12422         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12423         addend parameter.  Change caller.  Handle merge sections.
12424         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12425         Address to Addend.  Don't add in the result of
12426         local_section_offset, pass down the addend and use the returned
12427         value.
12428         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12429         Update declarations of local_section_offset and symbol_value.
12430         * testsuite/two_file_test_1.cc (t18): New function.
12431         * testsuite/two_file_test_2.cc (f18): New function.
12432         * testsuite/two_file_test_main.cc (main): Call t18.
12433         * testsuite/two_file_test.h (t18, f18): Declare.
12434
12435         * configure.ac: Don't test for objdump, c++filt, or readelf.
12436         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12437         conditionals.
12438         (TEST_READELF): New variable.
12439         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12440         (check_PROGRAMS): Add two_file_strip_test.
12441         (two_file_strip_test): New target.
12442         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12443         (two_file_same_shared_strip_test_SOURCES): New variable.
12444         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12445         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12446         (two_file_same_shared_strip_test_LDADD): New variable.
12447         (two_file_shared_strip.so): New target.
12448         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12449         (ver_test_5.syms, ver_test_7.syms): Likewise.
12450         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12451         (strip_test_3.stdout): Use TEST_OBJDUMP.
12452         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12453
12454 2008-04-04  Cary Coutant  <ccoutant@google.com>
12455
12456         * symtab.h (Symbol::is_weak_undefined): New function.
12457         (Symbol::is_strong_undefined): New function.
12458         (Symbol::is_absolute): New function.
12459         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12460         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12461         absolute symbols.
12462         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12463         (weak_undef_test): New target.
12464         * testsuite/Makefile.in: Rebuild.
12465         * testsuite/weak_undef_file1.cc: New file.
12466         * testsuite/weak_undef_file2.cc: New file.
12467         * testsuite/weak_undef_test.cc: New file.
12468
12469 2008-04-03  Craig Silverstein  <csilvers@google.com>
12470
12471         * compressed_output.h (class Output_compressed_section): Use
12472         unsigned buffer.
12473         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12474         add zlib header.
12475         (zlib_compressed_suffix): Removed.
12476         (Output_compressed_section::set_final_data_size): Use unsigned
12477         buffers.
12478         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12479         Fix linker invocation.
12480         (flagstest_o_specialfile_and_compress_debug_sections):
12481         Likewise.
12482         * testsuite/Makefile.in: Regenerated.
12483
12484 2008-04-02  David S. Miller  <davem@davemloft.net>
12485
12486         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12487         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12488
12489 2008-04-02  Craig Silverstein  <csilvers@google.com>
12490
12491         * TODO: New file.
12492
12493 2008-04-02  Ian Lance Taylor  <iant@google.com>
12494
12495         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12496         parameters.  Update for new key type to views_.  Change all
12497         callers.
12498         (File_read::read): Adjust for byteshift in returned view.
12499         (File_read::add_view): New function, broken out of
12500         find_and_make_view.
12501         (File_read::make_view): New function, broken out of
12502         find_and_make_view.
12503         (File_read::find_or_make_view): Add offset and aligned
12504         parameters.  Rewrite accordingly.  Change all callers.
12505         (File_read::get_view): Add offset and aligned parameters.  Adjust
12506         for byteshift in return value.
12507         (File_read::get_lasting_view): Likewise.
12508         * fileread.h (class File_read): Update declarations.
12509         (class File_read::View): Add byteshift_ field.  Add byteshift to
12510         constructor.  Add byteshift method.
12511         * archive.h (Archive::clear_uncached_views): New function.
12512         (Archive::get_view): Add aligned parameter.  Change all callers.
12513         * object.h (Object::get_view): Add aligned parameter.  Change all
12514         callers.
12515         (Object::get_lasting_view): Likewise.
12516
12517         * fileread.cc (File_read::release): Don't call clear_views if
12518         there are multiple objects.
12519         * fileread.h (File_read::clear_uncached_views): New function.
12520         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12521         on the archive.
12522
12523 2008-03-31  Cary Coutant  <ccoutant@google.com>
12524
12525         Add thin archive support.
12526         * archive.cc (Archive::armagt): New const.
12527         (Archive::setup): Remove task parameter and calls to unlock.
12528         (Archive::unlock_nested_archives): New function.
12529         (Archive::read_header): Add nested_off parameter. Change
12530         all callers.
12531         (Archive::interpret_header): Likewise.
12532         (Archive::include_all_members): Change to handle thin
12533         archives.
12534         (Archive::include_member): Likewise.
12535         * archive.h (Archive::Archive): Add new parameters and
12536         initializers.
12537         (Archive::armagt): New const.
12538         (Archive::setup): Remove task parameter.
12539         (Archive::unlock_nested_archives): New function.
12540         (Archive::read_header): Add nested_off parameter.
12541         (Archive::interpret_header): Likewise.
12542         (Archive::Nested_archive_table): New typedef.
12543         (Archive::is_thin_archive_): New field.
12544         (Archive::nested_archives_): New field.
12545         (Archive::options_): New field.
12546         (Archive::dirpath_): New field.
12547         (Archive::task_): New field.
12548         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12549         for thin archives.  Pass additional parameters to
12550         Archive::Archive.  Unlock the archive file after calling
12551         Archive::setup.
12552
12553 2008-03-29  Ian Lance Taylor  <iant@google.com>
12554
12555         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12556         version symbol to be local.
12557         * testsuite/ver_test_4.sh: New file.
12558         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12559         (check_DATA): Add ver_test_4.syms.
12560         (ver_test_4.syms): New target.
12561         * testsuite/Makefile.in: Rebuild.
12562
12563         * output.cc
12564         (Output_section::Input_section_sort_entry::has_priority): New
12565         function.
12566         (Output_section::Input_section_sort_entry::match_file_name): New
12567         function.
12568         (Output_section::Input_section_sort_entry::match_section_name):
12569         Remove.
12570         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12571         Remove.
12572         (Output_section::Input_section_sort_entry::match_section_file):
12573         Remove.
12574         (Output_section::Input_section_sort_compare::operator()): Rewrite
12575         using new Input_section_sort_entry functions.  Sort crtbegin and
12576         crtend first.  Sort sections with no priority before sections with
12577         a priority.
12578         * testsuite/initpri1.c (d3): Check j != 4.
12579         (cd5): New constructor/destructor function.
12580         (main): Check j != 2.
12581
12582         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12583         new symbol when resolving, don't call set_is_default.
12584         * testsuite/ver_test_7.cc: New file.
12585         * testsuite/ver_test_7.sh: New file.
12586         * testsuite/Makefile.am (ver_test_7.so): New target.
12587         (ver_test_7.o): New target.
12588         (check_SCRIPTS): Add ver_test_7.sh.
12589         (check_DATA): Add ver_test_7.syms.
12590         (ver_test_7.syms): New target.
12591
12592 2008-03-28  Ian Lance Taylor  <iant@google.com>
12593
12594         * layout.cc (Layout::layout): If we see an input section with a
12595         name that needs sorting, set the must_sort flag for the output
12596         section.
12597         (Layout::make_output_section): If the name of the output section
12598         indicates that it might require sorting, set the may_sort flag.
12599         * output.h (Output_section::may_sort_attached_input_sections): New
12600         function.
12601         (Output_section::set_may_sort_attached_input_sections): New
12602         function.
12603         (Output_section::must_sort_attached_input_sections): New
12604         function.
12605         (Output_section::set_must_sort_attached_input_sections): New
12606         function.
12607         (class Output_section): Declare Input_section_sort_entry.  Define
12608         Input_section_sort_compare.  Declare
12609         sort_attached_input_sections.  Add new fields:
12610         may_sort_attached_input_sections_,
12611         must_sort_attached_input_sections_,
12612         attached_input_sections_are_sorted_.
12613         * output.cc (Output_section::Output_section): Initialize new
12614         fields.
12615         (Output_section::add_input_section): Add an entry to
12616         input_sections_ if may_sort or must_sort are true.
12617         (Output_section::set_final_data_size): Call
12618         sort_attached_input_sections if necessary.
12619         (Output_section::Input_section_sort_entry): Define new class.
12620         (Output_section::Input_section_sort_compare::operator()): New
12621         function.
12622         (Output_section::sort_attached_input_sections): New function.
12623         * configure.ac: Check whether the compiler supports constructor
12624         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12625         * testsuite/initpri1.c: New file.
12626         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12627         CONSTRUCTOR_PRIORITY.
12628         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12629         (initpri1_LDFLAGS): New variable.
12630         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12631
12632 2008-03-27  Ian Lance Taylor  <iant@google.com>
12633
12634         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12635         * testsuite/common_test_1.c: New file.
12636         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12637         (common_test_1_SOURCES): New variable.
12638         (common_test_1_DEPENDENCIES): New variable.
12639         (common_test_1_LDFLAGS): New variable.
12640
12641         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12642         and commons_ correctly when NAME/VERSION does not override
12643         NAME/NULL.
12644         * testsuite/ver_test_6.c: New file.
12645         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12646         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12647         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12648
12649 2008-03-26  Ian Lance Taylor  <iant@google.com>
12650
12651         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12652         of an undefined symbol from a version script.
12653         * testsuite/Makefile.am (ver_test_5.so): New target.
12654         (ver_test_5.o): New target.
12655         (check_SCRIPTS): Add ver_test_5.sh.
12656         (check_DATA): Add ver_test_5.syms.
12657         (ver_test_5.syms): New target.
12658         * testsuite/ver_test_5.cc: New file.
12659         * testsuite/ver_test_5.script: New file.
12660         * testsuite/ver_test_5.sh: New file.
12661         * Makefile.in, testsuite/Makefile.in: Rebuild.
12662
12663         PR gold/5986
12664         Fix problems building gold with gcc 4.3.0.
12665         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12666         (gold_error_at_location, gold_warning_at_location): Use it.
12667         * configure.ac: Check whether we can compile and use a template
12668         function with a printf attribute.
12669         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12670         when jumping over bytes.
12671         * object.cc: Instantiate Object::read_section_data.
12672         * debug.h: Include <cstring>
12673         * dwarf_reader.cc: Include <algorithm>
12674         * main.cc: Include <cstring>.
12675         * options.cc: Include <cstring>.
12676         * output.cc: Include <cstring>.
12677         * script.cc: Include <cstring>.
12678         * script.h: Include <string>.
12679         * symtab.cc: Include <cstring> and <algorithm>.
12680         * target-select.cc: Include <cstring>.
12681         * version.cc: Include <string>.
12682         * testsuite/testmain.cc: Include <cstdlib>.
12683         * configure, config.in: Rebuild.
12684
12685 2008-03-25  Ian Lance Taylor  <iant@google.com>
12686
12687         * options.cc: Include "../bfd/bfdver.h".
12688         (options::help): Print bug reporting address.
12689
12690         * version.cc (print_version): Adjust output for current value of
12691         BFD_VERSION_STRING.
12692
12693         * NEWS: New file.
12694
12695         * options.cc (options::help): Print list of supported targets.
12696         * target-select.h: Include <vector>.
12697         (class Target_selector): Make machine_, size_, and is_big_endian_
12698         fields const.  Add bfd_name_ and instantiated_target_ fields.
12699         (Target_selector::Target_selector): Add bfd_name parameter.
12700         (Target_selector::recognize): Make non-virtual, call
12701         do_recognize.
12702         (Target_selector::recognize_by_name): Make non-virtual, call
12703         do_recognize_by_name.
12704         (Target_selector::supported_names): New function.
12705         (Target_selector::bfd_name): New function.
12706         (Target_selector::do_instantiate_target): New pure virtual
12707         function.
12708         (Target_selector::do_recognize): New virtual function.
12709         (Target_selector::do_recognize_by_name): New virtual function.
12710         (Target_selector::instantiate_target): New private function.
12711         (supported_target_names): Declare.
12712         * target-select.cc (Target_selector::Target_selector): Update for
12713         new parameter and fields.
12714         (select_target_by_name): Check that the name matches before
12715         calling recognize_by_name.
12716         (supported_target_names): New function.
12717         * i386.cc (class Target_selector_i386): Update Target_selector
12718         constructor call.  Remove recognize and recognize_by_name.  Add
12719         do_instantiate_target.
12720         * x86_64.cc (class Target_selector_x86_64): Likewise.
12721         * testsuite/testfile.cc (class Target_selector_test): Update for
12722         changes to Target_selector.
12723
12724         * README: Rewrite, with some notes on unsupported features.
12725
12726 2008-03-24  Cary Coutant  <ccoutant@google.com>
12727
12728         * i386.cc (Target_i386::Got_type): New enum declaration.
12729         (Target_i386::Scan::local): Updated callers of Output_data_got
12730         member functions.
12731         (Target_i386::Scan::global): Likewise.
12732         (Target_i386::Relocate::relocate): Likewise.
12733         (Target_i386::Relocate::relocate_tls): Likewise.
12734         * object.h (Got_offset_list): New class.
12735         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12736         (Sized_relobj::local_got_offset): Likewise.
12737         (Sized_relobj::set_local_got_offset): Likewise.
12738         (Sized_relobj::local_has_tls_got_offset): Removed.
12739         (Sized_relobj::local_tls_got_offset): Removed.
12740         (Sized_relobj::set_local_tls_got_offset): Removed.
12741         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12742         * output.cc (Output_data_got::add_global): Added got_type parameter.
12743         (Output_data_got::add_global_with_rel): Likewise.
12744         (Output_data_got::add_global_with_rela): Likewise.
12745         (Output_data_got::add_global_pair_with_rel): New function.
12746         (Output_data_got::add_global_pair_with_rela): New function.
12747         (Output_data_got::add_local): Added got_type parameter.
12748         (Output_data_got::add_local_with_rel): Likewise.
12749         (Output_data_got::add_local_with_rela): Likewise.
12750         (Output_data_got::add_local_pair_with_rel): New function.
12751         (Output_data_got::add_local_pair_with_rela): New function.
12752         (Output_data_got::add_global_tls): Removed.
12753         (Output_data_got::add_global_tls_with_rel): Removed.
12754         (Output_data_got::add_global_tls_with_rela): Removed.
12755         (Output_data_got::add_local_tls): Removed.
12756         (Output_data_got::add_local_tls_with_rel): Removed.
12757         (Output_data_got::add_local_tls_with_rela): Removed.
12758         * output.h (Output_data_got::add_global): Added got_type parameter.
12759         (Output_data_got::add_global_with_rel): Likewise.
12760         (Output_data_got::add_global_with_rela): Likewise.
12761         (Output_data_got::add_global_pair_with_rel): New function.
12762         (Output_data_got::add_global_pair_with_rela): New function.
12763         (Output_data_got::add_local): Added got_type parameter.
12764         (Output_data_got::add_local_with_rel): Likewise.
12765         (Output_data_got::add_local_with_rela): Likewise.
12766         (Output_data_got::add_local_pair_with_rel): New function.
12767         (Output_data_got::add_local_pair_with_rela): New function.
12768         (Output_data_got::add_global_tls): Removed.
12769         (Output_data_got::add_global_tls_with_rel): Removed.
12770         (Output_data_got::add_global_tls_with_rela): Removed.
12771         (Output_data_got::add_local_tls): Removed.
12772         (Output_data_got::add_local_tls_with_rel): Removed.
12773         (Output_data_got::add_local_tls_with_rela): Removed.
12774         * resolve.cc (Symbol::override_base_with_special): Removed
12775         reference to has_got_offset_ field.
12776         * symtab.cc (Symbol::init_fields): Replaced initialization
12777         of got_offset_ with got_offsets_.  Removed initialization
12778         of has_got_offset_
12779         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12780         (Symbol::got_offset): Likewise.
12781         (Symbol::set_got_offset): Likewise.
12782         (Symbol::has_tls_got_offset): Removed.
12783         (Symbol::tls_got_offset): Removed.
12784         (Symbol::set_tls_got_offset): Removed.
12785         (Symbol::got_offset_): Removed.
12786         (Symbol::tls_mod_got_offset_): Removed.
12787         (Symbol::tls_pair_got_offset_): Removed.
12788         (Symbol::got_offsets_): New field.
12789         (Symbol::has_got_offset): Removed.
12790         (Symbol::has_tls_mod_got_offset): Removed.
12791         (Symbol::has_tls_pair_got_offset): Removed.
12792         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12793         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12794         member functions.
12795         (Target_x86_64::Scan::global): Likewise.
12796         (Target_x86_64::Relocate::relocate): Likewise.
12797         (Target_x86_64::Relocate::relocate_tls): Likewise.
12798
12799 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12800
12801         * yyscript.y: Fix spelling error in comment.
12802
12803 2008-03-24  Ian Lance Taylor  <iant@google.com>
12804
12805         * options.h (class General_options): Define build_id option.
12806         * layout.h (class Layout): Declare write_build_id, create_note,
12807         create_build_id.  Add build_id_note_ member.
12808         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12809         "libiberty.h", "md5.h", "sha1.h".
12810         (Layout::Layout): Initialize eh_frame_data_,
12811         eh_frame_hdr_section_, and build_id_note_.
12812         (Layout::finalize): Call create_build_id.
12813         (Layout::create_note): New function, broken out of
12814         Layout::create_gold_note.
12815         (Layout::create_gold_note): Call create_note.
12816         (Layout::create_build_id): New function.
12817         (Layout::write_build_id): New function.
12818         (Close_task_runner::run): Call write_build_id.
12819
12820         * x86_64.cc: Correct license to GPLv3.
12821
12822 2008-03-23  Ian Lance Taylor  <iant@google.com>
12823
12824         * options.cc: Include "demangle.h".
12825         (parse_optional_string): New function.
12826         (parse_long_option): Handle takes_optional_argument.
12827         (parse_short_option): Update dash_z initializer.  Handle
12828         takes_optional_argument.
12829         (General_options::General_options): Initialize do_demangle_.
12830         (General_options::finalize): Set do_demangle_.  Handle demangling
12831         style.
12832         * options.h (parse_optional_string): Declare.
12833         (struct One_option): Add optional_arg field.  Update constructor.
12834         Update call constructor calls.  Add takes_optional_argument
12835         function.
12836         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12837         (DEFINE_optional_string): Define.
12838         (General_options::demangle): Change from DEFINE_bool to
12839         DEFINE_optional_string.
12840         (General_options::no_demangle): New function.
12841         (General_options::do_demangle): New function.
12842         (General_options::set_do_demangle): New function.
12843         (General_options::execstack_status_): Move definition to end of
12844         class definition.
12845         (General_options::static_): Likewise.
12846         (General_options::do_demangle_): New field.
12847         * object.cc (big_endian>::get_symbol_location_info): Call
12848         Options::do_demangle, not Options::demangle.
12849         * symtab.cc (demangle): Likewise.
12850
12851 2008-03-22  Ian Lance Taylor  <iant@google.com>
12852
12853         * gold.h: Include <cstddef> and <sys/types.h>
12854         * options.h: Include <cstring>.
12855
12856 2008-03-21  Ian Lance Taylor  <iant@google.com>
12857
12858         * Added source code to GNU binutils.