* incremental-dump.cc (find_input_containing_global): Replace
[external/binutils.git] / gold / ChangeLog
1 2012-04-24  Cary Coutant  <ccoutant@google.com>
2
3         * incremental-dump.cc (find_input_containing_global): Replace
4         magic number with symbolic constant.
5         (dump_incremental_inputs): Update version number.
6         * incremental.cc (Output_section_incremental_inputs): Update version
7         number; import symbolic constants from Incremental_inputs_reader.
8         (Incremental_inputs::create_data_sections): Align relocations
9         section correctly for 64-bit targets.
10         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
11         constants; add padding.
12         (Output_section_incremental_inputs::write_header): Add assert for
13         header_size.
14         (Output_section_incremental_inputs::write_input_files): Add assert
15         for input_entry_size.
16         (Output_section_incremental_inputs::write_info_blocks): Add padding;
17         add assert for object_info_size, input_section_entry_size,
18         global_sym_entry_size.
19         * incremental.h (Incremental_inputs_reader): Add symbolic constants
20         for data structure sizes; use them.
21         (Incremental_input_entry_reader): Import symbolic constants from
22         Incremental_inputs_reader; use them.
23
24 2012-04-23  David S. Miller  <davem@davemloft.net>
25
26         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
27         and elf_flags_set_.
28         (Target_sparc::Target_sparc): Initialize new fields.
29         (Target_sparc::do_make_elf_object): New function.
30         (Target_sparc::do_adjust_elf_header): New function.
31
32 2012-04-23  Cary Coutant  <ccoutant@google.com>
33
34         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
35         CU range table of gdb index.
36
37 2012-04-20  David S. Miller  <davem@davemloft.net>
38
39         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
40         instead of false.
41
42 2012-04-16  David S. Miller  <davem@davemloft.net>
43
44         * sparc.cc (Target_sparc::got_address): New function.
45         (Sparc_relocate_functions::gdop_hix22): New function.
46         (Sparc_relocate_functions::gdop_lox10): New function.
47         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
48         relocs.
49         (Target_sparc::Scan::local): Likewise if the global symbol is not
50         preemptible and is not IFUNC.
51         (Target_sparc::Relocate::relocate): Perform GOTDATA code
52         transformations for local and non-preemptible non-IFUNC global
53         symbols.
54
55         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
56         writing out 64-bit part of ranges.
57
58         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
59         -fpic and -fpie respectively.
60         * Makefile.in: Regenerate.
61
62         * sparc.cc (class Target_sparc): Add rela_ifunc_.
63         (Target_sparc::Target_sparc): Initialize new field.
64         (Target_sparc::do_plt_section_for_global): New function.
65         (Target_sparc::do_plt_section_for_local): New function.
66         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
67         (Target_sparc::make_plt_section): New function, broken out of
68         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
69         (Target_sparc::make_plt_entry): Call make_plt_section.
70         (Target_sparc::make_local_ifunc_plt_entry): New function.
71         (Target_sparc::rela_ifunc_section): New function.
72         (Target_sparc::plt_section): Remove const.
73         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
74         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
75         and ifunc_count_ fields.
76         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
77         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
78         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
79         (Output_data_plt_sparc::rela_ifunc): New function.
80         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
81         (Output_data_plt_sparc::has_ifunc_section): New function.
82         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
83         (Output_data_plt_sparc::address_for_global): New function.
84         (Output_data_plt_sparc::address_for_local): New function.
85         (Output_data_plt_sparc::plt_index_to_offset): New function.
86         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
87         and entry_count.
88         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
89         entry_count.
90         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
91         R_SPARC_JMP_IREL to switch.
92         (Target_sparc::Scan::check_non_pic): Likewise.
93         (Target_sparc::Scan::local): Handle IFUNC symbols.
94         (Target_sparc::Scan::local): Likewise.
95         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
96         and plt_address_for_local.
97         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
98         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
99
100         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
101         (class Output_data_reloc): Adjust calls to Output_reloc_type.
102         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
103         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
104         global relocs too.
105         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
106         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
107         calls.
108         * sparc.cc (Target_sparc::Scan::global): Likewise.
109         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
110
111 2012-04-16  Cary Coutant  <ccoutant@google.com>
112
113         * archive.cc (Library_base::should_include_member): Check for
114         --export-dynamic-symbol.
115         * options.h (class General_options): Add --export-dynamic-symbol.
116         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
117         --export-dynamic-symbol.
118         (Symbol_table::gc_mark_undef_symbols): Likewise.
119         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
120
121 2012-04-12  David S. Miller  <davem@davemloft.net>
122
123         * sparc.cc (Reloc::wdisp10): New relocation method.
124         (Reloc::h34): Likewise.
125         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
126         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
127         R_SPARC_WDISP10.
128         (Target_sparc::Scan::local): Likewise.
129         (Target_sparc::Scan::global): Likewise.
130         (Target_sparc::Relocate::relocate): Likewise.
131
132 2012-04-09  Cary Coutant  <ccoutant@google.com>
133
134         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
135         low_pc == 0.
136
137 2012-04-06  Ian Lance Taylor  <iant@google.com>
138
139         * timer.cc: #include <unistd.h>.
140
141 2012-04-06  Roland McGrath  <mcgrathr@google.com>
142
143         * configure.in (AC_CHECK_HEADERS): Add locale.h.
144         * config.in: Regenerate.
145         * configure: Regenerate.
146
147 2012-04-05  Nick Clifton  <nickc@redhat.com>
148
149         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
150         (AM_LC_MESSAGES): Add.
151         * aclocal.m4: Regenerate.
152         * config.in: Regenerate.
153         * configure: Regenerate.
154
155 2012-03-21  Cary Coutant  <ccoutant@google.com>
156
157         * Makefile.am: Add gdb-index.cc, gdb-index.h.
158         * Makefile.in: Regenerate.
159         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
160         (Sized_elf_reloc_mapper::symbol_section): New function.
161         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
162         (make_elf_reloc_mapper): New function.
163         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
164         (Dwarf_abbrev_table::do_read_abbrevs): New function.
165         (Dwarf_abbrev_table::do_get_abbrev): New function.
166         (Dwarf_ranges_table::read_ranges_table): New function.
167         (Dwarf_ranges_table::read_range_list): New function.
168         (Dwarf_pubnames_table::read_section): New function.
169         (Dwarf_pubnames_table::read_header): New function.
170         (Dwarf_pubnames_table::next_name): New function.
171         (Dwarf_die::Dwarf_die): New function.
172         (Dwarf_die::read_attributes): New function.
173         (Dwarf_die::skip_attributes): New function.
174         (Dwarf_die::set_name): New function.
175         (Dwarf_die::set_linkage_name): New function.
176         (Dwarf_die::attribute): New function.
177         (Dwarf_die::string_attribute): New function.
178         (Dwarf_die::int_attribute): New function.
179         (Dwarf_die::uint_attribute): New function.
180         (Dwarf_die::ref_attribute): New function.
181         (Dwarf_die::child_offset): New function.
182         (Dwarf_die::sibling_offset): New function.
183         (Dwarf_info_reader::check_buffer): New function.
184         (Dwarf_info_reader::parse): New function.
185         (Dwarf_info_reader::do_parse): New function.
186         (Dwarf_info_reader::do_read_string_table): New function.
187         (Dwarf_info_reader::lookup_reloc): New function.
188         (Dwarf_info_reader::get_string): New function.
189         (Dwarf_info_reader::visit_compilation_unit): New function.
190         (Dwarf_info_reader::visit_type_unit): New function.
191         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
192         Sized_elf_reloc_mapper.
193         (Sized_dwarf_line_info::symbol_section): Remove function.
194         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
195         (Sized_dwarf_line_info::read_line_mappings): Remove object
196         parameter, adjust callers.
197         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
198         * dwarf_reader.h: Include <sys/types.h>.
199         (class Track_relocs): Remove forward declaration.
200         (class Elf_reloc_mapper): New class.
201         (class Sized_elf_reloc_mapper): New class.
202         (class Dwarf_abbrev_table): New class.
203         (class Dwarf_range_list): New class.
204         (class Dwarf_ranges_table): New class.
205         (class Dwarf_pubnames_table): New class.
206         (class Dwarf_die): New class.
207         (class Dwarf_info_reader): New class.
208         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
209         (Sized_dwarf_line_info::symbol_section): Remove member function.
210         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
211         base class.
212         * gdb-index.cc: New source file.
213         * gdb-index.h: New source file.
214         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
215         and .debug_types sections, call Layout::add_to_gdb_index.
216         (Sized_relobj_incr::do_section_name): Implement.
217         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
218         return type; Implement.
219         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
220         return type.
221         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
222         parameter list and return type.
223         (Sized_incr_dynobj::do_section_contents): Likewise.
224         * layout.cc: Include gdb-index.h.
225         (Layout::Layout): Initialize gdb_index_data_.
226         (Layout::init_fixed_output_section): Check for .gdb_index section.
227         (Layout::add_to_gdb_index): New function. Instantiate.
228         * layout.h: Add forward declaration for class Gdb_index.
229         (Layout::add_to_gdb_index): New member function.
230         (Layout::gdb_index_data_): New data member.
231         * main.cc: Include gdb-index.h.
232         (main): Print statistics for gdb index.
233         * object.cc (Object::section_contents): Move code into
234         do_section_contents.
235         (need_decompressed_section): Check for sections needed when building
236         gdb index.
237         (build_compressed_section_map): Likewise.
238         (Sized_relobj_file::do_read_symbols): Need local symbols when building
239         gdb index.
240         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
241         sections; call Layout::add_to_gdb_index.
242         (Sized_relobj_file::do_decompressed_section_contents): Call
243         do_section_contents directly.
244         * object.h (Object::do_section_contents): Adjust parameter list and
245         return type.
246         (Object::do_decompressed_section_contents): Call do_section_contents
247         directly.
248         (Sized_relobj_file::do_section_contents): Adjust parameter list and
249         return type.
250         * options.h (class General_options): Add --gdb-index option.
251         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
252         list and return type.
253         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
254         * reloc.h (Track_relocs::checkpoint): New function.
255         (Track_relocs::reset): New function.
256
257         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
258         New test cases.
259         * testsuite/Makefile.in: Regenerate.
260         * testsuite/gdb_index_test.cc: New test source file.
261         * testsuite/gdb_index_test_1.sh: New test source file.
262         * testsuite/gdb_index_test_2.sh: New test source file.
263
264 2012-03-19  Doug Kwan  <dougkwan@google.com>
265
266         * arm.cc (Target_arm::do_define_standard_symbols): New method.
267         (Target_arm::do_finalize_sections): Remove code which defines
268         __exidx_start and __exidx_end.  Make symbol table parameter
269         anonymous as it is not used.
270         * gold.cc (queue_middle_tasks): Call target hook to define any
271         target-specific symbols.
272         * target.h (Target::define_standard_symbols): New method.
273         (Target::do_define_standard_symbols): Same.
274         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
275         * testsuite/Makefile.in: Regenerate.
276         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
277         and __exidx_end.
278         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
279         relocations are generated for __exidx_start and __exidx_end.
280
281 2012-03-16  Doug Kwan  <dougkwan@google.com>
282
283         * testsuite/Makefile.am: Disable test initpri3b.
284         * testsuite/Makefile.in: Regenerate.
285
286 2012-03-15  Doug Kwan  <dougkwan@google.com>
287
288         * arm.cc (Target_arm::got_section): Make .got section read-only
289         if -z now is given.
290
291 2012-03-15  Ian Lance Taylor  <iant@google.com>
292
293         PR gold/13850
294         * layout.cc (Layout::make_output_section): Correctly mark
295         SHT_INIT_ARRAY, et. al., as relro.
296
297 2012-03-14  Doug Kwan  <dougkwan@google.com>
298
299         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
300         dynamic relocations for protected symbols in shared objects.
301
302 2012-03-13  Ian Lance Taylor  <iant@google.com>
303
304         * resolve.cc (Symbol_table::resolve): When merging common symbols,
305         keep the larger alignment.
306
307 2012-03-12  Cary Coutant  <ccoutant@google.com>
308
309         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
310         handling of DW_LNE_define_file.
311
312 2012-03-12  Cary Coutant  <ccoutant@google.com>
313
314         * reduced_debug_output.cc
315         (Output_reduced_debug_info_section::get_die_end): Add new FORM
316         codes to switch.
317
318 2012-02-29  Cary Coutant  <ccoutant@google.com>
319
320         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
321
322 2012-02-29  Cary Coutant  <ccoutant@google.com>
323
324         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
325         Call Object::decompressed_section_contents.
326         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
327         New dtor.
328         (Sized_dwarf_line_info::buffer_start_): New data member.
329         * merge.cc (Output_merge_data::do_add_input_section): Call
330         Object::decompressed_section_contents.
331         (Output_merge_string::do_add_input_section): Likewise.
332         * object.cc (need_decompressed_section): New function.
333         (build_compressed_section_map): Decompress sections needed later.
334         (Sized_relobj_file::do_decompressed_section_contents): New function.
335         (Sized_relobj_file::do_discard_decompressed_sections): New function.
336         * object.h (Object::decompressed_section_contents): New function.
337         (Object::discard_decompressed_sections): New function.
338         (Object::do_decompressed_section_contents): New function.
339         (Object::do_discard_decompressed_sections): New function.
340         (Compressed_section_info): New type.
341         (Compressed_section_map): Include decompressed section contents.
342         (Sized_relobj_file::do_decompressed_section_contents): New function.
343         (Sized_relobj_file::do_discard_decompressed_sections): New function.
344
345 2012-02-16  Cary Coutant  <ccoutant@google.com>
346
347         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
348         * testsuite/Makefile.in: Regenerate.
349
350 2012-02-14  Cary Coutant  <ccoutant@google.com>
351
352         * options.cc (General_options::finalize): Disallow -pie and -static.
353
354 2012-02-03  Doug Kwan  <dougkwan@google.com>
355
356         * arm.cc (Arm_relocate_functions::abs8,
357         Arm_relocate_functions::abs16): Use
358         Bits::has_signed_unsigned_overflow32.
359         (Arm_relocate_functions::thm_abs8): Correct range of
360         overflow check.
361         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
362         in assertions.
363
364 2012-02-02  Doug Kwan  <dougkwan@google.com>
365
366         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
367         position independent outputs, not just shared objects.
368
369 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
370
371         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
372         * configure: Regenerated.
373
374 2012-01-27  Ian Lance Taylor  <iant@google.com>
375
376         * reloc.h (Bits): New class with static functions, copied from
377         namespace utils in arm.cc.
378         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
379         instead.
380
381 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
382
383         * incremental.cc (write_info_blocks): Correct relocation offset.
384
385 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
386
387         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
388         (Relocate::tls_gd_to_le): Likewise.
389
390 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
391
392         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
393
394 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
395
396         * configure.ac: Check if -mcmodel=medium works.
397         * configure: Regenerated.
398
399 2012-01-24  Cary Coutant  <ccoutant@google.com>
400
401         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
402         definition and ...
403         (read_unsigned_LEB_128_x): ... this new function.
404         (read_signed_LEB_128): Replaced with inline definition and ...
405         (read_signed_LEB_128_x): ... this new function.
406         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
407         (read_unsigned_LEB_128): Add inline definition.
408         (read_signed_LEB_128_x): New function.
409         (read_signed_LEB_128): Add inline definition.
410         * testsuite/Makefile.am (leb128_unittest): New unit test.
411         * testsuite/Makefile.in: Regenerate.
412         * testsuite/leb128_unittest.cc: New unit test.
413
414 2012-01-23  Ian Lance Taylor  <iant@google.com>
415
416         PR gold/13617
417         * i386.cc (Target_i386::do_code_fill): When using a jmp
418         instruction, pad with nop instructions.
419         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
420
421 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
422
423         * x86_64.cc (gc_process_relocs): Add typename on types used in
424         template.
425         (scan_relocs): Likewise.
426         (relocate_section): Likewise.
427         (apply_relocation): Likewise.
428
429 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
430
431         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
432         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
433         under x32.
434
435 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
436
437         * x86_64.cc: Initial support for x32.
438
439 2012-01-03  Cary Coutant  <ccoutant@google.com>
440
441         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
442         Use abstract base class for GOT.
443         * gold/output.h (class Output_data_got_base): New abstract base class.
444         (class Output_data_got): Derive from new base class, adjust ctors.
445         (Output_data_got::reserve_slot): Make virtual; rename to
446         do_reserve_slot; Adjust callers.
447         * gold/target.h (Sized_target::init_got_plt_for_update): Return
448         pointer to abstract base class.
449         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
450
451 2011-12-18  Ian Lance Taylor  <iant@google.com>
452
453         * object.h (Relobj::local_symbol_value): New function.
454         (Relobj::local_plt_offset): New function.
455         (Relobj::local_has_got_offset): New function.
456         (Relobj::local_got_offset): New function.
457         (Relobj::set_local_got_offset): New function.
458         (Relobj::do_local_symbol_value): New pure virtual function.
459         (Relobj::do_local_plt_offset): Likewise.
460         (Relobj::do_local_has_got_offset): Likewise.
461         (Relobj::do_local_got_offset): Likewise.
462         (Relobj::do_set_local_got_offset): Likewise.
463         (Sized_relobj::do_local_has_got_offset): Rename from
464         local_has_got_offset.
465         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
466         (Sized_relobj::do_set_local_got_offset): Rename from
467         set_local_got_offset.
468         (Sized_relobj_file::do_local_plt_offset): Rename from
469         local_plt_offset.
470         (Sized_relobj_file::do_local_symbol_value): New function.
471         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
472         local_plt_offset.
473         * output.cc (Output_data_got::Got_entry::write): Change object to
474         Relobj.  Use local_symbol_value.
475         (Output_data_got::add_global_with_rel): Change rel_dyn to
476         Output_data_reloc_generic*.  Use add_global_generic.
477         (Output_data_got::add_global_with_rela): Remove.  Change all
478         callers to use add_global_with_rel.
479         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
480         Output_data_reloc_generic*.  Use add_global_generic.
481         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
482         callers to use add_global_pair_with_rel.
483         (Output_data_got::add_local): Change object to Relobj*.
484         (Output_data_got::add_local_plt): Likewise.
485         (Output_data_got::add_local_with_rel): Change object to Relobj*,
486         change rel_dyn to Output_data_reloc_generic*.  Use
487         add_local_generic.
488         (Output_data_got::add_local_with_rela): Remove.  Change all
489         callers to use all_local_with_rel.
490         (Output_data_got::add_local_pair_with_rel): Change object to
491         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
492         add_output_section_generic.
493         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
494         callers to use add_local_pair_with_rel.
495         (Output_data_got::reserve_local): Change object to Relobj*.
496         * output.h: (class Output_data_reloc_generic): Add pure virtual
497         declarations for add_global_generic, add_local_generic,
498         add_output_section_generic.
499         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
500         functions for Output_data_reloc_generic.  Update declarations for
501         changes listed in output.cc.
502         (class Output_data_got): Change template parameter to got_size.
503         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
504         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
505         function.
506         (Sized_relobj_incr::do_local_plt_offset): New function.
507         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
508         add_global_generic.
509
510 2011-12-17  Cary Coutant  <ccoutant@google.com>
511
512         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
513         * resolve.cc (Symbol_table::resolve): Likewise.
514         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
515         arrays.
516         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
517
518 2011-12-16  Ian Lance Taylor  <iant@google.com>
519
520         * output.h (Output_data_reloc_generic::add): Only call
521         add_dynamic_reloc if this is a dynamic reloc section.
522
523 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
524
525         PR gold/13505
526         * target-reloc.h (apply_relocation): Replace <64, false> with
527         <size, big_endian>.
528
529 2011-11-25  Nick Clifton  <nickc@redhat.com>
530
531         * po/it.po: New Italian translation.
532
533 2011-11-17  Sterling Augustine  <saugustine@google.com>
534
535         * script.cc (script_include_directive): Implement.
536         (read_script_file): New local variables name and search_path. Update
537         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
538         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
539         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
540
541 2011-11-11  Sterling Augustine  <saugustine@google.com>
542
543         * yyscript.y (section_cmd): Add support for INCLUDE directive.
544         (file_or_sections_cmd): Likewise.
545
546 2011-11-11  Doug Kwan  <dougkwan@google.com>
547
548         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
549         if --just-symbols is given.
550
551 2011-11-10  Doug Kwan  <dougkwan@google.com>
552
553         PR gold/13362
554         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
555         when processing data relocs.
556         * reloc.h (Relocate_functions::rel_unaligned): New method.
557         (Relocate_functions::pcrel_unaligned): Ditto.
558         (Relocate_functions::rel32_unaligned): Ditto.
559         (Relocate_functions::pcrel32_unaligned): Ditto.
560
561 2011-11-09  Doug Kwan  <dougkwan@google.com>
562
563         PR gold/13362
564         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
565         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
566         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
567         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
568         (Relocate_functions::rel_unaligned): New.
569         (Relocate_functions::rel32_unaligned): New.
570         * target-reloc.h (relocate_for_relocatable): Add code to handle
571         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
572         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
573         arm_unaligned_reloc_r): New targets.
574         * testsuite/Makefile.in: Regenerate.
575         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
576         linking.
577
578 2011-11-02  Ian Lance Taylor  <iant@google.com>
579
580         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
581         NATIVE_LINKER.
582         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
583         * options.cc (General_options::finalize): Use library search path
584         from configure script if specified.  If not native and no sysroot,
585         only search TOOLLIBDIR.
586         * options.h (Search_directory::Search_directory): Change name to
587         const std::string&.
588         (General_options::add_to_library_path_with_sysroot): Change arg to
589         const std::string&.
590         * configure, Makefile.in, config.in: Rebuild.
591
592 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
593
594         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
595         we are working around the ARM1176 Erratum.
596         * options.h (General_options::fix_arm1176): Add option.
597         * testsuite/Makefile.am: Add testcases, and keep current ones
598         working.
599         * testsuite/Makefile.in: Regenerate.
600         * testsuite/arm_fix_1176.s: New file.
601         * testsuite/arm_fix_1176.sh: Likewise.
602
603 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
604
605         * arm.cc (Target_arm::Target_arm): Remove initialisation of
606         may_use_blx_.
607         (Target_arm::may_use_blx): Remove method.
608         (Target_arm::set_may_use_blx): Likewise.
609         (Target_arm::may_use_v4t_interworking): New method.
610         (Target_arm::may_use_v5t_interworking): Likewise.
611         (Target_arm::may_use_blx_): Remove member variable.
612         (Arm_relocate_functions::arm_branch_common): Check for v5T
613         interworking.
614         (Arm_relocate_functions::thumb_branch_common): Likewise.
615         (Reloc_stub::stub_type_for_reloc): Likewise.
616         (Target_arm::do_finalize_sections): Correct interworking checks.
617         * testsuite/Makefile.am: Add new tests.
618         * testsuite/Makefile.in: Regenerate.
619         * testsuite/arm_farcall_arm_arm.s: New test.
620         * testsuite/arm_farcall_arm_arm.sh: Likewise.
621         * testsuite/arm_farcall_arm_thumb.s: Likewise.
622         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
623         * testsuite/arm_farcall_thumb_arm.s: Likewise.
624         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
625         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
626         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
627
628 2011-10-31  Cary Coutant  <ccoutant@google.com>
629
630         PR gold/13023
631         * expression.cc (Expression::eval_with_dot): Add
632         is_section_dot_assignment parameter.
633         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
634         absolute and assigning to dot within a section.
635         * script-sections.cc
636         (Output_section_element_assignment::set_section_addresses): Pass
637         dot_section to set_if_absolute.
638         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
639         as is_section_dot_assignment flag to eval_with_dot.
640         (Output_section_element_dot_assignment::set_section_addresses):
641         Likewise.
642         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
643         parameter.  Also set value if relative to dot_section; set the
644         symbol's output_section.
645         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
646         parameter.  Adjust all callers.
647         (Expression::eval_maybe_dot): Likewise.
648         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
649         Adjust all callers.
650         * testsuite/script_test_2.t: Test assignment of an absolute value
651         to dot within an output section element.
652
653 2011-10-31  Cary Coutant  <ccoutant@google.com>
654
655         * options.h (class General_options): Add --[no-]gnu-unique options.
656         * symtab.cc (Symbol_table::sized_write_globals): Convert
657         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
658
659 2011-10-31  Cary Coutant  <ccoutant@google.com>
660
661         PR gold/13359
662         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
663         unnecessary assertion.
664         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
665
666 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
667
668         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
669         gc_mark_symbol.
670         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
671         gc_mark_symbol.
672         Change to just keep the section associated with symbol.
673         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
674         they are externally visible and --export-dynamic is turned on.
675         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
676
677 2011-10-19  Ian Lance Taylor  <iant@google.com>
678
679         PR gold/13163
680         * script-sections.cc
681         (Output_section_element_dot_assignment::needs_output_section): New
682         function.
683
684 2011-10-19  Ian Lance Taylor  <iant@google.com>
685
686         PR gold/13204
687         * layout.cc (Layout::segment_precedes): Don't assert failure if a
688         --section-start option was seen.
689         * options.h (General_options::any_section_start): New function.
690
691 2011-10-18  David S. Miller  <davem@davemloft.net>
692
693         PR binutils/13301
694         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
695         member to track relocation locations that have moved during TLS
696         reloc optimizations.
697         (Target_sparc::Relocate::Relocate): Initialize to NULL.
698         (Target_sparc::Relocate::relocate): Adjust view down by 4
699         bytes if it matches reloc_adjust_addr_.
700         (Target_sparc::Relocate::relocate_tls): Always move the
701         __tls_get_addr call delay slot instruction forward 4 bytes when
702         performing relaxation.
703
704 2011-10-18  Cary Coutant  <ccoutant@google.com>
705
706         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
707         (Output_file::map_no_anonymous): Check for non-zero
708         return code from posix_fallocate.
709
710 2011-10-17  Cary Coutant  <ccoutant@google.com>
711
712         PR gold/13245
713         * plugin.cc (is_visible_from_outside): Check for symbols
714         referenced from dynamic objects.
715         * resolve.cc (Symbol_table::resolve): Don't count references
716         from dynamic objects as references from real ELF files.
717         * testsuite/plugin_test_2.sh: Adjust expected result.
718
719 2011-10-17  Cary Coutant  <ccoutant@google.com>
720
721         * gold.cc: Include timer.h.
722         (queue_middle_tasks): Stamp time.
723         (queue_final_tasks): Likewise.
724         * main.cc (main): Store timer in parameters.  Print timers
725         for each pass.
726         * parameters.cc (Parameters::Parameters): Initialize timer_.
727         (Parameters::set_timer): New function.
728         (set_parameters_timer): New function.
729         * parameters.h (Parameters::set_timer): New function.
730         (Parameters::timer): New function.
731         (Parameters::timer_): New data member.
732         (set_parameters_timer): New function.
733         * timer.cc (Timer::stamp): New function.
734         (Timer::get_pass_time): New function.
735         * timer.h (Timer::stamp): New function.
736         (Timer::get_pass_time): New function.
737         (Timer::pass_times_): New data member.
738
739 2011-10-17  Cary Coutant  <ccoutant@google.com>
740
741         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
742         task for members of lib groups.
743
744 2011-10-17  Cary Coutant  <ccoutant@google.com>
745
746         PR gold/13288
747         * fileread.cc (File_read::find_view): Add assert.
748         (File_read::make_view): Move bounds check (replace with assert)...
749         (File_read::find_or_make_view): ... to here.
750
751 2011-10-12  Cary Coutant  <ccoutant@google.com>
752
753         * output.cc (Output_file::open_base_file): Handle case where
754         ::read returns less than requested size.
755
756 2011-10-10  Cary Coutant  <ccoutant@google.com>
757
758         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
759         Initialize defined_count_.
760         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
761         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
762         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
763         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
764         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
765         * incremental.h (Sized_relobj_incr::defined_count_): New data
766         member.
767         (Sized_incr_dynobj::defined_count_): New data member.
768         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
769         Return zeroes instead of internal error.
770
771 2011-10-10  Cary Coutant  <ccoutant@google.com>
772
773         PR gold/13249
774         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
775         (Output_reloc::symbol_value): Return PLT offset if flag is set.
776         * output.h (class Output_reloc): Add use_plt_offset flag.
777         (Output_reloc::type_): Adjust size of bit field.
778         (Output_reloc::use_plt_offset_): New bit field.
779         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
780         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
781         flag.  Adjust all callers.
782         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
783         creating RELATIVE relocations.
784
785 2011-10-10  Nick Clifton  <nickc@redhat.com>
786
787         * po/es.po: Updated Spanish translation.
788         * po/fi.po: Updated Finnish translation.
789
790 2011-10-03   Diego Novillo  <dnovillo@google.com>
791
792         * options.cc (parse_uint): Fix dereference of RETVAL.
793
794 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
795
796         * layout.h (section_order_map_): New member.
797         (get_section_order_map): New member function.
798         * output.cc (Output_section::add_input_section): Check for patterns
799         only when --section-ordering-file is specified.
800         * gold.cc (queue_middle_tasks): Delay updating order of sections till
801         output_sections have been formed.
802         * layout.cc (Layout_Layout): Initialize section_order_map_.
803         * plugin.cc (update_section_order): Store order in order_map. Do not
804         update the order.
805         * testsuite/Makefile.am: Add test case for plugin_final_layout.
806         * testsuite/Makefile.in: Regenerate.
807         * testsuite/plugin_section_order.c: New file.
808         * testsuite/plugin_final_layout.cc: New file.
809         * testsuite/plugin_final_layout.sh: New file.
810
811 2011-09-29  Cary Coutant  <ccoutant@google.com>
812
813         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
814         Check for NULL.
815         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
816         symbols during incremental update.
817         (Symbol_table::add_from_dynobj): Likewise.
818
819 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
820             Ian Lance Taylor  <iant@google.com>
821
822         * symtab.cc (Symbol_table::define_special_symbol): Always
823         canonicalize version string.
824
825 2011-09-26  Cary Coutant  <ccoutant@google.com>
826
827         * gold.cc (queue_initial_tasks): Move option checks ...
828         * options.cc (General_options::finalize): ... to here. Disable
829         some options; make others fatal.
830
831 2011-09-26  Cary Coutant  <ccoutant@google.com>
832
833         gcc PR lto/47247
834         * plugin.cc (get_symbols_v2): New function.
835         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
836         (is_referenced_from_outside): New function.
837         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
838         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
839         (get_symbols): Pass version parameter.
840         (get_symbols_v2): New function.
841         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
842         parameter.
843         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
844         (onload): Add LDPT_GET_SYMBOLS_V2.
845         (all_symbols_read_hook): Use get_symbols_v2; check for
846         LDPR_PREVAILING_DEF_IRONLY_EXP.
847         * testsuite/plugin_test_3.sh: Update expected results.
848
849 2011-09-23  Simon Baldwin  <simonb@google.com>
850
851         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
852         configuration options.
853         * configure: Regenerate.
854         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
855         * Makefile.in: Regenerate.
856         * testsuite/Makefile.in: Regenerate.
857
858 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
859
860         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
861
862 2011-09-19  Cary Coutant  <ccoutant@google.com>
863
864         * incremental.cc (can_incremental_update): Fix typo in comment.
865         * incremental.h (can_incremental_update): Likewise.
866
867 2011-09-18  Cary Coutant  <ccoutant@google.com>
868
869         * incremental.cc (can_incremental_update): New function.
870         * incremental.h (can_incremental_update): New function.
871         * layout.cc (Layout::init_fixed_output_section): Call it.
872         (Layout::make_output_section): Don't allow patch space in .eh_frame.
873         * object.cc (Sized_relobj_file::do_layout): Call
874         can_incremental_update.
875
876 2011-09-13  Cary Coutant  <ccoutant@google.com>
877
878         * configure.ac: Check for glibc support for gnu_indirect_function
879         support with static linking, setting automake conditional
880         IFUNC_STATIC.
881         * Makefile.in: Regenerate.
882         * configure: Regenerate.
883
884         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
885         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
886         for IFUNC_STATIC.
887         * testsuite/Makefile.in: Regenerate.
888
889 2011-09-13  Cary Coutant  <ccoutant@google.com>
890
891         * incremental.cc (Sized_relobj_incr::do_layout): Call
892         report_comdat_group for kept comdat sections.
893         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
894         * testsuite/Makefile.in: Regenerate.
895         * testsuite/incr_comdat_test_1.cc: New source file.
896         * testsuite/incr_comdat_test_2_v1.cc: New source file.
897         * testsuite/incr_comdat_test_2_v2.cc: New source file.
898         * testsuite/incr_comdat_test_2_v3.cc: New source file.
899
900 2011-09-13  Ian Lance Taylor  <iant@google.com>
901
902         * object.cc (Sized_relobj_file::do_layout): Remove unused local
903         variable external_symbols_offset.
904
905 2011-09-12  Ian Lance Taylor  <iant@google.com>
906
907         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
908         triggered if object has no symbols.
909
910 2011-09-09  David S. Miller  <davem@davemloft.net>
911
912         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
913         (Output_fill_debug_line::do_write): Likewise.
914
915 2011-08-29  Cary Coutant  <ccoutant@google.com>
916
917         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
918         casts to match formatting specs.
919         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
920
921 2011-08-26  Cary Coutant  <ccoutant@google.com>
922
923         * layout.cc (Free_list::allocate): Provide guarantee of minimum
924         remaining hole size when allocating.
925         (Layout::make_output_section): Set fill methods for debug sections.
926         * layout.h (Free_list::Free_list_node): Move from private to
927         public.
928         (Free_list::set_min_hole_size): New function.
929         (Free_list::begin, Free_list::end): New functions.
930         (Free_list::min_hole_): New data member.
931         * output.cc: Include dwarf.h.
932         (Output_fill_debug_info::do_minimum_hole_size): New function.
933         (Output_fill_debug_info::do_write): New function.
934         (Output_fill_debug_line::do_minimum_hole_size): New function.
935         (Output_fill_debug_line::do_write): New function.
936         (Output_section::Output_section): Initialize new data member.
937         (Output_section::set_final_data_size): Ensure patch space is larger
938         than minimum hole size.
939         (Output_section::do_write): Fill holes in debug sections.
940         * output.h (Output_fill): New class.
941         (Output_fill_debug_info): New class.
942         (Output_fill_debug_line): New class.
943         (Output_section::set_free_space_fill): New function.
944         (Output_section::free_space_fill_): New data member.
945         * testsuite/Makefile.am (incremental_test_3): Add
946         --incremental-patch option.
947         (incremental_test_4): Likewise.
948         (incremental_test_5): Likewise.
949         (incremental_test_6): Likewise.
950         (incremental_copy_test): Likewise.
951         (incremental_common_test_1): Likewise.
952         * testsuite/Makefile.in: Regenerate.
953
954 2011-08-26  Nick Clifton  <nickc@redhat.com>
955
956         * po/es.po: Updated Spanish translation.
957
958 2011-08-01  Cary Coutant  <ccoutant@google.com>
959
960         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
961         * gold/testsuite/Makefile.in: Regenerate.
962         * gold/testsuite/justsyms_exec.c: New source file.
963         * gold/testsuite/justsyms_lib.c: New source file.
964
965 2011-08-01  Cary Coutant  <ccoutant@google.com>
966
967         * layout.cc (Layout::set_segment_offsets): Don't realign text
968         segment if -Ttext was specified.
969         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
970         file type.
971         * object.h (Sized_relobj_file::e_type): New function.
972         (Sized_relobj_file::e_type_): New data member.
973         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
974         base address for ET_EXEC files.
975         * target.cc (Target::do_make_elf_object_implementation): Allow
976         ET_EXEC files with --just-symbols option.
977
978 2011-07-28  Cary Coutant  <ccoutant@google.com>
979
980         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
981         Add thread_number parameter.
982         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
983         * workqueue-threads.cc
984         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
985         current thread if its thread number is greater than desired thread
986         count.
987         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
988         Add thread_number parameter.
989         (Workqueue::should_cancel_thread): Likewise.
990         (Workqueue::find_runnable_or_wait): Pass thread_number to
991         should_cancel_thread.
992         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
993         parameter.
994
995 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
996
997         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
998         only after checking if it cannot be forced local.
999         * symtab.h (is_externally_visible): Check if the symbol is not forced
1000         local.
1001
1002 2011-07-15  Ian Lance Taylor  <iant@google.com>
1003
1004         * options.h (class General_options): Add --print-output-format.
1005         Move -EL next to -EB, for  better --help output.
1006         * target-select.cc: Include <cstdio>, "options.h", and
1007         "parameters.h".
1008         (Target_selector::do_target_bfd_name): New function.
1009         (print_output_format): New function.
1010         * target-select.h (class Target_selector): Update declarations.
1011         (Target_selector::target_bfd_name): New function.
1012         (print_output_format): Declare.
1013         * main.cc: Include "target-select.h".
1014         (main): Handle --print-output-format.
1015         * gold.cc: Include "target-select.h".
1016         (queue_initial_tasks): Handle --print-output-format when there are
1017         no input files.
1018         * parameters.cc (parameters_force_valid_target): Give a better
1019         error message if -EB/-EL does not match target.
1020         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1021         function.
1022
1023 2011-07-15  Ian Lance Taylor  <iant@google.com>
1024
1025         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1026         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1027         (Output_data_plt_i386::do_write): Write address of .dynamic
1028         section to first entry in .got.plt section.
1029         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1030         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1031         Initialize layout_.
1032         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1033         section to first entry in .got.plt section.
1034         * layout.h (Layout::dynamic_section): New function.
1035
1036 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1037
1038         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1039         to claim_file call.
1040         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1041         input_section_position_, and input_section_glob_.
1042         (read_layout_from_file): Call function section_ordering_specified.
1043         * layout.h (is_section_ordering_specified): New function.
1044         (section_ordering_specified): New function.
1045         (section_ordering_specified_): New boolean member.
1046         * main.cc(main): Call load_plugins after layout object is defined.
1047         * output.cc (Output_section::add_input_section): Use
1048         function section_ordering_specified to check if section ordering is
1049         needed.
1050         * output.cc (Output_section::add_relaxed_input_section): Use
1051         function section_ordering_specified to check if section ordering is
1052         needed.
1053         (Output_section::update_section_layout): New function.
1054         (Output_section::sort_attached_input_sections): Check if input section
1055         must be reordered.
1056         * output.h (Output_section::update_section_layout): New function.
1057         * plugin.cc (get_section_count): New function.
1058         (get_section_type): New function.
1059         (get_section_name): New function.
1060         (get_section_contents): New function.
1061         (update_section_order): New function.
1062         (allow_section_ordering): New function.
1063         (Plugin::load): Add the new interfaces to the transfer vector.
1064         (Plugin_manager::load_plugins): New parameter.
1065         (Plugin_manager::all_symbols_read): New parameter.
1066         (Plugin_manager::claim_file): New parameter. Save the elf object for
1067         unclaimed objects.
1068         (Plugin_manager::get_elf_object): New function.
1069         (Plugin_manager::get_view): Change to directly use the bool to check
1070         if get_view is called from claim_file_hook.
1071         * plugin.h (input_objects): New function
1072         (Plugin__manager::load_plugins): New parameter.
1073         (Plugin_manager::claim_file): New parameter.
1074         (Plugin_manager::get_elf_object): New function.
1075         (Plugin_manager::in_claim_file_handler): New function.
1076         (Plugin_manager::in_claim_file_handler_): New member.
1077         (layout): New function.
1078         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1079         handler with an extra parameter. Make the elf object before calling
1080         claim_file handler.
1081         * testsuite/plugin_test.c (get_section_count): New function pointer.
1082         (get_section_type): New function pointer.
1083         (get_section_name): New function pointer.
1084         (get_section_contents): New function pointer.
1085         (update_section_order): New function pointer.
1086         (allow_section_ordering): New function pointer.
1087         (onload): Check if the new interfaces exist.
1088
1089 2011-07-13  Ian Lance Taylor  <iant@google.com>
1090
1091         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1092         relro section.
1093         * x86_64.cc (Target_x86_64::got_section): Likewise.
1094         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1095         (relro_now_test_SOURCES): New variable.
1096         (relro_now_test_DEPENDENCIES): New variable.
1097         (relro_now_test_LDFLAGS): New variable.
1098         (relro_now_test_LDADD): New variable.
1099         (relro_now_test.so): New target.
1100         * testsuite/Makefile.in: Rebuild.
1101
1102 2011-07-12  Ian Lance Taylor  <iant@google.com>
1103
1104         PR gold/12980
1105         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1106         GLOB_DAT relocation rather than a RELATIVE relocation for a
1107         protected symbol when creating a shared library.
1108         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1109         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1110         * testsuite/protected_main_1.cc (main): Test that protected
1111         function has same address.
1112
1113 2011-07-11  Ian Lance Taylor  <iant@google.com>
1114
1115         PR gold/12979
1116         * options.h (class General_options): Add -Bgroup.
1117         * options.cc (General_options::finalize): If -Bgroup is set,
1118         default to --unresolved-symbols=report-all.
1119         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1120         * target-reloc.h (issue_undefined_symbol_error): Handle
1121         --unresolved-symbols=report-all.
1122
1123 2011-07-08  Ian Lance Taylor  <iant@google.com>
1124
1125         PR gold/11985
1126         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1127         if linker script discards key sections.
1128         (Layout::create_dynamic_symtab): Likewise.
1129         (Layout::assign_local_dynsym_offsets): Likewise.
1130         (Layout::sized_create_version_sections): Likewise.
1131         (Layout::create_interp): Likewise.
1132         (Layout::finish_dynamic_section): Likewise.
1133         (Layout::set_dynamic_symbol_size): Likewise.
1134
1135 2011-07-08  Ian Lance Taylor  <iant@google.com>
1136
1137         PR gold/12386
1138         * options.h (class General_options): Add --unresolved-symbols.
1139         * target-reloc.h (issue_undefined_symbol_error): Check
1140         --unresolved-symbols.  Add comments.
1141
1142 2011-07-08  Ian Lance Taylor  <iant@google.com>
1143
1144         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1145         expression more complex.
1146
1147 2011-07-08  Ian Lance Taylor  <iant@google.com>
1148
1149         PR gold/11317
1150         * target-reloc.h (issue_undefined_symbol_error): New inline
1151         function, broken out of relocate_section.
1152         (relocate_section): Call issue_undefined_symbol_error.
1153         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1154         there is no TLS segment if we are about to issue an undefined
1155         symbol error.
1156         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1157
1158 2011-07-08  Ian Lance Taylor  <iant@google.com>
1159
1160         PR gold/12279
1161         * resolve.cc (Symbol_table::should_override): Add fromtype
1162         parameter.  Change all callers.  Give error when linking together
1163         TLS and non-TLS symbol.
1164         (Symbol_table::should_override_with_special): Add fromtype
1165         parameter.  Change all callers.
1166         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1167         there is no TLS segment if we have reported some errors.
1168         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1169
1170 2011-07-08  Ian Lance Taylor  <iant@google.com>
1171
1172         PR gold/12372
1173         * target.h (Target::plt_address_for_global): New function.
1174         (Target::plt_address_for_local): New function.
1175         (Target::plt_section_for_global): Remove.
1176         (Target::plt_section_for_local): Remove.
1177         (Target::do_plt_address_for_global): New virtual function.
1178         (Target::do_plt_address_for_local): New virtual function.
1179         (Target::do_plt_section_for_global): Remove.
1180         (Target::do_plt_section_for_local): Remove.
1181         (Target::register_global_plt_entry): Add Symbol_table and Layout
1182         parameters.
1183         * output.cc (Output_data_got::Got_entry::write): Use
1184         plt_address_for_global and plt_address_for_local.
1185         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1186         address of output section.
1187         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1188         got_irelative_, and irelative_count_ fields.  Update
1189         declarations.
1190         (Output_data_plt_i386::has_irelative_section): New function.
1191         (Output_data_plt_i386::entry_count): Add irelative_count_.
1192         (Output_data_plt_i386::set_final_data_size): Likewise.
1193         (class Target_i386): Add got_irelative_ and rel_irelative_
1194         fields.  Update declarations.
1195         (Target_i386::Target_i386): Initialize new fields.
1196         (Target_i386::do_plt_address_for_global): New function replacing
1197         do_plt_section_for_global.
1198         (Target_i386::do_plt_address_for_local): New function replacing
1199         do_plt_section_for_local.
1200         (Target_i386::got_section): Create got_irelative_.
1201         (Target_i386::rel_irelative_section): New function.
1202         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1203         fields.  Don't define __rel_iplt_{start,end}.
1204         (Output_data_plt_i386::add_entry): Add symtab and layout
1205         parameters.  Change all callers.  Use different PLT and GOT for
1206         IFUNC symbols.
1207         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1208         layout parameters.  Change all callers.  Use different PLT and
1209         GOT.
1210         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1211         (Output_data_plt_i386::rel_irelative): New function.
1212         (Output_data_plt_i386::address_for_global): New function.
1213         (Output_data_plt_i386::address_for_local): New function.
1214         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1215         IRELATIVE GOT when changing IFUNC GOT entries.
1216         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1217         reloc.
1218         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1219         if we didn't create an IRELATIVE GOT.
1220         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1221         plt_address_for_local.
1222         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1223         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1224         got_irelative_, and irelative_count_ fields.  Update
1225         declarations.
1226         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1227         Initialize new fields.  Remove symtab parameter.  Change all
1228         callers.
1229         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1230         irelative_count_.
1231         (Output_data_plt_x86_64::has_irelative_section): New function.
1232         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1233         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1234         fields.  Update declarations.
1235         (Target_x86_64::Target_x86_64): Initialize new fields.
1236         (Target_x86_64::do_plt_address_for_global): New function replacing
1237         do_plt_section_for_global.
1238         (Target_x86_64::do_plt_address_for_local): New function replacing
1239         do_plt_section_for_local.
1240         (Target_x86_64::got_section): Create got_irelative_.
1241         (Target_x86_64::rela_irelative_section): New function.
1242         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1243         all callers.  Don't create __rel_iplt_{start,end}.
1244         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1245         parameters.  Change all callers.  Use different PLT and GOT for
1246         IFUNC symbols.
1247         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1248         layout parameters.  Change all callers.  Use different PLT and
1249         GOT.
1250         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1251         parameters.  Change all callers.  Use different PLT and GOT for
1252         IFUNC symbols.
1253         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1254         (Output_data_plt_x86_64::rela_irelative): New function.
1255         (Output_data_plt_x86_64::address_for_global): New function.
1256         (Output_data_plt_x86_64::address_for_local): New function.
1257         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1258         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1259         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1260         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1261         parameters.
1262         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1263         reloc.
1264         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1265         symbols if we didn't create an IRELATIVE GOT.
1266         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1267         plt_address_for_local.
1268         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1269         * testsuite/ifuncvar1.c: New test file.
1270         * testsuite/ifuncvar2.c: New test file.
1271         * testsuite/ifuncvar3.c: New test file.
1272         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1273         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1274         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1275         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1276         * testsuite/Makefile.in: Rebuild.
1277
1278 2011-07-07  Cary Coutant  <ccoutant@google.com>
1279
1280         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1281         (two_file_test_1_ndebug.o): Likewise.
1282         (two_file_test_1b_ndebug.o): Likewise.
1283         (two_file_test_2_ndebug.o): Likewise.
1284         (two_file_test_main_ndebug.o): Likewise.
1285         (incremental_test_2): Link with no-debug versions.
1286
1287 2011-07-06  Cary Coutant  <ccoutant@google.com>
1288
1289         * gold/incremental.cc
1290         (Output_section_incremental_inputs::write_info_blocks): Check for
1291         hidden and internal symbols.
1292
1293 2011-07-06  Cary Coutant  <ccoutant@google.com>
1294
1295         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1296         Check disposition for startup file.
1297         (Incremental_inputs::report_command_line): Ignore
1298         --incremental-startup-unchanged option.
1299         * options.cc (General_options::parse_incremental_startup_unchanged):
1300         New function.
1301         (General_options::General_options): Initialize new data member.
1302         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1303         (General_options): Add --incremental-startup-unchanged option.
1304         (General_options::incremental_startup_disposition): New function.
1305         (General_options::incremental_startup_disposition_): New data member.
1306
1307 2011-07-06  Cary Coutant  <ccoutant@google.com>
1308
1309         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1310         input file index to Script_info ctor.
1311         (Sized_incremental_binary::do_file_has_changed): Find the
1312         command-line argument for files named in scripts.
1313         * incremental.h (Script_info::Script_info): New ctor
1314         with input file index.
1315         (Script_info::input_file_index): New function.
1316         (Script_info::input_file_index_): New data member.
1317         (Incremental_binary::get_library): Add const.
1318         (Incremental_binary::get_script_info): Add const.
1319         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1320         * testsuite/Makefile.am (incremental_test_5): New test case.
1321         (incremental_test_6): New test case.
1322         * testsuite/Makefile.in: Regenerate.
1323
1324 2011-07-06  Cary Coutant  <ccoutant@google.com>
1325
1326         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1327         debug output when command lines differ.
1328
1329 2011-07-06  Cary Coutant  <ccoutant@google.com>
1330
1331         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1332         --incremental-patch option.
1333         * layout.cc (Free_list::allocate): Extend allocation beyond original
1334         end if enabled.
1335         (Layout::make_output_section): Mark sections that should get
1336         patch space.
1337         * options.cc (parse_percent): New function.
1338         * options.h (parse_percent): New function.
1339         (DEFINE_percent): New macro.
1340         (General_options): Add --incremental-patch option.
1341         * output.cc (Output_section::Output_section): Initialize new data
1342         members.
1343         (Output_section::add_input_section): Print section name when out
1344         of patch space.
1345         (Output_section::add_output_section_data): Likewise.
1346         (Output_section::set_final_data_size): Add patch space when
1347         doing --incremental-full.
1348         (Output_section::do_reset_address_and_file_offset): Remove patch
1349         space.
1350         (Output_segment::set_section_list_addresses): Print debug output
1351         only if --incremental-update.
1352         * output.h (Output_section::set_is_patch_space_allowed): New function.
1353         (Output_section::is_patch_space_allowed_): New data member.
1354         (Output_section::patch_space_): New data member.
1355         * parameters.cc (Parameters::incremental_full): New function.
1356         * parameters.h (Parameters::incremental_full): New function
1357         * testsuite/Makefile.am (incremental_test_2): Add test for
1358         --incremental-patch option.
1359         * testsuite/Makefile.in: Regenerate.
1360         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1361         (t18): Remove function body.
1362
1363 2011-07-05  Doug Kwan  <dougkwan@google.com>
1364
1365         PR gold/12771
1366         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1367         Arm_Address type for relocation result.
1368         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1369         overflow check.
1370         (Arm_relocate_functions::abs32): Use unaligned access.
1371         (Arm_relocate_functions::rel32): Ditto.
1372         (Arm_relocate_functions::prel31): Ditto.
1373         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1374         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1375         static data relocations.
1376         * testsuite/Makefile.in: Regnerate.
1377         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1378
1379 2011-07-05  Ian Lance Taylor  <iant@google.com>
1380
1381         PR gold/12392
1382         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1383         symbols if necessary.
1384         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1385
1386 2011-07-05  Ian Lance Taylor  <iant@google.com>
1387
1388         PR gold/12952
1389         * resolve.cc (Symbol::override_base_with_special): Simply override
1390         version with special symbol version, ignoring previous version.
1391
1392 2011-07-05  Ian Lance Taylor  <iant@google.com>
1393
1394         * object.cc (Sized_relobj_file::include_section_group): Add
1395         information to comment about signature location.
1396
1397 2011-07-02  Ian Lance Taylor  <iant@google.com>
1398
1399         PR gold/12957
1400         * options.h (class General_options): Add -f and -F.
1401         * options.cc (General_options::finalize): Fatal error if -f/-F
1402         are used without -shared.
1403         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1404
1405 2011-07-02  Ian Lance Taylor  <iant@google.com>
1406
1407         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1408
1409 2011-07-01  Ian Lance Taylor  <iant@google.com>
1410
1411         PR gold/12525
1412         PR gold/12952
1413         * resolve.cc (Symbol::override_base_with_special): Don't override
1414         the version if the overriding symbol has a different name.
1415         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1416         all callers.  If we give an error about an undefined version,
1417         define the base version if necessary.
1418         * dynobj.h (class Versions): Update declaration.
1419         * testsuite/weak_alias_test_5.cc: New file.
1420         * testsuite/weak_alias_test.script: New file.
1421         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1422         and versioned_alias have the right value, and call t2.
1423         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1424         weak_alias_test_5.so.
1425         (weak_alias_test_LDADD): Likewise.
1426         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1427         * testsuite/Makefile.in: Rebuild.
1428
1429 2011-07-01  Ian Lance Taylor  <iant@google.com>
1430
1431         PR gold/12525
1432         * options.h (class General_options): Support -z notext.
1433         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1434         -Wl,-z,notext.
1435         (two_file_shared_nonpic.so): Likewise.
1436         (two_file_shared_mixed.so): Likewise.
1437         (two_file_shared_mixed_1.so): Likewise.
1438         (weak_undef_lib_nonpic.so): Likewise.
1439         (alt/weak_undef_lib_nonpic.so): Likewise.
1440         (tls_test_shared_nonpic.so): Likewise.
1441         * testsuite/Makefile.in: Rebuild.
1442
1443 2011-07-01  Ian Lance Taylor  <iant@google.com>
1444
1445         PR gold/12525
1446         * configure.ac: Test whether static linking works, setting
1447         the automake conditional HAVE_STATIC.
1448         * testsuite/Makefile.am: Disable tests using -static if
1449         HAVE_STATIC is not true.
1450         * configure, testsuite/Makefile.in: Rebuild.
1451
1452 2011-07-01  Ian Lance Taylor  <iant@google.com>
1453
1454         PR gold/12525
1455         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1456         Assert if we see DW_EH_PE_indirect.
1457         * target.h (Target::ehframe_datarel_base): New function.
1458         (Target::do_ehframe_datarel_base): New target function.
1459         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1460         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1461         function.
1462
1463 2011-07-01  Ian Lance Taylor  <iant@google.com>
1464
1465         PR gold/12571
1466         * options.h (class General_options): Add
1467         --ld-generated-unwind-info.
1468         * ehframe.cc (Fde::write): Add address parameter.  Change all
1469         callers.  If associated with PLT, fill in address and size.
1470         (Cie::set_output_offset): Only add merge mapping if there is an
1471         object.
1472         (Cie::write): Add address parameter.  Change all callers.
1473         (Eh_frame::add_ehframe_for_plt): New function.
1474         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1475         input_offset_ fields into union u_, with new plt field.
1476         (Fde::Fde): Adjust for new union field.
1477         (Fde::Fde) [Output_data version]: New constructor.
1478         (Fde::add_mapping): Only add merge mapping if there is an object.
1479         (class Cie): Update declarations.
1480         (class Eh_frame): Declare add_ehframe_for_plt.
1481         * layout.cc (Layout::layout_eh_frame): Break out code into
1482         make_eh_frame_section, and call it.
1483         (Layout::make_eh_frame_section): New function.
1484         (Layout::add_eh_frame_for_plt): New function.
1485         * layout.h (class Layout): Update declarations.
1486         * merge.cc (Merge_map::add_mapping): Add assertion.
1487         * i386.cc: Include "dwarf.h".
1488         (class Output_data_plt_i386): Make first_plt_entry,
1489         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1490         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1491         and plt_eh_frame_fde.
1492         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1493         boundary.  Call add_eh_frame_for_plt if appropriate.
1494         * x86_64.cc: Include "dwarf.h".
1495         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1496         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1497         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1498         and plt_eh_frame_fde.
1499         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1500         appropriate.
1501
1502 2011-06-29  Ian Lance Taylor  <iant@google.com>
1503
1504         PR gold/12629
1505         * object.cc (Sized_relobj_file::layout_section): Change shdr
1506         parameter to be const.
1507         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1508         out of do_layout.
1509         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1510         appropriate.  Call layout_eh_frame_section.
1511         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1512         sections.
1513         * object.h (class Sized_relobj_file): Update declarations.
1514
1515 2011-06-29  Ian Lance Taylor  <iant@google.com>
1516
1517         PR gold/12652
1518         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1519         modifier.
1520         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1521
1522 2011-06-29  Ian Lance Taylor  <iant@google.com>
1523
1524         PR gold/12675
1525         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1526         SHT_X86_64_UNWIND.
1527         * layout.cc (Layout::layout_eh_frame): Likewise.
1528
1529 2011-06-29  Ian Lance Taylor  <iant@google.com>
1530
1531         PR gold/12695
1532         * layout.cc (Layout::symtab_section_shndx): New function.
1533         * layout.h (class Layout): Declare symtab_section_shndx.
1534         * output.cc (Output_section::write_header): Call it.
1535
1536 2011-06-29  Ian Lance Taylor  <iant@google.com>
1537
1538         PR gold/12818
1539         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1540         symbols which are not used in a relocation.
1541
1542 2011-06-28  Ian Lance Taylor  <iant@google.com>
1543
1544         PR gold/12898
1545         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1546         script create indistinguishable segments.
1547         (Layout::set_segment_offsets): Use stable_sort when sorting
1548         segments.  Pass this to Compare_segments constructor.
1549         * layout.h (class Layout): Make segment_precedes non-static.
1550         (class Compare_segments): Change from struct to class.  Add
1551         layout_ field.  Add constructor.
1552         * script-sections.cc
1553         (Script_sections::attach_sections_using_phdrs_clause): Rename
1554         local orphan to is_orphan.  Don't report failure to put empty
1555         section in segment.  On attachment failure, report name of
1556         section, and attach to first PT_LOAD segment.
1557
1558 2011-06-28  Ian Lance Taylor  <iant@google.com>
1559
1560         PR gold/12934
1561         * target-select.cc (Target_selector::Target_selector): Add
1562         emulation parameter.  Change all callers.
1563         (select_target_by_bfd_name): Rename from select_target_by_name.
1564         Change all callers.
1565         (select_target_by_emulation): New function.
1566         (supported_emulation_names): New function.
1567         * target-select.h (class Target_selector): Add emulation_ field.
1568         Update declarations.
1569         (Target_selector::recognize_by_bfd_name): Rename from
1570         recognize_by_name.  Change all callers.
1571         (Target_selector::supported_bfd_names): Rename from
1572         supported_names.  Change all callers.
1573         (Target_selector::recognize_by_emulation): New function.
1574         (Target_selector::supported_emulations): New function.
1575         (Target_selector::emulation): New function.
1576         (Target_selector::do_recognize_by_bfd_name): Rename from
1577         do_recognize_by_name.  Change all callers.
1578         (Target_selector::do_supported_bfd_names): Rename from
1579         do_supported_names.  Change all callers.
1580         (Target_selector::do_recognize_by_emulation): New function.
1581         (Target_selector::do_supported_emulations): New function.
1582         (select_target_by_bfd_name): Change name in declaration.
1583         (select_target_by_emulation): Declare.
1584         (supported_emulation_names): Declare.
1585         * parameters.cc (parameters_force_valid_target): Try to find
1586         target based on emulation from -m option.
1587         * options.h (class General_options): Change doc string for -m.
1588         * options.cc (help): Print emulations.
1589         (General_options::parse_V): Likewise.
1590         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1591         Add emulation parameter.  Change all callers.
1592
1593 2011-06-28  Ian Lance Taylor  <iant@google.com>
1594
1595         * target.h (class Target): Add osabi_ field.
1596         (Target::osabi): New function.
1597         (Target::set_osabi): New function.
1598         (Target::Target): Initialize osabi_.
1599         (Target::do_adjust_elf_header): Make pure virtual.
1600         (Sized_target::do_adjust_elf_header): Declare.
1601         * target.cc (Sized_target::do_adjust_elf_header): New function.
1602         (class Sized_target): Instantiate all versions.
1603         * freebsd.h (class Target_freebsd): Remove.
1604         (Target_selector_freebsd::do_recognize): Call set_osabi on
1605         Target.
1606         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1607         (Target_selector_freebsd::set_osabi): Remove.
1608         * i386.cc (class Target_i386): Inherit from Sized_target rather
1609         than Target_freebsd.
1610         * x86_64.cc (class Target_x86_64): Likewise.
1611
1612 2011-06-28  Ian Lance Taylor  <iant@google.com>
1613
1614         * target.h (Target::can_check_for_function_pointers): Rewrite.
1615         Make non-virtual.
1616         (Target::can_icf_inline_merge_sections): Likewise.
1617         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1618         (Target::Target_info): Add can_icf_inline_merge_sections field.
1619         (Target::do_can_check_for_function_pointers): New virtual
1620         function.
1621         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1622         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1623         from can_check_for_function_pointers, move in file.
1624         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1625         section_may_have_icf_unsafe_poineters, move in file.
1626         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1627         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1628         Rename from can_check_for_function_pointers, move in file.
1629         (Target_i386::can_icf_inline_merge_sections): Remove.
1630         (Target_i386::i386_info): Initialize
1631         can_icf_inline_merge_sections.
1632         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1633         Initialize can_icf_inline_merge_sections.
1634         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1635         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1636         Rename from can_check_for_function_pointers, move in file.
1637         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1638         (Target_x86_64::x86_64_info): Initialize
1639         can_icf_inline_merge_sections.
1640         * testsuite/testfile.cc (Target_test::test_target_info):
1641         Likewise.
1642         * icf.cc (get_section_contents): Correct formatting.
1643
1644 2011-06-27  Ian Lance Taylor  <iant@google.com>
1645
1646         * symtab.cc (Symbol::versioned_name): New function.
1647         (Symbol_table::add_to_final_symtab): Use versioned_name when
1648         appropriate.
1649         (Symbol_table::sized_write_symbol): Likewise.
1650         * symtab.h (class Symbol): Declare versioned_name.
1651         * stringpool.h (class Stringpool_template): Add variant of add
1652         which takes a std::basic_string.
1653         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1654         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1655         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1656         (ver_test_12.o): New target.
1657         * testsuite/Makefile.in: Rebuild.
1658
1659 2011-06-27  Doug Kwan  <dougkwan@google.com>
1660
1661         * arm.cc (Arm_relocate_functions::thm_jump8,
1662         Arm_relocate_functions::thm_jump11): Use a wider signed
1663         type to compute offset.
1664         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1665         arm_thm_jump8.
1666         * testsuite/Makefile.in: Regenerate.
1667         * testsuite/arm_branch_in_range.sh: Check test results of
1668         arm_thm_jump11 and arm_thm_jump8.
1669         * testsuite/arm_thm_jump11.s: New test source file.
1670         * testsuite/arm_thm_jump11.t: New linker script.
1671         * testsuite/arm_thm_jump8.s: New test source file.
1672         * testsuite/arm_thm_jump8.t: New linker script.
1673
1674 2011-06-24  Ian Lance Taylor  <iant@google.com>
1675
1676         * layout.cc: Include "object.h".
1677         (ctors_sections_in_init_array): New static variable.
1678         (Layout::is_ctors_in_init_array): New function.
1679         (Layout::layout): Add entry to ctors_sections_in_init_array if
1680         appropriate.
1681         * layout.h (class Layout): Declare is_ctors_in_init_array.
1682         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1683         is_ctors_reverse_view is set.
1684         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1685         all callers.  Set is_ctors_reverse_view field of View_size.
1686         (Sized_relobj_file::reverse_words): New function.
1687         * object.h (Sized_relobj_file::View_size): Add
1688         is_ctors_reverse_view field.
1689         (class Sized_relobj_file): Update declarations.
1690         * testsuite/initpri3.c: New test.
1691         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1692         initpri3b.
1693         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1694         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1695         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1696         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1697         * testsuite/Makefile.in: Rebuild.
1698
1699 2011-06-24  Cary Coutant  <ccoutant@google.com>
1700
1701         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1702         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1703         (debug_msg_cdebug.err): New targets.
1704         * testsuite/Makefile.in: Regenerate.
1705         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1706         Fix checks for link with shared library.
1707
1708 2011-06-24  Doug Kwan  <dougkwan@google.com>
1709
1710         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1711         skip empty text sections.
1712         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1713
1714 2011-06-22  Ian Lance Taylor  <iant@google.com>
1715
1716         PR gold/12910
1717         * options.h (class General_options): Add --ctors-in-init-array.
1718         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1719         friends as SHT_PROGBITS for merging sections.
1720         (Layout::layout): Remove special handling of .init_array and
1721         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1722         and .dtors if ctors_in_init_array.
1723         (Layout::make_output_section): Force correct section types for
1724         .init_array and friends.  Don't sort if doing relocatable link,
1725         Don't sort .ctors and .dtors if ctors_in_init_array.
1726         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1727         (Layout::output_section_name): Add relobj parameter.  Change all
1728         callers.  Handle .ctors. and .dtors. in code rather than table.
1729         Handle .ctors and .dtors if ctors_in_init_array.
1730         (Layout::match_file_name): New function, moved from output.cc.
1731         * layout.h (class Layout): Update declarations.
1732         * output.cc: Include "layout.h".
1733         (Input_section_sort_entry::get_priority): New function.
1734         (Input_section_sort_entry::match_file_name): Just call
1735         Layout::match_file_name.
1736         (Output_section::Input_section_sort_init_fini_compare::operator()):
1737         Handle .ctors and .dtors.  Sort by explicit priority rather than
1738         by name.
1739         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1740         * testsuite/initpri2.c: New test.
1741         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1742         (check_PROGRAMS): Add initpri2.
1743         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1744         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1745         * configure, testsuite/Makefile.in: Rebuild.
1746
1747 2011-06-19  Ian Lance Taylor  <iant@google.com>
1748
1749         PR gold/12880
1750         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1751         .interp section to a PT_INTERP segment even if we have seen a
1752         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1753         clause in a linker script.
1754         (Layout::finalize): Don't create a .interp section if we've
1755         already create a PT_INTERP segment.
1756         (Layout::create_interp): Always call choose_output_section (revert
1757         patch of 2011-06-17).  Don't create PT_INTERP segment.
1758         * script-sections.cc
1759         (Script_sections::create_note_and_tls_segments): Add a .interp
1760         section to a PT_INTERP segment even if we have seen a
1761         --dynamic-linker option.
1762
1763 2011-06-18  Ian Lance Taylor  <iant@google.com>
1764
1765         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1766         merely because a non-PT_LOAD segment has a dynamic reloc.
1767
1768 2011-06-18  Ian Lance Taylor  <iant@google.com>
1769
1770         * layout.cc (Layout::finish_dynamic_section): Don't create
1771         DT_FLAGS entry if not needed.
1772
1773 2011-06-18  Ian Lance Taylor  <iant@google.com>
1774
1775         PR gold/12745
1776         * layout.cc (Layout::layout_eh_frame): Correct handling of
1777         writable .eh_frame section.
1778
1779 2011-06-17  Ian Lance Taylor  <iant@google.com>
1780
1781         PR gold/12893
1782         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1783         symbol is redefined with the exact same object and value.
1784
1785 2011-06-17  Ian Lance Taylor  <iant@google.com>
1786
1787         PR gold/12880
1788         * layout.h (class Layout): Add interp_segment_ field.
1789         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1790         (Layout::attach_allocated_section_to_segment): If making shared
1791         library, put .interp section in PT_INTERP segment.
1792         (Layout::finalize): Also call create_interp if -dynamic-linker
1793         option was used.
1794         (Layout::create_interp): Assert that there is no PT_INTERP
1795         segment.  If not using a SECTIONS clause, use make_output_section.
1796         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1797         * script-sections.cc
1798         (Script_sections::create_note_and_tls_segments): If making shared
1799         library, put .interp section in PT_INTERP segment.
1800
1801 2011-06-17  Ian Lance Taylor  <iant@google.com>
1802
1803         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1804         when making a shared library.
1805
1806 2011-06-17  Ian Lance Taylor  <iant@google.com>
1807
1808         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1809         parameter.  Change all callers.  Don't issue warning about PC32
1810         against locally defined symbol.
1811
1812 2011-06-16  Ian Lance Taylor  <iant@google.com>
1813
1814         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1815         occurs in same object.
1816
1817 2011-06-14  Alan Modra  <amodra@gmail.com>
1818
1819         * po/POTFILES.in: Regenerate.
1820
1821 2011-06-09  Ian Lance Taylor  <iant@google.com>
1822
1823         * script-sections.cc
1824         (Orphan_output_section::set_section_addresses): For a relocatable
1825         link set address to 0.
1826
1827 2011-06-09  Cary Coutant  <ccoutant@google.com>
1828
1829         PR gold/12804
1830         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1831         used with --compress-debug-sections.
1832         * gold/object.cc (Sized_relobj_file::do_layout): Report
1833         uncompressed size of compressed input sections.
1834
1835 2011-06-08  Cary Coutant  <ccoutant@google.com>
1836
1837         PR gold/12804
1838         * testsuite/two_file_test_2_v1.cc: Change initialization of
1839         v2 to keep it in .data.
1840
1841 2011-06-07  Cary Coutant  <ccoutant@google.com>
1842
1843         * common.cc (Symbol_table::do_allocate_commons_list): Call
1844         gold_fallback.
1845         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1846         (Errors::fallback): New function.
1847         (gold_fallback): New function.
1848         * errors.h (Errors::fallback): New function.
1849         * gold.cc (gold_exit): Change status parameter to enum; adjust
1850         all callers.
1851         (queue_initial_tasks): Call gold_fallback.
1852         * gold.h: Include cstdlib.
1853         (Exit_status): New enum type.
1854         (gold_exit): Change status parameter to enum.
1855         (gold_fallback): New function.
1856         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1857         (Layout::create_symtab_sections): Likewise.
1858         (Layout::create_shdrs): Likewise.
1859         * main.cc (main): Adjust call to gold_exit.
1860         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1861         (Output_data_got::add_got_entry_pair): Likewise.
1862         (Output_section::add_input_section): Likewise.
1863         (Output_section::add_output_section_data): Likewise.
1864         (Output_segment::set_section_list_addresses): Likewise.
1865         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1866
1867 2011-06-07  Cary Coutant  <ccoutant@google.com>
1868
1869         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1870         for incremental links.
1871         * output.cc (Output_segment::set_section_list_addresses): Remove
1872         FIXME and test for TLS or BSS.
1873
1874 2011-06-07  Cary Coutant  <ccoutant@google.com>
1875
1876         * testsuite/Makefile.am: Add incremental_copy_test,
1877         incremental_common_test_1.
1878         * testsuite/Makefile.in: Regenerate.
1879         * testsuite/common_test_1_v1.c: New source file.
1880         * testsuite/common_test_1_v2.c: New source file.
1881         * testsuite/copy_test_v1.cc: New source file.
1882
1883 2011-06-07  Cary Coutant  <ccoutant@google.com>
1884
1885         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1886         update, allocate common from bss section's free list.
1887         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1888         linker-defined symbols.
1889         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1890         Skip GOT and PLT entries that are no longer referenced.
1891         (Output_section_incremental_inputs::write_info_blocks): Mark
1892         linker-defined symbols.
1893         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1894         * output.cc (Output_section::allocate): New function.
1895         * output.h (Output_section::allocate): New function.
1896         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1897         linker-defined symbols.
1898         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1899         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1900         (Symbol::init_base_output_data): Likewise.
1901         (Symbol::init_base_output_segment): Likewise.
1902         (Symbol::init_base_constant): Likewise.
1903         (Sized_symbol::init_output_data): Likewise.
1904         (Sized_symbol::init_output_segment): Likewise.
1905         (Sized_symbol::init_constant): Likewise.
1906         (Symbol_table::do_define_in_output_data): Likewise.
1907         (Symbol_table::do_define_in_output_segment): Likewise.
1908         (Symbol_table::do_define_as_constant): Likewise.
1909         * symtab.h (Symbol::is_predefined): New function.
1910         (Symbol::init_base_output_data): Add is_predefined parameter.
1911         (Symbol::init_base_output_segment): Likewise.
1912         (Symbol::init_base_constant): Likewise.
1913         (Symbol::is_predefined_): New data member.
1914         (Sized_symbol::init_output_data): Add is_predefined parameter.
1915         (Sized_symbol::init_output_segment): Likewise.
1916         (Sized_symbol::init_constant): Likewise.
1917         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1918
1919 2011-06-07  Cary Coutant  <ccoutant@google.com>
1920
1921         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1922         instead of emit_copy_reloc.
1923         (Copy_relocs::emit_copy_reloc): Refactor.
1924         (Copy_relocs::make_copy_reloc): New function.
1925         (Copy_relocs::add_copy_reloc): Remove.
1926         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1927         section.
1928         (Copy_relocs::make_copy_reloc): New function.
1929         (Copy_relocs::add_copy_reloc): Remove.
1930         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1931         unchanged input files.
1932         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1933         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1934         Reserve BSS space for COPY relocations.
1935         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1936         (Output_section_incremental_inputs::write_info_blocks): Record
1937         whether a symbol is copied from a shared object.
1938         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1939         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1940         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1941         (Incremental_input_entry_reader::get_output_symbol_index): Add
1942         is_copy parameter.
1943         (Incremental_binary::emit_copy_relocs): New function.
1944         (Incremental_binary::do_emit_copy_relocs): New function.
1945         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1946         new data member.
1947         (Sized_incremental_binary::add_copy_reloc): New function.
1948         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1949         (Sized_incremental_binary::Copy_reloc): New struct.
1950         (Sized_incremental_binary::Copy_relocs): New typedef.
1951         (Sized_incremental_binary::copy_relocs_): New data member.
1952         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1953         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1954         * target.h (Sized_target::emit_copy_reloc): New function.
1955         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1956
1957 2011-06-02  Cary Coutant  <ccoutant@google.com>
1958
1959         PR gold/12163
1960         * gold/archive.cc (Archive::Archive): Initialize new data member.
1961         (Archive::include_all_members): Return if archive has already been
1962         included.
1963         * gold/archive.h (Archive::include_all_members_): New data member.
1964
1965 2011-06-02  Nick Clifton  <nickc@redhat.com>
1966
1967         * dynobj.h: Fix spelling mistake in comment.
1968         * output.cc: Likewise.
1969
1970 2011-05-31  Doug Kwan  <dougkwan@google.com>
1971             Asier Llano
1972
1973         PR gold/12826
1974         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1975         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1976         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1977         redundant arm_exidx_test.so.
1978         * testsuite/Makefile.in: Regenerate.
1979         (check_SCRIPTS): Add pr12826.sh
1980         (check_DATA): Add pr12826.stdout
1981         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1982         * testsuite/pr12826.sh: New file.
1983         * testsuite/pr12826_1.s: Ditto.
1984         * testsuite/pr12826_1.s: Ditto.
1985
1986 2011-05-30  Ian Lance Taylor  <iant@google.com>
1987
1988         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1989         sections.
1990
1991 2011-05-29  Ian Lance Taylor  <iant@google.com>
1992
1993         PR gold/12804
1994         * testsuite/Makefile.am: Use different file name for two_file_test
1995         temporary file for each incremental test.
1996         * testsuite/Makefile.in: Rebuild.
1997
1998 2011-05-29  Ian Lance Taylor  <iant@google.com>
1999
2000         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2001         binary input file is empty.
2002
2003 2011-05-27  Ian Lance Taylor  <iant@google.com>
2004
2005         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2006         (ver_test_9.so): Likewise.
2007         * testsuite/Makefile.in: Rebuild.
2008
2009 2011-05-26 Cary Coutant  <ccoutant@google.com>
2010
2011         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2012         * incremental.cc (Incremental_inputs::report_input_section): Fix
2013         comment, indentation.
2014         (Incremental_inputs::report_comdat_group): New function.
2015         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2016         of data for incremental input file entry.
2017         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2018         group count, COMDAT group signatures.
2019         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2020         an unchanged input file.
2021         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2022         Initialize new data member.
2023         (Incremental_object_entry::add_comdat_group): New function.
2024         (Incremental_object_entry::get_comdat_group_count): New function.
2025         (Incremental_object_entry::get_comdat_signature_key): New function.
2026         (Incremental_object_entry::groups_): New data member.
2027         (Incremental_inputs::report_comdat_group): New function.
2028         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2029         data for incremental input file entry.
2030         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2031         (Incremental_input_entry_reader::get_input_section): Adjust size of
2032         data for incremental input file entry.
2033         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2034         (Incremental_input_entry_reader::get_comdat_group_signature): New
2035         function.
2036         * object.cc (Sized_relobj::include_section_group): Report kept
2037         COMDAT groups for incremental links.
2038
2039 2011-05-24  David Meyer  <pdox@google.com>
2040
2041         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2042         with name parameter.  Add found_name parameter.
2043         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2044         * dirsearch.h (class Dirsearch): Update declaration.
2045
2046 2011-05-24  Ian Lance Taylor  <iant@google.com>
2047
2048         * archive.cc (Library_base::should_include_member): Pull in object
2049         from archive if it defines the entry symbol.
2050         * parameters.cc (Parameters::entry): New function.
2051         * parameters.h (class Parameters): Declare entry.
2052         * output.h (class Output_file_header): Remove entry_ field.
2053         * output.cc (Output_file_header::Output_file_header): Remove entry
2054         parameter.  Change all callers.
2055         (Output_file_header::entry): Use parameters->entry.
2056         * gold.cc (queue_middle_tasks): Likewise.
2057         * plugin.cc (Plugin_hook::run): Likewise.
2058
2059 2011-05-24 Cary Coutant  <ccoutant@google.com>
2060
2061         * gold.cc (queue_initial_tasks): Pass incremental base filename
2062         to Output_file::open_base_file; don't print error message.
2063         * incremental-dump.cc (main): Adjust call to
2064         Output_file::open_for_modification.
2065         * incremental-dump.cc (main): Likewise.
2066         * incremental.cc (Incremental_inputs::report_command_line):
2067         Ignore --incremental-base option when comparing command lines.
2068         Ignore parameter when given as separate argument.
2069         * options.h (class General_options): Add --incremental-base.
2070         * output.cc (Output_file::Output_file):
2071         (Output_file::open_base_file): Add base_name and writable parameters;
2072         read base file into new file; print error message here.
2073         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2074         callers.
2075         * output.h (Output_file::open_for_modification): Rename to...
2076         (Output_file::open_base_file): ...this; add base_name and
2077         writable parameters; adjust all callers.
2078         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2079         callers.
2080         * testsuite/Makefile.am (incremental_test_4): Test
2081         --incremental-base.
2082         * testsuite/Makefile.in: Regenerate.
2083
2084 2011-05-24 Cary Coutant  <ccoutant@google.com>
2085
2086         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2087         incremental_test_4.
2088         * testsuite/Makefile.in: Regenerate.
2089         * testsuite/two_file_test_1_v1.cc: New test source file.
2090         * testsuite/two_file_test_1b_v1.cc: New test source file.
2091         * testsuite/two_file_test_2_v1.cc: New test source file.
2092
2093 2011-05-24 Cary Coutant  <ccoutant@google.com>
2094
2095         * dynobj.h (Dynobj::do_dynobj): New function.
2096         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2097         flag and soname for shared objects.
2098         * incremental.cc (Incremental_inputs::report_object): Make
2099         either Incremental_object_entry or Incremental_dynobj_entry; add
2100         soname to string table.
2101         (Incremental_inputs::report_input_section): Add assertion.
2102         (Output_section_incremental_inputs::set_final_data_size): Adjust
2103         type of input file entry for shared libraries; adjust size of
2104         shared library info entry.
2105         (Output_section_incremental_inputs::write_input_files): Write
2106         as_needed flag for shared libraries.
2107         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2108         of input file entry for shared libraries; write soname.
2109         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2110         soname from incremental info.
2111         * incremental.h (enum Incremental_input_flags): Add
2112         INCREMENTAL_INPUT_AS_NEEDED.
2113         (Incremental_input_entry::Incremental_input_entry): Initialize new
2114         data member.
2115         (Incremental_input_entry::set_as_needed): New function.
2116         (Incremental_input_entry::as_needed): New function.
2117         (Incremental_input_entry::do_dynobj_entry): New function.
2118         (Incremental_input_entry::as_needed_): New data member.
2119         (Incremental_object_entry::Incremental_object_entry): Don't check
2120         for shared library.
2121         (Incremental_object_entry::do_type): Likewise.
2122         (class Incremental_dynobj_entry): New class.
2123         (Incremental_input_entry_reader::as_needed): New function.
2124         (Incremental_input_entry_reader::get_soname): New function.
2125         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2126         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2127         size of shared library info entry.
2128         * layout.cc (Layout::finish_dynamic_section): Don't test for
2129         incremental link when adding DT_NEEDED entries.
2130         * object.h (Object::Object): Initialize new data member.
2131         (Object::dynobj): New function.
2132         (Object::set_as_needed): New function.
2133         (Object::as_needed): New function.
2134         (Object::do_dynobj): New function.
2135         (Object::as_needed_): New data member.
2136
2137 2011-05-24 Cary Coutant  <ccoutant@google.com>
2138
2139         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2140         info; adjust display of GOT entries.
2141         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2142         vector of input objects; remove file_status_.
2143         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2144         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2145         got_plt reader; call target hooks to reserve GOT entries.
2146         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2147         of input file info header and GOT info entry.
2148         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2149         relocation info.
2150         (Got_plt_view_info::got_descriptor): Remove.
2151         (Got_plt_view_info::sym_index): New data member.
2152         (Got_plt_view_info::input_index): New data member.
2153         (Local_got_offset_visitor::visit): Write input file index.
2154         (Global_got_offset_visitor::visit): Write 0 for input file index.
2155         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2156         with sym_index and input_index.
2157         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2158         incremental info GOT entry; replace got_descriptor with input_index.
2159         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2160         map from input file index to object.
2161         (Sized_relobj_incr::do_layout): Replace direct data member reference
2162         with accessor function.
2163         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2164         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2165         Adjust size of input file info header.
2166         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2167         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2168         (Incremental_input_entry_reader::get_input_section): Adjust size of
2169         input file info header.
2170         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2171         of incremental info GOT entry.
2172         (Incremental_got_plt_reader::get_got_desc): Remove.
2173         (Incremental_got_plt_reader::get_got_symndx): New function.
2174         (Incremental_got_plt_reader::get_got_input_index): New function.
2175         (Sized_incremental_binary::Sized_incremental_binary): Remove
2176         file_status_; add input_objects_.
2177         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2178         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2179         (Sized_incremental_binary::file_is_unchanged): Remove.
2180         (Sized_incremental_binary::set_input_object): New function.
2181         (Sized_incremental_binary::input_object): New function.
2182         (Sized_incremental_binary::file_status_): Remove.
2183         (Sized_incremental_binary::input_objects_): New data member.
2184         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2185         references.
2186         (Sized_relobj_incr::invalid_address): Move to base class.
2187         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2188         class.
2189         (Sized_relobj_incr::do_output_section_offset): Likewise.
2190         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2191         (Sized_relobj_incr::section_offsets_): Likewise.
2192         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2193         function.
2194         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2195         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2196         with accessor function.
2197         (Sized_relobj_file::do_layout): Likewise.
2198         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2199         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2200         (Sized_relobj_file::compute_final_local_value): Replace refs to
2201         section_offsets_ with accessor function.
2202         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2203         * object.h (Relobj::Relobj): Initialize new data members.
2204         (Relobj::add_dyn_reloc): New function.
2205         (Relobj::first_dyn_reloc): New function.
2206         (Relobj::dyn_reloc_count): New function.
2207         (Relobj::first_dyn_reloc_): New data member.
2208         (Relobj::dyn_reloc_count_): New data member.
2209         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2210         references.
2211         (Sized_relobj::Address): New typedef.
2212         (Sized_relobj::invalid_address): Move here from child class.
2213         (Sized_relobj::Sized_relobj): Initialize new data members.
2214         (Sized_relobj::sized_relobj): New function.
2215         (Sized_relobj::is_output_section_offset_invalid): Move here from
2216         child class.
2217         (Sized_relobj::get_output_section_offset): Likewise.
2218         (Sized_relobj::local_has_got_offset): Likewise.
2219         (Sized_relobj::local_got_offset): Likewise.
2220         (Sized_relobj::set_local_got_offset): Likewise.
2221         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2222         (Sized_relobj::clear_got_offsets): New function.
2223         (Sized_relobj::section_offsets): Move here from child class.
2224         (Sized_relobj::do_output_section_offset): Likewise.
2225         (Sized_relobj::do_set_section_offset): Likewise.
2226         (Sized_relobj::Local_got_offsets): Likewise.
2227         (Sized_relobj::local_got_offsets_): Likewise.
2228         (Sized_relobj::section_offsets_): Likewise.
2229         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2230         references.
2231         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2232         class.
2233         (Sized_relobj_file::sized_relobj): New function
2234         (Sized_relobj_file::local_has_got_offset): Move to base class.
2235         (Sized_relobj_file::local_got_offset): Likewise.
2236         (Sized_relobj_file::set_local_got_offset): Likewise.
2237         (Sized_relobj_file::get_output_section_offset): Likewise.
2238         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2239         (Sized_relobj_file::do_output_section_offset): Likewise.
2240         (Sized_relobj_file::do_set_section_offset): Likewise.
2241         (Sized_relobj_file::Local_got_offsets): Likewise.
2242         (Sized_relobj_file::local_got_offsets_): Likewise.
2243         (Sized_relobj_file::section_offsets_): Likewise.
2244         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2245         (all constructors).
2246         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2247         (Output_reloc::get_symbol_index): Likewise.
2248         (Output_reloc::local_section_offset): Likewise.
2249         (Output_reloc::get_address): Likewise.
2250         (Output_reloc::symbol_value): Likewise.
2251         (Output_data_got::reserve_slot): Move to class definition.
2252         (Output_data_got::reserve_local): New function.
2253         (Output_data_got::reserve_slot_for_global): Remove.
2254         (Output_data_got::reserve_global): New function.
2255         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2256         (all constructors, two instantiations).
2257         (Output_reloc::get_relobj): New function (two instantiations).
2258         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2259         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2260         (Output_data_reloc::add_global): Adjust type of relobj.
2261         (Output_data_reloc::add_global_relative): Likewise.
2262         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2263         (Output_data_reloc::add_local): Likewise.
2264         (Output_data_reloc::add_local_relative): Likewise.
2265         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2266         (Output_data_reloc::add_local_section): Likewise.
2267         (Output_data_reloc::add_output_section): Likewise.
2268         (Output_data_reloc::add_absolute): Likewise.
2269         (Output_data_reloc::add_target_specific): Likewise.
2270         (Output_data_got::reserve_slot): Move definition here.
2271         (Output_data_got::reserve_local): New function.
2272         (Output_data_got::reserve_global): New function.
2273         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2274         section_offsets_ with accessor function.
2275         (Sized_relobj_file::write_sections): Likewise.
2276         (Sized_relobj_file::do_relocate_sections): Likewise.
2277         * target.h (Sized_target::reserve_local_got_entry): New function.
2278         (Sized_target::reserve_global_got_entry): New function.
2279         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2280         (Target_x86_64::reserve_global_got_entry): New function.
2281         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2282
2283 2011-05-23 Cary Coutant  <ccoutant@google.com>
2284
2285         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2286         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2287         bit when checking got_type.
2288         * incremental.cc (Sized_incremental_binary::setup_readers):
2289         Store symbol table and string table locations; initialize bit vector
2290         of file status flags.
2291         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2292         unchanged files.
2293         (Sized_incremental_binary::do_process_got_plt): New function.
2294         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2295         (Output_section_incremental_inputs::set_final_data_size): Record
2296         file index for each input file.
2297         (Output_section_incremental_inputs::write_got_plt): Store file index
2298         instead of input entry offset for each GOT entry.
2299         * incremental.h
2300         (Incremental_input_entry::Incremental_input_entry): Initialize new
2301         data member.
2302         (Incremental_input_entry::set_offset): Store file index.
2303         (Incremental_input_entry::get_file_index): New function.
2304         (Incremental_input_entry::file_index_): New data member.
2305         (Incremental_binary::process_got_plt): New function.
2306         (Incremental_binary::do_process_got_plt): New function.
2307         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2308         data members.
2309         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2310         (Sized_incremental_binary::set_file_is_unchanged): New function.
2311         (Sized_incremental_binary::file_is_unchanged): New function.
2312         (Sized_incremental_binary::do_process_got_plt): New function.
2313         (Sized_incremental_binary::file_status_): New data member.
2314         (Sized_incremental_binary::main_symtab_loc_): New data member.
2315         (Sized_incremental_binary::main_strtab_loc_): New data member.
2316         * output.cc (Output_data_got::Got_entry::write): Add case
2317         RESERVED_CODE.
2318         (Output_data_got::add_global): Call add_got_entry.
2319         (Output_data_got::add_global_plt): Likewise.
2320         (Output_data_got::add_global_with_rel): Likewise.
2321         (Output_data_got::add_global_with_rela): Likewise.
2322         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2323         (Output_data_got::add_global_pair_with_rela): Likewise.
2324         (Output_data_got::add_local): Call add_got_entry.
2325         (Output_data_got::add_local_plt): Likewise.
2326         (Output_data_got::add_local_with_rel): Likewise.
2327         (Output_data_got::add_local_with_rela): Likewise.
2328         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2329         (Output_data_got::add_local_pair_with_rela): Likewise.
2330         (Output_data_got::reserve_slot): New function.
2331         (Output_data_got::reserve_slot_for_global): New function.
2332         (Output_data_got::add_got_entry): New function.
2333         (Output_data_got::add_got_entry_pair): New function.
2334         (Output_section::add_output_section_data): Edit FIXME.
2335         * output.h
2336         (Output_section_data_build::Output_section_data_build): New
2337         constructor with size parameter.
2338         (Output_data_space::Output_data_space): Likewise.
2339         (Output_data_got::Output_data_got): Initialize new data member; new
2340         constructor with size parameter.
2341         (Output_data_got::add_constant): Call add_got_entry.
2342         (Output_data_got::reserve_slot): New function.
2343         (Output_data_got::reserve_slot_for_global): New function.
2344         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2345         (Output_data_got::add_got_entry): New function.
2346         (Output_data_got::add_got_entry_pair): New function.
2347         (Output_data_got::free_list_): New data member.
2348         * target.h (Sized_target::init_got_plt_for_update): New function.
2349         (Sized_target::register_global_plt_entry): New function.
2350         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2351         Initialize new data member; call init; add constructor with PLT count.
2352         (Output_data_plt_x86_64::init): New function.
2353         (Output_data_plt_x86_64::add_relocation): New function.
2354         (Output_data_plt_x86_64::reserve_slot): New function.
2355         (Output_data_plt_x86_64::free_list_): New data member.
2356         (Target_x86_64::init_got_plt_for_update): New function.
2357         (Target_x86_64::register_global_plt_entry): New function.
2358         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2359         incremental updates.
2360         (Output_data_plt_x86_64::add_relocation): New function.
2361         * testsuite/object_unittest.cc (Object_test): Set default options.
2362
2363 2011-05-16  Ian Lance Taylor  <iant@google.com>
2364
2365         * options.h (class General_options): Make -i a synonym for -r.
2366
2367 2011-05-16  Ian Lance Taylor  <iant@google.com>
2368
2369         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2370
2371 2011-05-10 Cary Coutant  <ccoutant@google.com>
2372
2373         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2374         strip_all (-s).
2375
2376 2011-05-06  Ian Lance Taylor  <iant@google.com>
2377
2378         * layout.cc (Layout::layout): If the output section flags change,
2379         update the ordering.
2380
2381 2011-04-25 Cary Coutant  <ccoutant@google.com>
2382
2383         * incremental-dump.cc (dump_incremental_inputs): Print local
2384         symbol info for each input file.
2385         * incremental.cc
2386         (Output_section_incremental_inputs::set_final_data_size): Add local
2387         symbol info to input file entries in incremental info.
2388         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2389         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2390         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2391         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2392         implementation.
2393         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2394         (Sized_incr_relobj::do_relocate): Write the local symbols.
2395         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2396         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2397         Adjust size of input file header.
2398         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2399         (Incremental_inputs_reader::get_local_symbol_count): New function.
2400         (Incremental_inputs_reader::get_input_section): Adjust size of input
2401         file header.
2402         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2403         (Sized_incr_relobj::This): New typedef.
2404         (Sized_incr_relobj::sym_size): New const data member.
2405         (Sized_incr_relobj::Local_symbol): New struct.
2406         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2407         (Sized_incr_relobj::do_local_symbol_offset): New function.
2408         (Sized_incr_relobj::local_symbol_count_): New data member.
2409         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2410         (Sized_incr_relobj::local_symbol_index_): New data member.
2411         (Sized_incr_relobj::local_symbol_offset_): New data member.
2412         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2413         (Sized_incr_relobj::local_symbols_): New data member.
2414         * object.h (Relobj::output_local_symbol_count): New function.
2415         (Relobj::local_symbol_offset): New function.
2416         (Relobj::do_output_local_symbol_count): New function.
2417         (Relobj::do_local_symbol_offset): New function.
2418         (Sized_relobj::do_output_local_symbol_count): New function.
2419         (Sized_relobj::do_local_symbol_offset): New function.
2420
2421 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2422
2423         * descriptors.cc (set_close_on_exec): New function.
2424         (Descriptors::open): Use set_close_on_exec.
2425         * output.cc (S_ISLNK): Define if not defined.
2426
2427 2011-04-22 Cary Coutant  <ccoutant@google.com>
2428
2429         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2430         global symbol map.
2431         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2432         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2433         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2434         relocations.
2435         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2436         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2437         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2438         * incremental.h
2439         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2440         function.
2441         (Incremental_binary::apply_incremental_relocs): New function.
2442         (Incremental_binary::do_apply_incremental_relocs): New function.
2443         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2444         data member.
2445         (Sized_incremental_binary::add_global_symbol): New function.
2446         (Sized_incremental_binary::global_symbol): New function.
2447         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2448         (Sized_incremental_binary::symbol_map_): New data member.
2449         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2450         * target.h (Sized_target::apply_relocation): New function.
2451         * target-reloc.h (apply_relocation): New function.
2452         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2453
2454 2011-04-22  Doug Kwan  <dougkwan@google.com>
2455
2456         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2457         flag of a SHT_ARM_EXIDX section.
2458         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2459         * testsuite/Makefile.in: Regenerate.
2460         * testsuite/arm_exidx_test.s: New file.
2461         * testsuite/arm_exidx_test.sh: Same.
2462
2463 2011-04-20 Cary Coutant  <ccoutant@google.com>
2464
2465         PR gold/12689
2466         * archive.h (Incremental_archive_entry::Archive_member):
2467         Initialize arg_serial_ (second constructor).
2468
2469 2011-04-17  Ian Lance Taylor  <iant@google.com>
2470
2471         * object.cc (Relocate_info::location): Simplify location string.
2472         * errors.cc (Errors::error_at_location): Don't print program
2473         name.
2474         (Errors::warning_at_location): Likewise.
2475         (Errors::undefined_symbol): Likewise.
2476         * testsuite/debug_msg.sh: Update accordingly.
2477
2478 2011-04-14 Cary Coutant  <ccoutant@google.com>
2479
2480         * gold/layout.cc (Layout::symtab_section_offset): New function.
2481         * gold/layout.h (Layout::symtab_section_offset): New function.
2482         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2483
2484 2011-04-12  Ian Lance Taylor  <iant@google.com>
2485
2486         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2487         with MREMAP_MAYMOVE.
2488         * output.h (class Output_file): Add map_is_allocated_ field.
2489         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2490         not available, provide stubs.  If mremap is not available, #define
2491         it to gold_mremap.
2492         (MREMAP_MAYMOVE): Define if not defined.
2493         (Output_file::Output_file): Initialize map_is_allocated_.
2494         (Output_file::resize): Check map_is_allocated_.
2495         (Output_file::map_anonymous): If mmap fails, use malloc.
2496         (Output_file::unmap): Don't do anything for an anonymous map.
2497         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2498         is not available, provide stubs.
2499         (File_read::View::~View): Use free rather than delete[].
2500         (File_read::make_view): Use malloc rather than new[].  If mmap
2501         fails, use malloc.
2502         (File_read::find_or_make_view): Use malloc rather than new[].
2503         * gold.h: Remove HAVE_REMAP code.
2504         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2505         exists.  Rename mremap to gold_mremap.  If mmap is not available
2506         don't do anything.
2507         * configure, config.in: Rebuild.
2508
2509 2011-04-11  Ian Lance Taylor  <iant@google.com>
2510
2511         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2512         initialize local variable v.
2513
2514 2011-04-11  Cary Coutant  <ccoutant@google.com>
2515
2516         * archive.cc (Archive::include_member): Adjust call to
2517         report_object.
2518         (Add_archive_symbols::run): Track argument serial numbers.
2519         (Lib_group::include_member): Likewise.
2520         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2521         * archive.h (Incremental_archive_entry::Archive_member):
2522         Initialize arg_serial_.
2523         (Archive_member::arg_serial_): New data member.
2524         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2525         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2526         incremental link.
2527         (Sized_dynobj::do_for_all_local_got_entries): New function.
2528         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2529         function.
2530         * fileread.cc (get_mtime): New function.
2531         * fileread.h (get_mtime): New function.
2532         * gold.cc (queue_initial_tasks): Check for incremental update.
2533         (process_incremental_input): New function.
2534         (queue_middle_tasks): Don't force valid target for incremental
2535         update.
2536         * incremental-dump.cc (find_input_containing_global): Adjust
2537         size of symbol info entry.
2538         (dump_incremental_inputs): Dump argument serial number and
2539         in_system_directory flag; bias shndx by 1; print symbol names
2540         when dumping per-file symbol lists; use new symbol info readers.
2541         * incremental.cc
2542         (Output_section_incremental_inputs:update_data_size): New function.
2543         (Sized_incremental_binary::setup_readers): Setup input readers
2544         for each input file; build maps for files added from libraries
2545         and scripts.
2546         (Sized_incremental_binary::check_input_args): New function.
2547         (Sized_incremental_binary::do_check_inputs): Build map of argument
2548         serial numbers to input arguments.
2549         (Sized_incremental_binary::do_file_has_changed): Rename
2550         do_file_is_unchanged to this; compare file modification times.
2551         (Sized_incremental_binary::do_init_layout): New function.
2552         (Sized_incremental_binary::do_reserve_layout): New function.
2553         (Sized_incremental_binary::do_get_input_reader): Remove.
2554         (Sized_incremental_binary::get_symtab_view): New function.
2555         (Incremental_checker::can_incrementally_link_output_file): Remove.
2556         (Incremental_inputs::report_command_line): Exclude --debug options.
2557         (Incremental_inputs::report_archive_begin): Add parameter; track
2558         argument serial numbers; don't put input file entry for archive
2559         before archive members.
2560         (Incremental_inputs::report_archive_end): Put input file entry
2561         for archive after archive members.
2562         (Incremental_inputs::report_object): Add parameter; track argument
2563         serial numbers and in_system_directory flag.
2564         (Incremental_inputs::report_script): Add parameter; track argument
2565         serial numbers.
2566         (Output_section_incremental_inputs::set_final_data_size): Adjust
2567         size of symbol info entry; check for forwarding symbols.
2568         (Output_section_incremental_inputs::write_input_files): Write
2569         in_system_directory flag and argument serial number.
2570         (Output_section_incremental_inputs::write_info_blocks): Map section
2571         indices between incremental info and original input file; store
2572         input section index for each symbol.
2573         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2574         change operator() to visit().
2575         (class Global_got_offset_visitor): Likewise.
2576         (class Global_symbol_visitor_got_plt):
2577         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2578         classes.
2579         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2580         (Sized_incr_relobj::do_read_symbols): New function.
2581         (Sized_incr_relobj::do_layout): New function.
2582         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2583         (Sized_incr_relobj::do_add_symbols): New function.
2584         (Sized_incr_relobj::do_should_include_member): New function.
2585         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2586         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2587         (Sized_incr_relobj::do_section_size): New function.
2588         (Sized_incr_relobj::do_section_name): New function.
2589         (Sized_incr_relobj::do_section_contents): New function.
2590         (Sized_incr_relobj::do_section_flags): New function.
2591         (Sized_incr_relobj::do_section_entsize): New function.
2592         (Sized_incr_relobj::do_section_address): New function.
2593         (Sized_incr_relobj::do_section_type): New function.
2594         (Sized_incr_relobj::do_section_link): New function.
2595         (Sized_incr_relobj::do_section_info): New function.
2596         (Sized_incr_relobj::do_section_addralign): New function.
2597         (Sized_incr_relobj::do_initialize_xindex): New function.
2598         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2599         (Sized_incr_relobj::do_read_relocs): New function.
2600         (Sized_incr_relobj::do_gc_process_relocs): New function.
2601         (Sized_incr_relobj::do_scan_relocs): New function.
2602         (Sized_incr_relobj::do_count_local_symbols): New function.
2603         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2604         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2605         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2606         (Sized_incr_relobj::do_relocate): New function.
2607         (Sized_incr_relobj::do_set_section_offset): New function.
2608         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2609         (Sized_incr_dynobj::do_read_symbols): New function.
2610         (Sized_incr_dynobj::do_layout): New function.
2611         (Sized_incr_dynobj::do_add_symbols): New function.
2612         (Sized_incr_dynobj::do_should_include_member): New function.
2613         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2614         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2615         (Sized_incr_dynobj::do_section_size): New function.
2616         (Sized_incr_dynobj::do_section_name): New function.
2617         (Sized_incr_dynobj::do_section_contents): New function.
2618         (Sized_incr_dynobj::do_section_flags): New function.
2619         (Sized_incr_dynobj::do_section_entsize): New function.
2620         (Sized_incr_dynobj::do_section_address): New function.
2621         (Sized_incr_dynobj::do_section_type): New function.
2622         (Sized_incr_dynobj::do_section_link): New function.
2623         (Sized_incr_dynobj::do_section_info): New function.
2624         (Sized_incr_dynobj::do_section_addralign): New function.
2625         (Sized_incr_dynobj::do_initialize_xindex): New function.
2626         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2627         (make_sized_incremental_object): New function.
2628         (Incremental_library::copy_unused_symbols): New function.
2629         (Incremental_library::do_for_all_unused_symbols): New function.
2630         * incremental.h (enum Incremental_input_flags): New type.
2631         (class Incremental_checker): Remove.
2632         (Incremental_input_entry::Incremental_input_entry): Add argument
2633         serial number.
2634         (Incremental_input_entry::arg_serial): New function.
2635         (Incremental_input_entry::set_is_in_system_directory): New function.
2636         (Incremental_input_entry::is_in_system_directory): New function.
2637         (Incremental_input_entry::arg_serial_): New data member.
2638         (Incremental_input_entry::is_in_system_directory_): New data member.
2639         (class Script_info): Move here from script.h.
2640         (Script_info::Script_info): Add filename parameter.
2641         (Script_info::filename): New function.
2642         (Script_info::filename_): New data member.
2643         (Incremental_script_entry::Incremental_script_entry): Add argument
2644         serial number.
2645         (Incremental_object_entry::Incremental_object_entry): Likewise.
2646         (Incremental_object_entry::add_input_section): Build list of input
2647         sections with map to original shndx.
2648         (Incremental_object_entry::get_input_section_index): New function.
2649         (Incremental_object_entry::shndx_): New data member.
2650         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2651         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2652         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2653         serial number.
2654         (Incremental_inputs::report_archive_begin): Likewise.
2655         (Incremental_inputs::report_object): Likewise.
2656         (Incremental_inputs::report_script): Likewise.
2657         (class Incremental_global_symbol_reader): New class.
2658         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2659         and store flags and input file type.
2660         (Incremental_input_entry_reader::arg_serial): New function.
2661         (Incremental_input_entry_reader::type): Extract type from flags.
2662         (Incremental_input_entry_reader::is_in_system_directory): New function.
2663         (Incremental_input_entry_reader::get_input_section_count): Call
2664         accessor function for type.
2665         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2666         function for type; adjust size of global symbol entry.
2667         (Incremental_input_entry_reader::get_global_symbol_count): Call
2668         accessor function for type.
2669         (Incremental_input_entry_reader::get_object_count): Likewise.
2670         (Incremental_input_entry_reader::get_object_offset): Likewise.
2671         (Incremental_input_entry_reader::get_member_count): Likewise.
2672         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2673         (Incremental_input_entry_reader::get_member_offset): Likewise.
2674         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2675         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2676         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2677         (Incremental_input_entry_reader::get_global_symbol_reader): New
2678         function.
2679         (Incremental_input_entry_reader::get_output_symbol_index): New
2680         function.
2681         (Incremental_input_entry_reader::type_): Remove.
2682         (Incremental_input_entry_reader::flags_): New data member.
2683         (Incremental_inputs_reader::input_file_offset): New function.
2684         (Incremental_inputs_reader::input_file_index): New function.
2685         (Incremental_inputs_reader::input_file): Call input_file_offset.
2686         (Incremental_inputs_reader::input_file_at_offset): New function.
2687         (Incremental_relocs_reader::get_r_type): Reformat.
2688         (Incremental_relocs_reader::get_r_shndx): Reformat.
2689         (Incremental_relocs_reader::get_r_offset): Reformat.
2690         (Incremental_relocs_reader::data): New function.
2691         (Incremental_binary::Incremental_binary): Initialize new data members.
2692         (Incremental_binary::check_inputs): Add cmdline parameter.
2693         (Incremental_binary::file_is_unchanged): Remove.
2694         (Input_reader::arg_serial): New function.
2695         (Input_reader::get_unused_symbol_count): New function.
2696         (Input_reader::get_unused_symbol): New function.
2697         (Input_reader::do_arg_serial): New function.
2698         (Input_reader::do_get_unused_symbol_count): New function.
2699         (Input_reader::do_get_unused_symbol): New function.
2700         (Incremental_binary::input_file_count): New function.
2701         (Incremental_binary::get_input_reader): Change signature to use
2702         index instead of filename.
2703         (Incremental_binary::file_has_changed): New function.
2704         (Incremental_binary::get_input_argument): New function.
2705         (Incremental_binary::get_library): New function.
2706         (Incremental_binary::get_script_info): New function.
2707         (Incremental_binary::init_layout): New function.
2708         (Incremental_binary::reserve_layout): New function.
2709         (Incremental_binary::output_file): New function.
2710         (Incremental_binary::do_check_inputs): New function.
2711         (Incremental_binary::do_file_is_unchanged): Remove.
2712         (Incremental_binary::do_file_has_changed): New function.
2713         (Incremental_binary::do_init_layout): New function.
2714         (Incremental_binary::do_reserve_layout): New function.
2715         (Incremental_binary::do_input_file_count): New function.
2716         (Incremental_binary::do_get_input_reader): Change signature.
2717         (Incremental_binary::input_args_map_): New data member.
2718         (Incremental_binary::library_map_): New data member.
2719         (Incremental_binary::script_map_): New data member.
2720         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2721         new data members.
2722         (Sized_incremental_binary::output_section): New function.
2723         (Sized_incremental_binary::inputs_reader): Add const.
2724         (Sized_incremental_binary::symtab_reader): Add const.
2725         (Sized_incremental_binary::relocs_reader): Add const.
2726         (Sized_incremental_binary::got_plt_reader): Add const.
2727         (Sized_incremental_binary::get_symtab_view): New function.
2728         (Sized_incremental_binary::Inputs_reader): New typedef.
2729         (Sized_incremental_binary::Input_entry_reader): New typedef.
2730         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2731         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2732         (Sized_incremental_binary::do_file_has_changed): New function.
2733         (Sized_incremental_binary::do_init_layout): New function.
2734         (Sized_incremental_binary::do_reserve_layout): New function.
2735         (Sized_input_reader::Inputs_reader): Remove.
2736         (Sized_input_reader::Input_entry_reader): Remove.
2737         (Sized_input_reader::do_arg_serial): New function.
2738         (Sized_input_reader::do_get_unused_symbol_count): New function.
2739         (Sized_input_reader::do_get_unused_symbol): New function.
2740         (Sized_incremental_binary::do_input_file_count): New function.
2741         (Sized_incremental_binary::do_get_input_reader): Change signature;
2742         use index instead of filename.
2743         (Sized_incremental_binary::section_map_): New data member.
2744         (Sized_incremental_binary::input_entry_readers_): New data member.
2745         (class Sized_incr_relobj): New class.
2746         (class Sized_incr_dynobj): New class.
2747         (make_sized_incremental_object): New function.
2748         (class Incremental_library): New class.
2749         * layout.cc (Free_list::num_lists): New static data member.
2750         (Free_list::num_nodes): New static data member.
2751         (Free_list::num_removes): New static data member.
2752         (Free_list::num_remove_visits): New static data member.
2753         (Free_list::num_allocates): New static data member.
2754         (Free_list::num_allocate_visits): New static data member.
2755         (Free_list::init): New function.
2756         (Free_list::remove): New function.
2757         (Free_list::allocate): New function.
2758         (Free_list::dump): New function.
2759         (Free_list::print_stats): New function.
2760         (Layout_task_runner::run): Resize output file for incremental updates.
2761         (Layout::Layout): Initialize new data members.
2762         (Layout::set_incremental_base): New function.
2763         (Layout::init_fixed_output_section): New function.
2764         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2765         incremental updates.
2766         (Layout::create_gold_note): Do not create gold note section for
2767         incremental updates.
2768         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2769         for incremental updates.
2770         (Layout::set_section_offsets): For incremental updates, allocate space
2771         from free list.
2772         (Layout::create_symtab_sections): Layout with offsets relative to
2773         start of section; for incremental updates, allocate space from free
2774         list.
2775         (Layout::create_shdrs): For incremental updates, allocate space from
2776         free list.
2777         (Layout::finish_dynamic_section): For incremental updates, do not
2778         check --as-needed (fixed in subsequent patch).
2779         * layout.h (class Free_list): New class.
2780         (Layout::set_incremental_base): New function.
2781         (Layout::incremental_base): New function.
2782         (Layout::init_fixed_output_section): New function.
2783         (Layout::allocate): New function.
2784         (Layout::incremental_base_): New data member.
2785         (Layout::free_list_): New data member.
2786         * main.cc (main): Print Free_list statistics.
2787         * object.cc (Relobj::finalize_incremental_relocs): Add
2788         clear_counts parameter; clear counts only when clear_counts is set.
2789         (Sized_relobj::Sized_relobj): Initialize new base class.
2790         (Sized_relobj::do_layout): Don't report special sections.
2791         (Sized_relobj::do_for_all_local_got_entries): New function.
2792         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2793         symtab_off to all symbol table offsets.
2794         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2795         * object.h (class Got_offset_list): Move to top of file.
2796         (Object::Object): Allow case where input_file == NULL.
2797         (Object::~Object): Likewise.
2798         (Object::input_file): Assert that input_file != NULL.
2799         (Object::lock): Allow case where input_file == NULL.
2800         (Object::unlock): Likewise.
2801         (Object::is_locked): Likewise.
2802         (Object::token): Likewise.
2803         (Object::release): Likewise.
2804         (Object::is_incremental): New function.
2805         (Object::get_mtime): New function.
2806         (Object::for_all_local_got_entries): New function.
2807         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2808         (Object::set_is_in_system_directory): New function.
2809         (Object::is_in_system_directory): New function.
2810         (Object::do_is_incremental): New function.
2811         (Object::do_get_mtime): New function.
2812         (Object::do_for_all_local_got_entries): New function.
2813         (Object::is_in_system_directory_): New data member.
2814         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2815         (class Sized_relobj_base): New class.
2816         (class Sized_relobj): Derive from Sized_relobj_base.
2817         (class Sized_relobj::Symbols): Redeclare from base class.
2818         (class Sized_relobj::local_got_offset_list): Remove.
2819         (class Sized_relobj::Output_sections): Redeclare from base class.
2820         (class Sized_relobj::do_for_all_local_got_entries): New function.
2821         (class Sized_relobj::write_local_symbols): Add offset parameter.
2822         (class Sized_relobj::local_symbol_offset_): Update comment.
2823         (class Sized_relobj::local_dynsym_offset_): Update comment.
2824         * options.cc (Input_arguments::add_file): Remove const.
2825         * options.h (Input_file_argument::Input_file_argument):
2826         Initialize arg_serial_ (all constructors).
2827         (Input_file_argument::set_arg_serial): New function.
2828         (Input_file_argument::arg_serial): New function.
2829         (Input_file_argument::arg_serial_): New data member.
2830         (Input_arguments::Input_arguments): Initialize file_count_.
2831         (Input_arguments::add_file): Remove const.
2832         (Input_arguments::number_of_input_files): New function.
2833         (Input_arguments::file_count_): New data member.
2834         (Command_line::number_of_input_files): Call
2835         Input_arguments::number_of_input_files.
2836         * output.cc (Output_segment_headers::Output_segment_headers):
2837         Set current size.
2838         (Output_section::Input_section::current_data_size): New function.
2839         (Output_section::Output_section): Initialize new data members.
2840         (Output_section::add_input_section): Don't do merge sections for
2841         an incremental link; allocate space from free list for an
2842         incremental update.
2843         (Output_section::add_output_section_data): Allocate space from
2844         free list for an incremental update.
2845         (Output_section::update_data_size): New function.
2846         (Output_section::set_fixed_layout): New function.
2847         (Output_section::reserve): New function.
2848         (Output_segment::set_section_addresses): Remove const.
2849         (Output_segment::set_section_list_addresses): Remove const; allocate
2850         space from free list for an incremental update.
2851         (Output_segment::set_offset): Adjust size of RELRO segment for an
2852         incremental update.
2853         * output.h (Output_data::current_data_size): Move here from
2854         child classes.
2855         (Output_data::pre_finalize_data_size): New function.
2856         (Output_data::update_data_size): New function.
2857         (Output_section_headers::update_data_size): new function.
2858         (Output_section_data_build::current_data_size): Move to Output_data.
2859         (Output_data_strtab::update_data_size): New function.
2860         (Output_section::current_data_size): Move to Output_data.
2861         (Output_section::set_fixed_layout): New function.
2862         (Output_section::has_fixed_layout): New function.
2863         (Output_section::reserve): New function.
2864         (Output_section::update_data_size): New function.
2865         (Output_section::has_fixed_layout_): New data member.
2866         (Output_section::free_list_): New data member.
2867         (Output_segment::set_section_addresses): Remove const.
2868         (Output_segment::set_section_list_addresses): Remove const.
2869         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2870         New function.
2871         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2872         New function.
2873         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2874         parameter when calling Add_symbols constructor; store argument
2875         serial number for members of a lib group.
2876         (Add_symbols::locks): Allow case where token == NULL.
2877         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2878         (Read_member::~Read_member): New function.
2879         (Read_member::is_runnable): New function.
2880         (Read_member::locks): New function.
2881         (Read_member::run): New function.
2882         (Check_script::~Check_script): New function.
2883         (Check_script::is_runnable): New function.
2884         (Check_script::locks): New function.
2885         (Check_script::run): New function.
2886         (Check_library::~Check_library): New function.
2887         (Check_library::is_runnable): New function.
2888         (Check_library::locks): New function.
2889         (Check_library::run): New function.
2890         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2891         (Add_symbols::library_): New data member.
2892         (class Read_member): New class.
2893         (class Check_script): New class.
2894         (class Check_library): New class.
2895         * reloc.cc (Read_relocs::is_runnable): Allow case where
2896         token == NULL.
2897         (Read_relocs::locks): Likewise.
2898         (Scan_relocs::locks): Likewise.
2899         (Relocate_task::locks): Likewise.
2900         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2901         to clear counters.
2902         (Sized_relobj::incremental_relocs_scan): Fix comment.
2903         (Sized_relobj::do_relocate): Pass output file offset to
2904         write_local_symbols.
2905         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2906         from class declaration.
2907         * script.cc (read_input_script): Allocate Script_info; pass
2908         argument serial number to report_script.
2909         * script.h (class Script_info): Move to incremental.h.
2910         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2911         * symtab.h (Symbol_table::add_from_incrobj): New function.
2912         (Symbol_table::set_file_offset): New function.
2913
2914 2011-04-05  Cary Coutant  <ccoutant@google.com>
2915
2916         * incremental-dump.cc (dump_incremental_inputs): Change signature
2917         to take a Sized_incremental_binary; change caller.  Use readers
2918         in Sized_incremental_binary.
2919         * incremental.cc
2920         (Sized_incremental_binary::find_incremental_inputs_sections):
2921         Rename do_find_incremental_inputs_sections to this.
2922         (Sized_incremental_binary::setup_readers): New function.
2923         (Sized_incremental_binary::do_check_inputs): Check
2924         has_incremental_info_ flag; move setup code to setup_readers;
2925         use input readers.
2926         (Sized_incremental_binary::do_file_is_unchanged): New function.
2927         (Sized_incremental_binary::do_get_input_reader): New function.
2928         * incremental.h (class Incremental_binary): Move to end of file.
2929         (Incremental_binary::file_is_unchanged): New function.
2930         (Incremental_binary::do_file_is_unchanged): New function.
2931         (Incremental_binary::Input_reader): New class.
2932         (Incremental_binary::get_input_reader): New function.
2933         (class Sized_incremental_binary): Move to end of file.
2934         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2935         input section reader classes.
2936         (Sized_incremental_binary::has_incremental_info): New function.
2937         (Sized_incremental_binary::inputs_reader): New function.
2938         (Sized_incremental_binary::symtab_reader): New function.
2939         (Sized_incremental_binary::relocs_reader): New function.
2940         (Sized_incremental_binary::got_plt_reader): New function.
2941         (Sized_incremental_binary::do_file_is_unchanged): New function.
2942         (Sized_incremental_binary::Sized_input_reader): New class.
2943         (Sized_incremental_binary::get_input_reader): New function.
2944         (Sized_incremental_binary::find_incremental_inputs_sections):
2945         Rename do_find_incremental_inputs_sections to this.
2946         (Sized_incremental_binary::setup_readers): New function.
2947         (Sized_incremental_binary::has_incremental_info_): New data member.
2948         (Sized_incremental_binary::inputs_reader_): New data member.
2949         (Sized_incremental_binary::symtab_reader_): New data member.
2950         (Sized_incremental_binary::relocs_reader_): New data member.
2951         (Sized_incremental_binary::got_plt_reader_): New data member.
2952         (Sized_incremental_binary::current_input_file_): New data member.
2953
2954 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2955
2956         PR gold/12640
2957         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2958         violation.
2959
2960 2011-03-30  Cary Coutant  <ccoutant@google.com>
2961
2962         * archive.cc (Archive::include_member): Adjust call to report_object.
2963         (Add_archive_symbols::run): Add script_info to call to
2964         report_archive_begin.
2965         (Lib_group::include_member): Adjust call to report_object.
2966         (Add_lib_group_symbols::run): Adjust call to report_object.
2967         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2968         blocks.  Add object count for script input files.
2969         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2970         script_info parameter; change all callers.
2971         (Incremental_inputs::report_object): Add script_info parameter;
2972         change all callers.
2973         (Incremental_inputs::report_script): Store backpointer to
2974         incremental info entry.
2975         (Output_section_incremental_inputs::set_final_data_size): Record
2976         additional information for scripts.
2977         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2978         * incremental.h (Incremental_script_entry::add_object): New function.
2979         (Incremental_script_entry::get_object_count): New function.
2980         (Incremental_script_entry::get_object): New function.
2981         (Incremental_script_entry::objects_): New data member; adjust
2982         constructor.
2983         (Incremental_inputs::report_archive_begin): Add script_info parameter.
2984         (Incremental_inputs::report_object): Add script_info parameter.
2985         (Incremental_inputs_reader::get_object_count): New function.
2986         (Incremental_inputs_reader::get_object_offset): New function.
2987         * options.cc (Input_arguments::add_file): Return reference to
2988         new input argument.
2989         * options.h (Input_argument::set_script_info): New function.
2990         (Input_argument::script_info): New function.
2991         (Input_argument::script_info_): New data member; adjust all
2992         constructors.
2993         (Input_file_group::add_file): Return reference to new input argument.
2994         (Input_file_lib::add_file): Likewise.
2995         (Input_arguments::add_file): Likewise.
2996         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2997         * script.cc (Parser_closure::Parser_closure): Add script_info
2998         parameter; adjust all callers.
2999         (Parser_closure::script_info): New function.
3000         (Parser_closure::script_info_): New data member.
3001         (read_input_script): Report scripts earlier to incremental info.
3002         (script_add_file): Set script_info in Input_argument.
3003         (script_add_library): Likewise.
3004         * script.h (Script_options::Script_info): Rewrite class.
3005
3006 2011-03-29  Cary Coutant  <ccoutant@google.com>
3007
3008         * archive.cc (Library_base::should_include_member): Move
3009         method here from class Archive.
3010         (Archive::Archive): Initialize base class.
3011         (Archive::should_include_member): Move to base class.
3012         (Archive::do_for_all_unused_symbols): New function.
3013         (Add_archive_symbols::run): Remove redundant access to
3014         incremental_inputs.
3015         (Lib_group::Lib_group): Initialize base class.
3016         (Lib_group::do_filename): New function.
3017         (Lib_group::include_member): Pass pointer to Lib_group to
3018         report_object.
3019         (Lib_group::do_for_all_unused_symbols): New function.
3020         (Add_lib_group_symbols::run): Report archive information for
3021         incremental links.
3022         * archive.h (class Library_base): New base class.
3023         (class Archive): Derive from Library_base.
3024         (Archive::filename): Move to base class.
3025         (Archive::set_incremental_info): Likewise.
3026         (Archive::incremental_info): Likewise.
3027         (Archive::Should_include): Likewise.
3028         (Archive::should_include_member): Likewise.
3029         (Archive::Armap_entry): Remove.
3030         (Archive::Unused_symbol_iterator): Remove.
3031         (Archive::unused_symbols_begin): Remove.
3032         (Archive::unused_symbols_end): Remove.
3033         (Archive::do_filename): New function.
3034         (Archive::do_get_mtime): New function.
3035         (Archive::do_for_all_unused_symbols): New function.
3036         (Archive::task_): Move to base class.
3037         (Archive::incremental_info_): Likewise.
3038         (class Lib_group): Derive from Library_base.
3039         (Lib_group::do_filename): New function.
3040         (Lib_group::do_get_mtime): New function.
3041         (Lib_group::do_for_all_unused_symbols): New function.
3042         (Lib_group::task_): Move to base class.
3043         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3044         function.
3045         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3046         function.
3047         * incremental.cc (Incremental_inputs::report_archive_begin):
3048         Use Library_base; call library's get_mtime; add incremental inputs
3049         entry before members.
3050         (class Unused_symbol_visitor): New class.
3051         (Incremental_inputs::report_archive_end): Use Library_base; use
3052         visitor class to record unused symbols; don't add incremental inputs
3053         entry after members.
3054         (Incremental_inputs::report_object): Use Library_base.
3055         * incremental.h
3056         (Incremental_archive_entry::Incremental_archive_entry): Remove
3057         unused Archive parameter.
3058         (Incremental_inputs::report_archive_begin): Use Library_base.
3059         (Incremental_inputs::report_archive_end): Likewise.
3060         (Incremental_inputs::report_object): Likewise.
3061         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3062         function.
3063         * object.h (Object::for_all_global_symbols): New function.
3064         (Object::do_for_all_global_symbols): New function.
3065         (Sized_relobj::do_for_all_global_symbols): New function.
3066         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3067         function.
3068         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3069         function.
3070
3071 2011-03-27  Ian Lance Taylor  <iant@google.com>
3072
3073         * archive.cc (Archive::interpret_header): Return -1 if something
3074         goes wrong.  Change callers accordingly.
3075
3076 2011-03-25  Cary Coutant  <ccoutant@google.com>
3077
3078         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3079         * testsuite/Makefile.in: Regenerate.
3080
3081 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3082
3083         * plugin.cc (get_view): New.
3084         (Plugin::load): Pass get_view to the plugin.
3085         (Plugin_manager::get_view): New.
3086
3087 2011-03-21  Ian Lance Taylor  <iant@google.com>
3088
3089         * testsuite/final_layout.sh: Rewrite to not use dc.
3090         * testsuite/relro_test.sh: Fail if dc is not present.
3091
3092 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3093
3094         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3095         Change == to -eq.
3096         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3097         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3098         Change == to -eq.
3099         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3100         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3101
3102 2011-03-14  Ian Lance Taylor  <iant@google.com>
3103
3104         * script-sections.cc (Sort_output_sections::script_compare):
3105         Rename from is_before, change return type.
3106         (Sort_output_sections::operator()): Adjust accordingly.
3107
3108 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3109
3110         PR gold/12572
3111         * testsuite/odr_violation2.cc: Add comment to make all error line
3112         numbers double digits.
3113         * testsuite/debug_msg.sh: Adjust expected errors.
3114
3115 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3116
3117         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3118         but mark earlier ones as non-canonical
3119         (offset_to_iterator): Update search target and example
3120         (do_addr2line): Return extra lines in a vector*
3121         (format_file_lineno): Extract from do_addr2line
3122         (one_addr2line): Add vector* out-param
3123         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3124         when a lineno entry appeared last for its instruction
3125         (Dwarf_line_info): Add vector* out-param
3126         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3127         * symtab.cc (Odr_violation_compare): Include the lineno in the
3128         comparison again.
3129         (linenos_from_loc): New. Combine the canonical line for an
3130         address with its other lines.
3131         (True_if_intersect): New. Helper functor to make
3132         std::set_intersection a query.
3133         (detect_odr_violations): Compare sets of lines instead of just
3134         one line for each function. This became less deterministic, but
3135         has fewer false positives.
3136         * symtab.h: Declarations.
3137         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3138         mix an optimized and non-optimized object in the same binary
3139         (odr_violation2.so): Same.
3140         * testsuite/Makefile.in: Regenerate from Makefile.am.
3141         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3142         * testsuite/debug_msg.sh: Update line numbers and add
3143         assertions.
3144         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3145         non-optimized context.
3146         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3147         isn't inlined, and use OdrDerived in an optimized context.
3148         * testsuite/odr_header1.h: Defines OdrDerived, where
3149         optimization will change the
3150         first-instruction-in-the-destructor's file and line number.
3151         * testsuite/odr_header2.h: Defines OdrBase.
3152
3153 2011-03-09  Ian Lance Taylor  <iant@google.com>
3154
3155         * fileread.cc (File_read::clear_views): Don't delete the whole
3156         file view.
3157
3158 2011-03-08  Ian Lance Taylor  <iant@google.com>
3159
3160         PR gold/12525
3161         * fileread.cc: #include <climits>.
3162         (GOLD_IOV_MAX): Define.
3163         (File_read::read_multiple): Limit number of entries by iov_max.
3164         * fileread.h (class File_read): Always set max_readv_entries to
3165         128.
3166
3167 2011-03-07  Ian Lance Taylor  <iant@google.com>
3168
3169         PR gold/12525
3170         * options.h (class General_options): Add -dy and -dn.
3171
3172 2011-03-02  Cary Coutant  <ccoutant@google.com>
3173
3174         * testsuite/script_test_9.t: Add TLS segment.
3175
3176 2011-03-02  Simon Baldwin  <simonb@google.com>
3177
3178         * configure.ac: Add check for gnu_indirect_function support in
3179         the toolchain building binutils.
3180         * configure: Rebuild.
3181
3182 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3183
3184         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3185         plugin only symbols.
3186         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3187         in plugin files as not needed in the symbol table.
3188
3189 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3190
3191         * output.cc (Output_section::add_input_section): Delay fill
3192         generation for section ordering.
3193
3194 2011-02-09  Ian Lance Taylor  <iant@google.com>
3195
3196         PR gold/12316
3197         * object.h (class Sized_relobj): Remove clear_local_symbols.
3198         * reloc.cc (Sized_relobj::do_relocate): Don't call
3199         clear_local_symbols.
3200
3201 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3202
3203         * plugin.cc (is_visible_from_outside): Return true for symbols
3204         in the -u option.
3205
3206 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3207
3208         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3209         filename.
3210
3211 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3212
3213         * icf.h (is_section_foldable_candidate): Change type of parameter
3214         to std::string.
3215         * icf.cc (Icf::find_identical_sections): Change type of local variable
3216         section_name to be std::string.
3217         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3218
3219 2011-01-25  Ian Lance Taylor  <iant@google.com>
3220
3221         * script.cc (script_add_extern): Rewrite to use
3222         add_symbol_reference.
3223
3224 2011-01-25  Doug Kwan  <dougkwan@google.com>
3225
3226         * icf.cc (get_section_contents): Always lock section's object.
3227
3228 2011-01-24  Ian Lance Taylor  <iant@google.com>
3229
3230         * options.h (class General_options): Accept
3231         --no-detect-odr-violations.
3232
3233 2011-01-24  Ian Lance Taylor  <iant@google.com>
3234
3235         * version.cc (version_string): Bump to 1.11.
3236
3237 2011-01-24  Ian Lance Taylor  <iant@google.com>
3238
3239         * plugin.cc (class Plugin_rescan): Define new class.
3240         (Plugin_manager::claim_file): Set any_claimed_.
3241         (Plugin_manager::save_archive): New function.
3242         (Plugin_manager::save_input_group): New function.
3243         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3244         necessary.
3245         (Plugin_manager::new_undefined_symbol): New function.
3246         (Plugin_manager::rescan): New function.
3247         (Plugin_manager::rescannable_defines): New function.
3248         (Plugin_manager::add_input_file): Set any_added_.
3249         * plugin.h (class Plugin_manager): define new fields rescannable_,
3250         undefined_symbols_, any_claimed_, and any_added_.  Declare
3251         Plugin_rescan as friend.  Declare new functions.
3252         (Plugin_manager::Rescannable): Define type.
3253         (Plugin_manager::Rescannable_list): Define type.
3254         (Plugin_manager::Undefined_symbol_list): Define type.
3255         (Plugin_manager::Plugin_manager): Initialize new fields.
3256         * archive.cc (Archive::defines_symbol): New function.
3257         (Add_archive_symbols::run): Pass archive to plugins if any.
3258         * archive.h (class Archive): Declare defines_symbol.
3259         * readsyms.cc (Input_group::~Input_group): New function.
3260         (Finish_group::run): Pass input_group to plugins if any.
3261         * readsyms.h (class Input_group): Declare destructor.
3262         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3263         any.
3264
3265 2011-01-10  Ian Lance Taylor  <iant@google.com>
3266
3267         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3268         section as relro.
3269         (Layout::set_segment_offsets): Reset increase_relro before calling
3270         set_section_addresses a second time.
3271
3272 2011-01-04  Cary Coutant  <ccoutant@google.com>
3273
3274         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3275         sections before NOBITS sections.
3276
3277 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3278
3279         * version.cc (print_version): Update copyright to 2011.
3280
3281 2010-12-23  Cary Coutant  <ccoutant@google.com>
3282
3283         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3284         of OS to this->add.  Add OD parameter to second form of the function.
3285
3286 2010-12-20  Ian Lance Taylor  <iant@google.com>
3287
3288         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3289         second of two consecutive entries with same offset.
3290
3291 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3292
3293         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3294         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3295         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3296         to avoid unneeded links against $(LDADD).
3297         * testsuite/Makefile.in: Regenerate.
3298
3299 2010-12-15  Ian Lance Taylor  <iant@google.com>
3300
3301         PR gold/12324
3302         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3303         for R_X86_64_32 and R_X86_64_PC32.
3304         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3305         ver_matching_def_pic.o.
3306         (ver_matching_def_pic.o): New target.
3307
3308 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3309
3310         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3311         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3312         Move definition before File_read::View member definitions.
3313         (File_read::View::~View): Initialize and hold lock before
3314         updating current_mapped_bytes.
3315
3316 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3317
3318         * dwarf_reader.cc: Remove outdated comment.
3319         * gold-threads.cc: Fix typo in error message.
3320         * archive.cc: Fix typos in comments.
3321         * archive.h: Likewise.
3322         * arm-reloc-property.cc: Likewise.
3323         * arm-reloc-property.h: Likewise.
3324         * arm-reloc.def: Likewise.
3325         * arm.cc: Likewise.
3326         * attributes.h: Likewise.
3327         * cref.cc: Likewise.
3328         * ehframe.cc: Likewise.
3329         * fileread.h: Likewise.
3330         * gold.h: Likewise.
3331         * i386.cc: Likewise.
3332         * icf.cc: Likewise.
3333         * incremental.h: Likewise.
3334         * int_encoding.cc: Likewise.
3335         * layout.h: Likewise.
3336         * main.cc: Likewise.
3337         * merge.h: Likewise.
3338         * object.cc: Likewise.
3339         * object.h: Likewise.
3340         * options.cc: Likewise.
3341         * readsyms.cc: Likewise.
3342         * reduced_debug_output.cc: Likewise.
3343         * reloc.cc: Likewise.
3344         * script-sections.cc: Likewise.
3345         * sparc.cc: Likewise.
3346         * symtab.h: Likewise.
3347         * target-reloc.h: Likewise.
3348         * target.cc: Likewise.
3349         * target.h: Likewise.
3350         * timer.cc: Likewise.
3351         * timer.h: Likewise.
3352         * x86_64.cc: Likewise.
3353
3354 2010-12-09  Cary Coutant  <ccoutant@google.com>
3355
3356         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3357         stack.
3358         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3359         parameter; change all callers.
3360         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3361         * options.h (warn_execstack): New option.
3362
3363 2010-12-07  Doug Kwan  <dougkwan@google.com>
3364
3365         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3366         like function call relocations.
3367
3368 2010-12-07  Ian Lance Taylor  <iant@google.com>
3369
3370         * archive.cc (Archive::get_elf_object_for_member): Permit
3371         punconfigured to be NULL.
3372         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3373         (Archive::include_member): Pass NULL to get_elf_object_for_member
3374         if we searched for the archive and this is the first included
3375         object.
3376
3377 2010-12-01  Ian Lance Taylor  <iant@google.com>
3378
3379         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3380         track_relocs_type_ field.
3381         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3382         Set track_relocs_type_.
3383         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3384         contents when using RELA relocs.
3385         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3386         reloc_map_.
3387         * reloc.cc (Track_relocs::next_addend): New function.
3388         * reloc.h (class Track_relocs): Declare next_addend.
3389
3390 2010-12-01  Ian Lance Taylor  <iant@google.com>
3391
3392         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3393         virtual destructor.
3394
3395 2010-12-01  Ian Lance Taylor  <iant@google.com>
3396
3397         * README: Update compilers known to work and fail.
3398
3399 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3400
3401         * configure.in: For --enable-gold, handle value `default' instead of
3402         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3403         not the default.
3404         * configure: Regenerate.
3405
3406 2010-11-18  Doug Kwan  <dougkwan@google.com>
3407
3408         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3409         and right_alignment to be zero.  Store result alignment only if it is
3410         greater than existing alignment.
3411
3412 2010-11-16  Cary Coutant  <ccoutant@google.com>
3413
3414         PR gold/12220
3415         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3416         Check for ".zdebug_line".
3417
3418 2010-11-16  Doug Kwan  <dougkwan@google.com>
3419             Cary Coutant  <ccoutant@google.com>
3420
3421         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3422         by reference; adjust all callers.
3423         * output.cc (Output_segment::set_section_addresses): Adjust references
3424         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3425         list is empty.
3426         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3427         end at page boundary.
3428
3429 2010-11-16  Cary Coutant  <ccoutant@google.com>
3430
3431         PR gold/12220
3432         * layout.cc (Layout::choose_output_section): Transform names of
3433         compressed sections even when using a script with a SECTIONS clause.
3434         (Layout::output_section_name): Remove code to transform
3435         compressed debug section names.
3436         * output.cc (Output_section::add_input_section): Use uncompressed
3437         section size when tracking input sections.
3438
3439 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3440
3441         * symtab.h (Symbol::NON_PIC_REF): Remove.
3442         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3443         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3444         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3445         (Symbol::use_plt_offset): Take a flags argument and pass it
3446         directly to needs_dynamic_reloc.  Restrict check for undefined
3447         weak symbols to function calls.
3448         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3449         (Target_arm::Scan::global): Use it.
3450         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3451         (Target_arm::Relocate::relocate): Likewise.
3452         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3453         parameter with an r_type parameter.  Use get_reference_flags
3454         to get the flags.
3455         (Target_arm::Relocate::relocate): Update accordingly.
3456         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3457         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3458         (Target_i386::Scan::global): Likewise.
3459         (Target_i386::Relocate::relocate): Likewise.
3460         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3461         parameter with an r_type parameter.  Use get_reference_flags
3462         to get the flags.
3463         (Target_i386::Relocate::relocate): Update accordingly.
3464         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3465         (Target_powerpc::Scan::global): Use it.
3466         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3467         (Target_powerpc::Relocate::relocate): Likewise.
3468         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3469         (Target_sparc::Scan::global): Use it.
3470         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3471         (Target_sparc::Relocate::relocate): Likewise.
3472         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3473         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3474         (Target_x86_64::Scan::global): Likewise.
3475         (Target_x86_64::Relocate::relocate): Likewise.
3476
3477 2010-11-08  Doug Kwan  <dougkwan@google.com>
3478             Cary Coutant  <ccoutant@google.com>
3479
3480         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3481         (Arm_exidx_merge_section::section_contents_): New data member.
3482         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3483         (Arm_input_section::~Arm_input_section): De-allocate memory.
3484         (Arm_input_section::original_contents_): New data member.
3485         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3486         in parameters instead of calling Object::section_contents without
3487         locking.
3488         (Arm_output_section::group_section): New parameter TASK.  Pass it
3489         to callees that need locking objects.
3490         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3491         to lock EXIDX input sections.  Fix a formatting issue.  Call
3492         Arm_exidx_merged_section::build_contents to create merged section
3493         contents.
3494         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3495         to lock object of stub table owner.
3496         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3497         TEXT_SIZE to initialize data member TEXT_SIZE_.
3498         (Arm_exidx_input_section::addralign): Fix typo in comment.
3499         (Arm_exidx_input_section::text_size): New method.
3500         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3501         that require locking objects.  Lock objects before scanning for stubs
3502         and updating local symbols.
3503         (Arm_input_section<big_endian>::init): Copy contents of original
3504         input section.
3505         (Arm_input_section<big_endian>::do_write): Use saved contents of
3506         original input section instead of calling Object::section_contents
3507         without locking.
3508         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3509         size without calling Object::section_size().
3510         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3511         for size.  Allocate a buffer for merged EXIDX entries.
3512         (Arm_exidx_merged_section::build_contents): New method.
3513         (Arm_exidx_merged_section::do_write): Move merge section contents
3514         building code to Arm_exidx_merged_section::build_contetns.  Write
3515         out contetns in buffer instead of building it on the fly.
3516         (Arm_relobj::make_exidx_input_section): Also pass text section size
3517         to Arm_exidx_input_section constructor.
3518         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3519         (Arm_dynobj::do_read_symbols): Fix memory leak.
3520         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3521         * target.h: (class Task): Add forward declaration.
3522         (Target::relax): Add new parameter TASK and pass it to
3523         Target::do_relax().
3524         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3525
3526 2010-11-05  Cary Coutant  <ccoutant@google.com>
3527
3528         PR gold/10708
3529         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3530         object when reading from the file.
3531         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3532         second layout pass.
3533         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3534         when reading section contents.
3535         (get_section_contents): Likewise.
3536         (icf::find_identical_sections): Likewise.
3537         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3538         object when reading from the file.
3539         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3540         the object when doing deferred section layout.
3541
3542 2010-11-03  Nick Clifton  <nickc@redhat.com>
3543
3544         PR gold/12001
3545         * script.h (class Symbol_assignment: name): New member.  Returns
3546         the name of the symbol.
3547         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3548         Returns true if the given symbol name is on the list of
3549         assignments wating to be processed.
3550         * archive.cc (should_incldue_member): If the symbol is undefined,
3551         check to see if it is on the list of symbols pending assignment.
3552
3553 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3554
3555         * script-sections.cc (Script_sections::find_memory_region): Check
3556         for a NULL output section pointer.
3557
3558 2010-10-29  Doug Kwan  <dougkwan@google.com>
3559
3560         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3561         Output_section::add_relaxed_input_section.
3562         * output.cc (Output_section::add_relaxed_input_section): Add new
3563         arguments LAYOUT and NAME.  Set section order index.
3564         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3565         Copy section order index.
3566         * output.h (Output_section::add_relaxed_input_section): Add new
3567         arguments LAYOUT and NAME.
3568
3569 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3570
3571         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3572         NATIVE_OR_CROSS_LINKER.
3573         * testsuite/Makefile.in: Regenerate.
3574
3575 2010-10-20  Doug Kwan  <dougkwan@google.com>
3576
3577         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3578         without SHF_LINK_ORDER flags.
3579         * layout.cc (Layout::choose_output_section): Do not filter
3580         SHF_LINK_ORDER flag in a relocatable link.
3581
3582 2010-10-17  Cary Coutant  <ccoutant@google.com>
3583
3584         * output.h (Output_segment::set_section_addresses): Change function
3585         signature.  Update all callers.
3586         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3587         sections.
3588         (Output_segment::set_section_addresses): Align after last TLS
3589         section.  Add padding before last relro section instead of after.
3590
3591 2010-10-17  Doug Kwan  <dougkwan@google.com>
3592
3593         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3594         GOT output section to be writable.
3595
3596 2010-10-14  Cary Coutant  <ccoutant@google.com>
3597
3598         * debug.h (DEBUG_INCREMENTAL): New flag.
3599         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3600         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3601         mode.
3602         * incremental.cc (report_command_line): Ignore all forms of
3603         --incremental.
3604         * layout.cc (Layout::Layout): Check parameters for incremental link
3605         mode.
3606         * options.cc (General_options::parse_incremental): New function.
3607         (General_options::parse_no_incremental): New function.
3608         (General_options::parse_incremental_full): New function.
3609         (General_options::parse_incremental_update): New function.
3610         (General_options::incremental_mode_): New data member.
3611         (General_options::finalize): Check incremental_mode_.
3612         * options.h (General_options): Update help text for --incremental.
3613         Add --no-incremental, --incremental-full, --incremental-update.
3614         (General_options::Incremental_mode): New enum type.
3615         (General_options::incremental_mode): New function.
3616         (General_options::incremental_mode_): New data member.
3617         * parameters.cc (Parameters::incremental_mode_): New data member.
3618         (Parameters::set_options): Set incremental_mode_.
3619         (Parameters::set_incremental_full): New function.
3620         (Parameters::incremental): New function.
3621         (Parameters::incremental_update): New function.
3622         (set_parameters_incremental_full): New function.
3623         * parameters.h (Parameters::set_incremental_full): New function.
3624         (Parameters::incremental): New function.
3625         (Parameters::incremental_update): New function.
3626         (Parameters::incremental_mode_): New data member.
3627         (set_parameters_incremental_full): New function.
3628         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3629         incremental link mode.
3630         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3631         (Sized_relobj::do_relocate_sections): Likewise.
3632         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3633         option.
3634         * testsuite/Makefile.in: Regenerate.
3635         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3636
3637 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3638
3639         * script-sections.h (class Script_sections): Make
3640         Sections_elements typedef public.
3641         * script-sections.cc (class Sort_output_sections): Add elements_
3642         field.  Add constructor which sets it; change all callers.
3643         (Sort_output_sections::is_before): New function.
3644         (Sort_output_sections::operator()): Call is_before.
3645         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3646         conditional.
3647         * testsuite/script_test_10.sh: New test. Test script section
3648         order.
3649         * testsuite/script_test_10.t: Likewise.
3650         * testsuite/script_test_10.s: Likewise.
3651         * testsuite/Makefile.am: Wrap the cross linker tests and the
3652         common tests into NATIVE_OR_CROSS_LINKER.
3653         (check_SCRIPTS): Add script_test_10.sh.
3654         (check_DATA): Add script_test_10.stdout.
3655         (script_test_10.o, script_test_10): New targets.
3656         (script_test_10.stdout): New target.
3657         * configure, testsuite/Makefile.in: Regenerate.
3658
3659 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3660
3661         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3662         error for the deprecated relocations.
3663         (Target_arm::Scan::global): Likewise.
3664         (Target_arm::Relocate::relocate): Likewise.
3665
3666 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3667
3668         * fileread.cc (Input_file::find_file): Initialize *found_name
3669         and *namep when using the fallback search for case 4.
3670
3671 2010-10-11  Cary Coutant  <ccoutant@google.com>
3672
3673         * options.h (class General_options): Redefine -z lazy as an alias for
3674         the negation of -z now.
3675
3676 2010-10-11  Ian Lance Taylor  <iant@google.com>
3677
3678         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3679         binding.
3680
3681 2010-10-06  Nick Clifton  <nickc@redhat.com>
3682
3683         * script-sections.cc(class Memory_region): Remove
3684         current_lma_offset_ field.  Rename current_vma_offset_ to
3685         current_offset_.  Add last_section_ field.
3686         (Memory_region::get_current_vma_address): Rename to
3687         get_current_address.
3688         (Memory_region::get_current_lma_address): Delete.
3689         (Memory_region::increment_vma_offset): Rename to
3690         increment_offset.
3691         (Memory_region::increment_lma_offset): Delete.
3692         (Memory_region::attributes_compatible): New method.  Returns
3693         true if the provided section is compatible with the region.
3694         (Memory_region::get_last_section): New method.  Returns the last
3695         section to use the region.
3696         (Memory_region::set_last_section): New method.  Stores the last
3697         section to use the region.
3698         (Script_sections::block_in_region): New method.  Returns true if
3699         a block of memory is contained within a region.
3700         (Script_sections::find_memory_region): New method.  Locates a
3701         memory region to be used to set a VMA or LMA address.
3702         (Output_section_definition::set_section_addresses): Add code to
3703         check for addresses set by memory regions.
3704         (Output_segment::set_section_addresses): Remove memory region
3705         walking code.
3706         (Script_sections::create_segment): Add a warning if a header
3707         segment is created outside of any region.
3708         * script-sections.h (class Script_sections): Add prototypes for
3709         find_memory_region and block_in_region methods.
3710         * testsuite/memory_test.s: Use .long instead of .word.
3711         * testsuite/memory_test.t: Add some more output sections.
3712         * testsuite/memory_test.sh: Update expected output.
3713
3714 2010-10-02  Doug Kwan  <dougkwan@google.com>
3715
3716         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3717         defintion to symtab.h
3718         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3719         declaration to defintion.
3720
3721 2010-10-01  Nick Clifton  <nickc@redhat.com>
3722
3723         * expression.cc (eval): Replace dummy argument with NULL.
3724         (eval_maybe_dot): Check for a NULL result section pointer.
3725         (Symbol_expression::value): Likewise.
3726         (Dot_expression::value): Likewise.
3727         (BINARY_EXPRESSION): Likewise.
3728         (Max_expression::value): Likewise.
3729         (Min_expression::value): Likewise.
3730         (Absolute_expression::value): Likewise.
3731         (Addr_expression::value_from_output_section): Likewise.
3732         (Loaddddr_expression::value_from_output_section): Likewise.
3733         (Segment_start_expression::value): Likewise.
3734         * script-sections.cc
3735         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3736         argument with NULL.
3737         (Sections_elememt_dot_assignment::set_section_addresses):
3738         Likewise.
3739         (Output_data_expression::do_write_to_buffer): Likewise.
3740         (Output_section_definition::finalize_symbols): Likewise.
3741         (Output_section_definition::set_section_addresses): Likewise.
3742
3743 2010-09-30  Doug Kwan  <dougkwan@google.com>
3744
3745         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3746
3747 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3748
3749         * target.h (Target::can_icf_inline_merge_sections): New virtual
3750         function.
3751         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3752         virtual function.
3753         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3754         virtual function.
3755         * icf.cc (get_section_contents): Inline merge sections only when
3756         target allows it.
3757
3758 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3759
3760         * configure: Regenerate.
3761
3762 2010-09-17  Ian Lance Taylor  <iant@google.com>
3763
3764         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3765         * testsuite/Makefile.am (memory_test.o): New target.
3766         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3767         memory_test.t.
3768         * testsuite/Makefile.in: Rebuild.
3769
3770 2010-09-17  Doug Kwan  <dougkwan@google.com>
3771
3772         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3773         defintion if relocation uses GOT entries of the symbol.
3774         * testsuite/icf_safe_test.sh: Fix test.
3775         * testsuite/icf_safe_so_test.sh: Fix test.
3776
3777 2010-09-16  Cary Coutant  <ccoutant@google.com>
3778
3779         * script_sections.cc (class Memory_region): Remove "NULL" from
3780         vector initializations.
3781
3782 2010-09-15  Cary Coutant  <ccoutant@google.com>
3783
3784         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3785         Resolve forwarding symbols.
3786
3787 2010-09-15  Doug Kwan  <dougkwan@google.com>
3788
3789         * gold/testsuite/script_test_3.t: Add ARM special sections.
3790         * gold/testsuite/script_test_4.t: Same.
3791         * gold/testsuite/script_test_5.t: Same.
3792         * gold/testsuite/script_test_6.t: Same.
3793         * gold/testsuite/script_test_7.t: Same.
3794         * gold/testsuite/script_test_7.t: Same.
3795         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3796
3797 2010-09-14  Cary Coutant  <ccoutant@google.com>
3798
3799         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3800         (Target_x86_64::Relocate::relocate_tls): Replace check for
3801         saw_tls_block_reloc_ with test for executable section.
3802
3803 2010-09-12  Cary Coutant  <ccoutant@google.com>
3804
3805         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3806         position-independent executables to shared libraries need dynamic
3807         relocations.
3808         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3809         position-independent executables.
3810         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3811         * testsuite/Makefile.in: Regenerate.
3812
3813 2010-09-10  Nick Clifton  <nickc@redhat.com>
3814
3815         PR gold/11997
3816         * testsuite/memory_test.t: Discard any sections that are not
3817         needed.
3818
3819 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3820
3821         PR gold/11996
3822         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3823         "This::" to work around a bug in gcc 4.2.
3824
3825         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3826
3827 2010-09-09  Rafael Espindola  <espindola@google.com>
3828
3829         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3830         sections with different PF_X flags in the same segment.
3831         (Layout::find_first_load_seg): Search all segments to find the first
3832         one.
3833         * options.h (rosegment): New.
3834
3835 2010-09-08  Rafael Espindola  <espindola@google.com>
3836
3837         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3838
3839 2010-09-08  Doug Kwan  <dougkwan@google.com>
3840
3841         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3842         (Arm_relobj::do_relocate_sections): Add new parameter for output
3843         file to match the parent.
3844         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3845         of local symbols instead of input values.  Update code to track
3846         changes in gold::relocate_section.
3847         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3848         (Sized_relobj::compute_final_local_value_internal): New methods.
3849         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3850         body into private version of Sized_relobj::compute_final_local_value.
3851         Call the inline method.
3852         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3853         merged symbol value if there is one.
3854         (Symbol_value::has_output_value): New method defintiion.
3855         (Sized_relobj::Compute_final_local_value_status): New enum type.
3856         (Sized_relobj::compute_final_local_value): New methods.
3857         (Sized_relobj::compute_final_local_value_internal): New methods.
3858         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3859         and arm_cortex_a8.sh.
3860         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3861         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3862         New tests.
3863         * Makefile.in: Regenerate.
3864         * testsuite/arm_bl_out_of_range.s: Update test.
3865         * testsuite/thumb_bl_out_of_range.s: Ditto.
3866         * testsuite/thumb_blx_out_of_range.s: Ditto.
3867         * testsuite/arm_branch_out_of_range.sh: New file.
3868         * testsuite/arm_cortex_a8.sh: Ditto.
3869         * testsuite/arm_cortex_a8_b.s: Ditto.
3870         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3871         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3872         * testsuite/arm_cortex_a8_bl.s: Ditto.
3873         * testsuite/arm_cortex_a8_blx.s: Ditto.
3874         * testsuite/arm_cortex_a8_local.s: Ditto.
3875         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3876         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3877
3878 2010-09-08  Rafael Espindola  <espindola@google.com>
3879
3880         * Makefile.am (memory_test.stdout): Run readelf with -W.
3881         * Makefile.in: Regenerate.
3882         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3883         64 bit output.
3884
3885 2010-09-08  Rafael Espindola  <espindola@google.com>
3886
3887         * script-sections.cc (Script_sections::add_memory_region): Convert
3888         field precision to int.
3889         * script.cc (script_set_section_region, script_set_section_region):
3890         Convert field precision to int.
3891
3892 2010-09-08  Rafael Espindola  <espindola@google.com>
3893
3894         * arm.cc (do_finalize_sections): Create the __exidx_start and
3895         __exdix_end symbols even when the section is missing.
3896
3897 2010-09-08  Nick Clifton  <nickc@redhat.com>
3898
3899         * README: Remove claim that MEMORY is not supported.
3900         * expression.cc (script_exp_function_origin)
3901         (script_exp_function_length): Move from here to ...
3902         * script.cc: ... here.
3903         (script_set_section_region, script_add_memory)
3904         (script_parse_memory_attr, script_include_directive): New
3905         functions.
3906         * script-sections.cc
3907         (class Memory_region): New class.
3908         (class Output_section_definition): Add set_memory_region,
3909         set_section_vma, set_section_lma and get_section_name methods.
3910         (class Script_Sections): Add add_memory_region,
3911         find_memory_region, find_memory_region_origin,
3912         find_memory_region_length and set_memory_region methods.
3913         Have set_section_addresses method walk the list of set memory
3914         regions.
3915         Extend the print methos to display memory regions.
3916         * script-sections.h: Add prototypes for new methods.
3917         Add enum for MEMORY region attributes.
3918         * yyscript.y: Add support for parsing MEMORY regions.
3919         * script-c.h: Add prototypes for new functions.
3920         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3921         * testsuite/Makefile.in: Regenerate.
3922         * testsuite/memory_test.sh: New script.
3923         * testsuite/memory_test.s: New assembler source file.
3924         * testsuite/memory_test.t: New linker script.
3925
3926 2010-08-27  Doug Kwan  <dougkwan@google.com>
3927
3928         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3929         reference override an existing dynamic weak reference.
3930         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3931         * testsuite/Makefile.in: Regenerate.
3932         * testsuite/dyn_weak_ref.sh: New file.
3933         * testsuite/dyn_weak_ref_1.c: Ditto.
3934         * testsuite/dyn_weak_ref_2.c: Ditto.
3935
3936 2010-08-27  Ian Lance Taylor  <iant@google.com>
3937
3938         * incremental.h (class Incremental_input_entry): Add virtual
3939         destructor.
3940
3941 2010-08-27  Ian Lance Taylor  <iant@google.com>
3942
3943         * testsuite/start_lib_test_3.c: Mark t3 as used.
3944
3945 2010-08-27  Nick Clifton  <nickc@redhat.com>
3946
3947         * options.cc (version_script): Fix small typo in previous
3948         whitespace tidyup.
3949
3950 2010-08-25  Nick Clifton  <nickc@redhat.com>
3951
3952         * archive.cc: Formatting fixes: Remove whitespace between
3953         typename and following asterisk.  Remove whitespace between
3954         function name and opening parenthesis.
3955         * archive.h: Likewise.
3956         * arm.cc: Likewise.
3957         * attributes.cc: Likewise.
3958         * attributes.h: Likewise.
3959         * common.cc: Likewise.
3960         * copy-relocs.cc: Likewise.
3961         * dirsearch.h: Likewise.
3962         * dynobj.cc: Likewise.
3963         * ehframe.cc: Likewise.
3964         * ehframe.h: Likewise.
3965         * expression.cc: Likewise.
3966         * fileread.cc: Likewise.
3967         * fileread.h: Likewise.
3968         * gc.h: Likewise.
3969         * gold-threads.cc: Likewise.
3970         * gold.cc: Likewise.
3971         * i386.cc: Likewise.
3972         * icf.h: Likewise.
3973         * incremental-dump.cc: Likewise.
3974         * incremental.cc: Likewise.
3975         * layout.cc: Likewise.
3976         * layout.h: Likewise.
3977         * main.cc: Likewise.
3978         * merge.cc: Likewise.
3979         * merge.h: Likewise.
3980         * object.cc: Likewise.
3981         * object.h: Likewise.
3982         * options.cc: Likewise.
3983         * options.h: Likewise.
3984         * output.cc: Likewise.
3985         * output.h: Likewise.
3986         * plugin.cc: Likewise.
3987         * plugin.h: Likewise.
3988         * powerpc.cc: Likewise.
3989         * reloc.cc: Likewise.
3990         * script-c.h: Likewise.
3991         * script-sections.cc: Likewise.
3992         * script.cc: Likewise.
3993         * stringpool.cc: Likewise.
3994         * symtab.cc: Likewise.
3995         * symtab.h: Likewise.
3996         * target.cc: Likewise.
3997         * timer.cc: Likewise.
3998         * timer.h: Likewise.
3999         * version.cc: Likewise.
4000         * x86_64.cc: Likewise.
4001
4002 2010-08-24  Nick Clifton  <nickc@redhat.com>
4003
4004         PR 11899
4005         * layout.cc (segment_precedes): Sort segments by their physical
4006         addresses, if they have been set.
4007
4008 2010-08-23  Cary Coutant  <ccoutant@google.com>
4009
4010         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4011         symbols data.
4012         (Lib_group::include_member): Unlock object after deleting its
4013         symbols data.
4014         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4015         the bug fixed here.
4016
4017 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4018             Cary Coutant  <ccoutant@google.com>
4019
4020         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4021         constructor, and set_blocker.
4022         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4023         readsyms_blocker_.
4024         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4025         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4026         * testsuite/Makefile.am (start_lib_test): New test case.
4027         * testsuite/Makefile.in: Regenerate.
4028         * testsuite/start_lib_test_main.c: New file.
4029         * testsuite/start_lib_test_1.c: New file.
4030         * testsuite/start_lib_test_2.c: New file.
4031         * testsuite/start_lib_test_3.c: New file.
4032
4033 2010-08-19  Ian Lance Taylor  <iant@google.com>
4034
4035         * Makefile.in: Rebuild with automake 1.11.1.
4036         * aclocal.m4: Likewise.
4037         * testsuite/Makefile.in: Likewise.
4038
4039 2010-08-19  Ian Lance Taylor  <iant@google.com>
4040
4041         PR 10893
4042         * i386.cc (class Output_data_plt_i386): Update declarations.
4043         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4044         local_ifuncs_ fields.
4045         (Target_i386::do_plt_section_for_global): New function.
4046         (Target_i386::do_plt_section_for_local): New function.
4047         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4048         parameter; change all callers.  Initialize global_ifuncs_ and
4049         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4050         __rel_iplt_end.
4051         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4052         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4053         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4054         symbols.
4055         (Target_i386::make_plt_section): New function, broken out of
4056         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4057         (Target_i386::make_plt_entry): Call make_plt_section.
4058         (Target_i386::make_local_ifunc_plt_entry): New function.
4059         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4060         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4061         R_386_IRELATIVE to switch.
4062         (Target_i386::Scan::global): Likewise.
4063         (Target_i386::Relocate::relocate): Likewise.
4064         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4065         switch.
4066         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4067         (Target_x86_64::do_plt_section_for_global): New function.
4068         (Target_x86_64::do_plt_section_for_local): New function.
4069         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4070         parameter; change all callers.  If doing a static link define
4071         __rela_iplt_start and __rela_iplt_end.
4072         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4073         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4074         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4075         to point to .plt.
4076         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4077         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4078         switch.
4079         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4080         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4081         R_X86_64_IRELATIVE to switch.
4082         (Target_x86_64::Scan::global): Likewise.
4083         (Target_x86_64::Relocate::relocate): Likewise.
4084         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4085         switch.
4086         * target.h (class Target): Add plt_section_for_global and
4087         plt_section_for_local functions.  Add do_plt_section_for_global
4088         and do_plt_section_for_local virtual functions.
4089         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4090         clarifying comments.
4091         (Symbol::use_plt_offset): Handle IFUNC symbol.
4092         * object.cc (Sized_relobj::Sized_relobj): Initialize
4093         local_plt_offsets_.
4094         (Sized_relobj::local_has_plt_offset): New function.
4095         (Sized_relobj::local_plt_offset): New function.
4096         (Sized_relobj::set_local_plt_offset): New function.
4097         (Sized_relobj::do_count): Handle IFUNC symbol.
4098         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4099         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4100         is_ifunc_symbol functions.
4101         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4102         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4103         local_plt_offsets_ field.
4104         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4105         * output.h (class Output_section_data): Add non-const
4106         output_section function.
4107         (class Output_data_got): Update declarations.
4108         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4109         Add use_plt_offset parameter to global and local constructors.
4110         Change all callers.  Change local_sym_index_ field to 31 bits.
4111         Change GSYM_CODE and CONSTANT_CODE accordingly.
4112         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4113         doing a static link don't set sh_link field.
4114         (Output_data_got::Got_entry::write): Use PLT offset if
4115         appropriate.
4116         (Output_data_got::add_global_plt): New function.
4117         (Output_data_got::add_local_plt): New function.
4118         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4119         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4120         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4121         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4122         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4123         IFUNC conditional.
4124         * testsuite/ifunc-sel.h: New file.
4125         * testsuite/ifuncmain1.c: New file.
4126         * testsuite/ifuncmain1vis.c: New file.
4127         * testsuite/ifuncmod1.c: New file.
4128         * testsuite/ifuncdep2.c: New file.
4129         * testsuite/ifuncmain2.c: New file.
4130         * testsuite/ifuncmain3.c: New file.
4131         * testsuite/ifuncmod3.c: New file.
4132         * testsuite/ifuncmain4.c: New file.
4133         * testsuite/ifuncmain5.c: New file.
4134         * testsuite/ifuncmod5.c: New file.
4135         * testsuite/ifuncmain6pie.c: New file.
4136         * testsuite/ifuncmod6.c: New file.
4137         * testsuite/ifuncmain7.c: New file.
4138         * configure, testsuite/Makefile.in: Rebuild.
4139
4140 2010-08-18  Ian Lance Taylor  <iant@google.com>
4141
4142         * incremental.cc
4143         (Output_section_incremental_inputs::write_input_files): Add cast
4144         to avoid signed/unsigned comparison warning.
4145         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4146
4147 2010-08-12  Cary Coutant  <ccoutant@google.com>
4148
4149         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4150
4151 2010-08-13  Ian Lance Taylor  <iant@google.com>
4152
4153         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4154
4155 2010-08-12  Cary Coutant  <ccoutant@google.com>
4156             Doug Kwan  <dougkwan@google.com>
4157
4158         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4159         defintion overrides non-weak undef, remember that the original undef
4160         is not weak.
4161         * symtab.cc (Symbol_table::sized_write_global): For undef without
4162         an original weak binding, set binding to global in output.
4163         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4164         * testsuite/Makefile.in: Regenerate.
4165         * testsuite/strong_ref_weak_def.sh: New file.
4166         * testsuite/strong_ref_weak_def_1.c: Ditto.
4167         * testsuite/strong_ref_weak_def_2.c: Ditto.
4168
4169 2010-08-12  Cary Coutant  <ccoutant@google.com>
4170
4171         * testsuite/incremental_test.sh: Rewrite.
4172         * testsuite/incremental_test_1.c: Rewrite.
4173         * testsuite/incremental_test_2.c: Rewrite.
4174
4175 2010-08-12  Cary Coutant  <ccoutant@google.com>
4176
4177         * arm.cc (Target_arm::got_size): Add const.
4178         (Target_arm::got_entry_count): New function.
4179         (Target_arm::plt_entry_count): New function.
4180         (Target_arm::first_plt_entry_offset): New function.
4181         (Target_arm::plt_entry_size): New function.
4182         (Output_data_plt_arm::entry_count): New function.
4183         (Output_data_plt_arm::first_plt_entry_offset): New function.
4184         (Output_data_plt_arm::get_plt_entry_size): New function.
4185         * i386.cc (Target_i386::got_size): Add const.
4186         (Target_i386::got_entry_count): New function.
4187         (Target_i386::plt_entry_count): New function.
4188         (Target_i386::first_plt_entry_offset): New function.
4189         (Target_i386::plt_entry_size): New function.
4190         (Output_data_plt_i386::entry_count): New function.
4191         (Output_data_plt_i386::first_plt_entry_offset): New function.
4192         (Output_data_plt_i386::get_plt_entry_size): New function.
4193         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4194         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4195         * incremental.cc: Include target.h.
4196         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4197         parameter.  Adjust all callers.  Find incremental_got_plt section.
4198         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4199         section.
4200         (Output_section_incremental_inputs::set_final_data_size): Calculate
4201         size of incremental_got_plt section.
4202         (Output_section_incremental_inputs::do_write): Write the
4203         incremental_got_plt section.
4204         (Got_plt_view_info): New struct.
4205         (Local_got_offset_visitor): New class.
4206         (Global_got_offset_visitor): New class.
4207         (Global_symbol_visitor_got_plt): New class.
4208         (Output_section_incremental_inputs::write_got_plt): New function.
4209         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4210         Add parameter.  Adjust all callers.
4211         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4212         (Incremental_inputs::got_plt_section): New function.
4213         (Incremental_inputs::got_plt_section_): New data member.
4214         (Incremental_got_plt_reader): New class.
4215         * layout.cc (Layout::create_incremental_info_sections): Add the
4216         incremental_got_plt section.
4217         * object.h (Got_offset_list::get_list): New function.
4218         (Got offset_list::for_all_got_offsets): New function.
4219         (Sized_relobj::local_got_offset_list): New function.
4220         * powerpc.cc (Target_powerpc::got_size): Add const.
4221         (Target_powerpc::got_entry_count): New function.
4222         (Target_powerpc::plt_entry_count): New function.
4223         (Target_powerpc::first_plt_entry_offset): New function.
4224         (Target_powerpc::plt_entry_size): New function.
4225         (Output_data_plt_powerpc::entry_count): New function.
4226         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4227         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4228         * sparc.cc (Target_sparc::got_size): Add const.
4229         (Target_sparc::got_entry_count): New function.
4230         (Target_sparc::plt_entry_count): New function.
4231         (Target_sparc::first_plt_entry_offset): New function.
4232         (Target_sparc::plt_entry_size): New function.
4233         (Output_data_plt_sparc::entry_count): New function.
4234         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4235         (Output_data_plt_sparc::get_plt_entry_size): New function.
4236         * symtab.h (Symbol::got_offset_list): New function.
4237         (Symbol_table::for_all_symbols): New function.
4238         * target.h (Sized_target::got_entry_count): New function.
4239         (Sized_target::plt_entry_count): New function.
4240         (Sized_target::plt_entry_size): New function.
4241         * x86_64.cc (Target_x86_64::got_size): Add const.
4242         (Target_x86_64::got_entry_count): New function.
4243         (Target_x86_64::plt_entry_count): New function.
4244         (Target_x86_64::first_plt_entry_offset): New function.
4245         (Target_x86_64::plt_entry_size): New function.
4246         (Output_data_plt_x86_64::entry_count): New function.
4247         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4248         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4249
4250 2010-08-12  Cary Coutant  <ccoutant@google.com>
4251
4252         * archive.cc: Include incremental.h.
4253         (Archive::Archive): Initialize incremental_info_.
4254         (Archive::include_member): Record archive members in incremental info.
4255         (Add_archive_symbols::run): Record begin and end of an archive in
4256         incremental info.
4257         (Lib_group::include_member): Record objects in incremental info.
4258         * archive.h (Incremental_archive_entry): Forward declaration.
4259         (Archive::set_incremental_info): New member function.
4260         (Archive::incremental_info): New member function.
4261         (Archive::Unused_symbol_iterator): New class.
4262         (Archive::unused_symbols_begin): New member function.
4263         (Archive::unused_symbols_end): New member function.
4264         (Archive::incremental_info_): New data member.
4265         * incremental-dump.cc (find_input_containing_global): New function.
4266         (dump_incremental_inputs): Dump new incremental info sections.
4267         * incremental.cc: Include symtab.h.
4268         (Output_section_incremental_inputs): New class.
4269         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4270         new incremental info sections.
4271         (Sized_incremental_binary::do_check_inputs): Likewise.
4272         (Incremental_inputs::report_archive): Remove.
4273         (Incremental_inputs::report_archive_begin): New function.
4274         (Incremental_inputs::report_archive_end): New function.
4275         (Incremental_inputs::report_object): New function.
4276         (Incremental_inputs::finalize_inputs): Remove.
4277         (Incremental_inputs::report_input_section): New function.
4278         (Incremental_inputs::report_script): Rewrite.
4279         (Incremental_inputs::finalize): Do nothing but finalize string table.
4280         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4281         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4282         (Incremental_inputs::create_data_sections): New function.
4283         (Incremental_inputs::relocs_entsize): New function.
4284         (Output_section_incremental_inputs::set_final_data_size): New function.
4285         (Output_section_incremental_inputs::do_write): New function.
4286         (Output_section_incremental_inputs::write_header): New function.
4287         (Output_section_incremental_inputs::write_input_files): New function.
4288         (Output_section_incremental_inputs::write_info_blocks): New function.
4289         (Output_section_incremental_inputs::write_symtab): New function.
4290         * incremental.h (Incremental_script_entry): Forward declaration.
4291         (Incremental_object_entry): Forward declaration.
4292         (Incremental_archive_entry): Forward declaration.
4293         (Incremental_inputs): Forward declaration.
4294         (Incremental_inputs_header_data): Remove.
4295         (Incremental_inputs_header): Remove.
4296         (Incremental_inputs_header_write): Remove.
4297         (Incremental_inputs_entry_data): Remove.
4298         (Incremental_inputs_entry): Remove.
4299         (Incremental_inputs_entry_write): Remove.
4300         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4301         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4302         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4303         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4304         Likewise.
4305         (Incremental_input_entry): New class.
4306         (Incremental_script_entry): New class.
4307         (Incremental_object_entry): New class.
4308         (Incremental_archive_entry): New class.
4309         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4310         (Incremental_inputs::report_inputs): Remove.
4311         (Incremental_inputs::report_archive): Remove.
4312         (Incremental_inputs::report_archive_begin): New function.
4313         (Incremental_inputs::report_archive_end): New function.
4314         (Incremental_inputs::report_object): Change prototype.
4315         (Incremental_inputs::report_input_section): New function.
4316         (Incremental_inputs::report_script): Change prototype.
4317         (Incremental_inputs::get_reloc_count): New function.
4318         (Incremental_inputs::set_reloc_count): New function.
4319         (Incremental_inputs::create_data_sections): New function.
4320         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4321         (Incremental_inputs::inputs_section): New function.
4322         (Incremental_inputs::symtab_section): New function.
4323         (Incremental_inputs::relocs_section): New function.
4324         (Incremental_inputs::get_stringpool): Add const.
4325         (Incremental_inputs::command_line): Add const.
4326         (Incremental_inputs::inputs): Remove.
4327         (Incremental_inputs::command_line_key): New function.
4328         (Incremental_inputs::input_file_count): New function.
4329         (Incremental_inputs::input_files): New function.
4330         (Incremental_inputs::relocs_entsize): New function.
4331         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4332         (Incremental_inputs::finalize_inputs): Remove.
4333         (Incremental_inputs::Input_info): Remove.
4334         (Incremental_inputs::lock_): Remove.
4335         (Incremental_inputs::inputs_): Change type.
4336         (Incremental_inputs::inputs_map_): Remove.
4337         (Incremental_inputs::current_object_entry_): New data member.
4338         (Incremental_inputs::inputs_section_): New data member.
4339         (Incremental_inputs::symtab_section_): New data member.
4340         (Incremental_inputs::relocs_section_): New data member.
4341         (Incremental_inputs::reloc_count_): New data member.
4342         (Incremental_inputs_reader): New class.
4343         (Incremental_symtab_reader): New class.
4344         (Incremental_relocs_reader): New class.
4345         * layout.cc (Layout::finalize): Move finalization of incremental info
4346         and creation of incremental info sections to follow finalization of
4347         symbol table.  Set offsets for postprocessing sections.
4348         (Layout::create_incremental_info_sections): Call
4349         Incremental_inputs::create_data_sections.  Add incremental symtab
4350         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4351         sections to layout after input sections.
4352         * layout.h (struct Timespec): Forward declaration.
4353         (Layout::incremental_inputs): Add const.
4354         (Layout::create_incremental_info_sections): Add parameter.
4355         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4356         * object.cc: Include incremental.h.
4357         (Relobj::finalize_incremental_relocs): New function.
4358         (Sized_relobj::do_layout): Record input sections in incremental info.
4359         * object.h (Object::output_section): New function.
4360         (Object::output_section_offset): Moved from Relobj.
4361         (Object::get_incremental_reloc_base): New function.
4362         (Object::get_incremental_reloc_count): New function.
4363         (Object::do_output_section): New function.
4364         (Object::do_output_section_offset): Moved from Relobj.
4365         (Object::do_get_incremental_reloc_base): New function.
4366         (Object::do_get_incremental_reloc_count): New function.
4367         (Object::Object): Initialize new data members.
4368         (Relobj::output_section): Renamed do_output_section and moved to
4369         protected.
4370         (Relobj::output_section_offset): Moved to Object.
4371         (Relobj::do_get_incremental_reloc_base): New function.
4372         (Relobj::do_get_incremental_reloc_count): New function.
4373         (Relobj::allocate_incremental_reloc_counts): New function.
4374         (Relobj::count_incremental_reloc): New function.
4375         (Relobj::finalize_incremental_relocs): New function.
4376         (Relobj::next_incremental_reloc_index): New function.
4377         (Relobj::reloc_counts_): New data member.
4378         (Relobj::reloc_bases_): New data member.
4379         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4380         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4381         (Sized_relobj::incremental_relocs_scan): New function.
4382         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4383         (Sized_relobj::incremental_relocs_write): New function.
4384         (Sized_relobj::incremental_relocs_write_reltype): New function.
4385         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4386         incremental link.
4387         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4388         archives and object files elsewhere.
4389         (Add_symbols::run): Report object files here.
4390         (Finish_group::run): Report end of archive at end of group.
4391         * reloc.cc: Include layout.h, incremental.h.
4392         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4393         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4394         (Sized_relobj::incremental_relocs_scan): New function.
4395         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4396         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4397         (Sized_relobj::incremental_relocs_write): New function.
4398         (Sized_relobj::incremental_relocs_write_reltype): New function.
4399         * script.cc (read_input_script): Rewrite test for incremental link.
4400         Change call to Incremental_inputs::report_script.
4401         * symtab.h (Symbol_table::first_global_index): New function.
4402         (Symbol_table::output_count): New function.
4403
4404 2010-08-12  Doug Kwan  <dougkwan@google.com>
4405
4406         * arm.cc (Target_arm::merge_object_attributes): Check command line
4407         options --no-wchar-size-warning and --no-enum-size-warning.
4408         * options.h (General_options): Add ld-compatible options
4409         --no-enum-size-warning and --no-wchar-size-warning.
4410
4411 2010-08-04  Ian Lance Taylor  <iant@google.com>
4412
4413         * x86_64.cc (Target_x86_64::Scan::local): Use
4414         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4415         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4416         (Target_x86_64::Scan::global): Likewise.
4417         (Target_x86_64::Relocate::relocate): Likewise.
4418         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4419         Likewise.
4420
4421 2010-08-03  Cary Coutant  <ccoutant@google.com>
4422
4423         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4424         to reserve space in merged_strings vector. Keep total input size
4425         for stats.
4426         (Output_merge_string::do_print_merge_stats): Print total input size.
4427         * merge.h (Output_merge_string): Add input_size_ field.
4428         * stringpool.cc (Stringpool_template::string_length): Move
4429         implementations out of Stringpool_template class and place in
4430         stringpool.h.
4431         * stringpool.h (string_length): Move out of Stringpool_template.
4432
4433 2010-08-03  Ian Lance Taylor  <iant@google.com>
4434
4435         PR 11712
4436         * layout.cc (relaxation_loop_body): If address of load segment is
4437         set, adjust address to include headers if possible.
4438
4439 2010-08-03  Ian Lance Taylor  <iant@google.com>
4440
4441         * version.cc (version_string): Bump to 1.10.
4442
4443 2010-08-03  Ian Lance Taylor  <iant@google.com>
4444
4445         PR 11805
4446         * layout.h (enum Output_section_order): Define.
4447         (class Layout): Update declarations.
4448         * layout.cc (Layout::get_output_section): Add order parameter.
4449         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4450         is_first_non_relro parameters.  Change all callers.
4451         (Layout::choose_output_section): Likewise.
4452         (Layout::add_output_section_data): Likewise.
4453         (Layout::make_output_section): Likewise.  Set order.
4454         (Layout::default_section_order): New function.
4455         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4456         * output.cc (Output_section::Output_section): Initialize order_.
4457         Don't initialize deleted fields.
4458         (Output_segment::Output_segment): Don't initialize deleted
4459         fields.
4460         (Output_segment::add_output_section_to_load): New function
4461         replacing add_output_section.  Change all callers to call this or
4462         add_output_section_to_nonload.
4463         (Output_segment::add_output_section_to_nonload): New function.
4464         (Output_segment::remove_output_section): Rewrite.
4465         (Output_segment::add_initial_output_data): Likewise.
4466         (Output_segment::has_any_data_sections): Likewise.
4467         (Output_segment::is_first_section_relro): Likewise.
4468         (Output_segment::maximum_alignment): Likewise.
4469         (Output_segment::has_dynamic_reloc): New function replacing
4470         dynamic_reloc_count.  Change all callers.
4471         (Output_segment::has_dynamic_reloc_list): New function replacing
4472         dynamic_reloc_count_list.  Change all callers.
4473         (Output_segment::set_section_addresses): Rewrite.
4474         (Output_segment::set_offset): Rewrite.
4475         (Output_segment::find_first_and_last_list): Remove.
4476         (Output_segment::set_tls_offsets): Rewrite.
4477         (Output_segment::first_section_load_address): Likewise.
4478         (Output_segment::output_section_count): Likewise.
4479         (Output_segment::section_with_lowest_load_address): Likewise.
4480         (Output_segment::write_section_headers): Likewise.
4481         (Output_segment::print_sections_to_map): Likewise.
4482         * output.h (class Output_data): Remove dynamic_reloc_count_
4483         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4484         (Output_data::add_dynamic_reloc): Rewrite.
4485         (Output_data::has_dynamic_reloc): New function.
4486         (Output_data::dynamic_reloc_count): Remove.
4487         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4488         is_last_relro_, is_first_non_relro_, is_interp_,
4489         is_dynamic_linker_section_ fields.  Add order and set_order
4490         functions.  Remove is_relro_local, set_is_relro_local,
4491         is_last_relro, set_is_last_relro, is_first_non_relro,
4492         set_is_first_non_relro functions, is_interp, set_is_interp,
4493         is_dynamic_linker_section, and set_is_dynamic_linker_section
4494         functions.
4495         (class Output_segment): Change Output_data_list from std::list to
4496         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4497         output_bss_ fields.  Update declarations.
4498
4499 2010-08-02  Ian Lance Taylor  <iant@google.com>
4500
4501         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4502         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4503         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4504
4505 2010-08-02  Ian Lance Taylor  <iant@google.com>
4506
4507         PR 11855
4508         * script.cc (Script_options::Script_options): Initialize
4509         symbol_definitions_ and symbol_references_.
4510         (Script_options::add_symbol_assignment): Update
4511         symbol_definitions_ and symbol_references_.
4512         (Script_options::add_symbol_reference): New function.
4513         (script_symbol): New function.
4514         * script.h (class Script_options): Add symbol_definitions_ and
4515         symbol_references_ fields.
4516         (Script_options::referenced_const_iterator): New type.
4517         (Script_options::referenced_begin): New function.
4518         (Script_options::referenced_end): New function.
4519         (Script_options::is_referenced): New function.
4520         (Script_options::any_unreferenced): New function.
4521         * script-c.h (script_symbol): Declare.
4522         * yyscript.y (exp): Call script_symbol.
4523         * symtab.cc: Include "script.h".
4524         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4525         Change all callers.  Check symbols referenced by scripts.
4526         (Symbol_table::add_undefined_symbols_from_command_line): Add
4527         layout parameter.  Change all callers.
4528         (Symbol_table::do_add_undefined_symbols_from_command_line):
4529         Likewise.  Break out loop body.  Check symbols referenced by
4530         scripts.
4531         (Symbol_table::add_undefined_symbol_from_command_line): New
4532         function broken out of
4533         do_add_undefined_symbols_from_command_line.
4534         * symtab.h (class Symbol_table): Update declarations.
4535         * archive.cc: Include "layout.h".
4536         (Archive::should_include_member): Add layout parameter.  Change
4537         all callers.  Check for symbol mentioned in expression.
4538         * archive.h (class Archive): Update declaration.
4539         * object.cc (Sized_relobj::do_should_include_member): Add layout
4540         parameter.
4541         * object.h (Object::should_include_member): Add layout parameter.
4542         Change all callers.
4543         (Object::do_should_include_member): Add layout parameter.
4544         (class Sized_relobj): Update declaration.
4545         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4546         parameter.
4547         * dynobj.h (class Sized_dynobj): Update declaration.
4548         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4549         layout parameter.
4550         * plugin.h (class Sized_pluginobj): Update declaration.
4551
4552 2010-08-02  Ian Lance Taylor  <iant@google.com>
4553
4554         PR 11866
4555         * output.cc (Output_segment::set_offset): Search for the first and
4556         last sections rather than assuming that the list is in order.
4557         (Output_segment::find_first_and_last_list): New function.
4558         * output.h (class Output_segment): Update declarations.
4559         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4560         (relro_strip_test_SOURCES): New variable.
4561         (relro_strip_test_DEPENDENCIES): New variable.
4562         (relro_strip_test_LDFLAGS): New variable.
4563         (relro_strip_test_LDADD): New variable.
4564         (relro_strip_test.so): New target.
4565
4566 2010-08-02  Ian Lance Taylor  <iant@google.com>
4567
4568         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4569         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4570         (Target_i386::got_tlsdesc_section): New function.
4571         (Target_i386::got_section): Create space for GOT entries for
4572         TLSDESC relocations.
4573         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4574         R_386_TLS_GOTDESC.
4575         (Target_i386::Scan::global): Likewise.
4576         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4577         using TLSDESC GOT.
4578         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4579         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4580         (Target_x86_64::got_tlsdesc_section): New function.
4581         (Target_x86_64::got_section): Create space for GOT entries for
4582         TLSDESC relocations.
4583         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4584         R_386_TLS_GOTDESC.
4585         (Target_x86_64::Scan::global): Likewise.
4586         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4587         using TLSDESC GOT.
4588
4589 2010-08-02  Ian Lance Taylor  <iant@google.com>
4590
4591         * testsuite/final_layout.sh: Use dc to convert from hex to
4592         decimal.
4593
4594 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4595
4596         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4597         paramter to the call to gold::gc_process_relocs.
4598         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4599         paramter to the call to gold::gc_process_relocs.
4600         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4601         parameter to the call to gold::gc_process_relocs.
4602         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4603         template parameter to the call to gold::gc_process_relocs.
4604         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4605         paramter to the call to gold::gc_process_relocs.
4606         * gc.h (get_embedded_addend_size): New function.
4607         (gc_process_relocs): Save the size of the reloc for use by ICF.
4608         * icf.cc (get_section_contents): Get the addend from the text section
4609         for SHT_REL relocation sections.
4610         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4611         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4612         * int_encoding.h (read_from_pointer): New overloaded function.
4613         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4614         * testsuite/icf_sht_rel_addend_test.sh: New file.
4615         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4616         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4617
4618 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4619
4620         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4621         * Makefile.in: Regenerate.
4622         * testsuite/Makefile.in: Regenerate.
4623
4624 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4625
4626         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4627         * gold/testsuite/debug_msg.cc: Likewise.
4628         * gold/testsuite/odr_violation1.cc
4629         * gold/testsuite/odr_violation2.cc
4630
4631 2010-07-21  Cary Coutant  <ccoutant@google.com>
4632
4633         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4634         string, and length fields.
4635         (Output_merge_string::Merged_strings_list): New type.
4636         (Output_merge_string::Merged_strings_lists): New typedef.
4637         (Output_merge_string): Replace merged_strings_ with
4638         merged_strings_lists_.
4639         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4640         Merged_strings_list per input object and section.  Don't store pointer
4641         to the string.  Don't store length with each merged string entry.
4642         (Output_merge_string::finalize_merged_data): Loop over list of merged
4643         strings lists.  Recompute length of each merged string.
4644
4645 2010-07-15  Cary Coutant  <ccoutant@google.com>
4646
4647         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4648         here.
4649
4650 2010-07-14  Ian Lance Taylor  <iant@google.com>
4651
4652         * descriptors.cc (Descriptors::open): Report correct name in error
4653         message.
4654
4655 2010-07-13  Doug Kwan  <dougkwan@google.com>
4656
4657         * arm.cc (Arm_input_section::Arm_input_section): For a
4658         SHT_ARM_EXIDX section, always keeps the input sections.
4659         (Arm_input_section::set_exidx_section_link): New method.
4660         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4661         has_errors_ to false.
4662         (Arm_exidx_input_section::has_errors,
4663         Arm_exidx_input_section::set_has_errors): New methods.
4664         (Arm_exidx_input_section::has_errors_): New data member.
4665         (Arm_relobj::get_exidx_shndx_list): New method.
4666         (Arm_output_section::append_text_sections_to_list): Do not skip
4667         section without SHF_EXECINSTR.
4668         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4669         errors.
4670         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4671         section header.  Make error messages more verbose.  Check for
4672         a non-executable section linked to an EXIDX section.
4673         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4674         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4675         check that there is no deferred EXIDX section if we exit early.
4676         Instead of not making an EXIDX section in case of an error, make one
4677         and set the has_errors flag of it.
4678         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4679         in a relocatable link.
4680         (Target_arm::do_relax): Look for the EXIDX output section instead of
4681         assuming that it is called .ARM.exidx.
4682         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4683         section list.  Do not check for SHF_EXECINSTR section flags but
4684         skip any input section with errors.
4685         * output.cc (Output_section::Output_section): Initialize
4686         always_keeps_input_sections_ to false.
4687         (Output_section::add_input_section): Check for
4688         always_keeps_input_sections_.
4689         *  output.h (Output_section::always_keeps_input_sections,
4690         Output_section::set_always_keeps_input_sections): New methods.
4691         (Output_section::always_keeps_input_sections): New data member.
4692
4693 2010-07-13  Rafael Espindola  <espindola@google.com>
4694
4695         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4696         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4697
4698 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4699             Ian Lance Taylor  <iant@google.com>
4700
4701         * output.h (Output_section_lookup_maps::add_merge_section):
4702         Correct check of whether value was inserted.
4703         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4704         (Output_section_lookup_maps::add_relaxed_input_section):
4705         Likewise.
4706         * arm.cc (Target_arm::got_section): Remove used local os.
4707         * i386.cc (Target_i386::got_section): Likewise.
4708         * x86_64.cc (Target_x86_64::got_section): Likewise.
4709         * sparc.cc (Target_sparc::got_section): Likewise.
4710         (Target_sparc::relocate): Remove unused local have_got_offset.
4711         * powerpc.cc (Target_powerpc::relocate): Likewise.
4712
4713 2010-07-13  Ian Lance Taylor  <iant@google.com>
4714
4715         * compressed_output.cc (zlib_decompress): Fix signature in
4716         !HAVE_ZLIB_H case.
4717
4718         * archive.cc (Archive::include_member): Unlock an external member
4719         of a thin archive.  Don't bother to delete an object we know is
4720         NULL.
4721
4722 2010-07-12  Cary Coutant  <ccoutant@google.com>
4723
4724         * compressed_output.cc (zlib_decompress): New function.
4725         (get_uncompressed_size): New function.
4726         (decompress_input_section): New function.
4727         * compressed_output.h (get_uncompressed_size): New function.
4728         (decompress_input_section): New function.
4729         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4730         Handle compressed debug sections.
4731         * layout.cc (is_compressed_debug_section): New function.
4732         (Layout::output_section_name): Map compressed section names to
4733         canonical names.
4734         * layout.h (is_compressed_debug_section): New function.
4735         (is_debug_info_section): Recognize compressed debug sections.
4736         * merge.cc: Include compressed_output.h.
4737         (Output_merge_data::do_add_input_section): Handle compressed
4738         debug sections.
4739         (Output_merge_string::do_add_input_section): Handle compressed
4740         debug sections.
4741         * object.cc: Include compressed_output.h.
4742         (Sized_relobj::Sized_relobj): Initialize new data members.
4743         (build_compressed_section_map): New function.
4744         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4745         * object.h (Object::section_is_compressed): New method.
4746         (Object::do_section_is_compressed): New method.
4747         (Sized_relobj::Compressed_section_map): New type.
4748         (Sized_relobj::do_section_is_compressed): New method.
4749         (Sized_relobj::compressed_sections_): New data member.
4750         * output.cc (Output_section::add_input_section): Handle compressed
4751         debug sections.
4752         * reloc.cc: Include compressed_output.h.
4753         (Sized_relobj::write_sections): Handle compressed debug sections.
4754
4755 2010-07-08  Cary Coutant  <ccoutant@google.com>
4756
4757         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4758         weak when resolving to a dynamic def.
4759         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4760         for weak undef/dynamic def cases. Adjust callers.
4761         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4762         undef_binding_weak_.
4763         (Symbol_table::sized_write_globals): Adjust symbol binding.
4764         (Symbol_table::sized_write_symbol): Add binding parameter.
4765         * symtab.h (Symbol::set_undef_binding): New method.
4766         (Symbol::is_undef_binding_weak): New method.
4767         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4768         (Symbol_table::should_override): Add new parameter.
4769         (Symbol_table::sized_write_symbol): Add new parameter.
4770
4771         * testsuite/weak_undef_file1.cc: Add new test case.
4772         * testsuite/weak_undef_file2.cc: Fix header comment.
4773         * testsuite/weak_undef_test.cc: Add new test case.
4774
4775 2010-06-29  Doug Kwan  <dougkwan@google.com>
4776
4777         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4778         Initialize USE_SYMBOL_.
4779         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4780         definition.
4781         (Arm_reloc_property::uses_symbol_): New data member declaration.
4782         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4783         uses symbol value and symbol is undefined but not weakly undefined.
4784
4785 2010-06-28  Rafael Espindola  <espindola@google.com>
4786
4787         * plugin.cc (Plugin::load): Use dlerror.
4788
4789 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4790
4791         * symtab.cc (detect_odr_violations): When reporting an ODR
4792         violation, report an object where the symbol is defined.
4793
4794 2010-06-25  Doug Kwan  <dougkwan@google.com>
4795
4796         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4797         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4798         definition.
4799         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4800         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4801         target hook to detect function points.
4802         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4803         * icf.h (Icf::check_section_for_function_pointers): Change type of
4804         parameter SECTION_NAME to const reference to std::string.  Use
4805         target hook to determine if section may have unsafe pointers.
4806         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4807         method definition.
4808
4809 2010-06-21  Rafael Espindola  <espindola@google.com>
4810
4811         * fileread.cc (Input_file::find_fie): New
4812         (Input_file::open): Use Input_file::find_fie.
4813         * fileread.h (Input_file::find_fie): New
4814         * plugin.cc (set_extra_library_path): New.
4815         (Plugin::load): Add set_extra_library_path to the transfer vector.
4816         (Plugin_manager::set_extra_library_path): New.
4817         (Plugin_manager::add_input_file): Use the extra search path if set.
4818         (set_extra_library_path(): New.
4819         * plugin.h (Plugin_manager): Add set_extra_library_path and
4820         extra_search_path_.
4821
4822 2010-06-19  Cary Coutant  <ccoutant@google.com>
4823
4824         * layout.cc (gdb_sections): Add .debug_types.
4825         (lines_only_debug_sections): Likewise.
4826
4827 2010-06-18  Rafael Espindola  <espindola@google.com>
4828
4829         * plugin.cc (add_input_file,add_input_library)
4830         (Plugin_manager::add_input_file): Make filename arguments const.
4831         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4832         const.
4833
4834 2010-06-16  Doug Kwan  <dougkwan@google.com>
4835
4836         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4837         .ARM.attributes section if we have not merged any input
4838         attributes sections.
4839
4840 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4841
4842         * arm.cc: Allow combining objects with no EABI version
4843         information.
4844
4845 2010-06-15  Rafael Espindola  <espindola@google.com>
4846
4847         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4848
4849 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4850
4851         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4852         (struct iovec): Correct !HAVE_READV definition.
4853
4854 2010-06-10  Cary Coutant  <ccoutant@google.com>
4855
4856         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4857         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4858         reloc sections.
4859         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4860
4861         PR 11683
4862         * symtab.h (Symbol::is_placeholder): New member function.
4863         * target-reloc.h (relocate_section): Check for placeholder symbols.
4864
4865         * testsuite/Makefile.am (plugin_test_8): New test.
4866         (plugin_test_9): New test.
4867         * testsuite/Makefile.in: Regenerate.
4868
4869 2010-06-09  Nick Clifton  <nickc@redhat.com>
4870
4871         * yyscript.y (input_list_element): Allow strings prefixed with
4872         the '-' character.  Treat these as libraries.
4873         * script.cc (script_add_library): New function.  Adds a library
4874         specified by "-l<name>" found in an input script.
4875         * script-c.h: Add prototype for script_add_library.
4876
4877 2010-06-07  Doug Kwan  <dougkwan@google.com>
4878
4879         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4880         Restrict stub-group size to be within long conditional branch
4881         range when working around cortex-A8 erratum.
4882
4883 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4884
4885         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4886         #ifdef typo.
4887
4888 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4889
4890         PR gold/11658
4891         * output.cc
4892         (Output_section::Input_section_sort_entry::compare_section_ordering):
4893         Change to return non-zero correctly.
4894         (Output_section::Input_section_sort_section_order_index_compare
4895         ::operator()): Change to fix ambiguity in comparisons.
4896
4897 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4898
4899         * gold.h (is_wildcard_string): New function.
4900         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4901         (Layout::layout_eh_frame): Ditto.
4902         (Layout::find_section_order_index): New method.
4903         (Layout::read_layout_from_file): New method.
4904         * layout.h (Layout::find_section_order_index): New method.
4905         (Layout::read_layout_from_file): New method.
4906         (Layout::input_section_position_): New private member.
4907         (Layout::input_section_glob_): New private member.
4908         * main.cc (main): Call read_layout_from_file here.
4909         * options.h (--section-ordering-file): New option.
4910         * output.cc (Output_section::input_section_order_specified_): New
4911         member.
4912         (Output_section::Output_section): Initialize new member.
4913         (Output_section::add_input_section): Add new parameter.
4914         Keep input sections when --section-ordering-file is used.
4915         (Output_section::set_final_data_size): Sort input sections when
4916         section ordering file is specified.
4917         (Output_section::Input_section_sort_entry): Add new parameter.
4918         Check sorting type.
4919         (Output_section::Input_section_sort_entry::compare_section_ordering):
4920         New method.
4921         (Output_section::Input_section_sort_compare::operator()): Change to
4922         consider section_order_index.
4923         (Output_section::Input_section_sort_init_fini_compare::operator()):
4924         Change to consider section_order_index.
4925         (Output_section::Input_section_sort_section_order_index_compare
4926         ::operator()): New method.
4927         (Output_section::sort_attached_input_sections): Change to sort
4928         according to section order when specified.
4929         (Output_section::add_input_section<32, true>): Add new parameter.
4930         (Output_section::add_input_section<64, true>): Add new parameter.
4931         (Output_section::add_input_section<32, false>): Add new parameter.
4932         (Output_section::add_input_section<64, false>): Add new parameter.
4933         * output.h (Output_section::add_input_section): Add new parameter.
4934         (Output_section::input_section_order_specified): New
4935         method.
4936         (Output_section::set_input_section_order_specified): New method.
4937         (Input_section::Input_section): Initialize section_order_index_.
4938         (Input_section::section_order_index): New method.
4939         (Input_section::set_section_order_index): New method.
4940         (Input_section::section_order_index_): New member.
4941         (Input_section::Input_section_sort_section_order_index_compare): New
4942         struct.
4943         (Output_section::input_section_order_specified_): New member.
4944         * script-sections.cc (is_wildcard_string): Delete and move modified
4945         method to gold.h.
4946         (Output_section_element_input::Output_section_element_input): Modify
4947         call to is_wildcard_string.
4948         (Output_section_element_input::Input_section_pattern
4949         ::Input_section_pattern): Ditto.
4950         (Output_section_element_input::Output_section_element_input): Ditto.
4951         * testsuite/Makefile.am (final_layout): New test case.
4952         * testsuite/Makefile.in: Regenerate.
4953         * testsuite/final_layout.cc: New file.
4954         * testsuite/final_layout.sh: New file.
4955
4956 2010-06-01  Rafael Espindola  <espindola@google.com>
4957
4958         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4959
4960 2010-06-01  Rafael Espindola  <espindola@google.com>
4961
4962         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4963         visibility of symbols.
4964
4965 2010-05-27  Doug Kwan  <dougkwan@google.com>
4966
4967         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4968         from start of output section instead of address for a local symbol
4969         in a merged or relaxed section when doing a relocatable link.
4970
4971 2010-05-26  Rafael Espindola  <espindola@google.com>
4972
4973        PR 11604
4974         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4975         adding sections the garbage collector removed.
4976         * gold/testsuite/Makefile.am: Add test.
4977         * gold/testsuite/Makefile.in: Regenerate.
4978         * gold/testsuite/plugin_test_7.sh: New.
4979         * gold/testsuite/plugin_test_7_1.c: New.
4980         * gold/testsuite/plugin_test_7_2.c: New.
4981
4982 2010-05-26  Rafael Espindola  <espindola@google.com>
4983
4984         * script-sections.cc (Output_section_definition::set_section_addresses):
4985         Check for --section-start.
4986
4987 2010-05-26  Doug Kwan  <dougkwan@google.com>
4988
4989         * arm.cc (Arm_scan_relocatable_relocs): New class.
4990         (Target_arm::relocate_special_relocatable): New method.
4991         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4992         (Arm_relocate_functions::thumb_branch_common): Same.
4993         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4994         instead of Default_scan_relocatable_relocs.
4995         * target-reloc.h (relocate_for_relocatable): Let target handle
4996         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4997         * target.h (Sized_target::relocate_special_relocatable): New method.
4998
4999 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5000
5001         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5002
5003 2010-05-23  Doug Kwan  <dougkwan@google.com>
5004
5005         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5006         instead of a cast.
5007         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5008         with a direct branch, not a conditional branch, to a stub.
5009         * merge.cc (Output_merge_base::record_input_section): New method
5010         defintion.
5011         (Output_merge_data::do_add_input_section): Record input section if
5012         keeps-input-sections flag is set.
5013         (Output_merge_string::do_add_input_section): Ditto.
5014         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5015         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5016         INPUT_SECTIONS_.
5017         (Output_merge_base::keeps_input_sections,
5018         Output_merge_base::set_keeps_input_sections,
5019         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5020         method definitions.
5021         (Output_merge_base::Input_sections): New type declaration.
5022         (Output_merge_base::input_sections_begin,
5023         Output_merge_base::input_sections_end,
5024         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5025         (Output_merge_base::bool keeps_input_sections_,
5026         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5027         Output_merge_base::input_sections_): New data members.
5028         (Output_merge_data::do_set_keeps_input_sections): New method
5029         defintion.
5030         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5031         * output.cc (Output_section::Input_section::relobj): Move method
5032         defintion from class declaration to here and handle merge sections.
5033         (Output_section::Input_section::shndx): Ditto.
5034         (Output_section::Output_section): Remove initializations of removed
5035         data members and initialize new data member LOOKUP_MAPS_.
5036         (Output_section::add_input_section): Set keeps-input-sections flag
5037         for a newly created merge output section as appropriate.  Adjust code
5038         to use Output_section_lookup_maps class.
5039         (Output_section::add_relaxed_input_section): Adjst code for lookup
5040         maps code refactoring.
5041         (Output_section::add_merge_input_section): Add a new parameter
5042         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5043         class.  If adding input section to a newly created merge output
5044         section fails, remove the new merge section.
5045         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5046         Adjust code for use of the Output_section_lookup_maps class.
5047         (Output_section::find_merge_section): Ditto.
5048         (Output_section::build_lookup_maps): New method defintion.
5049         (Output_section::find_relaxed_input_section): Adjust code to use
5050         Output_section_lookup_maps class.
5051         (Output_section::get_input_sections): Export merge sections.  Adjust
5052         code to use Output_section_lookup_maps class.
5053         (Output_section:::add_script_input_section): Adjust code to use
5054         Output_section_lookup_maps class.  Update lookup maps for merge
5055         sections also.
5056         (Output_section::discard_states): Use Output_section_lookup_maps.
5057         (Output_section::restore_states): Same.
5058         * output.h (Merge_section_properties): Move class defintion out of
5059         Output_section.
5060         (Output_section_lookup_maps): New class.
5061         (Output_section::Input_section::is_merge_section): New method
5062         defintion.
5063         (Output_section::Input_section::relobj): Move defintion out of class
5064         defintion.  Declare method only.
5065         (Output_section::Input_section::shndx): Ditto.
5066         (Output_section::Input_section::output_merge_base): New method defintion.
5067         (Output_section::Input_section::u2_.pomb): New union field.
5068         (Output_section::Merge_section_by_properties_map,
5069         Output_section::Output_section_data_by_input_section_map,
5070         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5071         Remove types.
5072         (Output_section::add_merge_input_section): Add new parameter
5073         KEEPS_INPUT_SECTIONS.
5074         (Output_section::build_lookup_maps): New method declaration.
5075         (Output_section::merge_section_map_,
5076         Output_section::merge_section_by_properties_map_,
5077         Output_section::relaxed_input_section_map_,
5078         Output_section::is_relaxed_input_section_map_valid_): Remove data
5079         members.
5080         (Output_section::lookup_maps_): New data member.
5081
5082 2010-05-21  Doug Kwan  <dougkwan@google.com>
5083
5084         PR gold/11619
5085         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5086         avoid a compilation error.
5087
5088 2010-05-19  Rafael Espindola  <espindola@google.com>
5089
5090         * script-sections.cc (Output_section_definition::allocate_to_segment):
5091         Update the phdrs_list even when the output section is NULL.
5092         * testsuite/Makefile.am: Add test.
5093         * testsuite/Makefile.in: Regenerate.
5094         * testsuite/script_test_9.cc: New.
5095         * testsuite/script_test_9.sh: New.
5096         * testsuite/script_test_9.t: New.
5097
5098 2010-05-19  Doug Kwan  <dougkwan@google.com>
5099
5100         * arm.cc (Arm_input_section::original_size): New method.
5101         (Arm_input_section::do_addralign): Add a cast.
5102         (Arm_input_section::do_output_offset): Remove static cast.
5103         (Arm_input_section::original_addralign,
5104          Arm_input_section::original_size_): Change type to uint32_t.
5105         (Arm_input_section::init): Add safe casts for section alignment
5106         and size.
5107         (Arm_input_section::set_final_data_size): Do not set address and
5108         offset of stub table.
5109         (Arm_output_section::fix_exidx_coverage): Change use of of
5110         Output_section::Simple_input_section to that of
5111         Output_section::Input_section.
5112         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5113         except for the first pass.
5114         * output.cc (Output_section::get_input_sections): Change type of
5115         input_sections to std::list<Input_section>.
5116         (Output_section::add_script_input_section): Rename from
5117         Output_section::add_simple_input_section.  Change type of SIS
5118         parameter from Simple_input_section to Input_section.
5119         * output.h (Output_section::Simple_input_section): Remove class.
5120         (Output_section::Input_section): Change class visibility to public.
5121         (Output_section::Input_section::addralign): Use stored alignments
5122         for special input sections if set.
5123         (Output_section::Input_section::set_addralign): New method.
5124         (Output_section::get_input_sections): Change parameter type from
5125         list of Simple_input_section to list of Input_section.
5126         (Output_section::add_script_input_section): Rename from
5127         Output_section::add_simple_input_section. Change first parameter's
5128         type from Simple_input_section to Input_section and remove the
5129         second and third parameters.
5130         * script-sections.cc (Input_section::Input_section_list): Change
5131         type to list of Output_section::Input_section/
5132         (Input_section_info::Input_section_info): Change parameter type of
5133         INPUT_SECTION to Output_section::Input_section.
5134         (Input_section_info::input_section): Change return type.
5135         (Input_section_info::input_section_): Change type to
5136         Output_section::Input_section.
5137         (Output_section_element_input::set_section_addresses): Adjust code
5138         to use Output_section::Input_section instead of
5139         Output_section::Simple_input_section.  Adjust code for renaming
5140         of Output_section::add_simple_input_section.
5141         (Orphan_output_section::set_section_addresses): Ditto.
5142
5143 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5144
5145         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5146         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5147
5148 2010-05-18  Rafael Espindola  <espindola@google.com>
5149
5150         * options.cc (General_options::finalize): Handle -nostdlib.
5151         * options.h (nostdlib): New option.
5152         * script.cc (script_add_search_dir): Handle -nostdlib.
5153
5154 2010-05-12  Doug Kwan  <dougkwan@google.com>
5155
5156         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5157         attributes section only if there no attributes section after merging.
5158         (Target_arm::merge_object_attributes): Move value of
5159         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5160         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5161         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5162         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5163         and arm_attr_merge_7.stdout.
5164         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5165         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5166         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5167         arm_attr_merge_7b.o): New rules.
5168         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5169         arm_attr_merge_7
5170         * testsuite/Makefile.in: Regenerate.
5171         * testsuite/arm_attr_merge.sh: New file.
5172         * testsuite/arm_attr_merge_[67][ab].s: Same.
5173
5174 2010-05-05  Nick Clifton  <nickc@redhat.com>
5175
5176         * po/es.po: Updated Spanish translation.
5177
5178 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5179
5180         * Makefile.am (install-exec-local): Properly install gold as
5181         default cross linker.
5182         * Makefile.in: Regenerated.
5183
5184 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5185             Nick Clifton  <nickc@redhat.com>
5186
5187         * configure.ac (install_as_default): Define and set to false
5188         unless --enable-gold or --enable-gold=both/gold has been
5189         specified.
5190         * configure: Regenerate.
5191
5192         * Makefile.am (install-exec-local): Install the executable as
5193         'ld.gold'.  If install_as_default is true then also install it as
5194         'ld'.
5195         * Makefile.in: Regenerated.
5196
5197 2010-04-24  Ian Lance Taylor  <iant@google.com>
5198
5199         * layout.cc (Layout::layout_reloc): In relocatable link don't
5200         combine reloc sections for grouped sections.
5201
5202 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5203
5204         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5205         sections that are not ordinary to icf.
5206         * icf.cc (get_section_contents): Handle relocation pointing to section
5207         with no object or shndx information.
5208         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5209         * testsuite/Makefile.in: Regenerate.
5210         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5211         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5212
5213 2010-04-22  Ian Lance Taylor  <iant@google.com>
5214
5215         * expression.cc (Expression::Expression_eval_info): Add
5216         result_alignment_pointer field.
5217         (Expression::eval_with_dot): Add result_alignment_pointer
5218         parameter.  Change all callers.
5219         (Expression::eval_maybe_dot): Likewise.
5220         (class Binary_expression): Add alignment_pointer parameter to
5221         left_value and right_value.  Change all callers.
5222         (BINARY_EXPRESSION): Set result alignment.
5223         (class Trinary_expression): Add alignment_pointer parameter to
5224         arg2_value and arg3_value.  Change all callers.
5225         (Trinary_cond::value): Set result alignment.
5226         (Max_expression::value, Min_expression::value): Likewise.
5227         (Align_expression::value): Likewise.
5228         * script-sections.cc (class Sections_element): Add dot_alignment
5229         parameter to set_section_addresses virtual function.  Update
5230         instantiations.
5231         (class Output_section_element): Likewise.
5232         (Script_sections::create_segments): Add dot_alignment parameter.
5233         Change all callers.
5234         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5235         (Script_sections::set_phdrs_clause_addresses): Likewise.
5236         * script-sections.h: Update declarations.
5237         * script.h: Update declarations.
5238         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5239         min_p_align.
5240         * testsuite/script_test_3.t: Set large alignment.
5241         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5242         segment has expected alignment.
5243
5244 2010-04-22  Nick Clifton  <nickc@redhat.com>
5245
5246         * po/gold.pot: Updated by the Translation project.
5247         * po/vi.po: Updated Vietnamese translation.
5248
5249 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5250
5251         * testsuite/Makefile.am (check_PROGRAMS): Add
5252         icf_virtual_function_folding_test.
5253         * testsuite/Makefile.in: Regenerated.
5254
5255 2010-04-15  Andrew Haley  <aph@redhat.com>
5256
5257         * options.h (merge_exidx_entries): New option.
5258         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5259         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5260         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5261         (Target_arm::merge_exidx_entries): New function.
5262         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5263         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5264         to Arm_exidx_fixup constructor.
5265         Add new arg, merge_exidx_entries.
5266         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5267         Arm_output_section::fix_exidx_coverage.
5268
5269 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5270
5271         * icf.cc (get_section_contents): Check for preemptible functions.
5272         Ignore addend when appropriate.
5273         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5274         section folded.
5275         (add_from_relobj): Check for section folded.
5276         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5277         * symtab.h (should_add_dynsym_entry): Add new parameter.
5278         * target-reloc.h (scan_relocs): Check for section folded.
5279         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5280         Check reloc types for function pointers in shared objects.
5281         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5282         case.
5283         (icf_preemptible_functions_test): New test case.
5284         (icf_string_merge_test): New test case.
5285         * testsuite.Makefile.in: Regenerate.
5286         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5287         bar_glob.  Refactor code.
5288         * testsuite/icf_preemptible_functions_test.cc: New file.
5289         * testsuite/icf_preemptible_functions_test.sh: New file.
5290         * testsuite/icf_string_merge_test.cc: New file.
5291         * testsuite/icf_string_merge_test.sh: New file.
5292         * testsuite/icf_virtual_function_folding_test.cc: New file.
5293         * testsuite/icf_virtual_function_folding_test.sh: New file.
5294
5295 2010-04-14  Doug Kwan  <dougkwan@google.com>
5296
5297         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5298         for local symbol recounting if we remove a section due to ICF.
5299         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5300         there are no regular objects in input.
5301
5302 2010-04-13  Doug Kwan  <dougkwan@google.com>
5303
5304         * arm.cc (Arm_input_section::set_final_data_size): Compute
5305         accurate final data size instead of using current data size.
5306
5307 2010-04-09  Doug Kwan  <dougkwan@google.com>
5308
5309         * layout.cc (Layout::choose_output_section): Handle script section
5310         types.
5311         (Layout::make_output_section_for_script): Add section type parameter.
5312         Handle script section types.
5313         * layout.h (Layout::make_output_section_for_script): Add section
5314         type parameter.
5315         * output.cc (Output_section::Output_section): Initialize data member
5316         is_noload_.
5317         (Output_section::do_reset_address_and_file_offset): Do not set address
5318         to 0 if section is a NOLOAD section.
5319         * output.h (Output_section::is_noload): New method.
5320         (Output_section::set_is_noload): Ditto.
5321         (Output_section::is_noload_): New data member.
5322         * script-c.h (Script_section_type): New enum type.
5323         (struct Parser_output_section_header): Add new file section_type.
5324         * script-sections.cc (Sections_element::output_section_name): Add
5325         parameter for returning script section type.
5326         (Output_section_definition::output_section_name): Ditto.
5327         (Output_section_definition::section_type)P; New method.
5328         (Output_section_definiton::script_section_type_name): Ditto.
5329         (Output_section_definition::script_section_type_): New data member.
5330         (Output_section_definition::Output_section_definition): Initialize
5331         data member Output_section_definition::script_section_type_.
5332         (Output_section_definition::create_sections): Pass script section type
5333         to Layout::make_output_section_for_script.
5334         (Output_section_definition::output_section_name): Return script
5335         section type to caller.
5336         (Output_section_definition::set_section_address): Do not advance
5337         dot value and load address if section type is NOLOAD.  Set address
5338         of NOLOAD sections regardless of section flags.
5339         (Output_section_definition::print): Print section type if it is
5340         not SCRIPT_SECTION_TYPE_NONE.
5341         (Output_section_definition::section_type): New method.
5342         (Output_section_definition::script_section_type_name): Ditto.
5343         (Script_sections::output_section_name): Add new parameter
5344         PSECTION_TYPE for returning script section type.  Pass it to
5345         section elements.  Handle discard sections.
5346         (Sort_output_sections::operator()): Handle NOLOAD sections.
5347         * script-sections.h (Script_sections::Section_type): New enum type.
5348         (Script_sections::output_section_name): Add a new parameter for
5349         returning script section type.
5350         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5351         INFO and NOLOAD.
5352         * yyscript.y (union): Add new field SECTION_TYPE.
5353         (COPY, DSECT, INFO, NOLOAD): New tokens.
5354         (opt_address_and_section_type): Change type to output_section_header.
5355         (section_type): New non-terminal
5356         (section_header): Handle section type.
5357         (opt_address_and_section_type): Return section type value.
5358
5359 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5360
5361         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5362         * testsuite/plugin_common_test_2.c (foo): Likewise.
5363
5364 2010-04-08  Doug Kwan  <dougkwan@google.com>
5365
5366         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5367         Output_merge_data.
5368         * output.cc (Output_section::add_merge_input_section): Simplify
5369         code and return status of Output_merge_base::add_input_section.
5370         Update merge section map only if Output_merge_base::add_input_section
5371         returns true.
5372
5373 2010-04-07  Doug Kwan  <dougkwan@google.com>
5374
5375         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5376         if section is marked as containing instructions but has no mapping
5377         symbols.
5378         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5379         correct section index.
5380         (Arm_relobj::find_linked_text_section): Ditto.
5381
5382 2010-04-07  Cary Coutant  <ccoutant@google.com>
5383
5384         * archive.cc (include_member): Destroy Read_symbols_data object before
5385         releasing file.
5386         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5387         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5388         (Read_symbols_data::~Read_symbols_data) New destructor.
5389         (Section_relocs::Section_relocs) New constructor.
5390         (Section_relocs::~Section_relocs) New destructor.
5391         (Read_relocs_data::Read_relocs_data) New constructor.
5392         (Read_relocs_data::~Read_relocs_data) New destructor.
5393         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5394         pointers to NULL after deleting.
5395
5396 2010-04-07  Doug Kwan  <dougkwan@google.com>
5397
5398         * arm.cc: Replace "endianity" with "endianness" in comments.
5399         (Arm_exidx_cantunwind): Ditto.
5400         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5401         (Arm_relobj::merge_flags_and_attributes): New method.
5402         (Arm_relobj::merge_flags_and_attributes_): New data member.
5403         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5404         (Arm_relobj::scan_sections_for_stubs): Ditto.
5405         (Arm_relobj::do_read_symbols): Check to see if we really want to
5406         merge processor-specific flags and attributes.  Exit early if
5407         an object is empty except for section names and the undefined symbol.
5408         (Target_arm::do_finalize_sections): Move check for ELF format to
5409         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5410         attributes from a regular object only when we have determined that
5411         it is aapropriate.  Do not create an .ARM.attributes section in
5412         output if there is no regular input object.
5413         (Target_arm::merge_processor_specific_flags): Check
5414         --warn-mismatch before printing any error.
5415         (Target_arm::merge_object_attributes): Ditto.
5416         * gold.cc (queue_middle_tasks): Handle the case in which there is
5417         no regular object in input.
5418         * options.cc (General_options::parse_EB): New method.
5419         (General_options::parse_EL): Same.
5420         (General_options::General_options): Initialize endianness_.
5421         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5422         New options.
5423         (General_options::Endianness): New enum.
5424         (General_options::endianness): New method.
5425         (General_options::endianness_): New data member.
5426         * parameters.cc (Parameters::set_options): Check target endianness.
5427         (Parameters::set_target_once): Ditto.
5428         (Parameters::check_target_endianness): New method.
5429         (parameters_force_valid_target): If either -EL or -EB is specified,
5430         use it to define endianness of default target.
5431         * parameters.h (Parameters::check_target_endianness): New method
5432         declaration.
5433         * target.h (class Target): Change "endianity" to "endianness"
5434         in comments.
5435
5436 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5437
5438         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5439         * configure: Regenerate.
5440         * Makefile.in: Regenerate.
5441         * testsuite/Makefile.in: Regenerate.
5442
5443 2010-04-06  Cary Coutant  <ccoutant@google.com>
5444
5445         gcc PR lto/42757
5446         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5447         prevailing definitions of common symbols.
5448         * testsuite/plugin_test_6.sh: New test case.
5449         * testsuite/plugin_common_test_1.c: New test case.
5450         * testsuite/plugin_common_test_2.c: New test case.
5451         * testsuite/Makefile.am (plugin_test_6): New test case.
5452         * testsuite/Makefile.in: Regenerate.
5453
5454 2010-04-06  Nick Clifton  <nickc@redhat.com>
5455
5456         * po/vi.po: New Vietnamese translation.
5457
5458 2010-03-30  Doug Kwan  <dougkwan@google.com>
5459
5460         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5461
5462 2010-03-25  Doug Kwan  <dougkwan@google.com>
5463
5464         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5465         to avoid a conversion warning on a 32-bit host.
5466
5467 2010-03-24  Ian Lance Taylor  <iant@google.com>
5468
5469         * testsuite/script_test_3.t: Add a TLS segment.
5470         * testsuite/Makefile.am (check_PROGRAMS): Add
5471         tls_phdrs_script_test.
5472         (tls_phdrs_script_test_SOURCES): Define.
5473         (tls_phdrs_script_test_DEPENDENCIES): Define.
5474         (tls_phdrs_script_test_LDFLAGS): Define.
5475         (tls_phdrs_script_test_LDADD): Define.
5476         * testsuite/Makefile.in: Rebuild.
5477
5478 2010-03-23  Cary Coutant  <ccoutant@google.com>
5479
5480         * fileread.cc (find_or_make_view): Fix comment.
5481
5482 2010-03-23  Ian Lance Taylor  <iant@google.com>
5483
5484         * script-sections.cc (class Orphan_section_placement): Define
5485         PLACE_TLS and PLACE_TLS_BSS.
5486         (Orphan_section_placement::Orphan_section_placement): Initialize
5487         new places.
5488         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5489         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5490         (tls_script_test_SOURCES): Define.
5491         (tls_script_test_DEPENDENCIES): Define.
5492         (tls_script_test_LDFLAGS): Define.
5493         (tls_script_test_LDADD): Define.
5494         * testsuite/Makefile.in: Rebuild.
5495
5496 2010-03-22  Doug Kwan  <dougkwan@google.com>
5497
5498         * arm.cc (Arm_relocate_functions::abs8,
5499         Arm_relocate_functions::abs16): Use correct check for overflow
5500         specified in the ARM ELF specs.
5501         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5502         target of a BLX instruction specially.
5503         (Reloc_stub::stub_type_for_reloc): Ditto.
5504         (Relocate::relocate): Use symbolic names instead of numeric relocation
5505         codes to report error.
5506         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5507         workaround.
5508         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5509         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5510         thumb2_blx_out_of_range.stdout
5511         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5512         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5513         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5514         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5515         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5516         thumb2_blx_in_range, thumb2_blx_in_range.o,
5517         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5518         thumb2_blx_out_of_range.o): New rules.
5519         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5520         thumb2_blx_in_range and thumb2_blx_out_of_range.
5521         * testsuite/Makefile.in: Regenerate.
5522         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5523         * testsuite/thumb_blx_in_range.s: New file.
5524         * testsuite/thumb_blx_out_of_range.s: New file.
5525
5526 2010-03-22  Rafael Espindola  <espindola@google.com>
5527
5528         * archive.cc (Should_include): Move to archive.h.
5529         (should_include_member): Make it a member of Archive.
5530         (Lib_group): New.
5531         (Add_lib_group_symbols): New.
5532         * archive.h: Include options.h.
5533         (Archive_member): Moved from Archive.
5534         (Should_include): Moved from archive.cc.
5535         (Lib_group): New.
5536         (Add_lib_group_symbols): New.
5537         * dynobj.cc (do_should_include_member): New.
5538         * dynobj.h (do_should_include_member): New.
5539         * gold.cc (queue_initial_tasks): Update call to queue.
5540         * main.cc (main): Print lib group stats.
5541         * object.cc (do_should_include_member): New.
5542         * object.h: Include archive.h.
5543         (Object::should_include_member): New.
5544         (Object::do_should_include_member): New.
5545         (Sized_relobj::do_should_include_member): New.
5546         * options.cc (General_options::parse_start_lib): New.
5547         (General_options::parse_end_lib): New.
5548         (Input_arguments::add_file): Handle lib groups.
5549         (Input_arguments::start_group): Check we are not in a lib.
5550         (Input_arguments::start_lib): New.
5551         (Input_arguments::end_lib): New.
5552         * options.h (General_options): Add start_lib and end_lib.
5553         (Input_argument::lib_): New.
5554         (Input_argument::lib): New.
5555         (Input_argument::is_lib): New.
5556         (Input_file_lib): New.
5557         (Input_arguments::in_lib_): New.
5558         (Input_arguments::in_lib): New.
5559         (Input_arguments::start_lib): New.
5560         (Input_arguments::end_lib_): New.
5561         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5562         in unused members as preempted.
5563         (Sized_pluginobj::do_should_include_member): New.
5564         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5565         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5566         return the blocker.
5567         (Read_symbols::do_whole_lib_group): New.
5568         (Read_symbols::do_lib_group): New.
5569         (Read_symbols::do_read_symbols): Handle lib groups.
5570         (Read_symbols::get_name): Handle lib groups.
5571         * readsyms.h (Read_symbols): Add an archive member pointer.
5572         (Read_symbols::do_whole_lib_group): New.
5573         (Read_symbols::do_lib_group): New.
5574         (Read_symbols::member_): New.
5575         * script.cc (read_input_script): Update call to queue_soon.
5576
5577 2010-03-19  Doug Kwan  <dougkwan@google.com>
5578
5579         * arm.cc (Stub_table::Stub_table): Initialize new data members
5580         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5581         (Stub_table::add_reloc_stub): Assign stub offset and update
5582         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5583         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5584         New data members.
5585         (Stub_table::update_data_size_and_addralign): Use
5586         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5587         instead of going over all reloc stubs.
5588         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5589         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5590         Stringpool_template::offset_ to size of Stringpool_char.
5591         (Stringpool_template::new_key_offset): Remove code to initialize
5592         Stringpool_template::offset_.
5593         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5594         Stringpool_template::offset_ to zero.
5595
5596 2010-03-15  Doug Kwan  <dougkwan@google.com>
5597
5598         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5599         offset_.
5600         (Stringpool_template::new_key_offset): New method.
5601         (Stringpool_template::add_string): Assign offsets when adding new
5602         strings.
5603         (Stringpool_template::set_string_offsets): Do not set string offsets
5604         when not optimizing.
5605         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5606         member size_.
5607         (Chunked_vector::clear): Clear size_.
5608         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5609         (Chunked_vector::size): Return size_.
5610         (Chunked_vector::push_back): Use size_ to find insert position.
5611         (Chunked_vector::size_): New data member.
5612         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5613         (Stringpool_template::new_key_offset): New method declaration.
5614         (Stringpool_template::offset_): New data member.
5615
5616 2010-03-15   Rafael Espindola  <espindola@google.com>
5617
5618         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5619         Add_symbols' constructor.
5620         * readsyms.h (Add_symbols): Remove the input_group member.
5621
5622 2010-03-10  Ian Lance Taylor  <iant@google.com>
5623
5624         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5625         target to ask whether a reference to a symbol requires a stack
5626         split.
5627         * target.h (Target::is_call_to_non_split): New function.
5628         (Target::do_is_call_to_non_split): Declare virtual function.
5629         * target.cc: Include "symtab.h".
5630         (Target::do_is_call_to_non_split): New function.
5631         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5632
5633 2010-03-10  Cary Coutant  <ccoutant@google.com>
5634
5635         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5636         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5637         (File_read::open[2]): Add whole_file_view_ to list of views.
5638         (File_read::make_view): Remove test of whole_file_view_.
5639         (File_read::find_or_make_view): Create whole_file_view_ if
5640         necessary.
5641         (File_read::clear_views): Replace bool parameter with enum;
5642         adjust all callers.  Don't delete views with permanent data;
5643         do delete cached views and views from archives if
5644         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5645         if clearing the corresponding view.
5646         * fileread.h (File_read::Clear_views_mode): New enum.
5647         (File_read::View::is_permanent_view): New method.
5648         (File_read::clear_views): Replace bool parameter
5649         with enum; adjust all callers.
5650         * options.h (General_options): Change keep_files_mapped option;
5651         add map_whole_files.
5652         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5653         releasing the file.
5654         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5655         the file.
5656
5657 2010-03-10  David S. Miller  <davem@davemloft.net>
5658
5659         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5660
5661 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5662
5663         * icf.cc (get_section_contents): Add '@' marker after processing the
5664         merge reloc.
5665
5666 2010-03-08  Doug Kwan  <dougkwan@google.com>
5667
5668         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5669         due to a conversion warning.
5670         (Arm_relobj::update_output_local_symbol_count): Check for local
5671         symbol with unset output index.
5672
5673 2010-03-05  Ian Lance Taylor  <iant@google.com>
5674
5675         * options.h (class General_options): Add --spare-dynamic-tags.
5676         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5677         --spare-dynamic-tags.
5678
5679 2010-03-05  Ian Lance Taylor  <iant@google.com>
5680
5681         * incremental.cc: Include "libiberty.h".
5682
5683 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5684
5685         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5686         function, is_info_ member.
5687         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5688         (Versions::Versions): Update caller.
5689         (Versions::define_base_version): Likewise.
5690         (Versions::add_def): Likewise.
5691
5692 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5693
5694         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5695         (Scan::possible_function_pointer_reloc): New function.
5696         (Scan::local_reloc_may_be_function_pointer): Change to call
5697         possible_function_pointer_reloc.
5698         (Scan::global_reloc_may_be_function_pointer): Ditto.
5699         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5700         relocations in ".data.rel.ro._ZTV" section.
5701         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5702         * testsuite/icf_safe_so_test.cc: Ditto.
5703         * testsuite/icf_safe_test.cc: Ditto.
5704         * testsuite/icf_safe_test.sh: Ditto.
5705
5706 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5707             Ian Lance Taylor  <iant@google.com>
5708
5709         * target-reloc.h (relocate_section): Check the symbol table index
5710         for -1U before setting the local symbol index.
5711         (scan_relocatable_relocs): If copying the relocation, record that
5712         the local symbol is required.
5713         * object.h (Symbol_value::is_output_symtab_index_set): New
5714         function.
5715         (Symbol_value::may_be_discarded_from_output_symtab): New
5716         function.
5717         (Symbol_value::has_output_symtab_entry): New function.
5718         (Symbol_value::needs_output_symtab_entry): Remove.
5719         (Symbol_value::output_symtab_index): Make sure the symbol index is
5720         set.
5721         (Symbol_value::set_output_symtab_index): Make sure the symbol
5722         index is not set.  Make sure the new index is valid.
5723         (Symbol_value::set_must_have_output_symtab_entry): New function.
5724         (Symbol_value::has_output_dynsym_entry): New function.
5725         (Symbol_value::set_output_dynsym_index): Make sure the new index
5726         is valid.
5727         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5728         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5729         local symbol if permitted.
5730         (Sized_relobj::do_finalize_local_symbols): Call
5731         is_output_symtab_index_set rather than needs_output_symtab_entry.
5732         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5733         rather than needs_output_symtab_entry.  Call
5734         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5735         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5736         is_output_symtab_index_set rather than needs_output_symtab_entry.
5737         * testsuite/discard_locals_relocatable_test.c: New file.
5738         * testsuite/discard_locals_test.sh: Test -r.
5739         * testsuite/Makefile.am (check_DATA): Add
5740         discard_locals_relocatable_test1.syms,
5741         discard_local_relocatable_test2.syms.
5742         (MOSTLYCLEANFILES): Likewise.  Also add
5743         discard_locals_relocatable_test1.lout and
5744         discard_locals_relocatable_test2.out.
5745         (discard_locals_relocatable_test1.syms): New target.
5746         (discard_locals_relocatable_test.o): New target.
5747         (discard_locals_relocatable_test1.out): New target.
5748         (discard_locals_relocatable_test2.syms): New target.
5749         (discard_locals_relocatable_test2.out): New target.
5750         (various): Add missing ../ld-new dependencies.
5751         * testsuite/Makefile.in: Rebuild.
5752
5753 2010-03-03  Nick Clifton  <nickc@redhat.com>
5754
5755         * po/fi.po: New Finnish translation.
5756
5757 2010-03-01  Doug Kwan  <dougkwan@google.com>
5758
5759         * layout.cc (Layout::Layout): Force section types of .init_array*,
5760         .preinit_array* and .fini_array* sections.
5761         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5762         Fix check of return value of std::string::find.().
5763         (Output_section::Input_section_sort_compare::operator()): Remove
5764         comment about .init_array.
5765         (Output_section::Input_section_sort_init_fini_compare::operator()):
5766         New method.
5767         (Output_section::sort_attached_input_sections): Handle .init_array
5768         and .fini_array specially.
5769         * output.h (Output_section::Inut_section_sort_compare): Update
5770         comment.
5771         (Output_section::Input_section_sort_init_fini_compare): New struct.
5772
5773 2010-02-26  Doug Kwan  <dougkwan@google.com>
5774
5775         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5776         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5777         * testsuite/debug_msg.sh: Avoid matching source line number for
5778         use of global variable undef_int.
5779
5780 2010-02-26  Doug Kwan  <dougkwan@google.com>
5781
5782         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5783         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5784         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5785         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5786         * options.cc (General_options::General_options): Initialize member
5787         fix_v4bx_.
5788         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5789         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5790         and rm_no_fix_v4bx.stdout
5791         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5792         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5793         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5794         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5795         and arm_no_fix_v4bx.
5796         * Makefile.in: Regenerate.
5797         * testsuite/arm_fix_v4bx.s: New file.
5798         * testsuite/arm_fix_v4bx.sh: Ditto.
5799
5800 2010-02-24  Doug Kwan  <dougkwan@google.com>
5801
5802         * arm.cc (Target_arm::got_section): Make the .got section the first
5803         non RELRO section in the data segment.
5804         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5805         suffixes of section names.
5806
5807 2010-02-24  Doug Kwan  <dougkwan@google.com>
5808
5809         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5810         flags and attributes merging if an input file is a binary file.
5811         * fileread.cc (Input_file::open): Record format of original file.
5812         * fileread.h (Input_file::Format): New enum type.
5813         (Input_file::Input_file): Initialize data member format_.
5814         (Input_file::format): New method definition.
5815         (Input_file::format_):: New data member.
5816
5817 2010-02-24  Doug Kwan  <dougkwan@google.com>
5818
5819         * arm.cc (Arm_output_data_got): New class.
5820         (ARM_TCB_SIZE): New constant
5821         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5822         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5823         If user uses a script with a SECTIONS clause, issue only a warning
5824         for a misplaced EXIDX input section.  Otherwise, issue an error.
5825         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5826         garbage collection.
5827         (Target_arm::got_mode_index_entry): Handle static linking.
5828         (Target_arm::Scan::local): Ditto.
5829         (Target_arm::Scan::global): Ditto.
5830         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5831         all incorrectly implemented relocations.
5832         (Target_arm::fix_exidx_coverage): Pass layout to
5833         Arm_output_section::fix_exidx_coverage.
5834         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5835         from ".ARM.exidx." and ".ARM.extab.".
5836
5837 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5838
5839         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5840         section if it does not already exist.
5841         * attributes.cc (Attributes_section_data::Attributes_section_data):
5842         Don't crash if size is zero.
5843
5844 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5845             Ian Lance Taylor  <iant@google.com>
5846
5847         * gold.cc (queue_middle_tasks): If no input files were opened,
5848         exit.
5849         * workqueue.h (Task_function::Task_function): Assert that there is
5850         a blocker.
5851
5852 2010-02-22  Doug Kwan  <dougkwan@google.com>
5853
5854         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5855         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5856         types to avoid warnings due to different uint64_t implementations
5857         on different hosts.
5858
5859 2010-02-21  Doug Kwan  <dougkwan@google.com>
5860
5861         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5862         handling of the maximum backward branch offset.
5863         (Arm_relocate_functions::thumb_branch_common): Ditto.
5864         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5865         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5866         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5867         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5868         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5869         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5870         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5871         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5872         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5873         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5874         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5875         thumb2_bl_out_of_range.o): New rules.
5876         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5877         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5878         thumb2_bl_out_of_range
5879         * testsuite/Makefile.in: Regenerate.
5880         * testsuite/arm_bl_in_range.s: New file.
5881         * testsuite/arm_bl_out_of_range.s: Ditto.
5882         * testsuite/arm_branch_in_range.sh: Ditto.
5883         * testsuite/arm_branch_range.t: Ditto.
5884         * testsuite/thumb2_branch_range.t: Ditto.
5885         * testsuite/thumb_bl_in_range.s: Ditto.
5886         * testsuite/thumb_bl_out_of_range.s: Ditto.
5887         * testsuite/thumb_branch_range.t: Ditto.
5888
5889 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5890
5891         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5892         Add reloc offset information.
5893         * icf.cc (get_section_contents): Change iterators to point to the new
5894         vectors. Add reloc offset information to the contents.
5895         * icf.h (Icf::Sections_reachable_info): New typedef.
5896         (Icf::Sections_reachable_list): New typedef.
5897         (Icf::Offset_info): New typedef.
5898         (Icf::Reloc_info): New struct typedef.
5899         (Icf::Reloc_info_list): New typedef.
5900         (Icf::symbol_reloc_list): Delete method.
5901         (Icf::addend_reloc_list): Delete method.
5902         (Icf::section_reloc_list): Delete method.
5903         (Icf::reloc_info_list): New method.
5904         (Icf::reloc_info_list_): New member.
5905
5906 2010-02-19  Doug Kwan  <dougkwan@google.com>
5907
5908         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5909         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5910         * arm.cc (Arm_relocation_functions): New forward declaration.
5911         (Target_arm::Target_arm): Initialize new data members
5912         got_mod_index_offset_ and tls_base_symbol_defined_.
5913         (Target_arm::Relocate::relocate_tls): New method.
5914         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5915          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5916         New methods.
5917         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5918         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5919         (Target_arm::got_mod_index_offset_,
5920         Target_arm::tls_base_symbol_defined_): New data members.
5921         (Target_arm::Scan::local, Target::Scan::global,
5922         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5923         relocations.
5924
5925 2010-02-18  Doug Kwan  <dougkwan@google.com>
5926
5927         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5928         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5929         text section as a parameter becuase some broken tools may not set
5930         the link in section header.
5931         (Target_arm::has_got_section): New method.
5932         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5933         without any mapping symbol as data only.  Remove warning.
5934         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5935         link in its section header, try to discover the link by inspecting the
5936         REL31 relocation at the beginning of the section.
5937         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5938         in error message.
5939         (Target_arm::Scan::global): Treat any reference to the symbol
5940         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5941
5942 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5943
5944         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5945         (Scan::global_reloc_may_be_function_pointer): New function.
5946         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5947         (Scan::global_reloc_may_be_function_pointer): New function.
5948         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5949         (Scan::global_reloc_may_be_function_pointer): New function.
5950         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5951         (Scan::global_reloc_may_be_function_pointer): New function.
5952         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5953         (Scan::global_reloc_may_be_function_pointer): New function.
5954         (Scan::possible_function_pointer_reloc): New function.
5955         (Target_x86_64::can_check_for_function_pointers): New function.
5956         * gc.h (gc_process_relocs): Scan relocation types to determine if
5957         function pointers were taken for targets that support it.
5958         * icf.cc (Icf::find_identical_sections): Include functions for
5959         folding in safe ICF whose pointer is not taken.
5960         * icf.h (Secn_fptr_taken_set): New typedef.
5961         (fptr_section_id_): New member.
5962         (section_has_function_pointers): New function.
5963         (set_section_has_function_pointers): New function.
5964         (check_section_for_function_pointers): New function.
5965         * options.h: Fix comment for safe ICF option.
5966         * target.h (can_check_for_function_pointers): New function.
5967         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5968         Modify icf_safe_test for X86-64.
5969         * testsuite/Makefile.in: Regenerate.
5970         * testsuite/icf_safe_so_test.cc: New file.
5971         * testsuite/icf_safe_so_test.sh: New file.
5972         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5973         (main): Change to take pointer to function kept_func_3.
5974         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5975         folding is done correctly for X86-64.
5976
5977 2010-02-12  David S. Miller  <davem@davemloft.net>
5978
5979         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5980         is_symbolless parameter.
5981         (Output_reloc<SHT_REL>::is_symbolless): New.
5982         (Output_reloc<SHT_REL>::is_symbolless_): New.
5983         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5984         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5985         (Output_reloc<SHT_RELA>::is_symbolless): New.
5986         (Output_data_reloc::add_global): Handle is_symbolless.
5987         (Output_data_reloc::add_global_relative): Likewise.
5988         (Output_data_reloc::add_local): Likewise.
5989         (Output_data_reloc::add_local_relative): Likewise.
5990         (Output_data_reloc::add_symbolless_global_addend): New.
5991         (Output_data_reloc::add_symbolless_local_addend): New.
5992         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5993         is_symbolless.
5994         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5995         instead of ->is_relative_
5996         (Output_reloc::write): Likewise.
5997         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5998         (Output_reloc::write_rel): Simplify.
5999
6000         * sparc.cc (Target_sparc::Scan::local): Use
6001         ->add_symbolless_local_addend as needed.
6002         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6003         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6004         based upon relocation offset.
6005
6006 2010-02-11  Doug Kwan  <dougkwan@google.com>
6007
6008         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6009         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6010         beginning of function.
6011         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6012         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6013         parameter is_32bit in calls to should_apply_static_reloc.
6014         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6015         (check_DATA): Add arm_abs_global.stdout.
6016         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6017         arm_abs_global.stdout): New rules.
6018         (MOSTLLYCLEANFILES): Add arm_abs_global
6019         * Makefile.in: Regenerate.
6020         * testsuite/arm_abs_global.s: New file.
6021         * testsuite/arm_abs_global.sh: Ditto.
6022         * testsuite/arm_abs_lib.s: Ditto.
6023
6024 2010-02-11  Ian Lance Taylor  <iant@google.com>
6025
6026         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6027         Read_relocs task.
6028         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6029         Allocate_commons_task first.
6030         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6031         task, rather than symtab_lock_.
6032         (Gc_process_relocs::~Gc_process_relocs): New function.
6033         (Gc_process_relocs::is_runnable): Check this_blocker_.
6034         (Gc_process_relocs::locks): Use next_blocker_ rather than
6035         blocker_.
6036         (Scan_relocs::~Scan_relocs): New function.
6037         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6038         symtab_lock_.
6039         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6040         next_blocker_.
6041         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6042         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6043         constructor accordingly.
6044         (class Gc_process_relocs): Likewise.
6045         (class Scan_relocs): Likewise.
6046         * common.h (class Allocate_commons_task): Remove symtab_lock_
6047         field, and corresponding constructor parameter.
6048         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6049         symtab_lock_.
6050         (Allocate_commons_task::locks): Likewise.
6051
6052 2010-02-11  Ian Lance Taylor  <iant@google.com>
6053
6054         * gold-threads.h (class Once): Define.
6055         (class Initialize_lock): Rewrite as child of Once.
6056         * gold-threads.cc (class Once_initialize): Define.
6057         (once_pointer_control): New static variable.
6058         (once_pointer, once_arg): New static variables.
6059         (c_run_once): New static function.
6060         (Once::Once, Once::run_once, Once::internal_run): New functions.
6061         (class Initialize_lock_once): Remove.
6062         (initialize_lock_control): Remove.
6063         (initialize_lock_pointer): Remove.
6064         (initialize_lock_once): Remove.
6065         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6066         (Initialize_lock::initialize): Rewrite.
6067         (Initialize_lock::do_run_once): New function.
6068         * archive.cc (Archive::interpret_header): Only clear name if it is
6069         not already empty.
6070         * fileread.cc: Include "gold-threads.h"
6071         (file_counts_lock): New static variable.
6072         (file_counts_initialize_lock): Likewise.
6073         (File_read::release): Only increment counts when using --stats.
6074         Use a lock around the increment.
6075         * parameters.cc (class Set_parameters_target_once): Define.
6076         (set_parameters_target_once): New static variable.
6077         (Parameters::Parameters): Move here from parameters.h.
6078         (Parameters::set_target): Rewrite.
6079         (Parameters::set_target_once): New function.
6080         (Parameters::clear_target): Move here and rewrite.
6081         * parameters.h (class Parameters): Update declarations.  Add
6082         set_parameters_target_once_ field.
6083         (Parameters::Parameters): Move to parameters.cc.
6084         (Parameters::clear_target): Likewise.
6085         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6086         task.
6087         (Start_group::~Start_group): New function.
6088         (Start_group::is_runnable): New function.
6089         (Start_group::locks, Start_group::run): New functions.
6090         (Finish_group::run): Change saw_undefined to size_t.
6091         * readsyms.h (class Start_group): Define.
6092         (class Finish_group): Change saw_undefined_ field to size_t.
6093         (Finish_group::Finish_group): Remove saw_undefined and
6094         this_blocker parameters.  Change all callers.
6095         (Finish_group::set_saw_undefined): New function.
6096         (Finish_group::set_blocker): New function.
6097         * symtab.h (class Symbol_table): Change saw_undefined to return
6098         size_t.  Change saw_undefined_ field to size_t.
6099         * target-select.cc (Set_target_once::do_run_once): New function.
6100         (Target_selector::Target_selector): Initialize set_target_once_
6101         field.  Don't initialize lock_ and initialize_lock_ fields.
6102         (Target_selector::instantiate_target): Rewrite.
6103         (Target_selector::set_target): New function.
6104         * target-select.h (class Set_target_once): Define.
6105         (class Target_selector): Update declarations.  Make
6106         Set_target_once a friend.  Remove lock_ and initialize_lock_
6107         fields.  Add set_target_once_ field.
6108
6109 2010-02-10  Ian Lance Taylor  <iant@google.com>
6110
6111         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6112         queueing any tasks.
6113         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6114         (queue_middle_tasks): Add all blockers before queueing any tasks.
6115         (queue_final_tasks): Likewise.
6116         * token.h (Task_token::add_blockers): New function.
6117         * object.h (Input_objects::number_of_relobjs): New function.
6118
6119 2010-02-10  Ian Lance Taylor  <iant@google.com>
6120
6121         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6122         shared, not if not position independent.
6123         * x86_64.cc (Relocate::relocate_tls): Likewise.
6124         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6125         (tls_pie_pic_test): New target.
6126         * testsuite/Makefile.in: Rebuild.
6127
6128         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6129         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6130         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6131         * testsuite/Makefile.in: Rebuild.
6132
6133 2010-02-09  David S. Miller  <davem@davemloft.net>
6134
6135         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6136         R_SPARC_RELATIVE using ->add_local_relative().
6137         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6138
6139         * output.h (Output_data_dynamic::add_section_size): New method
6140         that takes two Output_data objects.
6141         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6142         entry param.  Handle it in initializers.
6143         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6144         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6145         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6146         arg.
6147         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6148         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6149         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6150         for dynrel_includes_plt.
6151         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6152         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6153         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6154         before .rela.plt
6155         (Target_sparc::do_finalize_sections): Update to pass true for
6156         dynrel_includes_plt.
6157         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6158         output before .rela.plt
6159         (Target_powerpc::do_finalize_sections): Update to pass true for
6160         dynrel_includes_plt when 32-bit.
6161
6162 2010-02-08  Doug Kwan  <dougkwan@google.com>
6163
6164         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6165         method.
6166         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6167         Arm_relobj::scan_section_for_cortex_a8_stubs,
6168         Arm_relobj::do_relocation_section): Instead of calling
6169         Output_section::output_address, use faster
6170         Arm_relobj::simple_input_section_output_address.
6171
6172 2010-02-08  David S. Miller  <davem@davemloft.net>
6173
6174         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6175         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6176         relocation helper function.
6177
6178         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6179         just like R_SPARC_GOT{10,13,22}.
6180         (Target_sparc::Scan::local): Likewise.
6181         (Target_sparc::Relocate:relocate): Likewise.
6182
6183 2010-02-06  Ian Lance Taylor  <iant@google.com>
6184
6185         * configure.ac: Rewrite targetobjs duplicate removal code to use
6186         only shell constructs.
6187         * configure: Rebuild.
6188
6189 2010-02-05  Doug Kwan  <dougkwan@google.com>
6190
6191         PR 11247
6192         * arm.cc (Arm_relobj::section_is_scannable): New method.
6193         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6194         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6195
6196 2010-02-04  Doug Kwan  <dougkwan@google.com>
6197
6198         PR 11247
6199         * arm-reloc-property.cc (cstdio): Include.
6200         * configure.ac (targetobjs): Remove duplicates.
6201         * configure: Regenerate.
6202         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6203         big and little endian version for a given address size.
6204
6205 2010-02-03  Doug Kwan  <dougkwan@google.com>
6206
6207         * arm-reloc-property.cc
6208         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6209         definition.
6210         * arm-reloc-property.h
6211         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6212         New method definition.
6213         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6214         declaration.
6215         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6216         overflow to N.
6217         (GOT_PREL): Change implemented to Y.
6218         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6219         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6220         (Arm_relocate_functions::movw_abs_nc): Remove method.
6221         (Arm_relocate_functions::movt_abs): Ditto.
6222         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6223         (Arm_relocate_functions::thm_movt_abs): Ditto.
6224         (Arm_relocate_functions::movw_rel_nc): Ditto.
6225         (Arm_relocate_functions::movw_rel): Ditto.
6226         (Arm_relocate_functions::movt_rel): Ditto.
6227         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6228         (Arm_relocate_functions:thm_movw_rel): Ditto.
6229         (Arm_relocate_functions:thm_movt_rel): Ditto.
6230         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6231         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6232         New method definitions.
6233         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6234         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6235         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6236         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6237         (Target_arm::Relocate::relocate): Check for non-static or
6238         unimplemented relocation code and exit early.  Change calls to
6239         Target_arm::reloc_uses_thumb_bit and
6240         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6241         instead.  Refactor code to handle similar relocations to increase
6242         code sharing.  Remove check for unsupported relocation code in switch
6243         statement.
6244         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6245         relocation property table to find out size.  Change error message to
6246         print out the name of a relocation code instead of the numeric value.
6247         (Target_arm::scan_reloc_for_stub): Use relocation property table
6248         instead of calling Target_arm::reloc_uses_thumb_bit().
6249
6250 2010-02-02  Doug Kwan  <dougkwan@google.com>
6251
6252         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6253         types of relaxed input section.
6254
6255 2010-02-02  Doug Kwan  <dougkwan@google.com>
6256
6257         * Makefile.am (HFILES): Add arm-reloc-property.h.
6258         (DEFFILES): New.
6259         (TARGETSOURCES): Add arm-reloc-property.cc
6260         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6261         (libgold_a_SOURCES): $(DEFFILES)
6262         * Makefile.in: Regenerate.
6263         * arm-reloc-property.cc: New file.
6264         * arm-reloc-property.h: New file.
6265         * arm-reloc.def: New file.
6266         * arm.cc: Update comments.
6267         (arm-reloc-property.h): New included header.
6268         (arm_reloc_property_table): New global variable.
6269         (Target_arm::do_select_as_default_target): New method definition.
6270         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6271         arm-reloc-property to targ_extra_obj.
6272         * parameters.cc (set_parameters_target): Call
6273         Target::select_as_default_target().
6274         * target.h (Target::select_as_default_target): New method definition.
6275         (Target::do_select_as_default_target): Same.
6276
6277 2010-02-01  Doug Kwan  <dougkwan@google.com>
6278
6279         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6280         first_output_text_section_.
6281         (Arm_exidx_fixup::first_output_text_section): New method definition.
6282         (Arm_exidx_fixup::first_output_text_section_): New data member.
6283         (Arm_exidx_fixup::process_exidx_section): Record the first text
6284         output section seen.
6285         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6286         and entsize in output section header.
6287
6288 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6289
6290         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6291         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6292         (Arm_relocate_functions::thm_alu11): New Method.
6293         (Arm_relocate_functions::thm_pc8): New Method.
6294         (Arm_relocate_functions::thm_pc12): New Method.
6295         (Target_arm::Scan::local): Handle the relocations.
6296         (Target_arm::Scan::global): Likewise.
6297         (Target_arm::Relocate::relocate): Likewise.
6298         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6299
6300 2010-01-29  Doug Kwan  <dougkwan@google.com>
6301
6302         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6303         of relocation types as ld.
6304
6305 2010-01-29  Doug Kwan  <dougkwan@google.com>
6306
6307         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6308         to public.
6309         (Arm_relocate_functions::thumb_branch_common): Ditto.
6310         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6311         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6312         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6313         Arm_relocate_functions::jump24): Remove.
6314         (Target_arm::Relocate::relocate): Adjust code to call
6315         Arm_relocation_functions::arm_branch_common and
6316         Arm_relocation_functions::thumb_branch_common instead of their removed
6317         wrappers.  Merge switch-cases together to reduce source code size.
6318
6319 2010-01-29  Doug Kwan  <dougkwan@google.com>
6320
6321         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6322         output_local_symbol_count_needs_update_.
6323         (Arm_relobj::output_local_symbol_count_needs_update,
6324          Arm_relobj::set_output_local_symbol_count_needs_update,
6325          Arm_relobj::update_output_local_symbol_count): New methods.
6326         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6327         member.
6328         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6329         of pointed function as in a R_ARM_PREL31 relocation.
6330         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6331         for output local symbol count updating.
6332         (Target_arm::do_relax): Update output local symbol counts in objects
6333         if necessary.
6334         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6335
6336 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6337
6338         * arm.cc: Added support for the ARM relocations:
6339         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6340         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6341         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6342         movw_prel_nc).
6343         (Arm_relocate_functions::movw_rel): New method.
6344         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6345         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6346         thm_movw_prel_nc).
6347         (Arm_relocate_functions::thm_movw_rel): New method.
6348         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6349         thm_movt_prel).
6350         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6351         relocations.
6352         (Target_arm::Scan::global): Likewise.
6353         (Target_arm::Relocate::relocate): Likewise.
6354         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6355         Likewise.
6356
6357 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6358
6359         * arm.cc: Added support for ARM group relocations.
6360         (Target_arm::reloc_needs_sym_origin): New method.
6361         (Arm_relocate_functions::calc_grp_kn): New method.
6362         (Arm_relocate_functions::calc_grp_residual): New method.
6363         (Arm_relocate_functions::calc_grp_gn): New method.
6364         (Arm_relocate_functions::arm_grp_alu): New Method.
6365         (Arm_relocate_functions::arm_grp_ldr): New Method.
6366         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6367         (Arm_relocate_functions::arm_grp_ldc): New Method.
6368         (Target_arm::Scan::local): Handle the ARM group relocations.
6369         (Target_arm::Scan::global): Likewise.
6370         (Target_arm::Relocate::relocate): Likewise.
6371         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6372         Likewise.
6373
6374 2010-01-26  Doug Kwan  <dougkwan@google.com>
6375
6376         * arm.cc (set): Include.
6377         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6378         pointer type.
6379         (Arm_output_section::Text_section_list): New type.
6380         (Arm_output_section::append_text_sections_to_list): New method.
6381         (Arm_output_section::fix_exidx_coverage): Ditto.
6382         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6383         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6384         Relobj::set_section_offset() instead of
6385         Sized_relobj::invalidate_section_offset().
6386         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6387         parameter for section headers. Ignore relocation sections for
6388         unallocated sections and EXIDX sections.
6389         (Target_arm::fix_exidx_coverage): New method.
6390         (Target_arm::output_section_address_less_than): New type.
6391         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6392         linked text section instead of the EXIDX section.
6393         (Arm_output_section::create_stub_group): Add an assertion to check
6394         that this is not an EXIDX output section.
6395         (Arm_output_section::append_text_sections_to_list): New method.
6396         (Arm_output_section::fix_exidx_coverage): Ditto.
6397         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6398         Arm_relobj::section_needs_reloc_stub_scanning.
6399         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6400         first pass.
6401         (Target_arm::fix_exidx_coverage): New method.
6402         * object.h (Relobj::set_output_section): New method.
6403         (Sized_relobj::invalidate_section_offset): Remove method.
6404         (Sized_relobj::do_invalidate_section_offset): Remove method.
6405         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6406
6407 2010-01-25  Doug Kwan  <dougkwan@google.com>
6408
6409         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6410         Fix warning due to signed and unsigned comparison on a 32-bit host.
6411
6412 2010-01-22  Doug Kwan  <dougkwan@google.com>
6413
6414         * arm.cc (Target_arm::do_relax): Record an output section for section
6415         offset adjustment it contains any stub table that has changed.
6416         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6417         offsets in an output section if necessary.
6418         * output.cc (Output_section::Output_section): Initialize
6419         section_offsets_need_adjustments_.
6420         (Output_section::add_input_section_for_script): Renamed to
6421         Output_section::add_simple_input_section.
6422         (Output_section::save_states): Add a comment.
6423         (Output_section::discard_states): New method defintion.
6424         (Output_section::adjust_section_offsets): Same.
6425         * output.h (Output_section::add_input_section_for_script): Renamed to
6426         Output_section::add_simple_input_section.
6427         (Output_section::discard_states): New method declaration.
6428         (Output_section::adjust_section_offsets): Same.
6429         (Output_section::section_offsets_need_adjustment,
6430         Output_section::set_section_offsets_need_adjustment): New method
6431         definitions.
6432         (Output_section::section_offsets_need_adjustment_): New data member.
6433         * script-sections.cc
6434         (Output_section_element_input::set_section_address): Adjust code for
6435         renaming of Output_section::add_input_section_for_script.
6436         (Orphan_output_section::set_section_address): Same.
6437
6438 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6439
6440         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6441         Fix_v4bx enum values .
6442         * gold/options.h (General_options): New option definitions.
6443         (General_options::fix_v4bx): New method.
6444         (General_options::Fix_v4bx): New enum.
6445         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6446         (General_options::parse_fix_v4bx_interworking): New method.
6447
6448 2010-01-22  Doug Kwan  <dougkwan@google.com>
6449
6450         * arm.cc (Arm_exidx_fixup): New class.
6451
6452 2010-01-21  Doug Kwan  <dougkwan@google.com>
6453
6454         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6455         classes.
6456         (Arm_exidx_section_offset_map): New type.
6457
6458 2010-01-21  Doug Kwan  <dougkwan@google.com>
6459
6460         * arm.cc (Arm_exidx_input_section): New class.
6461         (Arm_relobj::exidx_input_section_by_link,
6462         Arm_relobj::exidx_input_section_by_shndx,
6463         Arm_relobj::make_exidx_input_section): New methods.
6464         (read_arm_attributes_section): Remove.
6465         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6466         information about them.
6467         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6468         to here.
6469
6470 2010-01-20  Doug Kwan  <dougkwan@google.com>
6471
6472         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6473         Input_section_specifier to Section_id.
6474         (Target_arm::new_arm_input_section: Adjust code for change of key
6475         type.
6476         (Target_arm::find_arm_input_section): Ditto.
6477         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6478         (Section_id): Remove.
6479         (Garbage_collection::Section_id_hash): Remove.
6480         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6481         (Section_id): Remove.
6482         (Icf::Section_id_hash): Remove.
6483         * object.h (Section_id, Const_section_id, Section_id_hash,
6484         Const_section_id_hash): New type definitions.
6485         * output.cc (Output_section::add_relaxed_input_section): Change to
6486         use Const_section_id instead of Input_section_specifier as key type.
6487         (Output_section::add_merge_input_section): Ditto.
6488         (Output_section::build_relaxation_map): Change to use Section_id
6489         instead of Input_section_specifier as key type.
6490         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6491         Ditto.
6492         (Output_section::convert_input_sections_to_relaxed_sections): Change
6493         to use Const_section_id instead of Input_section_specifier as key type.
6494         (Output_section::find_merge_section): Ditto.
6495         (Output_section::find_relaxed_input_section): Ditto.
6496         * output.h (Input_section_specifier): Remove class.
6497         (Output_section::Output_section_data_by_input_section_map): Change
6498         key type to Const_section_id.
6499         (Output_section::Output_relaxed_input_section_by_input_section_map):
6500         Ditto.
6501         (Output_section::Relaxation_map): Change key type to Section_id.
6502
6503 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6504
6505         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6506         (class Arm_v4bx_stub): New class.
6507         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6508         (Stub_factory::make_arm_v4bx_stub): New method.
6509         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6510         (Stub_table::empty): Handle v4bx stubs.
6511         (Stub_table::add_arm_v4bx_stub): New method.
6512         (Stub_table::find_arm_v4bx_stub): New method.
6513         (Arm_relocate_functions::v4bx): New method.
6514         (Target_arm::fix_v4bx): New method.
6515         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6516         (Stub_table::relocate_stubs): Likewise.
6517         (Stub_table::do_write): Likewise.
6518         (Stub_table::update_data_size_and_addralign): Likewise.
6519         (Stub_table::finalize_stubs):  Likewise.
6520         (Target_arm::Scan::local): Likewise.
6521         (Target_arm::Scan::global): Likewise.
6522         (Target_arm::do_finalize_sections): Likewise.
6523         (Target_arm::Relocate::relocate): Likewise.
6524         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6525         Likewise.
6526         (Target_arm::scan_reloc_for_stub): Likewise.
6527         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6528
6529 2010-01-19  Ian Lance Taylor  <iant@google.com>
6530
6531         * output.cc (Output_section_headers::do_sized_write): Write large
6532         segment count to sh_info field.
6533         (Output_file_header::do_sized_write): For large segment count,
6534         write PN_XNUM to e_phnum field.
6535
6536 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6537
6538         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6539         (Arm_relocate_functions::thm_jump8): New function.
6540         (Arm_relocate_functions::thm_jump11): New function.
6541         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6542         R_ARM_THM_JUMP11.
6543         (Target_arm::Scan::global): Likewise.
6544         (Target_arm::Relocate::relocate): Likewise.
6545         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6546         Likewise.
6547
6548 2010-01-14  Doug Kwan  <dougkwan@google.com>
6549
6550         * arm.cc (map, utility): Include headers.
6551         (Target_arm::apply_cortex_a8_workaround): New method.
6552         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6553         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6554         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6555         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6556         the --[no-]fix-cortex-a8 command line options.
6557         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6558         (Target_arm::relocate_stub): Use addend in instruction template.
6559         * options.h (DEFINE_bool): Set the user-set flag.
6560         (General_options): Add --[no-]-fix-cortex options.
6561         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6562         : Update fast look-up map after conversion.
6563
6564 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6565
6566         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6567         in the first pass of do_layout.
6568
6569 2010-01-13  Doug Kwan  <dougkwan@google.com>
6570
6571         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6572         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6573         apparent compiler problem of not folding static constant integral
6574         data members of elfcpp::Elf_sizes<32>.
6575
6576 2010-01-13  Doug Kwan  <dougkwan@google.com>
6577
6578         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6579         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6580         Arm_relobj::scan_section_for_cortex_a8_erratum,
6581         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6582         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6583         sections to scan for relocation stubs into a new method
6584         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6585         relocation and Cortex-A8 stub scanning.
6586         (Target_arm::do_relax): Force stubs to be after stubbed sections
6587         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6588         the beginning of a new relaxation pass.  Update a comment.
6589         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6590
6591 2010-01-12  Ian Lance Taylor  <iant@google.com>
6592
6593         * target-reloc.h (visibility_error): New inline function.
6594         (relocate_section): Call visibility_error.
6595         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6596         (MOSTLYCLEANFILES): Likewise.
6597         (protected_4_pic.o, protected_3.err): New targets.
6598         * testsuite/protected_4.cc: New file.
6599
6600 2010-01-12  Doug Kwan  <dougkwan@google.com>
6601
6602         * arm.cc (Cortex_a8_reloc): New class.
6603         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6604         and cortex_a8_relocs_info_.
6605         (Target_arm::fix_cortex_a8): New method definition.
6606         (Target_arm::Cortex_a8_relocs_info): New type.
6607         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6608         New data member declarations.
6609         (Target_arm::scan_reloc_for_stub): Record information about
6610         relocations for THUMB branches that might be exempted from the
6611         Cortex-A8 workaround.
6612         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6613         at the beginning of a relaxation pass.
6614
6615 2010-01-12  Doug Kwan  <dougkwan@google.com>
6616
6617         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6618         (Arm_relobj::Mapping_symbol_position,
6619          Arm_reloj::Mapping_symbol_position_less,
6620          Arm_relobj::Mapping_symbols_info): New types.
6621         (Target_arm::is_mapping_symbol_name): New method definition.
6622         (Arm_relobj::do_count_local_symbols): Save information about mapping
6623         symbols.
6624
6625 2010-01-11  Doug Kwan  <dougkwan@google.com>
6626
6627         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6628         Arm_relocate_functions::thumb32_branch_upper,
6629         Arm_relocate_functions::thumb32_branch_lower,
6630         Arm_relocate_functions::thumb32_cond_branch_offset,
6631         Arm_relocate_functions::thumb32_cond_branch_upper,
6632         Arm_relocate_functions::thumb32_cond_branch_lower,
6633         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6634         branch offset encoding.
6635         (Arm_relocate_functions::thumb_branch_common): Use new branch
6636         offset encoding methods to avoid code duplication.
6637         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6638         (Stub_addend_reader::operator()): Use new branch encoding method
6639         to avoid code duplication.
6640
6641 2010-01-11  Doug Kwan  <dougkwan@google.com>
6642
6643         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6644         (Target_arm::do_finalize_sections): Define special EXIDX section
6645         symbols only if referenced.
6646         * gc.h (Garbage_collection::add_reference): New method.
6647         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6648         code duplication.
6649
6650 2010-01-11  Ian Lance Taylor  <iant@google.com>
6651
6652         * script.cc (Version_script_info::build_expression_list_lookup):
6653         Change complaing about duplicate wildcard match from error to
6654         warning.
6655
6656         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6657         of 2009-12-30.
6658         (Version_script_info::Version_script_info): Initialize globs_,
6659         default_version_, default_is_global_, and exact_.  Don't
6660         initialize globals_ or locals_.
6661         (Version_script_info::build_lookup_tables): Build local symbols
6662         first.
6663         (Version_script_info::unquote): New function.
6664         (Version_script_info::add_exact_match): New function.
6665         (Version_script_info::build_expression_list_lookup): Remove lookup
6666         parameter.  Add is_global parameter.  Change all callers.  Handle
6667         wildcard pattern specially.  Unquote pattern.  Call
6668         add_exact_match.
6669         (Version_script_info::get_name_to_match): New function.
6670         (Version_script_info::get_symbol_version): New function.
6671         (Version_script_info::get_symbol_version_helper): Remove.
6672         (Version_script_info::check_unmatched_names): Call unquote.
6673         * script.h (class Version_script_info): Change get_symbol_version
6674         to be non-inline and add is_global parameter; change all callers.
6675         Rewrite symbol_is_local.  Update declarations.  Define struct
6676         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6677         Remove globals_ and locals_ members.  Add exact_, globs_,
6678         default_version_, is_global_.
6679         (Version_script_info::Glob): Remove pattern, add expression and
6680         is_global.  Update constructor.  Change all callers.
6681         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6682         default version.
6683         (Versions::symbol_section_contents): If a symbol is undefined, or
6684         defined in a dynamic object, set the version index to
6685         VER_NDX_LOCAL.
6686         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6687         symbol_is_local.
6688         (Symbol_table::add_from_pluginobj): Likewise.
6689         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6690
6691 2010-01-11  Doug Kwan  <dougkwan@google.com>
6692
6693         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6694         (incremental_dump_LDADD): Add linking option for libintl.
6695         * Makefile.in: Regenerate.
6696
6697 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6698
6699         PR gold/11144
6700         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6701         instead of -Ds.
6702         * testsuite/Makefile.in: Regenerated.
6703
6704 2010-01-10  Doug Kwan  <dougkwan@google.com>
6705
6706         * options.h (DEFINE_var): Use parentheses around argument varname__
6707         in macro body to avoid any unintended subsequent substitutions.
6708
6709 2010-01-10  Ian Lance Taylor  <iant@google.com>
6710
6711         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6712         candidates before doing symbol resolution.
6713
6714         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6715         ODR candidates if only one is weak.
6716
6717 2010-01-08  Ian Lance Taylor  <iant@google.com>
6718
6719         * script.cc (Version_script_info::build_expression_list_lookup):
6720         Don't warn about ambiguous version, just record the ambiguity.
6721         (Version_script_info::get_symbol_version_helper): Give error if
6722         version is ambiguous.
6723
6724 2010-01-08  Doug Kwan  <dougkwan@google.com>
6725
6726         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6727           prev_data_size_ and prev_addralign_.  Remove initializer for
6728           deleted data member has_been_changed_.
6729           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6730           to determine if the table is empty.
6731           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6732           Remove.
6733           (Stub_table::add_reloc_stub): Define method in class definition
6734           instead of just declaring it there.
6735           (Stub_table::add_cortex_a8_stub): New method definition.
6736           (Stub_table::update_data_size_and_addralign): Ditto.
6737           (Stub_table::finalize_stubs): Ditto.
6738           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6739           (Stub_table::do_addralign_): Return address alignment in the
6740           (Stub_table::do_reset_address_and_file_offset): Define method in
6741           class definition instead of declaring it there.  Set current data
6742           size to be the data size of the previous pass.
6743           (Stub_table::set_final_data_size): Use current data size as the
6744           final data size.
6745           (Stub_table::relocate_stub): Change parameter type of stub from
6746           Reloc_stub pointer to Stub pointer.
6747           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6748           (Stub_table::Cortex_a8_stub_list): New typedef.
6749           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6750            Stub_table::prev_addralign_): New data member.
6751           (Arm_relobj::Arm_relobj): Initialize data member
6752           section_has_cortex_a8_workaround_.
6753           (Arm_relobj::section_has_cortex_a8_workaround,
6754            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6755            definitions.
6756           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6757           declarations.
6758           (Target_arm::relocate_stub): Change parameter type of stub from
6759           Reloc_stub pointer to Stub pointer.
6760           (Insn_template::size, Insn_template::alignment): Handle
6761           THUMB16_SPECIAL_TYPE.
6762           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6763            Stub_table::update_data_size_and_addralign,
6764            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6765           definitions.
6766           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6767           (Stub_table::do_write): Ditto.
6768           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6769
6770 2010-01-08  Ian Lance Taylor  <iant@google.com>
6771
6772         PR 11108
6773         * symtab.h (class Symbol): Remove fields is_target_special_ and
6774         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6775         (Symbol::is_defined_in_discarded_section): New function.
6776         (Symbol::set_is_defined_in_discarded_section): New function.
6777         (Symbol::has_plt_offset): Rewrite.
6778         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6779         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6780         Don't initialize is_target_special_ or has_plt_offset_.
6781         Initialize is_defined_in_discarded_section_.
6782         (Symbol_table::add_from_relobj): If appropriate, set
6783         is_defined_in_discarded_section.
6784         * resolve.cc (Symbol::override_base_with_special): Don't test
6785         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6786         * target-reloc.h (relocate_section): Do special handling for
6787         symbols defined in discarded sections for global symbols as well
6788         as local symbols.
6789
6790 2010-01-08  Ian Lance Taylor  <iant@google.com>
6791
6792         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6793         the SHT_SYMTAB case.
6794
6795 2010-01-08  Ian Lance Taylor  <iant@google.com>
6796
6797         * object.cc (Sized_relobj::do_layout): Don't get confused if
6798         layout_eh_frame returns NULL.
6799
6800 2010-01-08  Ian Lance Taylor  <iant@google.com>
6801
6802         PR 11084
6803         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6804         dynamic symbol table, use the normal symbol table.
6805         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6806         symbol table.
6807
6808 2010-01-08  Ian Lance Taylor  <iant@google.com>
6809
6810         PR 11072
6811         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6812         sections.
6813
6814 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6815
6816         * version.cc (print_version): Change to "Copyright 2010".
6817
6818 2010-01-08  Ian Lance Taylor  <iant@google.com>
6819
6820         PR 10287
6821         PR 11063
6822         * i386.cc (class Target_i386): Change return type of plt_section
6823         to be non-const.
6824         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6825         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6826         tls_desc_rel_ field.
6827         (Output_data_plt_i386::rel_tls_desc): New function.
6828         (Target_i386::rel_tls_desc_section): New function.
6829         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6830         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6831         R_386_TLS_DESC reloc in rel_tls_desc_section.
6832         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6833         Define struct Tlsdesc_info.
6834         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6835         (Target_x86_64::do_reloc_symbol_index): New function.
6836         (Target_x86_64::add_tlsdesc_info): New function.
6837         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6838         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6839         tlsdesc_rel_ field.
6840         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6841         all callers.
6842         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6843         (Target_x86_64::rela_tlsdesc_section): New function.
6844         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6845         handling.
6846         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6847         (Target_x86_64::do_reloc_addend): New function.
6848         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6849         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6850         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6851         (Output_reloc::type): New function.
6852         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6853         (Output_reloc::is_target_specific): New function.
6854         (Output_reloc::target_arg): New function.
6855         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6856         absolute relocs and target specific relocs.
6857         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6858         add_target_specific.
6859         (class Output_data_reloc) [SHT_RELA]: Likewise.
6860         * output.cc (Output_reloc::Output_reloc): Add four new versions
6861         for absolute relocs and target specific relocs.
6862         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6863         (Output_reloc::get_symbol_index): Likewise.
6864         (Output_reloc::local_section_offset): Check that local_sym_index_
6865         is not TARGET_CODE or 0.
6866         (Output_reloc::symbol_value): Likewise.
6867         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6868         reloc.
6869         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6870         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6871         functions.
6872         * layout.cc (add_target_dynamic_tags): Use output section for
6873         DT_PLTRELSZ and DT_JMPREL.
6874
6875 2010-01-07  Ian Lance Taylor  <iant@google.com>
6876
6877         PR 11061
6878         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6879         function.
6880         (class Output_data_reloc_generic): Define.
6881         (class Output_data_reloc_base): Change base class to
6882         Output_data_reloc_generic.  Change add() method to call
6883         bump_relative_reloc_count for a relative reloc.  Remove
6884         sort_relocs_ field.
6885         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6886         to sort_relocs().
6887         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6888         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6889         appropriate.
6890         * layout.h (class Layout): Update declaration.
6891
6892 2010-01-07  Ian Lance Taylor  <iant@google.com>
6893
6894         * output.h (class Output_data): Add const version of
6895         output_section and do_output_section.
6896         (class Output_section_data): Add const version of
6897         do_output_section.
6898         (class Output_section): Likewise.
6899         * layout.cc (Layout::add_target_dynamic_tags): New function.
6900         * layout.h (class Layout): Update declarations.
6901         * arm.cc (Target_arm::do_finalize_sections): Use
6902         add_target_dynamic_tags.
6903         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6904         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6905         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6906         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6907
6908 2010-01-07  Ian Lance Taylor  <iant@google.com>
6909
6910         PR 11042
6911         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6912         object as needed.
6913
6914 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6915             Ian Lance Taylor  <iant@google.com>
6916
6917         PR 11019
6918         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6919         Xindex::read_symtab_xindex.
6920
6921 2010-01-07  Doug Kwan  <dougkwan@google.com>
6922
6923         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6924         (Insn_template::thumb16_bcond_insn): New method declaration.
6925         (Insn_template): Fix spelling.
6926         (Stub::thumb16_special): New method declaration.
6927         (Stub::do_write): Define virtual method which was previously pure
6928         virtual.
6929         (Stub::do_thumb16_special): New method declaration.
6930         (Stub::do_fixed_endian_write): New template member.
6931         (Reloc_stub::do_write): Remove.
6932         (Reloc_stub::do_fixed_endian_write): Remove.
6933         (Cortex_a8_stub): New class definition.
6934         (Stub_factory::make_cortex_a8_stub): New method definition.
6935         (Stub_factory::Stub_factory): Add missing static storage class
6936         qualifier for elf32_arm_stub_a8_veneer_blx.
6937
6938 2010-01-07  Ian Lance Taylor  <iant@google.com>
6939
6940         PR 10980
6941         * options.h (class General_options): Add --warn-unresolved-symbols
6942         and --error-unresolved-symbols.
6943         * errors.cc (Errors::undefined_symbol): Implement
6944         --warn-unresolved-symbols.
6945
6946         * options.h (class General_options): Add -z text and -z textoff.
6947         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6948
6949 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6950
6951         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6952         (Garbage_collection::cident_sections): New function.
6953         (Garbage_collection::add_cident_section): New function.
6954         (Garbage_collection::cident_sections_): New member.
6955         (gc_process_relocs): Add references to sections whose names are C
6956         identifiers.
6957         * gold.h (cident_section_start_prefix): New constant.
6958         (cident_section_stop_prefix): New constant.
6959         (is_cident): New function.
6960         * layout.cc (Layout::define_section_symbols): Replace string constants
6961         with the newly defined constants.
6962         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6963         C identifiers.
6964         * testsuite/Makefile.am: Add gc_orphan_section_test.
6965         * testsuite/Makefile.in: Regenerate.
6966         * testsuite/gc_orphan_section_test.cc: New file.
6967         * testsuite/gc_orphan_section_test.sh: New file.
6968
6969 2010-01-06  Ian Lance Taylor  <iant@google.com>
6970
6971         PR 10980
6972         * options.h (class General_options): Add --warn-shared-textrel.
6973         * layout.cc (Layout::finish_dynamic_section): Implement
6974         --warn-shared-textrel.
6975
6976         PR 10980
6977         * options.h (class General_options): Add --warn-multiple-gp.
6978
6979 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6980
6981         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6982         $(THREADSLIB) and $(LIBDL).
6983         * Makefile.in: Rebuild.
6984
6985 2010-01-06  Ian Lance Taylor  <iant@google.com>
6986
6987         PR 10980
6988         * options.cc (General_options::parse_section_start): New function.
6989         (General_options::section_start): New function.
6990         (General_options::General_options): Initialize all members.
6991         * options.h: Include <map>
6992         (class General_options): Add --section-start.  Add section_starts_
6993         member.
6994         * layout.cc (Layout::attach_allocated_section_to_segment): If
6995         --section-start was used, set the address of the segment.  Remove
6996         local sort_sections.
6997         (Layout::relaxation_loop_body): If the address of the load segment
6998         has been set by --section-start, don't use it.
6999         * output.h (Output_segment::update_flags_for_output_section): New
7000         function.
7001         * output.cc (Output_segment::add_output_section): Call
7002         update_flags_for_output_section.
7003
7004 2010-01-05  Ian Lance Taylor  <iant@google.com>
7005
7006         PR 10980
7007         * options.h (class General_options): Add --undefined-version.
7008         * script.cc (struct Version_expression): Add was_matched_by_symbol
7009         field.
7010         (Version_script_info::matched_symbol): New function.
7011         (Version_script_info::get_symbol_version_helper): Call
7012         matched_symbol.
7013         (Version_script_info::check_unmatched_names): New function.
7014         * script.h (class Version_script_info): Update declarations.
7015         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7016
7017         * options.h (class General_options): Use DEFINE_bool_alias for
7018         allow_multiple_definition.
7019         * resolve.cc (Symbol_table::should_override): Don't test
7020         allow_multiple_definition.
7021
7022         PR 10980
7023         * options.h (class General_options): Add --cref.
7024         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7025         until after printing cref table.
7026         * cref.cc: Include "symtab.h".
7027         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7028         (Cref_table_compare::operator()): New function.
7029         (Cref_inputs::gather_cref): New function.
7030         (filecol): New static const.
7031         (Cref_inputs::print_cref): New function.
7032         (Cref::print_cref): New function.
7033         * cref.h: Include <cstdio>.
7034         (class Cref): Update declarations.
7035         * mapfile.h (Mapfile::file): New function.
7036         * object.h (class Object): Define Symbols.  Declare virtual
7037         do_get_global_symbols.
7038         (Object::get_global_symbols): New function.
7039         * object.cc (Input_objects::add_object): Pass object to cref_ if
7040         --cref.
7041         (Input_objects::archive_start): Likewise.
7042         (Input_objects::archive_stop): Likewise.
7043         (Input_objects::print_cref): New function.
7044         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7045         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7046         --cref.
7047         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7048         function.
7049         * plugin.h (class Sized_pluginobj): Update declarations.
7050
7051 2010-01-05  Ian Lance Taylor  <iant@google.com>
7052
7053         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7054         to is_default_version.  Rename insdef to insdefault.
7055         (Symbol_table::add_from_relobj): Rename def to is_default_version
7056         and local to is_forced_local.
7057         (Symbol_table::add_from_pluginobj): Likewise.
7058         (Symbol_table::add_from_dynobj): Likewise.
7059         (Symbol_table::define_special_symbol): Rename insdef to
7060         insdefault.
7061
7062 2010-01-04  Ian Lance Taylor  <iant@google.com>
7063
7064         PR 10980
7065         * options.h (class General_options): Add
7066         --allow-multiple-definition and -z muldefs.
7067         * resolve.cc (Symbol_table::should_override): Don't warn about a
7068         multiple symbol definition if --allow-multiple-definition or -z
7069         muldefs.
7070
7071         PR 10980
7072         * options.h (class General_options): Add --add-needed and
7073         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7074         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7075         error if --copy-dt-needed-entries aka --add-needed is used and
7076         would cause a change in behaviour.
7077
7078         PR 10980
7079         * options.h (class General_options): Add -G as a short version of
7080         --shared.  Add no-op options -assert, -g, and -i.
7081
7082 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7083
7084         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7085         check for .text or .gnu.linkonce.t sections.
7086         * icf.cc (Icf::find_identical_sections): Ditto.
7087         Change the detection for mangled function name within the section
7088         name.
7089         * icf.h (is_section_foldable_candidate): New function.
7090
7091 2009-12-30  Ian Lance Taylor  <iant@google.com>
7092
7093         PR 10980
7094         * options.h (class General_options): Permit two dashes with
7095         --retain-symbols-file.
7096
7097 2009-12-30  Ian Lance Taylor  <iant@google.com>
7098
7099         PR 10979
7100         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7101         don't put the file header and segment headers in the text
7102         segment.
7103
7104         PR 10979
7105         * common.cc (Sort_commons::operator()): Stabilize sort when both
7106         entries are NULL.
7107         (Symbol_table::do_allocate_commons_list): When allocating common
7108         symbols, skip a symbol which is no longer common.
7109         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7110         an object before checking its type.
7111         * testsuite/common_test_2.c: New file.
7112         * testsuite/common_test_3.c: New file.
7113         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7114         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7115         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7116         (common_test_2_pic.o, common_test_2.so): New targets.
7117         (common_test_3_pic.o, common_test_3.so): New targets.
7118         * testsuite/Makefile.in: Rebuild.
7119
7120         PR 10979
7121         * script.cc (read_input_script): If we see a new SECTIONS clause,
7122         and we have added an input section, give an error.
7123         * layout.h (class Layout): Add have_added_input_section function.
7124         Add have_added_input_section_ field.
7125         * layout.cc (Layout::Layout): Initialize
7126         have_added_input_section_.
7127         (Layout::layout): Set have_added_input_section_.
7128         (Layout::layout_eh_frame): Likewise.
7129
7130 2009-12-30  Ian Lance Taylor  <iant@google.com>
7131
7132         PR 10931
7133         * options.h (class General_options): Add --sort-common option.
7134         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7135         * common.cc (Sort_common): Add sort_order parameter to
7136         constructor.  Add sort_order_ field.
7137         (Sort_commons::operator): Check sort_order_.
7138         (Symbol_table::allocate_commons): Determine the sort order.
7139         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7140         Change all callers.
7141         (Symbol_table::do_allocate_commons_list): Likewise.
7142
7143 2009-12-30  Ian Lance Taylor  <iant@google.com>
7144
7145         PR 10916
7146         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7147         symbols from this object, don't change the visibility of an
7148         undefined symbol.
7149         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7150
7151 2009-12-30  Ian Lance Taylor  <iant@google.com>
7152
7153         PR 10861
7154         * script.h (class Version_script_info): Define Language enum.
7155         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7156         new fields globals_, locals_, and is_finalized_.
7157         * script.cc: Various formatting fixes.
7158         (class Parser_closure): Change language_stack_ from a vector of
7159         std::string to one of Version_script_info::Language.  Adjust all
7160         uses accordingly.
7161         (class Lazy_demangler): Remove.
7162         (struct Version_expression): Change language from std::string to
7163         Version_script_info::Language.
7164         (Version_script_info::Version_script_info): New function.
7165         (Version_script_info::~Version_script_info): Don't call clear.
7166         (Version_script_info::finalize): New function.
7167         (Version_script_info::build_lookup_tables): New function.
7168         (Version_script_info::build_expression_list_lookup): New
7169         function.
7170         (Version_script_info::get_symbol_version_helper): Rewrite to use
7171         lookup tables.
7172         (Version_script_info::print_expression_list): Adjust to use
7173         Version_script_info::Language.
7174         (script_push_lex_into_version_mode): Check that the version script
7175         has not been finalized.
7176         (version_script_push_lang): Change language string to
7177         Version_script_info::Language.
7178         * options.cc (Command_line::version_script): New function.
7179         * options.h (class General_options): Add finalize_dynamic_list
7180         function.  Change version_script from declaration to definition.
7181         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7182         * testsuite/version_script.map: Remove duplicate def of foo.
7183         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7184         version_script.map.
7185         * testsuite/Makefile.in: Rebuild.
7186
7187 2009-12-30  Ian Lance Taylor  <iant@google.com>
7188
7189         PR 10843
7190         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7191         if the input symbol index is 0, make the output symbol index 0.
7192
7193 2009-12-30  Ian Lance Taylor  <iant@google.com>
7194
7195         PR 10670
7196         * options.h (class General_options): Add -x/--discard-all.
7197         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7198         --discard-all.  If the local symbol needs a dynamic entry, check
7199         that before handling --discard-locals.
7200
7201 2009-12-30  Ian Lance Taylor  <iant@google.com>
7202
7203         PR 10450
7204         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7205         flags to PF_R.
7206         (Output_segment::add_output_section): Don't change the flags if
7207         the type is PT_TLS.
7208
7209         PR 10450
7210         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7211         GNU hash table if they need a dynamic value.  Otherwise, don't add
7212         them if they are defined in a dynamic object or are forced local.
7213
7214 2009-12-29  Ian Lance Taylor  <iant@google.com>
7215
7216         PR 10450
7217         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7218         .gnu.hash table for a 32-bit target.
7219
7220         PR 10450
7221         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7222         regular and a dynamic object only needs a dynamic symbol table
7223         entry if it is externally visible.
7224
7225         PR 10450
7226         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7227         constructor.  Add global_offset_table_ field.
7228         (Target_i386::got_section): Set global_offset_table_.
7229         (Target_i386::do_finalize_sections): Set global_offset_table_
7230         size.
7231         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7232         in constructor.  Add global_offset_table_ field.
7233         (Target_x86_64::got_section): Set global_offset_table_.
7234         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7235         size.
7236
7237         * layout.cc (Layout::Layout): Initialize increase_relro_.
7238         (Layout::get_output_section): Add is_relro, is_last_relro, and
7239         is_first_non_relro parameters.  Change all callers.
7240         (Layout::choose_output_section): Likewise.
7241         (Layout::add_output_section_data): Likewise.
7242         (Layout::make_output_section): Likewise.
7243         (Layout::set_segment_offsets): Clear increase_relro when using a
7244         linker script.
7245         * layout.h (class Layout): Add increase_relro method.  Add
7246         increase_relro_ field.  Update declarations.
7247         * output.cc (Output_section::Output_section): Initialize
7248         is_last_relro_ and is_first_non_relro_.
7249         (Output_segment::add_output_section): Group relro sections is
7250         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7251         (Output_segment::maximum_alignment): Remove relro handling.
7252         (Output_segment::set_section_addresses): Add increase_relro
7253         parameter.  Change all callers.  Add initial alignment to align
7254         relro sections on separate page.  Remove old relro handling.
7255         (Output_segment::set_section_list_addresses): Remove in_relro
7256         parameter.  Change all callers.
7257         (Output_segment::set_offset): Add increase parameter.  Change all
7258         callers.  Remove old relro handling.
7259         * output.h (class Output_section): Add new methods: is_last_relro,
7260         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7261         Add is_last_relro_ and is_first_non_relro_ fields.
7262         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7263         Create separate .got.plt section.  Call increase_relro.
7264         * x86_64.cc (Target_x86_64::got_section): Likewise.
7265         * testsuite/relro_script_test.t: Add .got.plt.
7266
7267         PR 10450
7268         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7269         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7270         (Layout::finalize): Call set_dynamic_symbol_size.
7271         (Layout::set_dynamic_symbol_size): New function.
7272         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7273         set_dynamic_symbol_size.
7274
7275         PR 10450
7276         * output.h (class Output_section): Add is_entsize_zero_ field.
7277         * output.cc (Output_section::Output_section): Initialize
7278         is_entsize_zero_.
7279         (Output_section::set_entsize): If two different entsizes are
7280         requested, force it to zero.
7281         (Output_section::add_input_section): Set flags for .debug_str
7282         before updating section flags.  Set entsize.
7283         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7284         and SHF_STRING if all input sections have those flags.
7285
7286 2009-12-29   Rafael Espindola  <espindola@google.com>
7287
7288         * main.cc (main): Fix the sys time reporting.
7289         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7290         reporting.
7291
7292 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7293
7294         * options.cc (General_options::parse_version): Allow -v to exit
7295         without an error if there is nothing to link.
7296
7297 2009-12-29  Ian Lance Taylor  <iant@google.com>
7298
7299         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7300         using a version of gcc before 4.1.
7301         * configure: Rebuild.
7302
7303 2009-12-28  Chris Demetriou  <cgd@google.com>
7304
7305         * attributes.cc (Output_attributes_section_data::do_write): Use
7306         std::vector::front rather than std::vector::data.
7307
7308 2009-12-28  Ian Lance Taylor  <iant@google.com>
7309
7310         * symtab.h (class Symbol_table): Add enum Defined.
7311         * resolve.cc (Symbol_table::should_override): Add defined
7312         parameter.  Change all callers.  Test whether object is NULL
7313         before calling a method on it.
7314         (Symbol_table::report_resolve_problem): Add defined parameter.
7315         Change all callers.
7316         (Symbol_table::should_override_with_special): Likewise.
7317         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7318         parameter.  Change all callers.
7319         (Symbol_table::do_define_in_output_data): Likewise.
7320         (Symbol_table::define_in_output_segment): Likewise.
7321         (Symbol_table::do_define_in_output_segment): Likewise.
7322         (Symbol_table::define_as_constant): Likewise.
7323         (Symbol_table::do_define_as_constant): Likewise.
7324         * script.h (class Symbol_assignment): Add is_defsym parameter to
7325         constructor; change all callers.
7326         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7327         parameter.  Change all callers.  Add is_defsym_ field.
7328         (class Parser_closure): Add parsing_defsym parameter to
7329         constructor; change all callers.  Add parsing_defsym accessor
7330         function.  Add parsing_defsym_ field.
7331
7332 2009-12-28  Ian Lance Taylor  <iant@google.com>
7333
7334         * gold.cc (queue_middle_tasks): Fix formatting.
7335         * object.cc (Relobj::is_section_name_included): Likewise.
7336
7337 2009-12-23  Ian Lance Taylor  <iant@google.com>
7338
7339         * i386.cc (Target_i386::do_calls_non_split): Recognize
7340         -fsplit-stack prologue for a function with a static chain.
7341         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7342         -fsplit-stack prologue when using %r11.
7343
7344 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7345
7346         * options.cc (General_options::parse_version): Make -v continue and do
7347         the link like GNU ld does.
7348
7349 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7350
7351         * Makefile.am (CCFILES): Add timer.cc.
7352         (HFILES): Add timer.h.
7353         * configure.ac: Check for sysconf and times.
7354         * main.cc: include timer.h.
7355         (main): Use Timer instead of get_run_time.
7356         * timer.cc: New.
7357         * timer.h: New.
7358         * workqueue.cc: include timer.h.
7359         (Workqueue::find_and_run_task):
7360         Report user, sys and wall time.
7361         * Makefile.in: Regenerate.
7362         * config.in: Regenerate.
7363         * configure: Regenerate.
7364
7365 2009-12-16  Doug Kwan  <dougkwan@google.com>
7366
7367         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7368         sections.
7369         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7370         relaxed input sections.
7371         * output.cc (Output_section::find_relaxed_input_section): Change
7372         return type to Output_relaxed_input_section pointer.  Adjust code
7373         for new type of relaxed_input_section_map_.
7374         * output.h (Output_section::find_relaxed_input_section): Change
7375         return type to Output_relaxed_input_section pointer.
7376         (Output_section::Output_relaxed_input_section_by_input_section_map):
7377         New type.
7378         (Output_section::relaxed_input_section_map_): Change type to
7379         Output_section::Output_relaxed_input_section_by_input_section_map.
7380         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7381         input section.
7382
7383 2009-12-15  Ian Lance Taylor  <iant@google.com>
7384
7385         * layout.cc (Layout::create_shstrtab): Only write out after input
7386         sections if we are compressing debug sections.
7387
7388 2009-12-15  Ian Lance Taylor  <iant@google.com>
7389
7390         * archive.cc (Archive::add_symbols): Only look up a symbol without
7391         a version if there is, in fact, a version.
7392
7393 2009-12-14  Ian Lance Taylor  <iant@google.com>
7394
7395         Revert -Wshadow changes, all changes from:
7396         2009-12-11  Doug Kwan  <dougkwan@google.com>
7397         2009-12-11  Nick Clifton  <nickc@redhat.com>
7398         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7399
7400 2009-12-11  Doug Kwan  <dougkwan@google.com>
7401
7402         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7403         due to -Wshadow.
7404         * attributes.cc (Object_attribute::size): Ditto.
7405         (Attributes_section_data::size): Ditto.
7406         (Attributes_section_data::Attributes_section_data): Ditto.
7407         (Output_attributes_section_data::do_write): Ditto.
7408         * attributes.h (Object_attribute::set_type): Ditto.
7409         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7410
7411 2009-12-11  Nick Clifton  <nickc@redhat.com>
7412
7413         * archive.cc: Fix shadowed variable warnings.
7414         * arm.cc: Likewise.
7415         * compressed_output.cc: Likewise.
7416         * compressed_output.h: Likewise.
7417         * configure: Likewise.
7418         * dwarf_reader.cc: Likewise.
7419         * dynobj.cc: Likewise.
7420         * dynobj.h: Likewise.
7421         * ehframe.cc: Likewise.
7422         * ehframe.h: Likewise.
7423         * errors.cc: Likewise.
7424         * expression.cc: Likewise.
7425         * fileread.cc: Likewise.
7426         * fileread.h: Likewise.
7427         * freebsd.h: Likewise.
7428         * i386.cc: Likewise.
7429         * icf.cc: Likewise.
7430         * incremental.h: Likewise.
7431         * layout.cc: Likewise.
7432         * layout.h: Likewise.
7433         * mapfile.cc: Likewise.
7434         * merge.cc: Likewise.
7435         * merge.h: Likewise.
7436         * object.cc: Likewise.
7437         * object.h: Likewise.
7438         * options.h: Likewise.
7439         * output.cc: Likewise.
7440         * output.h: Likewise.
7441         * parameters.cc: Likewise.
7442         * plugin.cc: Likewise.
7443         * powerpc.cc: Likewise.
7444         * reduced_debug_output.cc: Likewise.
7445         * reduced_debug_output.h: Likewise.
7446         * reloc.cc: Likewise.
7447         * reloc.h: Likewise.
7448         * resolve.cc: Likewise.
7449         * script-sections.cc: Likewise.
7450         * script.cc: Likewise.
7451         * script.h: Likewise.
7452         * sparc.cc: Likewise.
7453         * symtab.cc: Likewise.
7454         * symtab.h: Likewise.
7455         * target-select.cc: Likewise.
7456         * target-select.h: Likewise.
7457         * token.h: Likewise.
7458         * workqueue.cc: Likewise.
7459         * workqueue.h: Likewise.
7460         * x86_64.cc: Likewise.
7461
7462 2009-12-10  Doug Kwan  <dougkwan@google.com>
7463
7464         * arm.cc (attributes.h): New include.
7465         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7466         (Arm_relobj::~Arm_relobj): Delete object pointed by
7467         attributes_section_data_.
7468         (Arm_relobj::attributes_section_data): New method definition.
7469         (Arm_relobj::attributes_section_data_): New data member declaration.
7470         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7471         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7472         attributes_section_data_.
7473         (Arm_dynobj::attributes_section_data): New method definition.
7474         (Arm_dynobj::attributes_section_data_): New data member declaration.
7475         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7476         initialization value of may_use_blx_ to false.
7477         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7478         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7479         object attributes to compute results instead of hard-coding.
7480         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7481         Target_arm::get_secondary_compatible_arch,
7482         Target_arm::set_secondary_compatible_arch
7483         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7484         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7485         New method declarations.
7486         (Target_arm::get_aeabi_object_attribute): New method definition.
7487         (Target_arm::attributes_section_data_): New data member declaration.
7488         (read_arm_attributes_section): New template definition.
7489         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7490         (Arm_dynobj::do_read_symbols): Ditto.
7491         (Target_arm::do_finalize_sections): Merge attributes sections from
7492         input.  Check for BLX use after attributes section merging.
7493         Fix __exidx_start and __exidx_end visibility.  Create an
7494         .ARM.attributes section if necessary.
7495         (Target_arm::get_secondary_compatible_arch,
7496         Target_arm::set_secondary_compatible_arch,
7497         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7498         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7499         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7500         New method definitions.
7501
7502 2009-12-09  Ian Lance Taylor  <iant@google.com>
7503
7504         * plugin.cc (Plugin::load): Don't cast from void* to a function
7505         pointer.
7506
7507 2009-12-09  Ian Lance Taylor  <iant@google.com>
7508
7509         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7510         information fields.
7511
7512 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7513
7514         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7515         Replace two_file_shared_1.so with two_file_shared_2.so.
7516         * testsuite/Makefile.in: Regenerated.
7517
7518 2009-12-08  Doug Kwan  <dougkwan@google.com>
7519
7520         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7521         (HFILES): Add attributes.h and int_encoding.h.
7522         * Makefile.in: Regenerate.
7523         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7524         function definitions to int_encoding.cc
7525         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7526         prototypes to int_encoding.h
7527         * reduced_debug_output.cc (int_encoding.h): New include.
7528         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7529         function definitions to int_encoding.cc
7530         (insert_into_vector, read_from_pointer): Move template definitions to
7531         int_encoding.h
7532         * attributes.cc: New file.
7533         * attributes.h: New file.
7534         * int_encoding.cc: New file.
7535         * int_encoding.h: New file.
7536
7537 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7538
7539         PR gold/11055
7540         * incremental-dump.cc (dump_incremental_inputs): New.
7541         (main): Use dump_incremental_inputs.
7542
7543 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7544
7545         PR gold/10893
7546         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7547         checking elfcpp::STT_FUNC.
7548         (Target_i386::Relocate::relocate): Likewise.
7549         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7550
7551         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7552         symbols from shared libraries into normal FUNC symbols.
7553
7554         * symtab.h (Symbol): Add is_func and use it.
7555
7556 2009-12-05  Doug Kwan  <dougkwan@google.com>
7557
7558         * arm.cc (Target_arm::arm_info): Initialize new fields
7559         attributes_section and attributes_vendor.
7560         * i386.cc (Target_i386::i386_info): Same.
7561         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7562         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7563         fields attributes_section and attributes_vendor.
7564         * sparc.cc (Target_sparc::sparc_info): Same.
7565         * target.h (Target::attributes_section, Target::attributes_vendor,
7566         Target::is_attributes_section, Target::attribute_arg_type,
7567         Target::attributes_order): New method definitions.
7568         (Target::Target_info::attributes_section,
7569         Target::Target_info::attributes_vendor): New fields.
7570         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7571         virtual method definitions.
7572         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7573         attributes_section and attributes_vendor.
7574         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7575
7576 2009-12-05  Doug Kwan  <dougkwan@google.com>
7577
7578         * arm.cc: Update comments about interworking and stub generation.
7579         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7580         considered as non-PIC.
7581         (Arm_relocate_functions::base_abs): Fix formatting.
7582         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7583         of function to use GOT entry address instead of offset.
7584         (Target_arm::Scan::global): Issue an error if a symbol would need a
7585         PLT does not get one because it is untyped.  Remove code to create
7586         dynamic symbols for relative branches.
7587         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7588         takes unsigned integer instead of boolean.
7589
7590 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7591
7592         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7593         (two_file_test_LDADD): Likewise.
7594         (common_test_1_LDADD): Likewise.
7595         (exception_test_LDADD) Likewise.
7596         (weak_test_LDADD): Likewise.
7597         (many_sections_test_LDADD): Likewise.
7598         (initpri1_LDADD): Likewise.
7599         (script_test_1_LDADD): Likewise.
7600         (script_test_2_LDADD): Likewise.
7601         (justsyms_LDADD): Likewise.
7602         (binary_test_LDADD): Likewise.
7603         (large_LDADD): Likewise.
7604         * testsuite/Makefile.in: Regenerated.
7605
7606 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7607
7608         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7609         (Symbol_table::override_with_special): Likewise.
7610         (Symbol_table::add_from_object): Likewise.
7611
7612 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7613
7614         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7615         Don't set the data_offset twice.
7616
7617 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7618
7619         * testsuite/Makefile.in: Regenerate.
7620
7621 2009-12-03  Doug Kwan  <dougkwan@google.com>
7622
7623         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7624         (Target_arm::do_finalize_sections): Add parameter for symbol table
7625         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7626         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7627         parameter for symbol table pointer.
7628         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7629         an additional parameter for a pointer to symbol table.
7630         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7631         parameter for a symbol table pointer.
7632         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7633         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7634         Ditto.
7635         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7636         parameter for a symbol table pointer.
7637
7638 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7639
7640         * incremental.cc (Incremental_inputs_header)
7641         (Incremental_inputs_header_write, Incremental_inputs_entry)
7642         (Incremental_inputs_entry_write): Move ...
7643         * incremental.h (Incremental_inputs_header)
7644         (Incremental_inputs_header_write, Incremental_inputs_entry)
7645         (Incremental_inputs_entry_write): here.
7646
7647 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7648
7649         * incremental.cc (make_sized_incremental_binary): Set the target.
7650         Error if it is incompatible.
7651         * output.h (Output_file): Add filename method.
7652
7653 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7654
7655         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7656         from the get_* methods.
7657
7658 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7659
7660         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7661         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7662         Write 0 for the data_offset of scripts.
7663
7664 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7665
7666         * testsuite/Makefile.am: Add the incremental_test.sh test.
7667         * testsuite/incremental_test.sh: New.
7668         * testsuite/incremental_test_1.c: New.
7669         * testsuite/incremental_test_2.c: New.
7670
7671 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7672
7673        * incremental-dump.cc (main): Fix typos.
7674
7675 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7676
7677         PR gold/11025
7678         * incremental-dump.cc (main): Use llu to print 64 bit values.
7679
7680 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7681             H.J. Lu  <hongjiu.lu@intel.com>
7682
7683         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7684         $(LIBDL).
7685         (incremental_dump_LDADD): Likewise.
7686         * Makefile.in: Regenerated.
7687
7688 2009-11-25  Doug Kwan  <dougkwan@google.com>
7689
7690         Revert:
7691
7692         2009-11-25  Doug Kwan  <dougkwan@google.com>
7693
7694                 * arm.cc (Target_arm::Target_arm): Move method definition
7695                 outside of class definition.  Add code to handle
7696                 --target1-rel, --target1-abs and --target2= options.
7697                 (Target_arm::get_reloc_reloc_type): Change method to be
7698                 non-static and const.
7699                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7700                 New data member declaration.
7701                 (Target_arm::Scan::local, Target_arm::Scan::global,
7702                 Target_arm::Relocate::relocate,
7703                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7704                 Adjust call to Target_arm::get_real_reloc_type.
7705                 (Target_arm::get_real_reloc_type): Use command line options
7706                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7707                 * options.h (--target1-rel, --target1-abs, --target2): New
7708                 ARM-only options.
7709
7710 2009-11-25  Doug Kwan  <dougkwan@google.com>
7711
7712         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7713         class definition.  Add code to handle --target1-rel, --target1-abs
7714         and --target2= options.
7715         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7716         and const.
7717         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7718         member declaration.
7719         (Target_arm::Scan::local, Target_arm::Scan::global,
7720         Target_arm::Relocate::relocate,
7721         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7722         call to Target_arm::get_real_reloc_type.
7723         (Target_arm::get_real_reloc_type): Use command line options to
7724         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7725         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7726         options.
7727
7728 2009-11-25  Doug Kwan  <dougkwan@google.com>
7729
7730         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7731         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7732         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7733         formatting.
7734         (Arm_relocate_functions::thm_call): Replace body with a call to
7735         Arm_relocate_functions::thumb_branch_common.
7736         (Arm_relocate_functions::thm_jump24,
7737         Arm_relocate_functions::thm_xpc22): New method definitions.
7738         (Arm_relocate_functions::thumb_branch_common): New method definition.
7739         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7740         operator.
7741         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7742         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7743
7744 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7745
7746         * Makefile.am: Build incremental-dump
7747         * Makefile.in: Regenerate.
7748         * incremental-dump.cc: New.
7749         * incremental.cc (Incremental_inputs_header_data,
7750         Incremental_inputs_entry_data): Move to incremental.h
7751         * incremental.h: (Incremental_inputs_header_data,
7752         Incremental_inputs_entry_data): Move from incremental.cc
7753
7754 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7755
7756         * incremental.cc (Incremental_inputs_header,
7757         Incremental_inputs_header_write, Incremental_inputs_entry,
7758         Incremental_inputs_entry_write): Add a typedef with the data type.
7759
7760 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7761
7762         * incremental.cc (Incremental_inputs_header,
7763         Incremental_inputs_header_write, Incremental_inputs_entry,
7764         Incremental_inputs_entry_write): Update comment about which
7765         type has the filed descriptions.
7766
7767 2009-11-15  Doug Kwan  <dougkwan@google.com>
7768
7769         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7770         (Arm_relocate_functions::arm_branch_common): Change method defintion
7771         in class definition to a method declaration and update list of formal
7772         parameters.
7773         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7774         Arm_relocation_functions::jump24): Adjust call to
7775         Arm_relocate_functions::arm_branch_common.  Update list of formal
7776         parameters.
7777         (Arm_relocate_functions::xpc25): New method definition.
7778         (Arm_relocate_functions::arm_branch_common): Move method defintion
7779         out from class definition.  Use stubs for mode-switching and extending
7780         branch ranges.
7781         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7782         specially.  Change code to enable use of stubs in ARM branches.
7783
7784 2009-11-10  Doug Kwan  <dougkwan@google.com>
7785
7786         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7787         in method declaration.
7788         (Target_arm::relocate_stub): New method declaration.
7789         (Target_arm::default_target): Change to return a pointer instead of
7790         a const reference.
7791         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7792         Target_arm::default_target.
7793         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7794         method definition.
7795         (Target_arm::relocate_section): Adjust view.
7796         (Target_arm::relocate_stub): New method definition.
7797
7798 2009-11-10  Doug Kwan  <dougkwan@google.com>
7799
7800         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7801         a format warning.
7802         * incremental.cc (open_incremental_binary): Initialized local
7803         variables to avoid warnings.
7804         * object.cc (make_elf_object): Ditto.
7805         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7806         a format warning.
7807
7808 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7809
7810         PR gold/10930
7811         * testsuite/plugin_test.c: Include "config.h".
7812
7813 2009-11-09  Doug Kwan  <dougkwan@google.com>
7814
7815         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7816         (arm_symbol_value): Remove.
7817         (Arm_relocate_functions::arm_branch_common,
7818         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7819         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7820         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7821         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7822         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7823         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7824         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7825         Arm_relocate_functions::thm_mobw_abs_nc,
7826         Arm_relocate_functions::thm_mov_abs,
7827         Arm_relocate_functions::movw_prel_nc,
7828         Arm_relocate_functions::thm_movt_abs,
7829         Arm_relocate_functions::movt_prel,
7830         Arm_relocate_functions::thm_movw_prel_nc,
7831         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7832         (Target_arm::Relocate::relocate): Only decompose address into two
7833         parts if relocation type uses the thumb-bit and pass the actual
7834         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7835         calls to methods in Arm_relocate_functions for this change.
7836
7837 2009-11-08  Ian Lance Taylor  <iant@google.com>
7838
7839         PR 10925
7840         * reloc.cc: Instantiate
7841         Sized_relobj::initialize_input_to_output_maps and
7842         Sized_relobj:free_input_to_output_maps.
7843
7844 2009-11-06  Ian Lance Taylor  <iant@google.com>
7845
7846         PR 10876
7847         * defstd.cc (in_segment): Set only_if_ref true for "end".
7848
7849 2009-11-06  Doug Kwan  <dougkwan@google.com>
7850
7851         * arm.cc (class Reloc_stub): Correct a comment.
7852         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7853         (Target_arm::scan_section_for_stubs): New method declaration.
7854         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7855         Change methods from private to protected.
7856         (Target_arm::do_may_relax): New method definition.
7857         (Target_arm::do_relax, Target_arm::group_sections,
7858         Target_arm::scan_reloc_for_stub,
7859         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7860         (Target_arm::arm_input_section_map_): New data member declaration.
7861         (Target_arm::scan_reloc_for_stub,
7862         Target_arm::scan_reloc_section_for_stubs,
7863         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7864         Target_arm::do_relax): New method definitions.
7865
7866 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7867
7868         * configure.ac: Check for (struct stat)::st_mtim
7869         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7870         * config.in: Regenerate.
7871         * configure: Regenerate.
7872
7873 2009-11-05  Ian Lance Taylor  <iant@google.com>
7874
7875         PR 10910
7876         * output.cc (Output_segment::add_output_section): Add missing
7877         return statement.
7878
7879 2009-11-04  Ian Lance Taylor  <iant@google.com>
7880
7881         PR 10880
7882         * object.h (class Object): Add is_needed and set_is_needed
7883         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7884         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7885         defined in a dynamic object and referenced by a regular object,
7886         set is_needed for the dynamic object.
7887         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7888         if the file is marked with as_needed and it is not needed.
7889
7890 2009-11-04  Ian Lance Taylor  <iant@google.com>
7891
7892         PR 10887
7893         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7894         tags if data is discarded by linker script.
7895         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7896         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7897         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7898         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7899
7900 2009-11-04  Ian Lance Taylor  <iant@google.com>
7901
7902         * layout.cc (Layout::get_output_section): Add is_interp and
7903         is_dynamic_linker_section parameters.  Change all callers.
7904         (Layout::choose_output_section): Likewise.
7905         (Layout::make_output_section): Likewise.
7906         (Layout::add_output_section_data): Add is_dynamic_linker_section
7907         parameter.  Change all callers.
7908         * layout.h (class Layout): Update declarations.
7909         * output.h (class Output_section): Add is_interp, set_is_interp,
7910         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7911         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7912         generate_code_fills_at_write_ to a bitfield.
7913         * output.cc (Output_section::Output_sections): Initialize new
7914         fields.
7915         (Output_segment::add_output_section): Add do_sort parameter.
7916         Change all callers.
7917
7918 2009-11-03  Ian Lance Taylor  <iant@google.com>
7919
7920         PR 10860
7921         * options.h (class General_options): Add --warn-common.
7922         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7923         merging two common symbols.
7924         (Symbol_table::should_override): Handle --warn-common when merging
7925         a common symbol with a defined symbol.  Use report_resolve_problem
7926         for multiple definitions.
7927         (Symbol_table::report_resolve_problem): New function.
7928         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7929
7930 2009-11-03  Doug Kwan  <dougkwan@google.com>
7931
7932         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7933         stub_factory_.
7934         (Target_arm::stub_factory): New method definition.
7935         (Target_arm::new_arm_input_section,
7936         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7937         Target_arm::reloc_uses_thumb_bit): New method declarations.
7938         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7939         New type definitions.
7940         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7941         member declarations.
7942         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7943         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7944         New method definitions.
7945
7946 2009-11-03  Ian Lance Taylor  <iant@google.com>
7947
7948         * options.h (class General_options): Add --warn_constructors.
7949
7950 2009-11-03  Ian Lance Taylor  <iant@google.com>
7951
7952         PR 10893
7953         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7954         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7955
7956 2009-11-03  Ian Lance Taylor  <iant@google.com>
7957
7958         PR 10895
7959         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7960         --msgid-bugs-address.
7961         (install-pdf): New target.
7962         (install-data_yes): Look up one directory to find mkinstalldirs.
7963
7964 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7965
7966         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7967         tree.
7968
7969 2009-10-30  Doug Kwan  <dougkwan@google.com>
7970
7971         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7972
7973 2009-10-30  Doug Kwan  <dougkwan@google.com>
7974
7975         * arm.cc (Stub_addend_reader): New struct template definition
7976         and partial specializations.
7977         (Stub_addend_reader::operator()): New method definition for a
7978         partially specialized template.
7979
7980 2009-10-30  Doug Kwan  <dougkwan@google.com>
7981
7982         * arm.cc (Arm_relobj::processor_specific_flags): New method
7983         definition.
7984         (Arm_relobj::do_read_symbols): New method declaration.
7985         (Arm_relobj::processor_specific_flags_): New data member declaration.
7986         (Arm_dynobj): New class definition.
7987         (Target_arm::do_finalize_sections): Add input_objects parameter.
7988         (Target_arm::do_adjust_elf_header): New method declaration.
7989         (Target_arm::are_eabi_versions_compatible,
7990         (Target_arm::merge_processor_specific_flags): New method declaration.
7991         (Target_arm::do_make_elf_object): New overloaded method definitions
7992         and declaration.
7993         (Arm_relobj::do_read_symbols): New method definition.
7994         (Arm_dynobj::do_read_symbols): Ditto.
7995         (Target_arm::do_finalize_sections): Add input_objects parameters.
7996         Merge processor-specific flags from all input objects.
7997         (Target_arm::are_eabi_versions_compatible,
7998         Target_arm::merge_processor_specific_flags,
7999         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8000         New method definitions.
8001         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8002         Input_objects pointer type parameter.
8003         * layout.cc (Layout::finalize): Pass input objects to target's.
8004         finalize_sections function.
8005         * output.cc (Output_file_header::do_sized_write): Set ELF file
8006         header's processor-specific flags.
8007         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8008         Input_objects pointer type parameter.
8009         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8010         * target.h (Input_objects): New forward class declaration.
8011         (Target::processor_specific_flags,
8012         Target::are_processor_specific_flags_sect): New method definitions.
8013         (Target::finalize_sections): Add input_objects parameter.
8014         (Target::Target): Initialize processor_specific_flags_ and
8015         are_processor_specific_flags_set_.
8016         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8017         parameter.
8018         (Target::set_processor_specific_flags): New method definition.
8019         (Target::processor_specific_flags_,
8020         Target::are_processor_specific_flags_set_): New data member
8021         declarations.
8022         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8023         Input_objects pointer type parameter.
8024
8025 2009-10-30  Doug Kwan  <dougkwan@google.com>
8026
8027         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8028
8029 2009-10-28  Ian Lance Taylor  <iant@google.com>
8030
8031         * object.h (class Relobj): Drop options parameter from
8032         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8033         do_scan_relocs, do_relocate.  Change all callers.
8034         (class Sized_relobj): Drop options parameters from
8035         do_gc_process_relocs, do_scan_relocs, do_relocate,
8036         do_relocate_sections, relocate_sections, emit_relocs_scan,
8037         emit_relocs_scan_reltype.  Change all callers.
8038         (struct Relocate_info): Remove options field and all references to
8039         it.
8040         * reloc.h (class Read_relocs): Remove options constructor
8041         parameter and options_ field.  Change all callers.
8042         (class Gc_process_relocs, class Scan_relocs): Likewise.
8043         (class Relocate_task): Likewise.
8044         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8045         all callers.
8046         (scan_relocatable_relocs): Likewise.
8047         * target.h (class Sized_target): Remove options parameter from
8048         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8049         all callers.
8050         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8051         callers.
8052         * arm.cc: Update functions to remove options parameters.
8053         * i386.cc: Likewise.
8054         * powerpc.cc: Likewise.
8055         * sparc.cc: Likewise.
8056         * x86_64.cc: Likewise.
8057         * testsuite/testfile.cc: Likewise.
8058
8059 2009-10-28  Doug Kwan  <dougkwan@google.com>
8060
8061         * arm.cc (Arm_relobj): New class definition.
8062         (Arm_relobj::scan_sections_for_stubs,
8063         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8064         New method definitions.
8065
8066 2009-10-28  Cary Coutant  <ccoutant@google.com>
8067
8068         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8069         (Plugin::cleanup_done_): New member.
8070         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8071         (Plugin_manager::cleanup_done_): Remove.
8072         (Plugin_manager::add_input_file): Edit error message.
8073         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8074         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8075
8076 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8077
8078         * fileread.cc: (File_read::View::~View): Use the new
8079         data_ownership_ filed.
8080         (File_read::~File_read): Dispose the new whole_file_view_.
8081         (File_read::open): Mmap the whole file if needed.
8082         (File_read::open): Use whole_file_view_ instead of contents_.
8083         (File_read::find_view): Use whole_file_view_ if applicable.
8084         (File_read::do_read): Use whole_file_view_ instead of contents_.
8085         (File_read::make_view): Use whole_file_view_ instead of contents_,
8086         update File_read::View::View call.
8087         (File_read::find_or_make_view): Update File_read::View::View
8088         call.
8089         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8090         remove contents_
8091         (File_read::View::Data_ownership): New enum.
8092         (File_read::View::View): Replace bool mapped_ with Data_ownership
8093         argument.
8094         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8095         (File_read::View::data_ownership_): New field.
8096         (File_read::contents_): Remove (replaced by whole_file_view_).
8097         (File_read::whole_file_view_): New field.
8098         * options.h (class General_options): Add --keep-files-mapped.
8099
8100 2009-10-27  Cary Coutant  <ccoutant@google.com>
8101
8102         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8103         * testsuite/Makefile.am (plugin_test_5): New test case.
8104         * testsuite/Makefile.in: Regenerate.
8105
8106 2009-10-25  Doug Kwan  <dougkwan@google.com>
8107
8108         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8109         from private to protected to allow access by child class.
8110         (Sized_relobj::do_relocate_sections): New method declaration.
8111         (Sized_relobj::relocate_sections): Virtualize.
8112         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8113         Sized_relobj::relocate_sections.  Instantiate template explicitly
8114         for different target sizes and endianity.
8115
8116 2009-10-24  Doug Kwan  <dougkwan@google.com>
8117
8118         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8119         (Arm_input_section::as_arm_input_section): New method.
8120         (Arm_output_section): New class definition.
8121         (Arm_output_section::create_stub_group,
8122         Arm_output_section::group_sections): New method definitions.
8123
8124 2009-10-22  Doug Kwan  <dougkwan@google.com>
8125
8126         * arm.cc (Arm_input_section): New class definition.
8127         (Arm_input_section::init, Arm_input_section:do_write,
8128         Arm_input_section::set_final_data_size,
8129         Arm_input_section::do_reset_address_and_file_offset): New method
8130         definitions.
8131
8132 2009-10-21  Doug Kwan  <dougkwan@google.com>
8133
8134         * arm.cc (Stub_table, Arm_input_section): New forward class
8135         declarations.
8136         (Stub_table): New class defintion.
8137         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8138         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8139         New method definition.
8140
8141 2009-10-21  Doug Kwan  <dougkwan@google.com>
8142
8143         * arm.cc: Update copyright comments.
8144         (Target_arm): New forward class template declaration.
8145         (Arm_address): New type.
8146         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8147         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8148         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8149         constants.
8150         (Insn_template): Same.
8151         (DEF_STUBS): New macro.
8152         (Stub_type): New enum type.
8153         (Stub_template): New class definition.
8154         (Stub): Same.
8155         (Reloc_stub): Same.
8156         (Stub_factory): Same.
8157         (Target_arm::Target_arm): Initialize may_use_blx_ and
8158         should_force_pic_veneer_.
8159         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8160         Target_arm::should_force_pic_veneer,
8161         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8162         Target_arm::using_thumb_only, Target_arm:;default_target): New
8163         method defintions.
8164         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8165         New data member declarations.
8166         (Insn_template::size, Insn_template::alignment): New method defintions.
8167         (Stub_template::Stub_template): New method definition.
8168         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8169         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8170         (Stub_factory::Stub_factory): New method definition.
8171         * gold.h (string_hash): New template.
8172         * output.h (Input_section_specifier::hash_value): Use
8173         gold::string_hash.
8174         (Input_section_specifier::string_hash): Remove.
8175         * stringpool.cc (Stringpool_template::string_hash): Use
8176         gold::string_hash.
8177
8178 2009-10-20  Doug Kwan  <dougkwan@google.com>
8179
8180         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8181         symbols of relaxed input sections.
8182         * output.h (Output_section::find_relaxed_input_section): Make
8183         method public.
8184
8185 2009-10-16  Doug Kwan  <dougkwan@google.com>
8186
8187         * dynobj.cc (Versions::Versions): Initialize version_script_.
8188         Only insert base version symbol definition for a shared object
8189         if version script defines any version versions.
8190         (Versions::define_base_version): New method definition.
8191         (Versions::add_def): Check that base version is not needed.
8192         (Versions::add_need): Define base version lazily.
8193         * dynobj.h (Versions::define_base_version): New method declaration.
8194         (Versions::needs_base_version_): New data member declaration.
8195         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8196         (check_DATA): Add no_version_test.stdout.
8197         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8198         New make rules.
8199         * testsuite/Makefile.in: Regenerate.
8200         * testsuite/no_version_test.c: New file.
8201         * testsuite/no_version_test.sh: Ditto.
8202
8203 2009-10-16  Doug Kwan  <dougkwan@google.com>
8204
8205         * expression.cc (class Segment_start_expression): New class definition.
8206         (Segment_start_expression::value): New method definition.
8207         (script_exp_function_segment_start): Return a new
8208         Segment_start_expression.
8209         * gold/script-c.h (script_saw_segment_start_expression): New function
8210         prototype.
8211         * script-sections.cc (Script_sections::Script_sections): Initialize
8212         SAW_SEGMENT_START_EXPRESSION_ to false.
8213         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8214         and -Tbbs options to specify section addresses if given in
8215         command line and no SEGMENT_START expression is seen in a script.
8216         * script-sections.h (Script_sections::saw_segment_start_expression,
8217         Script_sections::set_saw_segment_start_expression): New method
8218         definition.
8219         (Script_sections::saw_segment_start_expression_): New data member
8220         declaration.
8221         * script.cc (script_saw_segment_start_expression): New function.
8222         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8223         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8224         script_test_7.sh and script_test_8.sh.
8225         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8226         script_test_8.stdout.
8227         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8228         (script_test_6, script_test_6.stdout, script_test_7,
8229         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8230         * Makefile.in: Regenerate.
8231         * testsuite/script_test_6.sh: New file.
8232         * testsuite/script_test_6.t: Same.
8233         * testsuite/script_test_7.sh: Same.
8234         * testsuite/script_test_7.t: Same.
8235         * testsuite/script_test_8.sh: Same.
8236
8237 2009-10-16  Doug Kwan  <dougkwan@google.com>
8238
8239         * output.cc (Output_segment::set_section_list_address): Cast
8240         expressions to unsigned long long type to avoid format warnings.
8241
8242 2009-10-15  Ian Lance Taylor  <iant@google.com>
8243
8244         * script.cc (Script_options::add_symbol_assignment): Always add a
8245         dot assignment to script_sections_.
8246         * script-sections.cc (Script_sections::add_dot_assignment):
8247         Initialize if necessary.
8248
8249         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8250         program headers with no load segment if there is a linker script.
8251
8252         * layout.cc (Layout::set_segment_offsets): Align the file offset
8253         to the segment aligment for -N or -n with no load segment.
8254         * output.cc (Output_segment::add_output_section): Don't crash if
8255         the first section is a TLS section.
8256         (Output_segment::set_section_list_addresses): Print an error
8257         message if the address moves backward in a linker script.
8258         * script-sections.cc
8259         (Output_section_element_input::set_section_addresses): Don't
8260         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8261         (Orphan_output_section::set_section_addresses): Likewise.
8262
8263 2009-10-15  Doug Kwan  <dougkwan@google.com>
8264
8265         * layout.cc (Layout::finish_dynamic_section): Generate tags
8266         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8267         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8268         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8269
8270 2009-10-14  Ian Lance Taylor  <iant@google.com>
8271
8272         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8273         fields.
8274         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8275         data_shdr fields of relinfo.
8276         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8277         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8278         R_386_TLS_LDO_32, adjust based on section flags.
8279         (Target_i386::Relocate::fix_up_ldo): Remove.
8280
8281 2009-10-13  Ian Lance Taylor  <iant@google.com>
8282
8283         Add support for -pie.
8284         * options.h (class General_options): Add -pie and
8285         --pic-executable.
8286         (General_options::output_is_position_independent): Test -pie.
8287         (General_options::output_is_executable): Return true if not shared
8288         and not relocatable.
8289         (General_options::output_is_pie): Remove.
8290         * options.cc (General_options::finalize): Reject incompatible uses
8291         of -pie.
8292         * gold.cc (queue_middle_tasks): A -pie link is not static.
8293         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8294         * symtab.cc (Symbol::final_value_is_known): Return false if
8295         output_is_position_independent.
8296         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8297         output_is_position_independent.
8298         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8299         output_is_position_independent.
8300         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8301         output_is_position_independent.
8302         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8303         two_file_pie_test.
8304         (basic_pie_test.o, basic_pie_test): New targets.
8305         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8306         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8307         (two_file_pie_test): New target.
8308         * testsuite/Makefile.in: Rebuild.
8309         * README: Remove note saying that -pie is not supported.
8310
8311 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8312
8313         * options.h (class General_options): Add -init and -fini.
8314         * layout.cc (Layout::finish_dynamic_section): Emit
8315         given init and fini functions.
8316
8317 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8318
8319         * gc.h (gc_process_relocs): Check if icf is enabled using new
8320         function.
8321         * gold.cc (queue_initial_tasks): Likewise.
8322         (queue_middle_tasks): Likewise.
8323         * object.cc (do_layout): Likewise.
8324         * symtab.cc (is_section_folded): Likewise.
8325         * main.cc (main): Likewise.
8326         * reloc.cc (Read_relocs::run): Likewise.
8327         (Sized_relobj::do_scan_relocs): Likewise.
8328         * icf.cc (is_function_ctor_or_dtor): New function.
8329         (Icf::find_identical_sections): Check if function is ctor or dtor when
8330         safe icf is chosen.
8331         * options.h (General_options::icf): Change option to be an enum.
8332         (Icf_status): New enum.
8333         (icf_enabled): New method.
8334         (icf_safe_folding): New method.
8335         (set_icf_status): New method.
8336         (icf_status_): New variable.
8337         * (options.cc) (General_options::finalize): Set icf_status_.
8338         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8339         icf_test and icf_keep_unique_test to use the --icf enum flag.
8340         * testsuite/icf_safe_test.sh: New file.
8341         * testsuite/icf_safe_test.cc: New file.
8342
8343 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8344
8345         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8346         includes to gc.h and icf.h.
8347         * arm.cc: Include gc.h.
8348         * gold.cc: Likewise.
8349         * i386.cc: Likewise.
8350         * powerpc.cc: Likewise.
8351         * sparc.cc: Likewise.
8352         * x86_64.cc: Likewise.
8353         * gc.h: Include icf.h.
8354
8355 2009-10-11  Ian Lance Taylor  <iant@google.com>
8356
8357         * plugin.cc: Include "gold.h" before other header files.
8358
8359 2009-10-10  Chris Demetriou  <cgd@google.com>
8360
8361         * options.h (Input_file_argument::Input_file_type): New enum.
8362         (Input_file_argument::is_lib_): Replace with...
8363         (Input_file_argument::type_): New member.
8364         (Input_file_argument::Input_file_argument): Take Input_file_type
8365         'type' rather than boolean 'is_lib' as second argument.
8366         (Input_file_argument::is_lib): Use type_.
8367         (Input_file_argument::is_searched_file): New function.
8368         (Input_file_argument::may_need_search): Handle is_searched_file.
8369         * options.cc (General_options::parse_library): Support -l:filename.
8370         (General_options::parse_just_symbols): Update for Input_file_argument
8371         changes.
8372         (Command_line::process): Likewise.
8373         * archive.cc (Archive::get_file_and_offset): Likewise.
8374         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8375         * script.cc (read_script_file, script_add_file): Likewise.
8376         * fileread.cc (Input_file::Input_file): Likewise.
8377         (Input_file::will_search_for): Handle is_searched_file.
8378         (Input_file::open): Likewise.
8379         * readsyms.cc (Read_symbols::get_name): Likewise.
8380         * testsuite/Makefile.am (searched_file_test): New test.
8381         * testsuite/Makefile.in: Regenerate.
8382         * testsuite/searched_file_test.cc: New file.
8383         * testsuite/searched_file_test_lib.cc: New file.
8384
8385 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8386             Ian Lance Taylor  <iant@google.com>
8387
8388         * descriptor.cc: Include <cstdio> and "binary-io.h".
8389         (Descriptors::open): Open the files in binary mode always.
8390         * script.cc (Lex::get_token): Treat \r as whitespace.
8391
8392 2009-10-09  Ian Lance Taylor  <iant@google.com>
8393
8394         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8395
8396 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8397             Ian Lance Taylor  <iant@google.com>
8398
8399         * configure.ac: Check for readv function also.
8400         * fileread.cc (readv): Define if not HAVE_READV.
8401         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8402         does not exist.
8403         * config.in: Regenerate.
8404         * configure: Regenerate.
8405
8406 2009-10-09  Doug Kwan  <dougkwan@google.com>
8407
8408         * layout.cc (Layout::make_output_section): Call target hook to make
8409         ordinary output section.
8410         (Layout::finalize): Adjust parameter list of call the
8411         Target::may_relax().
8412         * layout.h (class Layout::section_list): New method.
8413         * merge.h (Output_merge_base::entsize): Change visibility to public.
8414         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8415         New methods.
8416         (Output_merge_string::do_is_string): New method.
8417         * object.cc (Sized_relobj::do_setup): renamed from
8418         Sized_relobj::set_up.
8419         * object.h (Sized_relobj::adjust_shndx,
8420         Sized_relobj::initializ_input_to_output_maps,
8421         Sized_relobj::free_input_to_output_maps): Change visibilities to
8422         protected.
8423         (Sized_relobj::setup): Virtualize.
8424         (Sized_relobj::do_setup): New method declaration.
8425         (Sized_relobj::invalidate_section_offset,
8426         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8427         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8428         * options.cc (parse_int): New function.
8429         * options.h (parse_int): New declaration.
8430         (DEFINE_int): New macro.
8431         (stub_group_size): New option.
8432         * output.cc (Output_section::Output_section): Initialize memebers
8433         merge_section_map_, merge_section_by_properties_map_,
8434         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8435         (Output_section::add_input_section): Handled deferred code-fill
8436         generation and remove an old comment.
8437         (Output_section::add_relaxed_input_section): New method definition.
8438         (Output_section::add_merge_input_section): Use merge section by
8439         properties map to speed to search.  Update merge section maps
8440         as appropriate.
8441         (Output_section::build_relaxation_map): New method definition.
8442         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8443         Same.
8444         (Output_section::relax_input_section): Renamed to
8445         Output_section::convert_input_sections_to_relaxed_sections and change
8446         interface to take a vector of pointers to relaxed sections.
8447         (Output_section::find_merge_section,
8448         Output_section::find_relaxed_input_section): New method definitions.
8449         (Output_section::is_input_address_mapped,
8450         Output_section::output_offset, Output_section::output_address):
8451         Use output section data maps to speed up searching.
8452         (Output_section::find_starting_output_address): Add comments.
8453         (Output_section::do_write,
8454         Output_section::write_to_postprocessing_buffer): Do code-fill
8455         generation as appropriate.
8456         (Output_section::get_input_sections): Invalidate relaxed input section
8457         map.
8458         (Output_section::restore_states): Adjust type of checkpoint .
8459         Invalidate relaxed input section map.
8460         * output.h (Output_merge_base): New class declaration.
8461         (Input_section_specifier): New class defintion.
8462         (class Output_relaxed_input_section) Change base class to
8463         Output_section_data_build.
8464         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8465         base class initializer.
8466         (Output_section::add_relaxed_input_section): New method declaration.
8467         (Output_section::Input_section): Change visibility to protected.
8468         (Output_section::Input_section::relobj,
8469         Output_section::Input_section::shndx): Handle relaxed input sections.
8470         Output_section::input_sections) Change visibility to protected.  Also
8471         define overload to return a non-const pointer.
8472         (Output_section::Merge_section_properties): New class defintion.
8473         (Output_section::Merge_section_by_properties_map,
8474         Output_section::Output_section_data_by_input_section_map,
8475         Output_section::Relaxation_map): New types.
8476         (Output_section::relax_input_section): Rename method to
8477         Output_section::convert_input_sections_to_relaxed_sections and change
8478         interface to take a vector of relaxed section pointers.
8479         (Output_section::find_merge_section,
8480         Output_section::find_relaxed_input_section,
8481         Output_section::build_relaxation_map,
8482         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8483         New method declarations.
8484         (Output_section::merge_section_map_
8485         Output_section::merge_section_by_properties_map_,
8486         Output_section::relaxed_input_section_map_,
8487         Output_section::is_relaxed_input_section_map_valid_,
8488         Output_section::generate_code_fills_at_write_): New data members.
8489         * script-sections.cc
8490         (Output_section_element_input::set_section_addresses): Call
8491         current_data_size and addralign methods of relaxed input sections.
8492         (Orphan_output_section::set_section_addresses): Call current_data_size
8493         and addralign methods of relaxed input sections.
8494         * symtab.cc (Symbol_table::compute_final_value): Extract template
8495         from the body of Symbol_table::sized_finalize_symbol.
8496         (Symbol_table::sized_finalized_symbol): Call
8497         Symbol_table::compute_final_value.
8498         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8499         (Symbol_table::compute_final_value): New templated method declaration.
8500         * target.cc (Target::do_make_output_section): New method defintion.
8501         * target.h (Target::make_output_section): New method declaration.
8502         (Target::relax): Add more parameters for input objects, symbol table
8503         and layout.  Adjust call to do_relax.
8504         (Target::do_make_output_section): New method declaration.
8505         (Target::do_relax): Add parameters for input objects, symbol table
8506         and layout.
8507
8508 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8509
8510         * pread.c: Include stdio.h.
8511
8512 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8513
8514         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8515         defined.
8516
8517 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8518
8519         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8520         Change read_shndx type to unsigned int.
8521         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8522         int.
8523         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8524         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8525         Change read_shndx type to unsigned int.
8526         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8527         int.
8528         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8529         * layout.cc (Layout::create_symtab_sections): Cast the result of
8530         local_symcount * symsize to off_t in the gold_assert.
8531
8532 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8533
8534         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8535         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8536         R_ARM_BASE_ABS.
8537         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8538         (Arm_relocate_functions::thm_abs5): New function.
8539         (Arm_relocate_functions::abs12): New function.
8540         (Arm_relocate_functions::abs16): New function.
8541         (Arm_relocate_functions::base_abs): New function.
8542         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8543         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8544         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8545         R_ARM_BASE_ABS.
8546         (Scan::global): Likewise.
8547         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8548         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8549         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8550         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8551         R_ARM_BASE_ABS.
8552
8553 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8554
8555         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8556         (Arm_relocate_functions::movt_prel): New function.
8557         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8558         (Arm_relocate_functions::thm_movt_prel): New function.
8559         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8560         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8561         (Scan::global, Relocate::relocate): Likewise.
8562         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8563
8564 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8565
8566         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8567         Incremental_checker.
8568         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8569         unsigned int.
8570         (class Incremental_inputs_header): New class.
8571         (Incremental_inputs_header_writer): Edit comment.
8572         (Incremental_inputs_entry): New class.
8573         (Incremental_inputs_entry_writer): Edit comment.
8574         (Sized_incremental_binary::do_find_incremental_inputs_section):
8575         Add *strtab_shndx parameter, fill it.
8576         (Sized_incremental_binary::do_check_inputs): New method.
8577         (Incremental_checker::can_incrementally_link_output_file): Use
8578         Sized_incremental_binary::check_inputs.
8579         (Incremental_inputs::report_command_line): Save command line in
8580         command_line_.
8581         * incremental.h:
8582         (Incremental_binary::find_incremental_inputs_section): New
8583         method.
8584         (Incremental_binary::do_find_incremental_inputs_section): Add
8585         strtab_shndx parameter.
8586         (Incremental_binary::do_check_inputs): New pure virtual method.
8587         (Sized_incremental_binary::do_check_inputs): Declare.
8588         (Incremental_checker::Incremental_checker): Add incremental_inputs
8589         parameter, use it to initialize incremental_inputs_.
8590         (Incremental_checker::incremental_inputs_): New field.
8591         (Incremental_checker::command_line): New method.
8592         (Incremental_checker::inputs): New method.
8593         (Incremental_checker::command_line_): New field.
8594
8595 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8596
8597         * incremental.cc: Include <cstdarg> and "target-select.h".
8598         (vexplain_no_incremental): New function.
8599         (explain_no_incremental): New function.
8600         (Incremental_binary::error): New method.
8601         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8602         method.
8603         (make_sized_incremental_binary): New function.
8604         (open_incremental_binary): New function.
8605         (can_incrementally_link_file): Add checks if output is ELF and has
8606         inputs section.
8607         * incremental.h: Include "elfcpp_file.h" and "output.h".
8608         (Incremental_binary): New class.
8609         (Sized_incremental_binary): New class.
8610         (open_incremental_binary): Declare.
8611         * object.cc (is_elf_object): Use
8612         elfcpp::Elf_recognizer::is_elf_file.
8613         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8614         * output.h (Output_file::filesize): New method.
8615
8616 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8617
8618         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8619         New function.
8620         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8621         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8622         function.
8623         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8624         function.
8625         (Arm_relocate_functions::movw_abs_nc): New function.
8626         (Arm_relocate_functions::movt_abs): New function.
8627         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8628         (Arm_relocate_functions::thm_movt_abs): New function.
8629         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8630         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8631         (Scan::global): Likewise.
8632         (Relocate::relocate): Likewise.
8633         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8634
8635 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8636
8637         * arm.cc (Arm_relocate_functions::got_prel) New function.
8638         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8639         (Relocate::relocate): Likewise.
8640         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8641
8642 2009-10-06  Ian Lance Taylor  <iant@google.com>
8643
8644         * options.h (class General_options): Define
8645         split_stack_adjust_size parameter.
8646         * object.h (class Object): Add uses_split_stack_ and
8647         has_no_split_stack_ fields.  Add uses_split_stack and
8648         has_no_split_stack accessor functions.  Declare
8649         handle_split_stack_section.
8650         (class Reloc_symbol_changes): Define.
8651         (class Sized_relobj): Define Function_offsets.  Declare
8652         split_stack_adjust, split_stack_adjust_reltype, and
8653         find_functions.
8654         * object.cc (Object::handle_split_stack_section): New function.
8655         (Sized_relobj::do_layout): Call handle_split_stack_section.
8656         * dynobj.cc (Sized_dynobj::do_layout): Call
8657         handle_split_stack_section.
8658         * reloc.cc (Sized_relobj::relocate_sections): Call
8659         split_stack_adjust for executable sections in split_stack
8660         objects.  Pass reloc_map to relocate_section.
8661         (Sized_relobj::split_stack_adjust): New function.
8662         (Sized_relobj::split_stack_adjust_reltype): New function.
8663         (Sized_relobj::find_functions): New function.
8664         * target-reloc.h: Include "object.h".
8665         (relocate_section): Add reloc_symbol_changes parameter.  Change
8666         all callers.
8667         * target.h (class Target): Add calls_non_split method.  Declare
8668         do_calls_non_split virtual method.  Declare match_view and
8669         set_view_to_nop.
8670         * target.cc: Include "elfcpp.h".
8671         (Target::do_calls_non_split): New function.
8672         (Target::match_view): New function.
8673         (Target::set_view_to_nop): New function.
8674         * gold.cc (queue_middle_tasks): Give an error if mixing
8675         split-stack and non-split-stack objects with -r.
8676         * i386.cc (Target_i386::relocate_section): Add
8677         reloc_symbol_changes parameter.
8678         (Target_i386::do_calls_non_split): New function.
8679         * x86_64.cc (Target_x86_64::relocate_section): Add
8680         reloc_symbol_changes parameter.
8681         (Target_x86_64::do_calls_non_split): New function.
8682         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8683         parameter.
8684         * powerpc.cc (Target_powerpc::relocate_section): Add
8685         reloc_symbol_changes parameter.
8686         * sparc.cc (Target_sparc::relocate_section): Add
8687         reloc_symbol_changes parameter.
8688         * configure.ac: Call AM_CONDITIONAL for the default target.
8689         * configure: Rebuild.
8690         * testsuite/Makefile.am (TEST_AS): New variable.
8691         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8692         (check_DATA): Add split_i386 and split_x86_64 files.
8693         (SPLIT_DEFSYMS): Define.
8694         (split_i386_[1234n].o): New targets.
8695         (split_i386_[124]): New targets.
8696         (split_i386_[1234r].stdout): New targets.
8697         (split_x86_64_[1234n].o): New targets.
8698         (split_x86_64_[124]): New targets.
8699         (split_x86_64_[1234r].stdout): New targets.
8700         (MOSTLYCLEANFILES): Add new executables.
8701         * testsuite/split_i386.sh: New file.
8702         * testsuite/split_x86_64.sh: New file.
8703         * testsuite/split_i386_1.s: New file.
8704         * testsuite/split_i386_2.s: New file.
8705         * testsuite/split_i386_3.s: New file.
8706         * testsuite/split_i386_4.s: New file.
8707         * testsuite/split_i386_n.s: New file.
8708         * testsuite/split_x86_64_1.s: New file.
8709         * testsuite/split_x86_64_2.s: New file.
8710         * testsuite/split_x86_64_3.s: New file.
8711         * testsuite/split_x86_64_4.s: New file.
8712         * testsuite/split_x86_64_n.s: New file.
8713         * testsuite/testfile.cc (Target_test): Update relocation_section
8714         function.
8715         * testsuite/Makefile.in: Rebuild.
8716
8717 2009-10-06  Ian Lance Taylor  <iant@google.com>
8718
8719         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8720         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8721         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8722         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8723         the address on ldo_addrs_.
8724         (Target_i386::Relocate::fix_up_ldo): New function.
8725
8726 2009-10-06   Rafael Espindola  <espindola@google.com>
8727
8728         * plugin.cc (add_input_library): New.
8729         (Plugin::load): Add add_input_library to tv.
8730         (Plugin_manager::add_input_file): Add the is_lib argument.
8731         (add_input_file): Update call to Plugin_manager::add_input_file.
8732         (add_input_library): New.
8733         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8734
8735 2009-09-30  Doug Kwan  <dougkwan@google.com>
8736
8737         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8738         symbol and call Symbol::may_need_copy_reloc to determine if
8739         a copy reloc is needed.
8740         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8741         nocopyreloc is given in command line.
8742         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8743         given in command line.
8744         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8745         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8746         of the removed Target_i386::may_need_copy_reloc.
8747         * options.h (copyreloc): New option with default value false.
8748         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8749         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8750         instead of the removed Target_powerpc::may_need_copy_reloc.
8751         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8752         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8753         instead of the removed Target_sparc::may_need_copy_reloc.
8754         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8755         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8756         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8757         instead of the removed Target_x86_64::may_need_copy_reloc.
8758
8759 2009-09-30  Ian Lance Taylor  <iant@google.com>
8760
8761         * object.h (class Object): Remove target_ field, and target,
8762         sized_target, and set_target methods.
8763         (Object::sized_target): Remove.
8764         (class Sized_relobj): Update declarations.  Remove sized_target.
8765         * object.cc (Sized_relobj::setup): Remove target parameter.
8766         Change all callers.
8767         (Input_objects::add_object): Don't do anything with the target.
8768         (make_elf_sized_object): Add punconfigured parameter.  Change all
8769         callers.  Set or test parameter target.
8770         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8771         Change all callers.
8772         * parameters.cc (Parameters::set_target): Change parameter type to
8773         be non-const.
8774         (Parameters::default_target): Remove.
8775         (set_parameters_target): Change parameter type to be non-const.
8776         (parameters_force_valid_target): New function.
8777         (parameters_clear_target): New function.
8778         * parameters.h (class Parameters): Update declarations.  Remove
8779         default_target method.  Add sized_target and clear_target
8780         methods.  Change target_ to be non-const.
8781         (set_parameters_target): Update declaration.
8782         (parameters_force_valid_target): Declare.
8783         (parameters_clear_target): Declare.
8784         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8785         as NULL if we aren't searching.
8786         (Add_symbols::run): Don't check for compatible target.
8787         * fileread.cc (Input_file::open_binary): Call
8788         parameters_force_valid_target.
8789         * gold.cc (queue_middle_tasks): Likewise.
8790         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8791         set_target on object.
8792         * dynobj.h (class Sized_dynobj): Update declarations.
8793         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8794         make_elf_object returns NULL.
8795         (Archive::include_member): Don't check whether object target is
8796         compatible.
8797         * output.cc (Output_section::add_input_section): Get target from
8798         parameters.
8799         (Output_section::relax_input_section): Likewise.
8800         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8801         parameters.
8802         (Sized_relobj::do_scan_relocs): Likewise.
8803         (Sized_relobj::relocate_sections): Likewise.
8804         * resolve.cc (Symbol_table::resolve): Likewise.
8805         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8806         parameter.  Change all callers.
8807         (Symbol_table::add_from_object): Get target from parameters.
8808         (Symbol_table::add_from_relobj): Don't check object target.
8809         (Symbol_table::add_from_dynobj): Likewise.
8810         (Symbol_table::define_special_symbol): Get target from
8811         parameters.
8812         * symtab.h (class Symbol_table): Update declaration.
8813         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8814         parameter.  Change all callers.  Clear parameter target.
8815         (Binary_test): Test target here.
8816         * testsuite/object_unittest.cc (gold_testsuite): Remove
8817         target_test_pointer parameter.  Change all callers.
8818         (Object_test): Test target here.
8819
8820 2009-09-26  Ian Lance Taylor  <iant@google.com>
8821
8822         * testsuite/initpri1.c: Don't try to use constructor priorities if
8823         compiling with gcc before 4.3.
8824
8825 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8826
8827         * testsuite/retain_symbols_file_test.sh (check_present): Change
8828         output file name to retain_symbols_file_test.stdout.
8829         (check_absent): Likewise.
8830
8831 2009-09-18  Craig Silverstein  <csilvers@google.com>
8832
8833         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8834         * options.cc: Include <cerrno> and <fstream>.
8835         (General_options::finalize): Parse -retain-symbols-file tag.
8836         * options.h: New flag.
8837         (General_options): New method should_retain_symbol, new
8838         variable symbols_to_retain.
8839         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8840         should_retain_symbol map.
8841         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8842         * testsuite/Makefile.in: Regenerate.
8843         * testsuite/retain_symbols_file_test.sh: New file.
8844
8845 2009-09-18  Nick Clifton  <nickc@redhat.com>
8846
8847         * po/es.po: Updated Spanish translation.
8848
8849 2009-09-17  Doug Kwan  <dougkwan@google.com>
8850
8851         * debug.h (DEBUG_RELAXATION): New constant.
8852         (DEBUG_ALL): Add DEBUG_RELAXATION.
8853         (debug_string_to_enum): Add relaxation debug option.
8854         * layout.cc
8855         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8856         Layout::Relaxation_debug_check::read_sections,
8857         Layout::Relaxation_debug_check::read_sections): New method definitions.
8858         (Layout::Layout): Initialize data members
8859         record_output_section_data_from_scrips_,
8860         script_output_section_data_list_ and relaxation_debug_check_.
8861         (Layout::save_segments, Layout::restore_segments,
8862         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8863         Layout::relaxation_loop_body): New method definitions.
8864         (Layout::finalize): Support relaxation.  Move section layout code to
8865         Layout::relaxation_loop_body.
8866         (Layout::set_asection_address_from_script): Move code for orphan
8867         section placement out.
8868         (Layout::place_orphan_sections_in_script): New method definition.
8869         * layout.h (Output_segment_headers, Output_file_header):
8870         New forward class declarations.
8871         (Layout::~Layout): Define.
8872         (Layout::new_output_section_data_from_script): New method definition.
8873         (Layout::place_orphan_sections_in_script): New method declaration.
8874         (Layout::Segment_states): New type declaration.
8875         (Layout::save_segments, Layout::restore_segments,
8876         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8877         Layout::relaxation_loop_body): New method declarations.
8878         (Layout::Output_section_data_list): New type declaration.
8879         (Layout::Relaxation_debug_check): New class definition.
8880         (Layout::record_output_section_data_from_script_,
8881         Layout::script_output_section_data_list_, Layout::segment_states_,
8882         Layout::relaxation_debug_check_): New data members.
8883         * output.cc: (Output_section_headers::do_size): New method definition.
8884         (Output_section_headers::Output_section_headers): Move size
8885         computation to Output_section_headers::do_size.
8886         (Output_segment_headers::do_size): New method definition.
8887         (Output_file_header::Output_file_header): Move size computation to
8888         Output_file_header::do_size and call it.
8889         (Output_file_header::do_size): New method definition.
8890         (Output_data_group::Output_data_group): Adjust call to
8891         Output_section_data.
8892         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8893         (Output_symtab_xindex::do_write): Add array bound check.
8894         (Output_section::Input_section::print_to_mapfile): Handle
8895         RELAXED_INPUT_SECTION_CODE.
8896         (Output_section::Output_section): Initialize data member checkpoint_.
8897         (Output_section::~Output_section): Delete checkpoint object pointed
8898         by checkpoint_.
8899         (Output_section::add_input_section): Always add an Input_section if
8900         relaxing.
8901         (Output_section::add_merge_input_section): Add assert.
8902         (Output_section::relax_input_section): New method definition.
8903         (Output_section::set_final_data_size): Set load address to zero for
8904         an unallocated section.
8905         (Output_section::do_address_and_file_offset_have_reset_values):
8906         New method definition.
8907         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8908         Handle relaxed input section.
8909         (Output_section::sort_attached_input_sections): Checkpoint input
8910         section list lazily.
8911         (Output_section::get_input_sections): Change type of input_sections to
8912         list of Simple_input_section pointers.  Checkpoint input section list
8913         lazily.  Also handle relaxed input sections.
8914         (Output_section::add_input_section_for_script): Take a reference to
8915         a Simple_input_section object instead of Relobj pointer and section
8916         index as parameter.  Handle relaxed input sections.
8917         (Output_section::save_states, Output_section::restore_states): New
8918         method definitions.
8919         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8920         (Output_data::is_data_size_fixed): New method definition.
8921         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8922         if it is fixed.
8923         (Output_data::address_and_file_offset_have_reset_values): New method
8924         definition.
8925         (Output_data::do_address_and_file_offset_have_reset_values): New method
8926         definition.
8927         (Output_data::set_data_size): Check that data size is not fixed.
8928         (Output_data::fix_data_size): New method definition.
8929         (Output_data::is_data_size_fixed_): New data member.
8930         (Output_section_headers::set_final_data_size): New method definition.
8931         (Output_section_headers::do_size): New method declaration.
8932         (Output_segment_headers::set_final_data_size): New method definition.
8933         (Output_segment_headers::do_size): New method declaration.
8934         (Output_file_header::set_final_data_size)::New method definition.
8935         (Output_file_header::do_size)::New method declaration.
8936         (Output_section_data::Output_section_data): Add new parameter
8937         is_data_size_fixed and use it to fix data size.
8938         (Output_data_const::Output_data_const): Adjust call to base class
8939         constructor and fix data size.
8940         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8941         base class constructor and fix data size.
8942         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8943         base class constructor and fix data size.
8944         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8945         class constructor and fix data size.
8946         (Output_data_group::set_final_data_size): New method definition.
8947         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8948         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8949         class constructor and fix data size.
8950         (Output_relaxed_input_section): New class definition.
8951         (Output_section::Simple_input_section): New class definition.
8952         (Output_section::get_input_sections): Adjust parameter list.
8953         (Output_section::add_input_section_for_script): Same.
8954         (Output_section::save_states, Output_section::restore_states,
8955         Output_section::do_address_and_file_offset_have_reset_values,
8956         (Output_section::Input_section::Input_section): Handle
8957         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8958         Output_relaxed_input_section.
8959         (Output_section::Input_section::is_input_section,
8960         Output_section::Input_section::set_output_section): Handle relaxed
8961         input section.
8962         (Output_section::Input_section::is_relaxed_input_section,
8963         Output_section::Input_section::output_section_data,
8964         Output_section::Input_section::relaxed_input_section): New method
8965         definitions.
8966         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8967         value.
8968         (Output_section::Input_section::u1_): Update comments.
8969         (Output_section::Input_section::u2_): Add new union member poris.
8970         (Output_section::Checkpoint_output_section): New classs definition.
8971         (Output_section::relax_input_section): New method declaration.
8972         (Output_section::checkpoint_): New data member.
8973         (Output_segment): Update comments.
8974         (Output_segment::Output_segment): Un-privatize copy constructor.
8975         (Output_segment::operator=): Un-privatize.
8976         * script-sections.cc (Output_section_element::Input_section_list):
8977         Change element type to Output_section::Simple_input_section.
8978         (Output_section_element_dot_assignment::set_section_addresses):
8979         Register output section data for relaxation clean up.
8980         (Output_data_exression::Output_data_expression): Adjust call to base
8981         constructor to fix data size.
8982         (Output_section_element_data::set_section_addresses): Register
8983         Output_data_expression object for relaxation clean up.
8984         (struct Input_section_info): Replace Relobj pointer and section index
8985         pair with Output_section::Simple_input_section and Convert struct to a
8986         class.
8987         (Input_section_sorter::operator()): Adjust access to
8988         Input_section_info data member to use accessors.
8989         (Output_section_element_input::set_section_addresses): Use layout
8990         parameter.  Adjust code to use Output_section::Simple_input_section
8991         and Input_secction_info classes.  Register filler for relaxation
8992         clean up.
8993         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8994         and section index pair with Output_section::Simple_input_section
8995         class.  Adjust code accordingly.
8996         (Phdrs_element::release_segment): New method definition.
8997         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8998         segment list.
8999         (Script_sections::release_segments): New method definition.
9000         * gold/script-sections.h (Script_sections::release_segments): New
9001         method declaration.
9002         * gold/target.h (Target::may_relax, Target::relax,
9003         Target::do_may_relax, Target::do_relax): New method definitions.
9004
9005 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9006
9007         * arm.cc (has_signed_unsigned_overflow): New function.
9008         (Arm_relocate_functions::abs8): New function.
9009         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9010         (Target_arm::Scan::global): Likewise.
9011         (Target_arm::relocate::relocate): Likewise.
9012         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9013         Likewise.
9014
9015 2009-09-16  Cary Coutant  <ccoutant@google.com>
9016
9017         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9018         * testsuite/Makefile.in: Regenerate.
9019
9020 2009-09-11  Nick Clifton  <nickc@redhat.com>
9021
9022         * po/gold.pot: Updated by the Translation project.
9023
9024 2009-09-08  Cary Coutant  <ccoutant@google.com>
9025
9026         * output.cc (Output_file::open): Add execute permission to empty file.
9027         * testsuite/Makefile.am (permission_test): New test.
9028         * testsuite/Makefile.in: Regenerate.
9029
9030 2009-09-02  Ian Lance Taylor  <iant@google.com>
9031
9032         * output.cc (Output_file::resize): Call map_no_anonymous rather
9033         than map.
9034
9035 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9036
9037         * gold.cc: Include "incremental.h".
9038         (queue_initial_tasks): Call Incremental_checker methods.
9039         * incremental.cc: Include "output.h".
9040         (Incremental_checker::can_incrementally_link_output_file): New
9041         method.
9042         * incremental.h (Incremental_checker): New class.
9043
9044         * output.cc (Output_file::open_for_modification): New method.
9045         (Output_file::map_anonymous): Changed return type to bool.  Record
9046         map in base_ field.
9047         (Output_file::map_no_anonymous): New method, broken out of map.
9048         (Output_file::map): Use map_no_anonymous and map_anonymous.
9049         * output.h (class Output_file): Update declarations.
9050
9051 2009-08-24  Cary Coutant  <ccoutant@google.com>
9052
9053         * options.h (Command_line::Pre_options): New class.
9054         (Command_line::pre_options): New member.
9055         * options.cc (gold::options::ready_to_register): New variable.
9056         (One_option::register_option): Do nothing if not registering options.
9057         Assert if same short option registered twice.
9058         (General_options::General_options): Turn off option registration when
9059         done constructing.
9060         (Command_line::Pre_options::Pre_options): New constructor.
9061
9062 2009-08-24  Cary Coutant  <ccoutant@google.com>
9063
9064         * options.h (General_options::no_keep_memory): Remove incorrect
9065         short option.
9066
9067 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9068
9069         * Makefile.am (am__skiplex, am__skipyacc): New.
9070         * Makefile.in: Regenerate.
9071
9072 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9073
9074         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9075         (INCLUDES): ... this.
9076         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9077         (AM_CPPFLAGS): Renamed from ...
9078         (INCLUDE): ... this.
9079         * Makefile.in, testsuite/Makefile.in: Regenerate.
9080
9081         * Makefile.in: Regenerate.
9082         * aclocal.m4: Likewise.
9083         * config.in: Likewise.
9084         * configure: Likewise.
9085         * testsuite/Makefile.in: Likewise.
9086
9087         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9088         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9089         * Makefile.in: Regenerate.
9090         * testsuite/Makefile.in: Regenerate.
9091
9092 2009-08-19  Cary Coutant  <ccoutant@google.com>
9093
9094         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9095         symbols in shared libraries overridden by hidden or internal symbols
9096         in the main program.
9097
9098 2009-08-19  Chris Demetriou  <cgd@google.com>
9099
9100         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9101         checking source file names in error messages.
9102
9103 2009-08-18  Doug Kwan  <dougkwan@google.com>
9104
9105         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9106         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9107         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9108         an elfcpp::Ehdr as parameter.
9109         * object.cc (Object::set_target): Remove the version that looks up
9110         a target and sets it.
9111         (Sized_relobj::setup): Take a Target object instead of
9112         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9113         (make_elf_sized_object): Find target and ask target to
9114         make an ELF object.
9115         * object.h: (Object::set_target): Remove the version that looks up
9116         a target and sets it.
9117         (Sized_relobj::setup): Take a Target object instead of
9118         an elfcpp:Ehdr as parameter.
9119         * target.cc: Include dynobj.h.
9120         (Target::do_make_elf_object_implementation): New.
9121         (Target::do_make_elf_object): New.
9122         * target.h (Target::make_elf_object): New template declaration.
9123         (Target::do_make_elf_object): New method declarations.
9124         (Target::do_make_elf_object_implementation): New template declaration.
9125
9126 2009-08-14  Ian Lance Taylor  <iant@google.com>
9127
9128         * gold.h (FUNCTION_NAME): Define.
9129         (gold_unreachable): Use FUNCTION_NAME.
9130
9131 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9132
9133         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9134         symbol in the --keep-unique list is not found.
9135
9136 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9137
9138         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9139         been maked as --keep-unique.
9140         (Icf::unfold_section): New function.
9141         * icf.h (Icf::unfold_section): New function.
9142         * options.h (General_options::keep_unique): New option.
9143         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9144         * testsuite/Makefile.in: Regenerate.
9145         * testsuite/icf_keep_unique_test.sh: New file.
9146         * testsuite/icf_keep_unique_test.cc: New file.
9147
9148 2009-08-12  Cary Coutant  <ccoutant@google.com>
9149
9150         PR 10471
9151         * resolve.cc (Symbol_table::resolve): Check for references from
9152         dynamic objects to hidden and internal symbols.
9153         * testsuite/Makefile.am (hidden_test.sh): New test.
9154         * testsuite/Makefile.in: Regenerate.
9155         * testsuite/hidden_test.sh: New script.
9156         * testsuite/hidden_test_1.c: New test source.
9157         * testsuite/hidden_test_main.c: New test source.
9158
9159 2009-08-11  Doug Kwan  <dougkwan@google.com>
9160
9161         * arm.cc: Update comments.
9162         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9163         segment to locate the .ARM.exidx section if present.
9164
9165 2009-08-09  Doug Kwan  <dougkwan@google.com>
9166
9167         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9168         patch.
9169
9170 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9171         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9172         compiler warnings.
9173
9174 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9175
9176         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9177         valid tls_segment only for non-debug-section relocations.
9178         * testsuite/Makefile.am: Add gc_tls_test.
9179         * testsuite/Makefile.in: Regenerate.
9180         * testsuite/gc_tls_test.cc: New file.
9181         * testsuite/gc_tls_test.sh: New file.
9182
9183 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9184
9185         * icf.cc: New file.
9186         * icf.h: New file.
9187         * Makefile.am (CCFILES): Add icf.cc.
9188         (HFILES): Add icf.h
9189         * Makefile.in: Regenerate.
9190         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9191         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9192         section, symbol and addend information for the relocs.
9193         * gold.cc (queue_middle_tasks): Call identical code folding.
9194         * gold.h: Add defines for multimap.
9195         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9196         to the call of finalize_local_symbols.
9197         * main.cc (main): Create object of class Icf.
9198         * object.cc (Sized_relobj::do_layout): Allow this function to be
9199         called twice during icf.
9200         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9201         to sections marked as identical by icf.
9202         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9203         when available.
9204         (Sized_relobj::do_section_entsize): New function.
9205         * object.h (Object::section_entsize): New function.
9206         (Object::do_section_entsize): New pure virtual function.
9207         (Relobj::finalize_local_symbols): Add new parameter.
9208         (Relobj::do_section_entsize): New function.
9209         * options.h (General_options::icf): New option.
9210         (General_options::icf_iterations): New option.
9211         (General_options::print_icf_sections): New option.
9212         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9213         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9214         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9215         icf.
9216         * symtab.cc (Symbol_table::is_section_folded): New function.
9217         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9218         to sections marked as identical by icf.
9219         * symtab.h (Symbol_table::set_icf): New function.
9220         (Symbol_table::icf): New function.
9221         (Symbol_table::is_section_folded): New function.
9222         (Symbol_table::icf_): New data member.
9223         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9224         * testsuite/Makefile.am: Add commands to build icf_test.
9225         * testsuite/Makefile.in: Regenerate.
9226         * testsuite/icf_test.sh: New file.
9227         * testsuite/icf_test.cc: New file.
9228
9229 2009-07-24  Chris Demetriou  <cgd@google.com>
9230
9231         * layout.cc (is_compressible_debug_section): Fix incorrect
9232         comment about compressed section names.
9233
9234 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9235
9236         PR 10419
9237         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9238
9239 2009-07-16  Ian Lance Taylor  <iant@google.com>
9240
9241         PR 10400
9242         * layout.h: #include <map>.
9243         (class Kept_section): Change from struct to class.  Add accessors
9244         and setters.  Add section size to Comdat_group mapping.  Change
9245         Comdat_group to std::map.  Add is_comdat_ field.  Add
9246         linkonce_size field in union.
9247         (class Layout): Update declaration of find_or_add_kept_section.
9248         Don't declare find_kept_object.
9249         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9250         parameter.  Add object, shndx, is_comdat, and is_group_name
9251         parameters.  Change all callers.  Adjust for new Kept_section.
9252         (Layout::find_kept_object): Remove.
9253         * object.cc (Sized_relobj::include_section_group): Update use of
9254         Kept_section.  Rename secnum to shndx.  Only record
9255         Kept_comdat_section if sections are the same size.
9256         (Sized_relobj::include_linkonce_section): Update use of
9257         Kept_section.  Only record Kept_comdat_section if sections are the
9258         same size.  Set size of linkonce section.
9259         (Sized_relobj::map_to_kept_section): Update call to
9260         get_kept_comdat_section.
9261         * object.h (class Sized_relobj): Rename fields in
9262         Kept_comdat_section to drop trailing underscores; change object
9263         field to Relobj*.  Change Kept_comdat_section_table to store
9264         struct rather than pointer.
9265         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9266         Add kept_object and kept_shndx parameters.  Change all callers.
9267         (Sized_relobj::get_kept_comdat_section): Change return type to
9268         bool.  Add kept_object and kept_shndx parameters.  Change all
9269         callers.
9270         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9271         Layout::find_or_add_kept_section.
9272
9273 2009-07-09  Ian Lance Taylor  <iant@google.com>
9274
9275         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9276         Reserve space in the hash table.
9277
9278 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9279
9280         * fileread.cc (File_read::get_mtime): New method.
9281         * fileread.h (Timespec): New structure.
9282         (File_read::get_mtime): New method.
9283         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9284         Renamed from timestamp_nsec.
9285         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9286         Elf_Xword.
9287         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9288         timestamp_nsec.
9289         (Incremental_inputs::report_archive): Save mtime; style fix.
9290         (Incremental_inputs::report_obejct): Save mtime; style fix.
9291         (Incremental_inputs::report_script): Save mtime; style fix.
9292         (Incremental_inputs::finalize_inputs): Style fix.
9293         (Incremental_inputs::finalize): Style fix.
9294         (Incremental_inputs::create_input_section_data): Store inputs
9295         mtime.
9296         * incremental.h (Incremental_inputs::report_script): Add mtime
9297         argument.
9298         (Incremental_inputs::Input_info::Input_info): Intialize only one
9299         union member.
9300         (Incremental_inputs::Input_info::archive): Move to nameless
9301         union.
9302         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9303         (Incremental_inputs::Input_info::script): Move to nameless union.
9304         (Incremental_inputs::mtime): New field.
9305         * script.cc (read_input_script): Pass file mtime to
9306         Incremental_input.
9307         * script.h (Script_info::inputs): Style fix.
9308
9309 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9310
9311         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9312         instead of 32.
9313
9314 2009-06-24  Ian Lance Taylor  <iant@google.com>
9315
9316         PR 10156
9317         * layout.cc (Layout::choose_output_section): If we find an
9318         existing section, update the flags.
9319         (Layout::create_notes): New function, broken out of
9320         Layout::finalize.
9321         (Layout::finalize): Don't create note sections.
9322         (Layout::create_note): Don't crash if linker script discards
9323         section.
9324         (Layout::create_gold_note): Likewise.
9325         (Layout::create_build_id): Likewise.  Don't set
9326         after_input_sections on the section.
9327         (Layout::create_executable_stack_info): Remove target parameter.
9328         Change caller.
9329         * layout.h (class Layout): Declare create_notes.  Update
9330         declaration of create_executable_stack_info.
9331         * gold.cc (queue_middle_tasks): Call create_notes.
9332         * output.cc (Output_section::update_flags_for_input_section): Move
9333         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9334         invalid.
9335         * output.h (Output_data::mark_address_invalid): New function.
9336         (class Output_section): Only declare, not define,
9337         update_flags_for_input_section.  Remove set_flags.
9338
9339 2009-06-24  Ian Lance Taylor  <iant@google.com>
9340
9341         * script-sections.cc (Output_section_definition::
9342         set_section_addresses): Rename shadowing local load_address to
9343         laddr.
9344
9345 2009-06-24  Ian Lance Taylor  <iant@google.com>
9346
9347         PR 10244
9348         * reloc.cc (relocate_sections): Skip empty relocation sections.
9349
9350 2009-06-23  Ian Lance Taylor  <iant@google.com>
9351
9352         PR 10156
9353         * layout.cc (Layout::create_note): Use choose_output_section
9354         rather than make_output_section.
9355
9356 2009-06-23  Ian Lance Taylor  <iant@google.com>
9357
9358         PR 10237
9359         * options.cc (General_options::parse_V): Set printed_version_.
9360         (General_options::General_options): Initialize printed_version_.
9361         * options.h (class General_options): Add printed_version_ field.
9362         * gold.cc (queue_initial_tasks): If there are no input files,
9363         don't give a fatal error if we printed the version information.
9364         (queue_middle_tasks): If using -r with a shared object, give a
9365         fatal error rather than an ordinary error.
9366
9367 2009-06-23  Ian Lance Taylor  <iant@google.com>
9368
9369         PR 10219
9370         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9371         (Layout::make_output_section): Set have_stabstr_section_ if we see
9372         a .stab*str section.
9373         (Layout::finalize): Call link_stabs_sections.
9374         (Layout::link_stabs_sections): New file.
9375         * layout.h (class Layout): Add have_stabstr_section_ field.
9376         Declare link_stabs_sections.
9377
9378 2009-06-23  Doug Kwan  <dougkwan@google.com>
9379
9380         * Makefile.am (libgold_a_LIBADD): New.
9381         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9382         * Makefile.in: Regenerate.
9383         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9384         * configure: Regenerate.
9385         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9386         * fileread.cc: Include sys/state.h
9387         * gold.h: Declare memmem and strndup if found missing.
9388         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9389
9390 2009-06-23  Ian Lance Taylor  <iant@google.com>
9391
9392         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9393         * configure: Rebuild.
9394
9395 2009-06-23  Ian Lance Taylor  <iant@google.com>
9396
9397         PR 10147
9398         * object.cc (Object::section_contents): Don't try to get a view if
9399         the section has length zero.
9400         (Object::handle_gnu_warning_section): If the section is empty, use
9401         the name of the section as the warning.
9402
9403 2009-06-23  Ian Lance Taylor  <iant@google.com>
9404
9405         PR 10133
9406         * stringpool.h (class Stringpool_template): Add optimize_ field.
9407         (Stringpool_template::set_optimize): New function.
9408         * stringpool.cc (Stringpool_template::Stringpool_template):
9409         Initialize optimize_ field.
9410         (Stringpool_template::set_string_offsets): Test local optimize
9411         fild rather than parameter.
9412         * layout.cc (Layout::Layout): Call set_optimize on the section
9413         name stringpool.
9414
9415 2009-06-22  Ian Lance Taylor  <iant@google.com>
9416
9417         PR 10030
9418         * yyscript.y: Parse TARGET.
9419         * script.cc (script_set_target): New function.
9420         * script-c.h (script_set_target): Declare.
9421         * options.cc (General_options::string_to_object_format): Rename
9422         from string_to_object_format in anonymous namespace.  Change
9423         callers.
9424         * options.h (class General_options): Declare
9425         string_to_object_format.
9426
9427 2009-06-22  Ian Lance Taylor  <iant@google.com>
9428
9429         * script-sections.cc (Script_sections::create_segments): Don't put
9430         program headers in a PT_LOAD segment if -n or -N.
9431
9432 2009-06-22  Ian Lance Taylor  <iant@google.com>
9433
9434         PR 10141
9435         * options.h (class General_options): Add -z lazy and -z now.  Sort
9436         -z options into alphabetical order.
9437         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9438
9439 2009-06-21  Ian Lance Taylor  <iant@google.com>
9440
9441         * layout.cc (Layout::make_output_section): Call
9442         Target::new_output_section.
9443         (Layout::attach_allocated_section_to_segment): Put large section
9444         sections in a separate load segment with the large segment flag
9445         set.
9446         (Layout::segment_precedes): Sort large data segments after other
9447         load segments.
9448         (align_file_offset): New static function.
9449         (Layout::set_segment_offsets): Use align_file_offset.
9450         * output.h (class Output_section): Add is_small_section_ and
9451         is_large_section_ fields.
9452         (Output_section::is_small_section): New function.
9453         (Output_section::set_is_small_section):  New function.
9454         (Output_section::is_large_section): New function.
9455         (Output_section::set_is_large_section): New function.
9456         (Output_section::is_large_data_section): New function.
9457         (class Output_segment): Add is_large_data_segment_ field.
9458         (Output_segment::is_large_data_segment): New function.
9459         (Output_segment::set_is_large_data_segment): New function.
9460         * output.cc (Output_section::Output_section): Initialize new
9461         fields.
9462         (Output_segment::Output_segment): Likewise.
9463         (Output_segment::add_output_section): Add assertion that large
9464         data sections always go in large data segments.  Force small data
9465         sections to the end of the list of data sections.  Force small BSS
9466         sections to the start of the list of BSS sections.  For large BSS
9467         sections to the end of the list of BSS sections.
9468         * symtab.h (class Symbol): Declare is_common_shndx.
9469         (Symbol::is_defined): Check Symbol::is_common_shndx.
9470         (Symbol::is_common): Likewise.
9471         (class Symbol_table): Define enum Commons_section_type.  Update
9472         declarations.  Add small_commons_ and large_commons_ fields.
9473         * symtab.cc (Symbol::is_common_shndx): New function.
9474         (Symbol_table::Symbol_table): Initialize new fields.
9475         (Symbol_table::add_from_object): Put small and large common
9476         symbols in the right list.
9477         (Symbol_table::sized_finalized_symbol): Check
9478         Symbol::is_common_shndx.
9479         (Symbol_table::sized_write_globals): Likewise.
9480         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9481         common symbol lists.  Don't call do_allocate_commons_list if the
9482         list is empty.
9483         (Symbol_table::do_allocate_commons_list): Remove is_tls
9484         parameter.  Add comons_section_type parameter.  Change all
9485         callers.  Handle small and large common symbols.
9486         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9487         Symbol::is_common_shndx.
9488         * resolve.cc (symbol_to_bits): Likewise.
9489         * target.h (Target::small_common_shndx): New function.
9490         (Target::small_common_section_flags): New function.
9491         (Target::large_common_shndx): New function.
9492         (Target::large_common_section_flags): New function.
9493         (Target::new_output_section): New function.
9494         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9495         small_common_section_flags, and large_common_section_flags
9496         fields.
9497         (Target::do_new_output_section): New virtual function.
9498         * arm.cc (Target_arm::arm_info): Initialize new fields.
9499         * i386.cc (Target_i386::i386_info): Likewise.
9500         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9501         Likewise.
9502         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9503         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9504         (Target_x86_64::do_new_output_section): New function.
9505         * configure.ac: Define conditional MCMODEL_MEDIUM.
9506         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9507         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9508         (large_LDFLAGS): Define.
9509         * testsuite/large.c: New file.
9510         * testsuite/testfile.cc (Target_test::test_target_info):
9511         Initialize new fields.
9512         * configure, testsuite/Makefile.in: Rebuild.
9513
9514 2009-06-05  Doug Kwan  <dougkwan@google.com>
9515
9516         * Makefile.am (CCFILES): Add target.cc.
9517         * Makefile.in: Regenerate.
9518         * i386.cc (class Target_i386): Define new virtual method to
9519         override do_is_local_label_name in parent.
9520         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9521         local symbols if --discard-locals or -X is given.
9522         * options.h (class General_options): Declare new options
9523         '--discard-locals' and '-X' for discarding locals.
9524         * target.h (class Target): Define new methods is_local_label_name.
9525         Declare new virtual method do_is_local_label_name.
9526         * target.cc: New file.
9527         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9528         (check_SCRIPTS): Add discard_locals_test.sh.
9529         (check_DATA): Add discard_local_tests.syms.
9530         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9531         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9532         * testsuite/Makefile.in: Regenerate.
9533         * testsuite/discard_locals_test.c: New file.
9534         * testsuite/discard_locals_test.sh: Same.
9535
9536 2009-06-05  Doug Kwan  <dougkwan@google.com>
9537
9538         * object.cc (Sized_relobj::Sized_relobj): Initialize
9539         discarded_eh_frame_shndx_ to -1U.
9540         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9541         section.
9542         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9543         a discarded .eh_frame section.
9544         (Sized_relobj::do_finalize_local_symbols): Ditto.
9545         * object.h (class Sized_relobj): Declare new member
9546         discarded_eh_frame_shndx_.
9547         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9548         (local_labels_test.o, local_labels_test): New rules.
9549         * testsuite/Makefile.in: Regenerate.
9550
9551 2009-06-04  Doug Kwan  <dougkwan@google.com>
9552
9553         * layout.cc (Layout::section_name_mapping): Add mapping for
9554         special ARM sections.
9555
9556 2009-06-03  Doug Kwan  <dougkwan@google.com>
9557
9558         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9559         (utils::has_overflow): Same.
9560
9561 2009-06-03  Ian Lance Taylor  <iant@google.com>
9562
9563         * layout.cc (Layout::section_name_mapping): New array, replacing
9564         Layout::linkonce_mapping.
9565         (Layout::section_name_mapping_count): New variable, replacing
9566         Layout::linkonce_mapping_count.
9567         (Layout::linkonce_output_name): Remove.
9568         (Layout::output_section_name): Rewrite.
9569         * layout.h (class Layout): Rename Linkonce_mapping to
9570         Section_name_mapping, linkonce_mapping to section_name_mapping,
9571         linkonce_mapping_count to section_name_mapping_count.  Don't
9572         declare linkonce_output_name.
9573
9574 2009-06-03  Doug Kwan  <dougkwan@google.com>
9575
9576         * gold/arm.cc (namespace utils): New.
9577         (Target_arm::reloc_is_non_pic): Define new method.
9578         (class Arm_relocate_functions): New.
9579         (Target_arm::Relocate::relocate): Handle relocation types used by
9580         Android.
9581
9582 2009-06-03  Ian Lance Taylor  <iant@google.com>
9583
9584         * arm.cc (Target_arm::scan::global): Use || instead of |.
9585
9586 2009-06-02  Doug Kwan  <dougkwan@google.com>
9587
9588         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9589         issued_non_pic_error_.
9590         (class Target_arm::Scan): Declare new method check_non_pic.
9591         Define new method symbol_needs_plt_entry.
9592         Declare new data member issued_non_pic_error_.
9593         (class Target_arm::Relocate): Declare new method
9594         should_apply_static_reloc.
9595         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9596         (Target_arm::Scan::check_non_pic): Define new method.
9597         (Target_arm::Scan::local): Handle a small subset of reloc types used
9598         by Android.
9599         (Target_arm::Scan::local): Same.
9600         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9601
9602 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9603
9604         * incremental.cc (Incremental_inputs::report_command_line): Filter
9605         out --incremental-* options.
9606
9607 2009-05-29  Doug Kwan  <dougkwan@google.com>
9608
9609         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9610         template class.
9611         (class Target_arm): Update comment.
9612         (Target_arm::Target_arm): Initialize new data members GOT_,
9613         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9614         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9615         and Target_arm::rel_dyn_section.
9616         Declare new_enum Target_arm::Got_type.
9617         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9618         and DYNBSS_.
9619         Update commments for member do_dynsym_value.
9620         (Target_arm::got_size, Target_arm::plt_section,
9621         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9622         new methods inside class defintion.
9623         (Target_arm::got_section): Define new method.
9624         (Target_arm::rel_dyn_section): Same.
9625         (Output_data_plt_arm): New template class.
9626         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9627         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9628         (Output_data_plt_arm::add_entry): Same.
9629         (Output_data_plt_arm::first_plt_entry): Define new
9630         static data member for PLT instruction template.
9631         (Output_data_plt_arm::plt_entry): Same.
9632         (Output_data_plt_arm::do_write): Define new method.
9633         (Target_arm::make_plt_entry): Same.
9634         (Target_arm::do_finalize_sections): Same.
9635         (Target_arm::do_dynsym_value): Same.
9636
9637 2009-05-28  Doug Kwan  <dougkwan@google.com>
9638
9639         * Makefile.am (TARGETSOURCES): Add arm.cc.
9640         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9641         * Makefile.in: Regenerate.
9642         * arm.cc: New file.
9643         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9644
9645 2009-05-26  Doug Kwan  <dougkwan@google.com>
9646
9647         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9648         (General_options::check_excluded_libs): Strip off directories in
9649         archive name before matching like GNU ld does.
9650         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9651         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9652         (exclude_libs_test_LDFLAGS): Add linker option
9653         -Wl,--exclude-libs,libexclude_libs_test_3
9654         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9655         an explicit archive without using -l.
9656         (alt/libexclude_libs_test_3.a): New make rule.
9657         * testsuite/Makefile.in: Regenerate.
9658         * testsuite/exclude_libs_test.c : Declare lib3_default().
9659         (main): Call it.
9660         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9661         * exclude_libs_test_3.c: New file.
9662
9663 2009-05-26  Nick Clifton  <nickc@redhat.com>
9664
9665         * po/id.po: New Indonesian translation.
9666         * po/gold.pot: Updated template file.
9667
9668 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9669
9670         * testsuite/Makefile.am: Add -ffunction-sections to compile
9671         gc_comdat_test files.  Add -Wl,--gc-sections to build
9672         gc_comdat_test.
9673         * testsuite/Makefile.in: Regenerate.
9674         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9675
9676 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9677
9678         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9679         kept comdat section was garbage collected.
9680         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9681         * testsuite/Makefile.in: Regenerate.
9682         * testsuite/gc_comdat_test.sh: New file.
9683         * testsuite/gc_comdat_test_1.cc: New file.
9684         * testsuite/gc_comdat_test_2.cc: New file.
9685
9686 2009-05-19  Doug Kwan  <dougkwan@google.com>
9687
9688         * archive.cc (Archive::Archive): Move constructor from archive.h
9689         to here.  Initialize no_export_.
9690         (Archive::get_elf_object_for_member): Set no_export flag of object.
9691         * archive.h (Archive::Archive): Move constructor body to
9692         archive.cc.
9693         (Archive::no_export): New method.
9694         (Archive::no_export_): New field.
9695         * object.h (Object::Object): Initialize no_export_ to false.
9696         (Object::no_export, Object::set_no_export): New methods.
9697         (Object::no_export_): New field.
9698         * options.cc (General_options::parse_exclude_libs): New method.
9699         (General_options::check_excluded_libs) Same.
9700         * options.h (exclude_libs): New option.
9701         (General_options::check_excluded_libs): New method declaration.
9702         (General_options::excluded_libs_): New field.
9703         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9704         default or protected visibility if an object has no-export flag set.
9705         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9706         (check_SCRIPTS): Add exclude_libs_test.sh.
9707         (check_DATA): Add exclude_libs_test.syms.
9708         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9709         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9710         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9711         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9712         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9713         libexclude_libs_test_2.a): New rules.
9714         * testsuite/Makefile.in: Regenerate.
9715         * testsuite/exclude_libs_test.c: New file.
9716         * testsuite/exclude_libs_test.sh: Ditto.
9717         * testsuite/exclude_libs_test_1.c: Ditto.
9718         * testsuite/exclude_libs_test_2.c: Ditto.
9719
9720 2009-05-15  Ian Lance Taylor  <iant@google.com>
9721
9722         * configure.ac: Check for declarations for cases where libiberty.h
9723         checks HAVE_DECL_xxx.
9724         * configure, config.in: Rebuild.
9725
9726 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9727
9728         * gold.h (Incremental_argument_list): Remove (invalid) forward
9729         declaration.
9730         * incremental.cc (Incremental_inputs::report_achive): New method.
9731         (Incremental_inputs::report_object): New method.
9732         (Incremental_inputs::report_script): New method.
9733         (Incremental_inputs::finalize_inputs): New method.
9734         (Incremental_inputs::finalize): Call finalize_inputs().
9735         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9736         Create inputs entries.
9737         * incremental.h (Incremental_input_type): New enum.
9738         (Incremental_inputs::Incremental_input): Initialize new fields.
9739         (Incremental_inputs::report_inputs): New method.
9740         (Incremental_inputs::report_achive): New method.
9741         (Incremental_inputs::report_object): New method.
9742         (Incremental_inputs::report_script): New method.
9743         (Incremental_inputs::finalize_inputs): New method.
9744         (Incremental_inputs::Input_info): New struct.
9745         (Incremental_inputs::Input_info_map): New typedef.
9746         (Incremental_inputs::lock_): New field.
9747         (Incremental_inputs::Inputs_): New field.
9748         (Incremental_inputs::Inputs_map): New field.
9749         * main.cc (main): Call Incremental_input::report_inputs.
9750         * options.h (Input_argument_list): Typedef moved from
9751         Input_arguments.
9752         (Input_file_group::Files): Remove, use ::Input_argument_list.
9753         (Input_file_group::Input_argument_list): Remove, use
9754         ::Input_argument_list.
9755         * plugin.cc (Plugin_manager::add_input_file): Add error in
9756         incremental build.
9757         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9758         functions.
9759         * script.cc (read_input_script): Call
9760         Incremental_input::report_script.
9761         * script.h (Script_info): New class.
9762
9763 2009-04-27  Ian Lance Taylor  <iant@google.com>
9764
9765         * x86_64.cc (do_adjust_output_section): Set entsize to
9766         plt_entry_size.
9767
9768 2009-04-23  Elliott Hughes  <enh@google.com>
9769
9770         * output.cc (Output_file::close): After short writes, continue
9771         writing from the correct offset in the buffer being written.
9772
9773 2009-04-23  Chris Demetriou  <cgd@google.com>
9774
9775         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9776         * configure: Regenerate.
9777         * config.in: Regenerate.
9778         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9779         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9780
9781 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9782
9783         * incremental.cc (Incremental_inputs_header_data): Renamed from
9784         Incremental_input_header_data.
9785         (Incremental_inputs_header_data::data_size): New field.
9786         (Incremental_inputs_header_data::put_input_file_count): Renamed
9787         from input_file_count.
9788         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9789         from command_line_offset.
9790         (Incremental_inputs_header_data::put_reserved): Renamed from
9791         put_reserved.
9792         (Incremental_inputs_entry_data): Renamed from
9793         Incremental_input_entry_data.
9794         (Incremental_inputs_entry_data::data_size): New field.
9795         (Incremental_inputs::report_command_line): New method.
9796         (Incremental_inputs::finalize): New method.
9797         (Incremental_inputs::create_incremental_inputs_data): New method.
9798         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9799         * incremental.h: New file.
9800         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9801        (Layout::finalize): Create incremental inputs section in
9802         incremental builds.
9803        (Layout::create_incremental_info_sections): New method.
9804         * layout.h (Layout::incremental_inputs): New method.
9805        (Layout::create_incremental_info_sections): New method.
9806        (Layout::incremental_inputs_): New field.
9807         * main.cc (main): Notify Incremental_input of the command line.
9808
9809 2009-04-01  Ian Lance Taylor  <iant@google.com>
9810             Mikolaj Zalewski  <mikolajz@google.com>
9811
9812         * gold.h (reserve_unordered_map): Define, three versions, one for
9813         each version of Unordered_map.
9814         * layout.cc (Layout::Layout): Remove options parameter.  Add
9815         number_of_input_files parameter.  Don't initialize options_.
9816         Initialize number_of_input_files_ and resized_signatures_.  Move
9817         sections_are_attached_.
9818         (Layout::layout_group): Reserve space for group_signatures_.
9819         (Layout::find_or_add_kept_section): Change name parameter to be a
9820         reference.  Resize signatures_ map when it gets large enough.
9821         (Layout::layout_eh_frame): Use parameters->options() instead of
9822         this->options_.
9823         (Layout::make_output_section): Likewise.
9824         (Layout::attach_allocated_section_to_segment): Likewise.
9825         (Layout::finalize, Layout::create_executable_stack): Likewise.
9826         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9827         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9828         * layout.h (class Layout): Update declarations.  Remove options_
9829         field.  Add number_of_input_files_ and resized_signatures_
9830         fields.  Move sections_are_attached_ field.
9831         * main.cc (main): Pass number of input files to Layout
9832         constructor.  Don't pass options.
9833
9834 2009-03-30  Ian Lance Taylor  <iant@google.com>
9835
9836         * ffsll.c (ffsll): Correct implementation.
9837
9838 2009-03-27  Ian Lance Taylor  <iant@google.com>
9839
9840         * ffsll.c: New file.
9841         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9842         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9843         * ftruncate.c (ftruncate): Declare before definition.
9844         * mremap.c (mremap): Likewise.
9845         * pread.c (pread): Likewise.
9846         * configure, Makefile.in, config.in: Rebuild.
9847
9848         * mremap.c: New file.
9849         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9850         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9851         (mremap): Declare if HAVE_MREMAP is not defined.
9852         * configure, Makefile.in, config.in: Rebuild.
9853
9854 2009-03-27  Cary Coutant  <ccoutant@google.com>
9855
9856         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9857         position independent.
9858         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9859         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9860
9861 2009-03-24  Cary Coutant  <ccoutant@google.com>
9862
9863         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9864         an executable.
9865         (needs_dynamic_reloc): Likewise.
9866
9867 2009-03-24  Ian Lance Taylor  <iant@google.com>
9868
9869         * yyscript.y (file_cmd): Recognize EXTERN.
9870         (extern_name_list, extern_name_list_body): New nonterminals.
9871         * script.cc (script_add_extern): Define.
9872         * script-c.h (script_add_extern): Declare.
9873
9874 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9875
9876         * object.cc (is_elf_object): Define.
9877         * object.h (is_elf_object): Declare.
9878         * archive.cc (Archive::get_elf_object_for_member): Call
9879         is_elf_object.
9880         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9881
9882 2009-03-24  Elliott Hughes  <enh@google.com>
9883
9884         * output.cc (Output_file::map_anonymous): Define.
9885         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9886         try an anonymous one.  Report the size if the mmap fails.
9887         * output.h (class Output_file): Declare map_anonymous.
9888
9889 2009-03-24  Ian Lance Taylor  <iant@google.com>
9890
9891         * target-select.cc (instantiate_target): Don't acquire the lock if
9892         the instantiated_target_ field has already been set.
9893
9894 2009-03-23  Ian Lance Taylor  <iant@google.com>
9895
9896         * gold-threads.h (class Initialize_lock): Define.
9897         * gold-threads.cc (class Initialize_lock_once): Define.
9898         (initialize_lock_control): New static variable.
9899         (initialize_lock_pointer): New static variable.
9900         (initialize_lock_once): New static function.
9901         (Initialize_lock::Initialize_lock): Define.
9902         (Initialize_lock::initialize): Define.
9903         * target-select.h: Include "gold-threads.h".
9904         (class Target_selector): Add lock_ and initialize_lock_ fields.
9905         Don't define instantiate_target, just declare it.
9906         * target-select.cc (Target_selector::Target_selector): Initialize
9907         new fields.
9908         (Target_selector::instantiate_target): Define.
9909         * descriptors.h: Include "gold-threads.h".
9910         (class Descriptors): Add initialize_lock_ field.
9911         * descriptors.cc (Descriptors::Descriptors): Initialize new
9912         field.
9913         (Descriptors::open): Use initialize_lock_ field
9914         * errors.h (class Errors): Add initialize_lock_ field.
9915         * errors.cc (Errors::Errors): Initialize new field.
9916         (Errors::initialize_lock): Use initialize_lock_ field.
9917         * powerpc.cc (class Target_selector_powerpc): Remove
9918         instantiated_target_ field.  In do_recognize call
9919         instantiate_target rather than do_instantiate_target.  In
9920         do_instantiate_target just allocate a new target.
9921         * sparc.cc (class Target_selector_sparc): Likewise.
9922
9923         * freebsd.h: New file.
9924         * i386.cc: Include "freebsd.h".
9925         (Target_i386): Derive from Target_freebsd rather than
9926         Sized_target.
9927         (Target_selector_i386): Derive from Target_selector_freebsd rather
9928         than Target_selector.
9929         * x86_64.cc: Include "freebsd.h".
9930         (Target_x86_64): Derive from Target_freebsd rather than
9931         Sized_target.
9932         (Target_selector_x86_64): Derive from Target_selector_freebsd
9933         rather than Target_selector.
9934         * target.h (class Target): Add adjust_elf_header and
9935         do_adjust_elf_header.
9936         * output.cc (Output_file_header:: do_sized_write): Call target
9937         adjust_elf_header routine.
9938         * configure.tgt: Set targ_osabi.
9939         * configure.ac: Define GOLD_DEFAULT_OSABI.
9940         * parameters.cc (Parameters::default_target): Pass
9941         GOLD_DEFAULT_OSABI to select_target.
9942         * target-select.h (class Target_selector): Make instantiate_target
9943         protected rather than private.
9944         * Makefile.am (HFILES): Add freebsd.h.
9945         * configure, Makefile.in, config.in: Rebuild.
9946
9947         * merge.cc (do_add_input_section): Correct pend value.  Change
9948         message about last entry not being null terminated from error to
9949         warning.
9950
9951 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9952
9953         * incremental.cc: New file.
9954         * Makefile.am (CCFILES): Add incremental.cc.
9955         * Makefile.in: Rebuild.
9956
9957 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9958
9959         * layout.cc (Layout::output_section_name): Preserve names
9960         of '.note.' sections.
9961
9962 2009-03-19  Ian Lance Taylor  <iant@google.com>
9963
9964         * descriptors.cc (Descriptors::open): Check that the options are
9965         valid before using them.
9966
9967 2009-03-18  Ian Lance Taylor  <iant@google.com>
9968
9969         * script-sections.h: Include <list>.
9970         (class Script_sections): Change Sections_elements from std::vector
9971         to std::list.  Typedef public Elements_iterator.  Add
9972         orphan_section_placement_, data_segment_align_start_, and
9973         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9974         field.
9975         * script-sections.cc (class Orphan_section_placement): New class.
9976         (class Sections_element): Add virtual functions is_relro and
9977         orphan_section_init.  Remove virtual function place_orphan_here.
9978         (class Output_section_definition): Add is_relro and
9979         orphan_section_init.  Remove place_orphan_here.
9980         (class Orphan_output_section): Likewise.
9981         (Script_sections::Script_sections): Update for field changes.
9982         (Script_sections::data_segment_align): Set saw_data_segment_align_
9983         and data_segment_align_start_, not data_segment_align_index.
9984         (Script_sections::data_segment_relro_end): Check
9985         saw_data_segment_align_.  Use data_segment_align_start_ rather
9986         than data_segment_align_index_.
9987         (Script_sections::place_orphan): Rewrite to use
9988         Orphan_section_placement.
9989
9990 2009-03-17  Ian Lance Taylor  <iant@google.com>
9991
9992         * archive.cc (Archive::add_symbols): Check for a version attached
9993         to the symbol name in the archive map.
9994         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9995         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9996         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9997         (ver_test_11.a): New target.
9998         * testsuite/Makefile.in: Rebuild.
9999
10000         * configure.ac: Check for chsize and posix_fallocate.  Replace
10001         ftruncate.
10002         * ftruncate.c: New file, from gnulib.
10003         * output.cc (posix_fallocate): Define dummy version if not
10004         HAVE_POSIX_FALLOCATE.
10005         (Output_file::map): Call posix_fallocate rather than lseek and
10006         write.
10007         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10008         * configure, Makefile.in, config.in: Rebuild.
10009
10010 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10011
10012         * layout.h (Layout::create_note): Add section_name parameter.
10013         * layout.cc (Layout::create_note): Likewise.
10014         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10015
10016 2009-03-17  Ian Lance Taylor  <iant@google.com>
10017
10018         * descriptors.cc: Include "options.h".
10019         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10020         (Descriptors::open): Always use O_CLOEXEC when opening a new
10021         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10022         then set FD_CLOEXEC.
10023
10024         * sparc.cc (class Target_sparc): Add has_got_section.
10025         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10026         make sure we have a GOT section.
10027
10028         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10029         (Target_sparc::Scan::local): Likewise.
10030         (Target_sparc::Scan::global): Likewise.
10031         (Target_sparc::Relocate::relocate): Likewise.
10032         (Target_sparc::Relocate::relocate_tls): Likewise.
10033
10034         * symtab.cc (Symbol_table::define_default_version): New function,
10035         broken out of add_from_object.
10036         (Symbol_table::add_from_object): Call define_default_version.
10037         (Symbol_table::define_special_symbol): Add resolve_oldsym
10038         parameter.  Change all callers.  If the version for a symbol comes
10039         from a version script, resolve it with the symbol with the same
10040         name with no version.  Also add the symbol without a version if
10041         appropriate.
10042         (do_define_in_output_data): If resolving with oldsym, don't delete
10043         sym.
10044         (do_define_in_output_segment): Likewise.
10045         (do_define_as_constant): Likewise.
10046         * symtab.h (class Symbol_table): Update declarations.
10047
10048 2009-03-13  Ian Lance Taylor  <iant@google.com>
10049
10050         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10051         (Read_symbols::requeue): New function.
10052         (Read_symbols::do_read_symbols): If make_elf_object fails because
10053         the target type is not configured, and the file was searched for,
10054         issue a warning and retry with the next directory.
10055         (Add_symbols::run): If the file has an incompatible format, and
10056         it was searched for, requeue the Read_symbols task.  On error,
10057         release the object.
10058         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10059         dirindex parameter to constructor.  Change all callers.  Declare
10060         incompatible_warning and requeue.
10061         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10062         input_argument_ and input_group_ fields.  Add them to
10063         constructor.  Change all callers.
10064         (class Read_script): Add dirindex_ field.  Add it to constructor.
10065         Change all callers.
10066         * archive.cc (Archive::setup): Remove input_objects parameter.
10067         Change all callers.
10068         (Archive::get_file_and_offset): Likewise.
10069         (Archive::read_all_symbols): Likewise.
10070         (Archive::read_symbols): Likewise.
10071         (Archive::get_elf_object_for_member): Remove input_objects
10072         parameter.  Add punconfigured parameter.  Change all callers.
10073         (Archive::add_symbols): Change return type to bool.  Check return
10074         value of include_member.
10075         (Archive::include_all_members): Likewise.
10076         (Archive::include_member): Change return type to bool.  Return
10077         false if first included object has incompatible target.  Set
10078         included_member_ field.
10079         (Add_archive_symbols::run): If add_symbols returns false, requeue
10080         Read_symbols task.
10081         * archive.h (class Archive): Add included_member_ field.
10082         Initialize it in constructor.  Add input_file and searched_for
10083         methods.  Update declarations.
10084         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10085         input_argument_ fields.  Add them to constructor.  Change all
10086         callers.
10087         * script.cc: Include "target-select.h".
10088         (class Parser_closure): Add skip_on_incompatible_target_ and
10089         found_incompatible_target_ fields.  Add
10090         skip_on_incompatible_target parameter to constructor.  Change all
10091         callers.  Add methods skip_on_incompatible_target,
10092         clear_skip_on_incompatible_target, found_incompatible_target, and
10093         set_found_incompatible_target.
10094         (read_input_script): Add dirindex parameter.  Change all callers.
10095         If parser finds an incompatible target, requeue Read_symbols
10096         task.
10097         (script_set_symbol): Clear skip_on_incompatible_target in
10098         closure.
10099         (script_add_assertion, script_parse_option): Likewise.
10100         (script_start_sections, script_add_phdr): Likewise.
10101         (script_check_output_format): New function.
10102         * script.h (read_input_script): Update declaration.
10103         * script-c.h (script_check_output_format): Declare.
10104         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10105         (ignore_cmd): Remove OUTPUT_FORMAT.
10106         * fileread.cc (Input_file::Input_file): Add explicit this.
10107         (Input_file::will_search_for): New function.
10108         (Input_file::open): Add pindex parameter.  Change all callers.
10109         * fileread.h (class Input_file): Add input_file_argument method.
10110         Declare will_search_for.  Update declarations.
10111         * object.cc (make_elf_object): Add punconfigured parameter.
10112         Change all callers.
10113         * object.h (class Object): Make input_file public.  Add
10114         searched_for method.
10115         (make_elf_object): Update declaration.
10116         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10117         restart search.
10118         * dirsearch.h (class Dirsearch): Update declaration.
10119         * options.h (class General_options): Add --warn-search-mismatch.
10120         * parameters.cc (Parameters::is_compatible_target): New function.
10121         * parameters.h (class Parameters): Declare is_compatible_target.
10122         * workqueue.cc (Workqueue::add_blocker): New function.
10123         * workqueue.h (class Workqueue): Declare add_blocker.
10124
10125         * fileread.cc (Input_file::open): Remove options parameter.
10126         Change all callers.
10127         (Input_file::open_binary): Likewise.
10128         * script.cc (read_input_script): Likewise.
10129         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10130         options parameter from constructor.  Change all callers.
10131         (class Read_script): Likewise.
10132         * fileread.h (class Input_file): Update declarations.
10133         * script.h (read_input_script): Update declaration.
10134
10135 2009-03-10  Nick Clifton  <nickc@redhat.com>
10136
10137         * po/es.po: New Spanish translation.
10138
10139 2009-03-06  Cary Coutant  <ccoutant@google.com>
10140
10141         * options.cc (parse_short_option): Keep dash_z from registering itself.
10142
10143 2009-03-03  Ian Lance Taylor  <iant@google.com>
10144
10145         PR 9918
10146         * target-reloc.h (relocate_section): Pass output_section to
10147         relocate.
10148         * i386.cc (Target_i386::should_apply_static_reloc): Add
10149         output_section parameter.  Change all callers.
10150         (Target_i386::Relocate::relocate): Add output_section parameter.
10151         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10152         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10153         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10154         * testsuite/two_file_shared.sh: New script.
10155         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10156         (check_DATA): Add two_file_shared.dbg.
10157         (two_file_shared.dbg): New target.
10158         * testsuite/Makefile.in: Rebuild.
10159
10160 2009-03-01  Ian Lance Taylor  <iant@google.com>
10161
10162         * configure.ac: Check for byteswap.h.
10163         * configure: Rebuild.
10164         * config.in: Rebuild.
10165
10166 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10167
10168         * layout.cc (Layout::find_or_add_kept_section): New function.
10169         (Layout::add_comdat): Removed.
10170         * layout.h (struct Kept_section): Move out of class Layout.
10171         Remove trailing underscores from field names.  Add group_sections
10172         field.  Rename group_ field to is_group.  Change all uses.
10173         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10174         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10175         comdat_groups_ field.
10176         (Sized_relobj::include_section_group): Use
10177         find_or_add_kept_section and Kept_section::group_sections.
10178         (Sized_relobj::include_linkonce_section): Likewise.
10179         * object.cc (class Sized_relobj): Don't define Comdat_group or
10180         Comdat_group_table.  Remove find_comdat_group and
10181         add_comdat_group.  Remove comdat_groups_ field.
10182         * plugin.cc (include_comdat_group): Use
10183         Layout::find_or_add_kept_section.
10184
10185 2009-02-28  Ian Lance Taylor  <iant@google.com>
10186
10187         * README: --gc-sections and map files are now supported.  Document
10188         some build requirements.
10189
10190         PR 6992
10191         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10192         relocatable link set the value of the section symbol to zero.
10193         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10194         relocatable link don't include the section address in the local
10195         symbol value.
10196
10197 2009-02-27  Ian Lance Taylor  <iant@google.com>
10198
10199         PR 6811
10200         * options.h (class Search_directory): Add is_system_directory.
10201         (class General_options): Declare is_in_system_directory.
10202         * options.cc (get_relative_sysroot): Make static.
10203         (get_default_sysroot): Make static.
10204         (General_optoins::is_in_system_directory): New function.
10205         * fileread.cc (Input_file::is_in_system_directory): New function.
10206         * fileread.h (class Input_file): Declare is_in_system_directory.
10207         * object.h (class Object): Add is_in_system_directory.
10208         (class Input_objects): Remove system_library_directory_ field.
10209         * object.cc (Input_objects::add_object): Don't set
10210         system_library_directory_.
10211         (input_objects::found_in_system_library_directory): Remove.
10212         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10213         parameter.  Change all callers.
10214         (Symbol_table::sized_write_globals): Likewise.
10215         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10216         Call Object::is_in_system_directory.
10217         * symtab.h (class Symbol_table): Update declarations.
10218
10219         PR 5990
10220         * descriptors.h (Open_descriptor): Add is_on_stack field.
10221         * descriptors.cc (Descriptors::open): If the descriptor is on the
10222         top of the stack, remove it.  Initialize is_on_stack field.
10223         (Descriptors::release): Only add pod to stack if it is not on the
10224         stack already.
10225         (Descriptors::close_some_descriptor): Clear stack_next and
10226         is_on_stack fields.
10227
10228         PR 7091
10229         * output.cc (Output_section::find_starting_output_address): Rename
10230         from starting_output_address; add PADDR parameter; change return
10231         type.
10232         * output.h (class Output_section): Declare
10233         find_starting_output_address instead of starting_output_address.
10234         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10235         section symbol for which we can't find a merge section.
10236
10237         PR 9836
10238         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10239         hidden or internal, force the symbol to be local.
10240         * resolve.cc (Symbol::override_visibility): Define.
10241         (Symbol::override_base): Use override_visibility.
10242         (Symbol_table::resolve): Likewise.
10243         (Symbol::override_base_with_special): Likewise.
10244         (Symbol_table::override_with_special): If the visibility is hidden
10245         or internal, force the symbol to be local.
10246         * symtab.h (class Symbol): Add set_visibility and
10247         override_visibility.
10248         * testsuite/ver_test_1.sh: New file.
10249         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10250         (check_DATA): Add ver_test_1.syms.
10251         (ver_test_1.syms): New target.
10252         * testsuite/Makefile.in: Rebuild.
10253
10254 2009-02-25  Cary Coutant  <ccoutant@google.com>
10255
10256         * layout.cc (Layout::choose_output_section): Don't rename sections
10257         when using a linker script that has a SECTIONS clause.
10258         * Makefile.in: Regenerate.
10259
10260         * testsuite/Makefile.am (script_test_5.sh): New test case.
10261         * testsuite/Makefile.in: Regenerate.
10262         * testsuite/script_test_5.cc: New file.
10263         * testsuite/script_test_5.sh: New file.
10264         * testsuite/script_test_5.t: New file.
10265
10266 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10267
10268         * archive.cc (Archive::include_member): Update calls to add_symbols.
10269         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10270         the Layout argument.
10271         * dynobj.h (do_add_symbols): Add the Layout argument.
10272         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10273         Layout argument.
10274         * object.h (Object::add_symbols): Add the Layout argument.
10275         (Object::do_add_symbols): Add the Layout argument.
10276         (Sized_relobj::do_add_symbols): Add the Layout argument.
10277         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10278         Unify the two versions.
10279         (Add_plugin_symbols): Remove.
10280         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10281         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10282         (Add_plugin_symbols): Remove.
10283         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10284         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10285         (Add_symbols::run): Make it work with Pulginobj.
10286
10287 2009-02-06  Ian Lance Taylor  <iant@google.com>
10288
10289         * object.cc (Sized_relobj::do_layout): Make info message start
10290         with lower case letter.
10291
10292 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10293
10294         * binary.cc: Fix file comment.
10295
10296         * options.h (enum Incremental_disposition): Define.
10297         (class General_options): Add new options: --incremental,
10298         --incremental_changed, --incremental_unchanged,
10299         --incremental_unknown.  Add incremental_disposition_ and
10300         implicit_incremental_ fields.
10301         (General_options::incremental_disposition): New function.
10302         (class Position_dependent_options): Add incremental_disposition
10303         option.
10304         (Position_dependent_options::copy_from_options): Set incremental
10305         dispositions.
10306         * options.cc (General_options::parse_incremental_changed): New
10307         function.
10308         (General_options::parse_incremental_unchanged): New function.
10309         (General_options::parse_incremental_unknown): New function.
10310         (General_options::General_options): Initialize new fields
10311         incremental_disposition_ and implicit_incremental_.
10312         (General_options::finalize): Check for uasge of --incremental-*
10313         without --incremental.
10314
10315 2009-02-06  Chris Demetriou  <cgd@google.com>
10316
10317         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10318         pointer and to report location as the file name associated with
10319         the symbol.
10320         (gold_undefined_symbol_at_location): New function to replace the
10321         old gold_undefined_symbol functionality.
10322         * target-reloc.h (relocate_section): Update to use
10323         gold_undefined_symbol_at_location.
10324         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10325         Call gold_undefined_symbol function rather than gold_error.
10326         * errors.h (Errors::undefined_symbol): Take location as a
10327         string, rather than calculating it from a relocation.
10328         * errors.cc (Errors::fatal): Print "fatal error:" before the
10329         formatted message.
10330         (Errors::error, Errors::error_at_location): Print "error: "
10331         before the formatted message.
10332         (Errors::undefined_symbol): Take location as a string, rather
10333         than calculating it from a relocation.
10334         (gold_undefined_symbol_at_location): New function akin to
10335         old gold_undefined_symbol, calculates location from relocation.
10336         (gold_undefined_symbol): Change to take only a Symbol pointer
10337         and to report location as the file name associated with the symbol.
10338         * testsuite/debug_msg.sh: Update for changed error messages.
10339         * testsuite/undef_symbol.sh: Likewise.
10340
10341 2009-02-04  Duncan Sands  <baldrick@free.fr>
10342
10343         PR 9812
10344         * reduced_debug_output.h
10345         (Output_reduced_debug_abbrev_section::failed): Use format for
10346         gold_warning.
10347         (Output_reduced_debug_info_section::faild): Likewise.
10348
10349 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10350
10351         * script.cc (Lazy_demangler): New class.
10352         (Version_script_info::get_symbol_version_helper): Demangle a
10353         symbol only once.
10354
10355 2009-01-29  Cary Coutant  <ccoutant@google.com>
10356
10357         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10358         to __tls_get_addr.
10359         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10360
10361 2009-01-28  Ian Lance Taylor  <iant@google.com>
10362
10363         * version.cc (version_string): Bump to 1.9.
10364
10365         * gold.h: Include <cstring> and <stdint.h>.
10366         * version.cc: Include <cstdio>.
10367         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10368         warning.
10369         * reduced_debug_output.cc (insert_into_vector): Rename from
10370         Insert_into_vector; change all callers.  Use Swap_unaligned to
10371         avoid aliasing issue; remove union since it is unnecessary.
10372
10373 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10374
10375         * Makefile.am (CCFILES): Add gc.cc.
10376         (HFILES): Add gc.h.
10377         * Makefile.in: Regenerate.
10378         * gold.cc (Gc_runner): New class.
10379         (queue_initial_tasks): Call garbage collection related tasks
10380         when corresponding options are invoked.
10381         (queue_middle_gc_tasks): New function.
10382         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10383         processed early before laying out sections during garbage collection.
10384         * gold.h (queue_middle_gc_tasks): New function.
10385         (is_prefix_of): Move from "layout.cc".
10386         * i386.cc (Target_i386::gc_process_relocs): New function.
10387         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10388         * main.cc (main): Create object of class "Garbage_collection".
10389         * object.cc (Relobj::copy_symbols_data): New function.
10390         (Relobj::is_section_name_included): New function.
10391         (Sized_relobj::do_layout): Allow this function to be called twice
10392         during garbage collection and defer layout of section during the
10393         first call.
10394         * object.h (Relobj::get_symbols_data): New function.
10395         (Relobj::is_section_name_included): New function.
10396         (Relobj::copy_symbols_data): New function.
10397         (Relobj::set_symbols_data): New function.
10398         (Relobj::get_relocs_data): New function.
10399         (Relobj::set_relocs_data): New function.
10400         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10401         (Relobj::gc_process_relocs): New function.
10402         (Relobj::do_gc_process_relocs): New pure virtual function.
10403         (Relobj::sd_): New data member.
10404         (Sized_relobj::is_output_section_offset_invalid): New function.
10405         (Sized_relobj::do_gc_process_relocs): New function.
10406         * options.h (General_options::gc_sections): Modify to not be a no-op.
10407         (General_options::print_gc_sections): New option.
10408         * plugin.cc (Plugin_finish::run): Remove function call to
10409         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10410         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10411         * reloc.cc (Read_relocs::run): Add task to process relocs and
10412         determine unreferenced sections when doing garbage collection.
10413         (Gc_process_relocs): New class.
10414         (Sized_relobj::do_gc_process_relocs): New function.
10415         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10416         sections that are garbage collected.
10417         * reloc.h (Gc_process_relocs): New class.
10418         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10419         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10420         symbols whose corresponding sections are garbage collected.
10421         (Symbol_table::Symbol_table): Add new parameter for the garbage
10422         collection object.
10423         (Symbol_table::gc_mark_undef_symbols): New function.
10424         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10425         (Symbol_table::gc_mark_dyn_syms): New function.
10426         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10427         as garbage.
10428         (Symbol_table::add_from_object): Likewise.
10429         (Symbol_table::add_from_relobj): When building shared objects, do not
10430         treat externally visible symbols as garbage.
10431         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10432         table information for static and relocatable links.
10433         * symtab.h (Symbol_table::set_gc): New function.
10434         (Symbol_table::gc): New function.
10435         (Symbol_table::gc_mark_undef_symbols): New function.
10436         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10437         (Symbol_table::gc_mark_dyn_syms): New function.
10438         (Symbol_table::gc_): New data member.
10439         * target.h (Sized_target::gc_process_relocs): New pure virtual
10440         function.
10441         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10442         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10443
10444 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10445
10446         * options.h (General_options::gc_sections): Define as a no-op for now.
10447         (General_options::no_keep_memory): Ditto.
10448         (General_options::Bshareable): Define.
10449         * options.cc (General_options::finalize): Honor -Bshareable.
10450
10451 2009-01-20  Andreas Schwab  <schwab@suse.de>
10452
10453         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10454         read the value in the contents, since we don't use it.  Use the
10455         template endianness when writing.
10456         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10457
10458 2009-01-19  Andreas Schwab  <schwab@suse.de>
10459
10460         * configure.tgt (powerpc64-*): Fix targ_obj.
10461
10462 2009-01-15  Ian Lance Taylor  <iant@google.com>
10463
10464         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10465         local symbols when stripping all symbols.
10466
10467 2009-01-14  Cary Coutant  <ccoutant@google.com>
10468
10469         * output.cc (Output_reloc): Add explicit instantiations.
10470
10471 2009-01-14  Cary Coutant  <ccoutant@google.com>
10472
10473         * archive.cc (Archive::get_elf_object_for_member): Remove call
10474         to File_read::claim_for_plugin.
10475         * descriptors.cc (Descriptors::open): Remove reference to
10476         is_claimed.
10477         (Descriptors::claim_for_plugin): Remove.
10478         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10479         (Descriptors::is_claimed): Remove.
10480         (claim_descriptor_for_plugin): Remove.
10481         * fileread.cc (File_read::claim_for_plugin): Remove.
10482         * fileread.h (File_read::claim_for_plugin): Remove.
10483         (File_read::descriptor): Reopen descriptor if necessary.
10484         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10485         (Plugin_manager::all_symbols_read): Add task parameter. Change
10486         all callers.
10487         (Plugin_manager::get_input_file): New function.
10488         (Plugin_manager::release_input_file): New function.
10489         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10490         corresponding data member.
10491         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10492         and pass to base constructor. Change all callers.
10493         (get_input_file, release_input_file): New functions.
10494         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10495         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10496         (Plugin_manager::all_symbols_read): Add task parameter.
10497         (Plugin_manager::get_input_file): New function.
10498         (Plugin_manager::release_input_file): New function.
10499         (Plugin_manager::task_): New data member.
10500         (Pluginobj::Pluginobj): Add filesize parameter.
10501         (Pluginobj::filename): New function.
10502         (Pluginobj::descriptor): New function.
10503         (Pluginobj::filesize): New function.
10504         (Pluginobj::filesize_): New data member.
10505         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10506         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10507         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10508
10509         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10510         with archive libraries.
10511         * testsuite/Makefile.in: Regenerate.
10512         * testsuite/plugin_test.c (struct sym_info): New type.
10513         (get_input_file, release_input_file): New static variables.
10514         (onload): Capture new transfer vector entries.
10515         (claim_file_hook): Stop reading at end of file according to filesize.
10516         Factor out parsing of readelf output into separate function.
10517         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10518         APIs and get the source file name from the symbol table.  Convert
10519         source file name to corresponding object file name.  Print info
10520         message when adding new input files.
10521         (parse_readelf_line): New function.
10522         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10523         * testsuite/plugin_test_2.sh: Likewise.
10524         * testsuite/plugin_test_3.sh: Likewise.
10525         * testsuite/plugin_test_4.sh: New test case.
10526
10527 2009-01-07  Ian Lance Taylor  <iant@google.com>
10528
10529         * version.cc (version_string): Bump to 1.8.
10530
10531 2008-12-23  Cary Coutant  <ccoutant@google.com>
10532
10533         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10534         * plugin.cc (Plugin_manager::finish): Rename as
10535         layout_deferred_objects.  Move cleanup to separate function.
10536         (Plugin_manager::cleanup): New function.
10537         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10538         separately.
10539         * plugin.h (Plugin_manager::finish): Rename as
10540         layout_deferred_objects.
10541         (Plugin_manager::cleanup): New function.
10542         (Plugin_manager::cleanup_done): New field.
10543
10544 2008-12-23  Cary Coutant  <ccoutant@google.com>
10545
10546         * plugin.cc (is_visible_from_outside): New function.
10547         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10548         so we don't return "IR only" status for exported symbols or -r links.
10549
10550         * testsuite/Makefile.am (plugin_test_3): New test case.
10551         * testsuite/Makefile.in: Regenerate.
10552         * testsuite/plugin_test_3.sh: New file.
10553
10554 2008-12-22  Cary Coutant  <ccoutant@google.com>
10555
10556         * object.cc (Sized_relobj::layout_section): New function.
10557         (Sized_relobj::do_layout): Defer layout of input sections until after
10558         plugin has provided replacement files.
10559         (Sized_relobj::do_layout_deferred_sections): New function.
10560         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10561         (Relobj::layout_deferred_sections): New function.
10562         (Relobj::do_layout_deferred_sections): New function.
10563         (Sized_relobj::do_layout_deferred_sections): New function.
10564         (Sized_relobj::layout_section): New function.
10565         (Sized_relobj::Deferred_layout): New structure.
10566         (Sized_relobj::deferred_layout_): New field.
10567         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10568         Change all callers.  Layout deferred sections.
10569         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10570         references.
10571         (Plugin_hook::run): Move code from do_plugin_hook inline.
10572         (Plugin_hook::do_plugin_hook): Remove.
10573         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10574         (Plugin_manager::finish): Renamed, was cleanup.
10575         (Plugin_manager::should_defer_layout): New function.
10576         (Plugin_manager::add_deferred_layout_object): New function.
10577         (Plugin_manager::Deferred_layout_list): New type.
10578         (Plugin_manager::deferred_layout_objects_): New field.
10579         (Plugin_hook::do_plugin_hook): Remove.
10580
10581 2008-12-17  Ian Lance Taylor  <iant@google.com>
10582
10583         * options.h (class General_options): Add --no case for
10584         --export-dynamic.
10585
10586 2008-12-16  Cary Coutant  <ccoutant@google.com>
10587
10588         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10589         vector.
10590         (Plugin_manager::claim_file): Create plugin object even if
10591         plugin did not call the add_symbols callback.
10592         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10593         asking for more symbols than were added.
10594         * testsuite/Makefile.am (plugin_test_1): Add test case with
10595         no global symbols.
10596         (empty.syms): New target.
10597         * testsuite/Makefile.in: Regenerate.
10598         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10599         message. Don't call add_symbols if no globals.
10600         (all_symbols_read_hook): Don't provide replacement for empty
10601         claimed file.
10602
10603 2008-12-12  Ian Lance Taylor  <iant@google.com>
10604
10605         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10606         r_type == 0 for a local symbol with r_sym == 0.
10607         (scan_relocatable_relocs): Pass r_sym to
10608         local_non_section_strategy.
10609         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10610         r_sym parameter.
10611
10612         * configure.ac: Update test for TLS descriptors: they are
10613         supported as of glibc 2.9.
10614         * configure: Rebuild.
10615
10616 2008-12-11  Ian Lance Taylor  <iant@google.com>
10617
10618         PR 7091
10619         * target-reloc.h (Default_scan_relocatable_relocs): For each
10620         function, map r_type == 0 to RELOC_DISCARD.
10621
10622 2008-12-10  Cary Coutant  <ccoutant@google.com>
10623
10624         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10625         object to override a kept COMDAT group from a plugin object.
10626
10627 2008-12-09  Ian Lance Taylor  <iant@google.com>
10628
10629         PR 7088
10630         * yyscript.y (file_cmd): Handle INPUT.
10631
10632         * testsuite/initpri1.c: Change all declarations to be full
10633         prototypes by adding void, to avoid compiler warnings.
10634
10635 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10636
10637         * options.cc (General_options::parse_plugin_opt): New.
10638         (General_options::add_plugin): The argument now is just the filename.
10639         (General_options::add_plugin_option): New.
10640         * options.h (plugin_opt): New.
10641         (add_plugin): Change argument name.
10642         (add_plugin_option): New.
10643         * plugin.cc (Plugin::load): Don't parse the plugin option.
10644         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10645         (Plugin::add_option): New.
10646         (Plugin::args_): Change type.
10647         (Plugin::filename_): New.
10648         (Plugin_manager::add_plugin_option): New.
10649         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10650         * testsuite/Makefile.in: Regenerate.
10651
10652 2008-12-05  Cary Coutant  <ccoutant@google.com>
10653
10654         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10655         Handle --strip-lto-sections option.
10656         * options.h (strip_lto_sections): New option.
10657
10658 2008-12-01  Cary Coutant  <ccoutant@google.com>
10659
10660         * plugin.cc (ld_plugin_message): Change format parameter to const.
10661         Fix mismatch between new[] and delete.
10662
10663 2008-11-14  Cary Coutant  <ccoutant@google.com>
10664
10665         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10666         instead of -1U.
10667
10668 2008-11-05  Craig Silverstein  <csilvers@google.com>
10669
10670         * options.cc (General_options::parse_dynamic_list): New function.
10671         * options.h (General_options): New flags dynamic_list,
10672         dynamic_list_data, dynamic_list_cpp_new, and
10673         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10674         (General_options::in_dynamic_list): New function.
10675         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10676         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10677         (Lex::can_continue_name): Likewise.
10678         (yylex): Likewise.
10679         (read_script_file): New parameter script_options.
10680         (read_dynamic_list): New function.
10681         (Script_options::define_dynamic_list): New function.
10682         (dynamic_list_keyword_parsecodes): New variable.
10683         (dynamic_list_keywords): New variable.
10684         * script.h (Script_options::define_dynamic_list): New function
10685         prototype.
10686         (read_dynamic_list): New function prototype.
10687         * symtab.cc (strprefix): New macro.
10688         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10689         dynamic_list_data, dynamic_list_cpp_new, and
10690         dynamic_list_cpp_typeinfo.
10691         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10692         (dynamic_list_expr): New rule.
10693         (dynamic_list_nodes): Likewise.
10694         (dynamic_list_node): Likewise.
10695         * testsuite/Makefile.am (dynamic_list): New test.
10696         * testsuite/Makefile.in: Regenerated.
10697         * testsuite/dynamic_list.t: New file.
10698         * testsuite/dynamic_list.sh: New file.
10699
10700 2008-11-05  Craig Silverstein  <csilvers@google.com>
10701
10702         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10703         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10704         (t11_last): Likewise.
10705         * testsuite/ver_test_6.c (main): Likewise.
10706
10707 2008-10-07  Cary Coutant  <ccoutant@google.com>
10708
10709         * options.c (General_options::finalize): Add check for -static and
10710         -shared.
10711         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10712         is not empty.
10713
10714 2008-10-02  Cary Coutant  <ccoutant@google.com>
10715
10716         * plugin.cc (make_sized_plugin_object): Fix conditional
10717         compilation to work when not all targets are enabled.
10718
10719 2008-09-29  Cary Coutant  <ccoutant@google.com>
10720
10721         * archive.cc (Archive::get_file_and_offset): Use filename instead
10722         of name to get library path.
10723         (Archive::include_member): Unlock external member of a thin archive.
10724
10725         * testsuite/Makefile.am (TEST_AR): New variable.
10726         (thin_archive_test_1): New test.
10727         (thin_archive_test_2): New test.
10728         * testsuite/Makefile.in: Regenerate.
10729         * testsuite/thin_archive_main.cc: New file.
10730         * testsuite/thin_archive_test_1.cc: New file.
10731         * testsuite/thin_archive_test_2.cc: New file.
10732         * testsuite/thin_archive_test_3.cc: New file.
10733         * testsuite/thin_archive_test_4.cc: New file.
10734
10735 2008-09-29  Cary Coutant  <ccoutant@google.com>
10736
10737         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10738         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10739         instead of -1U.
10740         (Sized_relobj::do_finalize_local_symbols): Likewise.
10741         (Sized_relobj::map_to_kept_section): Likewise.
10742         * object.h (Sized_relobj::invalid_address): New constant.
10743         (Sized_relobj::do_output_section_offset): Check for invalid_address
10744         and return -1ULL.
10745         * output.cc (Output_reloc::local_section_offset): Use constant
10746         invalid_address instead of -1U.
10747         (Output_reloc::get_address): Likewise.
10748         (Output_section::output_address): Change -1U to -1ULL.
10749         * output.h (Output_reloc::invalid_address): New constant.
10750         * reloc.cc (Sized_relobj::write_sections): Use constant
10751         invalid_address instead of -1U.
10752         (Sized_relobj::relocate_sections): Likewise.
10753         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10754         values for merge sections.
10755         * target-reloc.h (relocate_for_relocatable): Use constant
10756         invalid_address instead of -1U.
10757
10758 2008-09-19  Cary Coutant  <ccoutant@google.com>
10759
10760         Add plugin functionality for link-time optimization (LTO).
10761         * configure.ac (plugins): Add --enable-plugins option.
10762         * configure: Regenerate.
10763         * config.in: Regenerate.
10764         * Makefile.am (LIBDL): New variable.
10765         (CCFILES): Add plugin.cc.
10766         (HFILES): Add plugin.h.
10767         (ldadd_var): Add LIBDL.
10768         * Makefile.in: Regenerate.
10769
10770         * archive.cc: Include "plugin.h".
10771         (Archive::setup): Don't preread archive symbols when using a plugin.
10772         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10773         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10774         files.
10775         (Archive::include_member): Add symbols from plugin objects.
10776         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10777         * descriptors.cc (Descriptors::open): Check for file descriptors
10778         abandoned by plugins.
10779         (Descriptors::claim_for_plugin): New function.
10780         * descriptors.h (Descriptors::claim_for_plugin): New function.
10781         (Open_descriptor::is_claimed): New field.
10782         (claim_descriptor_for_plugin): New function.
10783         * fileread.cc (File_read::claim_for_plugin): New function.
10784         * fileread.h (File_read::claim_for_plugin): New function.
10785         (File_read::descriptor): New function.
10786         * gold.cc: Include "plugin.h".
10787         (queue_initial_tasks): Add task to call plugin hooks for generating
10788         new object files.
10789         * main.cc: Include "plugin.h".
10790         (main): Load plugin libraries.
10791         * object.h (Pluginobj): Declare.
10792         (Object::pluginobj): New function.
10793         (Object::do_pluginobj): New function.
10794         (Object::set_target): New function.
10795         * options.cc: Include "plugin.h".
10796         (General_options::parse_plugin): New function.
10797         (General_options::General_options): Initialize plugins_ field.
10798         (General_options::add_plugin): New function.
10799         * options.h (Plugin_manager): Declare.
10800         (General_options): Add --plugin option.
10801         (General_options::has_plugins): New function.
10802         (General_options::plugins): New function.
10803         (General_options::add_plugin): New function.
10804         (General_options::plugins_): New field.
10805         * plugin.cc: New file.
10806         * plugin.h: New file.
10807         * readsyms.cc: Include "plugin.h".
10808         (Read_symbols::do_read_symbols): Check for archive before checking
10809         for ELF file.  Call plugin hooks to claim files.
10810         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10811         from a real object file; force override when processing replacement
10812         files.
10813         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10814         (Symbol::init_base_object): Likewise.
10815         (Symbol::init_base_output_data): Likewise.
10816         (Symbol::init_base_output_segment): Likewise.
10817         (Symbol::init_base_constant): Likewise.
10818         (Symbol::init_base_undefined): Likewise.
10819         (Symbol::output_section): Assert that object is not a plugin.
10820         (Symbol_table::add_from_pluginobj): New function.
10821         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10822         undefined.
10823         (Symbol_table::sized_write_globals): Likewise.
10824         (Symbol_table::add_from_pluginobj): Instantiate template.
10825         * symtab.h (Sized_pluginobj): Declare.
10826         (Symbol::in_real_elf): New function.
10827         (Symbol::set_in_real_elf): New function.
10828         (Symbol::in_real_elf_): New field.
10829         (Symbol_table::add_from_pluginobj): New function.
10830
10831         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10832         (LIBDL): New variable.
10833         (LDADD): Add LIBDL.
10834         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10835         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10836         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10837         (MOSTLYCLEANFILES): Likewise.
10838         * testsuite/Makefile.in: Regenerate.
10839         * testsuite/plugin_test.c: New file.
10840         * testsuite/plugin_test_1.sh: New file.
10841         * testsuite/plugin_test_2.sh: New file.
10842
10843 2008-09-16  Ian Lance Taylor  <iant@google.com>
10844
10845         * target-reloc.h (relocate_section): Check whether a symbol is
10846         defined by the ABI before reporting an undefined symbol error.
10847         * target.h (Target::is_defined_by_abi): Make parameter const.
10848         (Target::do_is_defined_by_abi): Likewise.
10849         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10850         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10851         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10852         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10853         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10854         * testsuite/Makefile.in: Rebuild.
10855
10856         * fileread.cc (make_view): Add casts to avoid warning.
10857
10858 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10859
10860         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10861         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10862
10863 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10864
10865         * options.h (General_options::output_is_executable): New.
10866         (General_options::output_is_pie): New.
10867         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10868         for shared libraries.
10869         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10870
10871 2008-09-11  Chris Demetriou  <cgd@google.com>
10872
10873         * options.h (origin): New -z option.
10874         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10875         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10876         in DT_FLAGS_1.
10877
10878 2008-09-05  Cary Coutant  <ccoutant@google.com>
10879
10880         * fileread.cc (File_read::make_view): Add check for attempt to map
10881         beyond end of file.
10882
10883 2008-09-05  Cary Coutant  <ccoutant@google.com>
10884
10885         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10886         explicit instantiations.
10887
10888 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10889
10890         PR gold/6858
10891         * options.cc (General_options::finalize): Allow undefined symbols
10892         in shlibs if linking -shared.
10893
10894         PR gold/6859
10895         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10896         symbols as not needing a dynsym entry.
10897
10898 2008-08-20  Craig Silverstein  <csilvers@google.com>
10899
10900         * fileread.cc (File_read::open): Do not lock the file unless it
10901         was successfully opened.
10902
10903 2008-08-14  Cary Coutant  <ccoutant@google.com>
10904
10905         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10906         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10907         * testsuite/tls_test.cc (struct int128): 128-bit struct
10908         for testing TLS relocs with non-zero addend.
10909         (v12): New TLS variable.
10910         (t12): New test.
10911         (t_last): Add check for v12.
10912         * testsuite/tls_test.h (t12): New function.
10913         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10914
10915 2008-08-13  Ian Lance Taylor  <iant@google.com>
10916
10917         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10918         set tls_segment_ or relro_segment_.
10919         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10920         when appropriate.
10921         * output.h (Output_section::clear_is_relro): New function.
10922         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10923         sections specially even when output_data_ is empty.
10924         (Output_segment::maximum_alignment): When first section is relro,
10925         only force alignment for PT_LOAD segments.
10926         * script.cc (script_data_segment_align): New function.
10927         (script_data_segment_relro_end): New function.
10928         * script-c.h (script_data_segment_align): Declare.
10929         (script_data_segment_relro_end): Declare.
10930         * script-sections.h (class Script_sections): Declare
10931         data_segment_align and data_segment_relro_end.  Add fields
10932         segment_align_index_ and saw_relro_end_.
10933         * script-sections.cc (class Sections_element): Add set_is_relro
10934         virtual function.  Add new bool* parameter to place_orphan_here.
10935         Add get_output_section virtual function.
10936         (class Output_section_definition): Add set_is_relro.  Add new
10937         bool* parameter to place_orphan_here.  Add get_output_section.
10938         Add is_relro_ field.
10939         (Output_section_definition::Output_section_definition): Initialize
10940         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10941         and is_relro_ fields.
10942         (Output_section_definition::place_orphan_here): Add is_relro
10943         parameter.
10944         (Output_section_definition::set_section_addresses): Set relro for
10945         output section.
10946         (Output_section_definition::alternate_constraint): Likewise.
10947         (class Orphan_output_section): Add new bool* parameter to
10948         place_orphan_here.  Add get_output_section.
10949         (Orphan_output_section::place_orphan_here): Add is_relro
10950         parameter.
10951         (Script_sections::Script_sections): Initialize
10952         data_segment_align_index_ and saw_relro_end_.
10953         (Script_sections::data_segment_align): New function.
10954         (Script_sections::data_segment_relro_end): New function.
10955         (Script_sections::place_orphan): Set or clear is_relro.
10956         (Script_sections::set_section_addresses): Force alignment of first
10957         TLS section.
10958         * yyscript.y (exp): Call script_data_segment_align and
10959         script_data_segment_relro_end.
10960         * testsuite/relro_script_test.t: New file.
10961         * testsuite/relro_test.cc (using_script): Declare.
10962         (t1, t2): Test using_script.
10963         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10964         (relro_script_test_SOURCES): Define.
10965         (relro_script_test_DEPENDENCIES): Define.
10966         (relro_script_test_LDFLAGS): Define.
10967         (relro_script_test_LDADD): Define.
10968         (relro_script_test.so): New target.
10969         * testsuite/Makefile.in: Rebuild.
10970
10971 2008-08-06  Cary Coutant <ccoutant@google.com>
10972
10973         * archive.cc (Archive::total_archives, Archive::total_members)
10974         (Archive::total_members_loaded): New variables.
10975         (Archive::setup): Add parameter.  Add option to preread
10976         archive symbols.
10977         (Archive::read_armap): Add counter.
10978         (Archive::get_file_and_offset): New function.
10979         (Archive::get_elf_object_for_member): New function.
10980         (Archive::read_all_symbols): New function.
10981         (Archive::read_symbols): New function.
10982         (Archive::add_symbols): Add counters.
10983         (Archive::include_all_members): Use armap to find members if it's
10984         already built.
10985         (Archive::include_member): Skip reading symbols if already read.
10986         Factored code into Archive::get_file_and_offset and
10987         Archive::get_elf_object_for_member.  Changed call to
10988         Mapfile::report_include_archive_member.
10989         (Archive::print_stats): New function.
10990         * archive.h: Declare Object and Read_symbols_data classes.
10991         (Archive::Archive): Add initializers for new members.
10992         (Archive::setup): Add parameter.
10993         (Archive::print_stats): New function.
10994         (Archive::total_archives, Archive::total_members)
10995         (Archive::total_members_loaded): New variables.
10996         (Archive::get_file_and_offset): New function.
10997         (Archive::get_elf_object_for_member): New function.
10998         (Archive::read_all_symbols): New function.
10999         (Archive::read_symbols): New function.
11000         (Archive::Archive_member): New class.
11001         (Archive::members_): New member.
11002         (Archive::num_members_): New member.
11003         * main.cc: Include archive.h.
11004         (main): Call Archive::print_stats.
11005         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11006         archive parameter; member_name is now the fully-decorated name.
11007         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11008         * options.h: (General_options): Add --preread-archive-symbols option.
11009         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11010         Archive::setup.
11011
11012 2008-08-04  Ian Lance Taylor  <iant@google.com>
11013
11014         * symtab.h (Symbol::use_plt_offset): New function.
11015         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11016         * powerpc.cc (Relocate::relocate): Likewise.
11017         * sparc.cc (Relocate::relocate): Likewise.
11018         * x86_64.cc (Relocate::relocate): Likewise.
11019         * testsuite/weak_plt.sh: New test.
11020         * testsuite/weak_plt_main.cc: New test.
11021         * testsuite/weak_plt_shared.cc: New test.
11022         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11023         (check_PROGRAMS): Add weak_plt.
11024         (check_DATA): Add weak_plt_shared.so.
11025         (weak_plt_main_pic.o, weak_plt): New targets.
11026         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11027         * testsuite/Makefile.in: Rebuild.
11028
11029         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11030         gcctestdir/ld.
11031         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11032         * testsuite/Makefile.in: Rebuild.
11033
11034 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11035
11036         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11037         * Makefile.in: Regenerate.
11038         * po/POTFILES.in: Regenerate.
11039
11040 2008-07-29  Ian Lance Taylor  <iant@google.com>
11041
11042         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11043         symbols before other symbols.
11044         * testsuite/script_test_2.cc (test_addr): Declare.
11045         (test_addr_alias): Declare.
11046         (main): Check that test_addr and test_addr_alias have the right
11047         values.
11048         * testsuite/script_test_2.t: Define test_addr_alias and
11049         test_addr.
11050
11051 2008-07-24  Ian Lance Taylor  <iant@google.com>
11052
11053         PR 5990
11054         * descriptors.cc: New file.
11055         * descriptors.h: New file.
11056         * gold-threads.h (class Hold_optional_lock): New class.
11057         * fileread.cc: Include "descriptors.h".
11058         (File_read::~File_read): Release descriptor rather than closing
11059         it.
11060         (File_read::open) [file]: Call open_descriptor rather than open.
11061         Set is_descriptor_opened_.
11062         (File_read::open) [memory]: Assert that descriptor is not open.
11063         (File_read::reopen_descriptor): New function.
11064         (File_read::release): Release descriptor.
11065         (File_read::do_read): Make non-const.  Reopen descriptor.
11066         (File_read::read): Make non-const.
11067         (File_read::make_view): Reopen descriptor.
11068         (File_read::do_readv): Likewise.
11069         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11070         Update declarations.
11071         * layout.cc: Include "descriptors.h".
11072         (Layout::create_build_id): Use open_descriptor rather than open.
11073         * output.cc: Include "descriptors.h".
11074         (Output_file::open): Use open_descriptor rather than open.
11075         * archive.cc (Archive::const_iterator): Change Archive to be
11076         non-const.
11077         (Archive::begin, Archive::end): Make non-const.
11078         (Archive::count_members): Likewise.
11079         * archive.h (class Archive): Update declarations.
11080         * object.h (Object::read): Make non-const.
11081         * Makefile.am (CCFILES): Add descriptors.cc.
11082         (HFILES): Add descriptors.h.
11083         * Makefile.in: Rebuild.
11084
11085         PR 6716
11086         * gold.h: Always include <clocale>.  Add Solaris workarounds
11087         following code in binutils/sysdep.h.
11088
11089         PR 6048
11090         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11091         this->eh_frame_hdr_ is NULL before using it.
11092
11093         * dynobj.cc (Versions::Versions): Update comment.
11094
11095         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11096         the base version name.
11097
11098         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11099         array size plus one.
11100         (Stringpool_template::set_string_offsets): Subtract one from key
11101         before using it as an array index.
11102         (Stringpool_template::get_offset_with_length): Likewise.
11103         (Stringpool_template::write_to_buffer): Likewise.
11104         * stringpool.h (Stringpool_template::get_offset_from_key):
11105         Likewise.
11106
11107 2008-07-23  Ian Lance Taylor  <iant@google.com>
11108
11109         PR 6658
11110         * object.h (Merged_symbol_value::value): Do our best to handle a
11111         negative addend.
11112
11113         PR 6647
11114         * script.cc (Version_script_info::get_versions): Don't add empty
11115         version tag to return value.
11116         (Version_script_info::get_symbol_version_helper): Change return
11117         type to bool.  Add pversion parameter.  Change all callers.
11118         (script_register_vers_node): Don't require a non-NULL tag.
11119         * script.h (class Version_script_info): Update declarations.
11120         (Version_script_info::get_symbol_version): Change return type to
11121         bool.  Add version parameter.  Change all callers.
11122         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11123         handling.  Handle an empty version from a version script.
11124         (Symbol_table::define_special_symbol): Likewise.
11125         * testsuite/ver_test_10.script: New file.
11126         * testsuite/ver_test_10.sh: New file.
11127         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11128         (check_DATA): Add ver_test_10.syms.
11129         (ver_test_10.syms, ver_test_10.so): New target.
11130         * testsuite/Makefile.in: Rebuild.
11131
11132 2008-07-23  Simon Baldwin  <simonb@google.com>
11133
11134         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11135         to zero for undefined symbols from dynamic libraries.
11136
11137 2008-07-23  Ian Lance Taylor  <iant@google.com>
11138
11139         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11140         Change all callers.
11141         * symtab.h (class Symbol_table): Update declaration.
11142         * testsuite/ver_test_9.cc: New file.
11143         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11144         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11145         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11146         (ver_test_9.so, ver_test_9.o): New targets.
11147         * testsuite/Makefile.in: Rebuild.
11148
11149 2008-07-22  Ian Lance Taylor  <iant@google.com>
11150
11151         * options.h (class General_options): Define --check-sections.
11152         * layout.cc (Layout::set_segment_offsets): Handle
11153         --check-sections.
11154
11155         * options.h (class General_options): Define -n/--nmagic and
11156         -N/--omagic.
11157         * options.cc (General_options::finalize): For -n/--nmagic or
11158         -N/--omagic, set -static.
11159         * layout.cc (Layout::attach_allocated_section_to_segment): If
11160         -N/--omagic, don't put read-only and read-write sections in
11161         different segments.
11162         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11163         finding a read-only segment.
11164         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11165         don't set the minimum segment alignment to the common page size,
11166         and don't set the file offset to the address modulo the page size.
11167         * script-sections.cc (Script_sections::create_segments): If
11168         -n/--omagic, don't put read-only and read-write sections in
11169         different segments.
11170
11171         * cref.cc: New file.
11172         * cref.h: New file.
11173         * options.h (class General_options): Add --print-symbol-counts.
11174         * main.cc (main): Issue defined symbol report if requested.
11175         * archive.cc (Archive::interpret_header): Make into a const member
11176         function.
11177         (Archive::add_symbols): Call Input_objects::archive_start and
11178         archive_stop.
11179         (Archive::const_iterator): Define new class.
11180         (Archive::begin, Archive::end): New functions.
11181         (Archive::include_all_members): Rewrite to use iterator.
11182         (Archive::count_members): New function.
11183         * archive.h (class Archive): Update declarations.
11184         (Archive::filename): New function.
11185         * object.cc: Include "cref.h".
11186         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11187         (Sized_relobj::do_get_global_symbol_counts): New function.
11188         (Input_objects::add_object): Add object to cross-referencer.
11189         (Input_objects::archive_start): New function.
11190         (Input_objects::archive_stop): New function.
11191         (Input_objects::print_symbol_counts): New function.
11192         * object.h: Declare Cref and Archive.
11193         (Object::get_global_symbol_counts): New function.
11194         (Object::do_get_global_symbol_counts): New pure virtual function.
11195         (class Sized_relobj): Add defined_count_ field.  Update
11196         declarations.
11197         (class Input_objects): Add cref_ field.  Update constructor.
11198         Update declarations.
11199         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11200         defined_count_.
11201         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11202         symbol counts.
11203         (Sized_dynobj::do_get_global_symbol_counts): New function.
11204         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11205         defined_count_.  Update declarations.  Define Symbols typedef.
11206         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11207         parameter.  Change all callers.
11208         (Symbol_table::add_from_dynobj): Add sympointers and defined
11209         parameters.  Change all callers.
11210         * symtab.h (class Symbol_table): Update declarations.
11211         * Makefile.am (CCFILES): Add cref.cc.
11212         (HFILES): Add cref.h.
11213         * Makefile.in: Rebuild.
11214
11215 2008-07-22  Simon Baldwin  <simonb@google.com>
11216
11217         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11218         to zero when writing undefined symbols.
11219
11220 2008-07-22  Ian Lance Taylor  <iant@google.com>
11221
11222         * output.cc (Output_section::add_input_section): Don't try to
11223         merge empty merge sections.
11224
11225 2008-07-21  Craig Silverstein  <csilvers@google.com>
11226
11227         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11228         Include symbol version in error message.
11229
11230 2008-07-20  Chris Demetriou  <cgd@google.com>
11231
11232         * configure.ac (gold_cv_c_random_seed): New configured variable.
11233         (RANDOM_SEED_CFLAGS): New substituted variable.
11234         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11235         * configure: Rebuild.
11236         * Makefile.in: Likewise.
11237         * testsuite/Makefile.in: Likewise.
11238
11239 2008-07-18  Ian Lance Taylor  <iant@google.com>
11240
11241         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11242         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11243         * testsuite/ver_test_main.cc (main): Call t4.
11244         (t4, t4_2a): Define.
11245         * testsuite/ver_test_2.cc (t4_2): Define.
11246         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11247         * testsuite/ver_test_4.cc (t4_2a): Define.
11248         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11249         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11250
11251 2008-07-17  Ian Lance Taylor  <iant@google.com>
11252
11253         * dynobj.cc (Versions::add_def): If we give an error about a
11254         missing version, go ahead and create the version anyhow.
11255
11256 2008-07-10  Ian Lance Taylor  <iant@google.com>
11257
11258         Handle output sections with more than 0x7fffffff bytes.
11259         * object.h (class Relobj): Change map_to_output_ to
11260         output_sections_, and just keep a section pointer.  Change all
11261         uses.  Move comdat group support to Sized_relobj.
11262         (Relobj::is_section_specially_mapped): Remove.
11263         (Relobj::output_section): Remove poff parameter.  Change all
11264         callers.
11265         (Relobj::output_section_offset): New function.
11266         (Relobj::set_section_offset): Rewrite.
11267         (Relobj::map_to_output): Remove.
11268         (Relobj::output_sections): New function.
11269         (Relobj::do_output_section_offset): New pure virtual function.
11270         (Relobj::do_set_section_offset): Likewise.
11271         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11272         group support from Relobj.  Update declarations.
11273         (Sized_relobj::get_output_section_offset): New function.
11274         (Sized_relobj::do_output_section_offset): New function.
11275         (Sized_relobj::do_set_section_offset): New function.
11276         * object.cc (Relobj::output_section_address): Remove.
11277         (Sized_relobj::Sized_relobj): Initialize new fields.
11278         (Sized_relobj::include_section_group): Cast find_kept_object to
11279         Sized_relobj.
11280         (Sized_relobj::include_linkonce_section): Likewise.
11281         (Sized_relobj::do_layout): Use separate arrays for output section
11282         and output offset.
11283         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11284         output_sections.
11285         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11286         output_sections and section_offsets.
11287         (Sized_relobj::write_local_symbols): Likewise.
11288         (map_to_kept_section): Compute output address directly.
11289         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11290         output_sections and section_offsets.
11291         (Sized_relobj::write_sections): Likewise.
11292         (Sized_relobj::relocate_sections): Likewise.
11293         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11294         * output.h (class Output_reloc): Update declarations.  Change
11295         u2_.relobj to Sized_relobj*.
11296         (class Output_data_reloc): Change add functions to use
11297         Sized_relobj*.
11298         * output.cc (Output_reloc::Output_reloc): Change relobj to
11299         Sized_relobj*.
11300         (Output_reloc::local_section_offset): Change return type to
11301         Elf_Addr.  Use get_output_section_offset.
11302         (Output_reloc::get_address): Likewise.
11303         (Output_section::is_input_address_mapped): Don't call
11304         is_section_specially_mapped.
11305         (Output_section::output_offset): Likewise.
11306         (Output_section::output_address): Likewise.
11307         (Output_section::starting_output_address): Likewise.
11308         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11309         parameter to Sized_relobj*.
11310         (Copy_relocs::need_copy_reloc): Likewise.
11311         (Copy_relocs::save): Likewise.
11312         * copy-relocs.h (class Copy_relocs): Update declarations.
11313         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11314         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11315         * target-reloc.h (relocate_for_relocatable): Change
11316         offset_in_output_section type to Elf_Addr.  Change code that uses
11317         it as well.
11318         * layout.cc (Layout::layout): Always set *off.
11319         * mapfile.cc (Mapfile::print_input_section): Use
11320         output_section_offset.
11321         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11322         Sized_relobj*.
11323         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11324         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11325         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11326
11327 2008-07-03  Ian Lance Taylor  <iant@google.com>
11328
11329         * layout.cc (Layout::include_section): Do not discard unrecognized
11330         SHT_STRTAB sections.
11331
11332 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11333
11334         * script.cc (Lex::can_continue_name): Make '?' allowable in
11335         version-script names.
11336         * testsuite/version_script.map: Change glob pattern to use '?'
11337
11338 2008-06-30  Manish Singh  <yosh@gimp.org>
11339
11340         PR 6585
11341         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11342         Correct typo.
11343
11344 2008-06-30  Ian Lance Taylor  <iant@google.com>
11345
11346         PR 6660
11347         PR 6682
11348         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11349         versions]: Don't try to read the value in the contents, since we
11350         don't use it.  Use the template endianness when writing.
11351
11352 2008-06-25  Cary Coutant  <ccoutant@google.com>
11353
11354         * fileread.cc (File_read::make_view): Assert on zero-length view.
11355         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11356         symbol table when there are no symbols to read.
11357
11358 2008-06-23  Craig Silverstein  <csilvers@google.com>
11359
11360         * version.cc (version_string): Bump to 1.7
11361
11362 2008-06-18  Craig Silverstein  <csilvers@google.com>
11363
11364         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11365         constant 0xFFFF to type Valtype.
11366         (Powerpc_relocate_functions::rel16_ha): Likewise.
11367
11368 2008-06-17  Ian Lance Taylor  <iant@google.com>
11369
11370         * output.h (Output_section::Input_section): Initialize p2align_ to
11371         zero for Output_section_data constructors.
11372         (Output_section::Input_section::addralign): If not an input
11373         section, return the alignment of the Output_section_data.
11374         * testsuite/copy_test.cc: New file.
11375         * testsuite/copy_test_1.cc: New file.
11376         * testsuite/copy_test_2.cc: New file.
11377         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11378         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11379         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11380         (copy_test_1_pic.o, copy_test_1.so): New targets.
11381         (copy_test_2_pic.o, copy_test_2.so): New targets.
11382         * testsuite/Makefile.in: Rebuild.
11383
11384         * script-sections.cc (Script_sections::place_orphan): Initialize
11385         local variable exact.
11386
11387 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11388
11389         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11390
11391 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11392             David S. Miller  <davem@davemloft.net>
11393
11394         * powerpc.cc: New file.
11395         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11396         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11397         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11398         * Makefile.in: Rebuild.
11399
11400 2008-06-09  Ian Lance Taylor  <iant@google.com>
11401
11402         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11403         <exception>.
11404         (throwing, orig_terminate): New static variables.
11405         (terminate_handler): New static function.
11406         (t2): Set terminate handler.
11407
11408 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11409
11410         PR 6584
11411         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11412         alignment.
11413
11414 2008-05-30  Cary Coutant  <ccoutant@google.com>
11415
11416         * archive.cc (Archive::include_all_members) Correct to step
11417         over symbol table and extended name table in thin archives.
11418
11419 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11420
11421         PR 6407
11422         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11423         calculation.
11424
11425 2008-05-28  Caleb Howe  <cshowe@google.com>
11426
11427         * reduced_debug_output.cc: New file.
11428         * reduced_debug_output.h: New file.
11429         * options.h (class General_options): Add --strip-debug-non-line.
11430         * options.cc (General_options::finalize): Add strip_debug_non_line
11431         to the strip heirarchy.
11432         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11433         fields.
11434         * layout.cc: Include "reduced_debug_output.h".
11435         (Layout::Layout): Initialize new fields.
11436         (line_only_debug_sections): New static array.
11437         (is_lines_only_debug_sections): New static inline function.
11438         (Layout::include_section): Handle --strip-debug-non-line.
11439         (Layout::make_output_section): If --strip-debug-non-line, build
11440         new output sections for .debug_abbrev and .debug_info.
11441         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11442         gold.  Warn about possible overflow.
11443         (read_signed_LEB_128): Likewise.
11444         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11445         (read_signed_LEB_128): Declare.
11446         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11447         (HFILES): Add reduced_debug_output.h.
11448         * Makefile.in: Rebuild.
11449
11450 2008-05-21  Ian Lance Taylor  <iant@google.com>
11451
11452         * mapfile.cc: New file.
11453         * mapfile.h: New file.
11454         * options.h (class General_options): Add -M/--print-map and -Map.
11455         * options.cc (General_options::finalize): Make -M equivalent to
11456         -Map -.
11457         * main.cc: Include <cstdio> and "mapfile.h".
11458         (main): Open mapfile if requested.
11459         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11460         constructor.  Change caller.
11461         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11462         (queue_middle_tasks): Likewise.
11463         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11464         declarations.
11465         * archive.cc: Include "mapfile.h".
11466         (Archive::add_symbols): Add mapfile parameter.  Change all
11467         callers.  Pass mapfile, symbol, and reason to include_member.
11468         (Archive::include_all_members): Add mapfile parameter.  Change all
11469         callers.
11470         (Archive::include_member): Add mapfile, sym, and why parameters.
11471         Change all callers.  Report inclusion to map file.
11472         * archive.h: Include "fileread.h".
11473         (class Archive): Update declarations.
11474         (Archive::file): New const method.
11475         (class Add_archive_symbols): Add mapfile_ field.  Update
11476         constructor.  Change all callers.
11477         * readsyms.h (class Read_symbols): Likewise.
11478         (class Finish_group): Likewise.
11479         (class Read_script): Likewise.
11480         * common.cc: Include "mapfile.h".
11481         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11482         all callers.
11483         (Symbol_table::do_allocate_commons): Likewise.
11484         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11485         symbol allocation to mapfile.
11486         * common.h (class Allocate_commons_task): Add mapfile_ field.
11487         Update constructor.  Change all callers.
11488         * symtab.h (class Symbol_table): Update declarations.
11489         * layout.cc: Include "mapfile.h".
11490         (Layout_task_runner::run): Print information to mapfile.
11491         (Layout::create_gold_note): Change Output_data_fixed_space to
11492         Output_data_zero_fill.
11493         (Layout::create_build_id): Likewise.
11494         (Layout::print_to_mapfile): New function.
11495         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11496         constructor.  Change caller.
11497         (class Layout): Declare print_to_mapfile.
11498         * output.cc (Output_section::Input_section::print_to_mapfile): New
11499         function.
11500         (Output_section::add_input_section): If producing a map, always
11501         add to input_sections_ list.
11502         (Output_section::do_print_to_mapfile): New function.
11503         (Output_segment::print_sections_to_mapfile): New function.
11504         (Output_segment::print_section_list_to_mapfile): New function.
11505         * output.h: Include "mapfile.h".
11506         (Output_data::print_to_mapfile): New function.
11507         (Output_data::do_print_to_mapfile): New virtual function.
11508         (Output_segment_headers::do_print_to_mapfile): New function.
11509         (Output_file_header::do_print_to_mapfile): New function.
11510         (Output_data_const::do_print_to_mapfile): New function.
11511         (class Output_data_const_buffer): Add map_name_ field.  Update
11512         constructor.  Change all callers.  Add do_print_to_mapfile
11513         function.
11514         (class Output_data_fixed_space): Likewise.
11515         (class Output_data_space): Likewise.
11516         (class Output_data_zero_fill): New class.
11517         (Output_data_strtab::do_print_to_mapfile): New function.
11518         (Output_data_reloc_base::do_print_to_mapfile): New function.
11519         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11520         (Output_data_group::do_print_to_mapfile): New function.
11521         (Output_data_got::do_print_to_mapfile): New function.
11522         (Output_data_dynamic::do_print_to_mapfile): New function.
11523         (Output_symtab_xindex::do_print_to_mapfile): New function.
11524         (class Output_section): Declare do_print_to_mapflie.  Declare
11525         print_to_mapfile in Input_section.
11526         (class Output_segment): Declare new functions.
11527         * object.h (Sized_relobj::symbol_count): New function.
11528         * script-sections.cc
11529         (Output_section_element_dot_assignment::set_section_addresses):
11530         Change Output_data_fixed_space to Output_data_zero_fill.
11531         (Output_data_expression::do_print_to_mapfile): New function.
11532         * script.cc (read_input_script): Add mapfile parameter.  Change
11533         all callers.
11534         * script.h (read_input_script): Update declaration.
11535         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11536         (Eh_frame::do_print_to_mapfile): New function.
11537         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11538         (Output_merge_string::do_print_to_mapfile): New function.
11539         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11540         function.
11541         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11542         function.
11543         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11544         function.
11545         * Makefile.am (CCFILES): Add mapfile.cc.
11546         (HFILES): Add mapfile.h.
11547         * Makefile.in: Rebuild.
11548
11549 2008-05-19  Ian Lance Taylor  <iant@google.com>
11550
11551         * options.h (class General_options): Add -z relro.
11552         * layout.cc (Layout::Layout): Initialize relro_segment_.
11553         (Layout::add_output_section_data): Return the output section.
11554         (Layout::make_output_section): Rcognize relro sections and mark
11555         them appropriately.
11556         (Layout::attach_allocated_section_to_segment): Put relro sections
11557         in a PT_GNU_RELRO segment.
11558         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11559         section as relro.
11560         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11561         PT_TLS segments.
11562         (Layout::linkonce_mapping): Map d.rel.ro.local to
11563         .data.rel.ro.local.
11564         (Layout::output_section_name): Us .data.rel.ro.local for any
11565         section which begins with that.
11566         * layout.h (class Layout): Update add_output_section_data
11567         declaration.  Add relro_segment_ field.
11568         * output.cc (Output_section::Output_section): Initialize is_relro_
11569         and is_relro_local_ fields.
11570         (Output_segment::add_output_section): Group relro sections.
11571         (Output_segment::is_first_section_relro): New function.
11572         (Output_segment::maximum_alignment): If there is a relro section,
11573         align the segment to the common page size.
11574         (Output_segment::set_section_addresses): Track whether we are
11575         looking at relro sections.  If the last section is a relro
11576         section, align to the common page size.
11577         (Output_segment::set_section_list_addresses): Add in_relro
11578         parameter.  Change all callers.  Align to the page size when
11579         moving from relro to non-relro section.
11580         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11581         segment.
11582         * output.h (class Output_section): Add is_relro_ and
11583         is_relro_local_ fields.
11584         (Output_section::is_relro): New function.
11585         (Output_section::set_is_relro): New function.
11586         (Output_section::is_relro_local): New function.
11587         (Output_section::set_is_relro_local): New function.
11588         (class Output_segment): Update declarations.
11589         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11590         * sparc.cc (Target_sparc::got_section): Likewise.
11591         * x86_64.cc (Target_x86_64::got_section): Likewise.
11592         * testsuite/relro_test_main.cc: New file.
11593         * testsuite/relro_test.cc: New file.
11594         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11595         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11596         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11597         (relro_test.so, relro_test_pic.o): New targets.
11598         * testsuite/Makefile.in: Rebuild.
11599
11600 2008-05-16  Ian Lance Taylor  <iant@google.com>
11601
11602         * output.cc (Output_segment::add_output_section): Remove front
11603         parameter.
11604         * output.h (class Output_segment): Remove
11605         add_initial_output_section and overloaded add_output_section.
11606         Update declaration of remaining add_output_section.
11607         * layout.cc (Layout::create_interp): Call add_output_section
11608         rather than add_initial_output_section.
11609         (Layout::finish_dynamic_section): Likewise.
11610
11611         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11612         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11613         know the dynamic type.
11614         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11615         field.  Initialize it in constructor.
11616         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11617         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11618         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11619         reloc.
11620
11621         * output.cc (Output_reloc::get_address): Change return type to
11622         Elf_Addr.
11623         * output.h (class Output_reloc): Update get_address declaration.
11624         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11625         for section addresses.
11626
11627 2008-05-09  Ian Lance Taylor  <iant@google.com>
11628
11629         PR 6493
11630         * gold.cc (gold_nomem): Use return value of write.
11631
11632 2008-05-08  Ian Lance Taylor  <iant@google.com>
11633
11634         * symtab.c (Symbol::init_base_output_data): Add version
11635         parameter.  Change all callers.
11636         (Symbol::init_base_output_segment): Likewise.
11637         (Symbol::init_base_constant): Likewise.
11638         (Symbol::init_base_undefined): Likewise.
11639         (Sized_symbol::init_output_data): Likewise.
11640         (Sized_symbol::init_output_segment): Likewise.
11641         (Sized_symbol::init_constant): Likewise.
11642         (Sized_symbol::init_undefined): Likewise.
11643         (Symbol_table::do_define_in_output_data): If the new symbol has a
11644         version, mark it as the default.
11645         (Symbol_table::do_define_in_output_segment): Likewise.
11646         (Symbol_table::do_define_as_constant): Likewise.
11647         * symtab.h (class Symbol): Update declarations.
11648         (class Sized_symbol): Likewise.
11649         * resolve.cc (Symbol::override_version): New function.
11650         (Symbol::override_base): Call override_version.
11651         (Symbol::override_base_with_special): Likewise.
11652         * testsuite/ver_script_8.script: New file.
11653         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11654         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11655         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11656         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11657
11658 2008-05-06  Ian Lance Taylor  <iant@google.com>
11659
11660         PR 6049
11661         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11662         functions.
11663         (class General_options): Remove existing --undefined, and add
11664         --no-undefined instead.  Add new --undefined as synonym for -u.
11665         * archive.cc (Archive::add_symbols): Check whether symbol was
11666         named with -u.
11667         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11668         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11669         all uses.  Add IS_UNDEFINED.  Update declarations to split
11670         different versions of init_base.  Declare init_base_undefined.
11671         (Symbol::is_defined): Handle IS_UNDEFINED.
11672         (Symbol::is_undefined): Likewise.
11673         (Symbol::is_weak_undefined): Call is_undefined.
11674         (Symbol::is_absolute): Handle IS_CONSTANT.
11675         (class Sized_symbol): Update declarations to split different
11676         versions of init.  Declare init_undefined.
11677         (class Symbol_table): Declare new functions.
11678         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11679         Change all callers.
11680         (Symbol::init_base_output_data): Likewise.
11681         (Symbol::init_base_output_segment): Likewise.
11682         (Symbol::init_base_constant): Likewise.
11683         (Symbol::init_base_undefined): New function.
11684         (Sized_symbol::init_object): Rename from init.  Change all
11685         callers.
11686         (Sized_symbol::init_output_data): Likewise.
11687         (Sized_symbol::init_output_segment): Likewise.
11688         (Sized_symbol::init_constant): Likewise.
11689         (Sized_symbol::init_undefined): New function.
11690         (Symbol_table::add_undefined_symbols_from_command_line): New
11691         function.
11692         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11693         function.
11694         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11695         (Symbol::output_section): Likewise.
11696         (Symbol::set_output_section): Likewise.
11697         (Symbol_table::sized_finalize_symbol): Likewise.
11698         (Symbol_table::sized_write_globals): Likewise.
11699         * resolve.cc (Symbol_table::should_override): Likewise.
11700         (Symbol::override_base_with_special): Likewise.
11701
11702         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11703         symbol, change it to have default visibility.
11704         * testsuite/protected_1.cc: New file.
11705         * testsuite/protected_2.cc: New file.
11706         * testsuite/protected_3.cc: New file.
11707         * testsuite/protected_main_1.cc: New file.
11708         * testsuite/protected_main_2.cc: New file.
11709         * testsuite/protected_main_3.cc: New file.
11710         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11711         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11712         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11713         (protected_1.so): New target.
11714         (protected_1_pic.o, protected_2_pic.o): New targets.
11715         (protected_3_pic.o): New target.
11716         (check_PROGRAMS): Add protected_2.
11717         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11718         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11719         * testsuite/Makefile.in: Rebuild.
11720
11721         * options.h (DEFINE_var): Add set_user_set_##varname__.
11722         (DEFINE_bool_alias): New macro.
11723         (class General_options): Define -Bstatic using DEFINE_bool_alias
11724         rather than DEFINE_special.  Add --undefined as an alias for -z
11725         defs.
11726         * options.cc (General_options::parse_Bstatic): Remove.
11727
11728         * options.h (class General_options): Add --fatal-warnings.
11729         * main.cc (main): Implement --fatal-warnings.
11730         * errors.h (Errors::warning_count): New function.
11731
11732         * options.h (class General_options): Add -Bsymbolic-functions.
11733         * symtab.h (Symbol::is_preemptible): Check for
11734         -Bsymbolic-functions.
11735
11736 2008-05-05  Ian Lance Taylor  <iant@google.com>
11737
11738         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11739         as noVARNAME rather than no-VARNAME.
11740         (class General_options): Add option -z combreloc.
11741         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11742         get_address.
11743         (Output_reloc::sort_before) [SHT_REL]: New function.
11744         (Output_reloc::sort_before) [SHT_RELA]: New function.
11745         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11746         Sort_relocs_comparison.
11747         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11748         parameter.  Change all callers.
11749         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11750         sort_relocs parameter.  Change all callers.
11751         * output.cc (Output_reloc::get_address): New function, broken out
11752         of write_rel.
11753         (Output_reloc::write_rel): Call it.
11754         (Output_reloc::compare): New function.
11755         (Output_data_reloc_base::do_write): Optionally sort relocs.
11756
11757         * configure.ac: If targ_extra_obj is set, link it in.
11758         * configure.tgt: Initialize all variables.
11759         (x86_64*): Set targ_extra_obj and targ_extra_size.
11760         * configure: Rebuild.
11761
11762         * object.cc (Sized_relobj::include_section_group): Adjust section
11763         indexes read from group data.  Build vector to pass to
11764         layout_group.
11765         * layout.cc (Layout::layout_group): Add flags and shndxes
11766         parameters.  Remove contents parameter.  Change caller.  Update
11767         explicit instantiations.
11768         * layout.h (class Layout): Update layout_group declaration.
11769         * output.cc (Output_data_group::Output_data_group): Add flags and
11770         input_shndxes parameters.  Remove contents parameter.  Change
11771         caller.
11772         (Output_data_group::do_write): Change input_sections_ to
11773         input_shndxes_.
11774         * output.h (class Output_data_group): Update constructor
11775         declaration.  Rename input_sections_ to input_shndxes_.
11776         * testsuite/many_sections_test.cc: Add template.
11777
11778 2008-04-30  Cary Coutant  <ccoutant@google.com>
11779
11780         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11781
11782         * layout.cc (Layout::include_section): Refactored check for debug
11783         info section.
11784         (Layout::add_comdat): Add new parameters.  Change type
11785         of signature parameter.  Add object and shndx to signatures table.
11786         (Layout::find_kept_object): New function.
11787         * layout.h: Include <cstring>.
11788         (Layout::is_debug_info_section): New function.
11789         (Layout::add_comdat): Add new parameters.
11790         (Layout::find_kept_object): New function.
11791         (Layout::Kept_section): New struct.
11792         (Layout::Signatures): Change type of map range.
11793         * object.cc (Relobj::output_section_address): New function.
11794         (Sized_relobj::include_section_group): Add new parameters.  Change
11795         calls to Layout::add_comdat.  Change to build table of kept comdat
11796         groups and table mapping discarded sections to kept sections.
11797         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11798         (Sized_relobj::do_layout): Change calls to include_section_group and
11799         include_linkonce_section.
11800         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11801         value to zero when section is discarded.
11802         (Sized_relobj::map_to_kept_section): New function.
11803         * object.h (Relobj::output_section_address): New function.
11804         (Relobj::Comdat_group): New type.
11805         (Relobj::find_comdat_group): New function.
11806         (Relobj::Comdat_group_table): New type.
11807         (Relobj::Kept_comdat_section): New type.
11808         (Relobj::Kept_comdat_section_table): New type.
11809         (Relobj::add_comdat_group): New function.
11810         (Relobj::set_kept_comdat_section): New function.
11811         (Relobj::get_kept_comdat_section): New function.
11812         (Relobj::comdat_groups_): New field.
11813         (Relobj::kept_comdat_sections_): New field.
11814         (Symbol_value::input_value): Update comment.
11815         (Sized_relobj::map_to_kept_section) New function.
11816         (Sized_relobj::include_linkonce_section): Add new parameter.
11817         * target-reloc.h (Comdat_behavior): New type.
11818         (get_comdat_behavior): New function.
11819         (relocate_section): Add code to map a discarded section to the
11820         corresponding kept section when applying a relocation.
11821
11822 2008-04-30  Craig Silverstein  <csilvers@google.com>
11823
11824         * dwarf_reader.cc (next_generation_count): New static var.
11825         (Addr2line_cache_entry): New struct.
11826         (addr2line_cache): New static var.
11827         (Dwarf_line_info::one_addr2line): Added caching.
11828         (Dwarf_line_info::clear_addr2line_cache): New function.
11829         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11830         cache-size parameter.
11831         (Dwarf_line_info::one_addr2line_cache): New function.
11832         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11833         new cache-size argument to one_addr2line(), and clear cache.
11834
11835 2008-04-28  Cary Coutant  <ccoutant@google.com>
11836
11837         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11838         R_386_PC8 relocations.
11839
11840 2008-04-23  Ian Lance Taylor  <iant@google.com>
11841
11842         * object.cc (Sized_relobj::include_section_group): Check for
11843         invalid section group.
11844
11845         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11846         header size.
11847
11848         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11849         than read for file header.
11850         * archive.cc (Archive::include_member): Likewise.
11851
11852 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11853
11854         * aclocal.m4: Regenerate.
11855         * configure: Regenerate.
11856
11857 2008-04-19  Ian Lance Taylor  <iant@google.com>
11858
11859         * version.cc (version_string): Bump to 1.6.
11860
11861         * testsuite/Makefile.am (many_sections_r_test): New target.
11862         (many_sections_r_test_SOURCES): Remove.
11863         (many_sections_r_test_DEPENDENCIES): Remove.
11864         (many_sections_r_test_LDFLAGS): Remove.
11865         (many_sections_r_test_LDADD): Remove.
11866
11867         * object.cc (Sized_relobj::do_add_symbols): Always pass
11868         local_symbol_count_ to add_from_relobj.
11869
11870         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11871         every thousand variables.
11872         * testsuite/Makefile.in: Rebuild.
11873
11874         * object.cc (Xindex::initialize_symtab_xindex): New function.
11875         (Xindex::read_symtab_xindex): New function.
11876         (Xindex::sym_xindex_to_shndx): New function.
11877         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11878         available.
11879         (Sized_relobj::do_initialize_xindex): New function.
11880         (Sized_relobj::do_read_symbols): Adjust section links.
11881         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11882         parameter.  Change all callers.
11883         (Sized_relobj::include_section_group): Adjust section links and
11884         symbol section indexes.
11885         (Sized_relobj::do_layout): Adjust section links.
11886         (Sized_relobj::do_count_local_symbols): Adjust section links and
11887         symbol section indexes.
11888         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11889         ordinary and special symbols.
11890         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11891         dynsym_xindex parameters.  Change all callers.  Adjust section
11892         links.  Use SHN_XINDEX when needed.
11893         (Sized_relobj::get_symbol_location_info): Adjust section links.
11894         Don't get fooled by special symbols.
11895         * object.h (class Xindex): Define.
11896         (class Object): Add xindex_ parameter.  Declare virtual functoin
11897         do_initialize_xindex.
11898         (Object::adjust_sym_shndx): New function.
11899         (Object::set_xindex): New protected function.
11900         (class Symbol_value): Add is_ordinary_shndx_ field.
11901         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11902         (Symbol_value::value): Assert ordinary section.
11903         (Symbol_value::initialize_input_to_output_map): Likewise.
11904         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11905         Change all callers.
11906         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11907         all callers.
11908         (class Sized_relobj): Update declarations.
11909         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11910         parameter.  Change all callers.
11911         (Sized_relobj::adjust_shndx): New function.
11912         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11913         field.
11914         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11915         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11916         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11917         (Sized_dynobj::read_dynsym_section): Adjust section links.
11918         (Sized_dynobj::read_dynamic): Likewise.
11919         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11920         section links.
11921         (Sized_dynobj::do_initialize_xindex): New function.
11922         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11923         do_initialize_xindex.
11924         (Sized_dynobj::adjust_shndx): New function.
11925         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11926         dynsym_xindex_ fields.
11927         (Layout::finalize): Add a call to set_section_indexes before
11928         creating the symtab sections.
11929         (Layout::set_section_indexes): Don't do anything if the section
11930         already has a section index.
11931         (Layout::create_symtab_sections): Add shnum parameter.  Change
11932         caller.  Create .symtab_shndx section if needed.
11933         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11934         caller.
11935         (Layout::allocated_output_section_count): New function.
11936         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11937         needed.
11938         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11939         fields.  Update declarations.
11940         (Layout::symtab_xindex): New function.
11941         (Layout::dynsym_xindex): New function.
11942         (class Write_symbols_task): Add layout_ field.
11943         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11944         Change caller.
11945         * output.cc (Output_section_headers::Output_section_headers): Add
11946         shstrtab_section parameter.  Change all callers.
11947         (Output_section_headers::do_sized_write): Store overflow values
11948         for section count and section string table section index in
11949         section header zero.
11950         (Output_file_header::do_sized_write): Check for overflow of
11951         section count and section string table section index.
11952         (Output_symtab_xindex::do_write): New function.
11953         (Output_symtab_xindex::endian_do_write): New function.
11954         * output.h (class Output_section_headers): Add shstrtab_section_.
11955         Update declarations.
11956         (class Output_symtab_xindex): Define.
11957         (Output_section::has_out_shndx): New function.
11958         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11959         field.
11960         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11961         Change all callers.
11962         (Sized_symbol::init): Likewise.
11963         (Symbol::output_section): Check for ordinary symbol.
11964         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11965         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11966         callers.
11967         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11968         Change all callers.  Simplify handling of symbols from sections
11969         not included in the link.
11970         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11971         distinction.
11972         (Weak_alias_sorter::operator()): Assert that symbols are
11973         ordinary.
11974         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11975         distinction.
11976         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11977         parameters.  Change all callers.
11978         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11979         symbol distinction.  Use SHN_XINDEX when needed.
11980         (Symbol_table::write_section_symbol): Add symtab_xindex
11981         parameter.  Change all callers.
11982         (Symbol_table::sized_write_section_symbol): Likewise.  Use
11983         SHN_XINDEX when needed.
11984         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
11985         declarations.
11986         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
11987         (Symbol::is_defined): Check is_ordinary.
11988         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11989         (Symbol::is_absolute, Symbol::is_common): Likewise.
11990         (class Sized_symbol): Update declarations.
11991         (class Symbol_table): Update declarations.
11992         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11993         parameters.  Change all callers.
11994         (Sized_symbol::override): Likewise.
11995         (Symbol_table::override): Likewise.
11996         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
11997         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
11998         is_ordinary, and orig_st_shndx parameters.  Change all callers.
11999         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12000         to be in an ordinary section.
12001         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12002         object and is_ordinary parameters.  Change all callers.
12003         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12004         Change all callers.  Don't add undefined or non-ordinary symbols
12005         to reloc_map_.
12006         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12007         Change all callers.
12008         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12009         declarations.
12010         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12011         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12012         (Sized_relobj::relocate_sections): Likewise.
12013         * target-reloc.h (scan_relocs): Adjust section symbol index.
12014         (scan_relocatable_relocs): Likewise.
12015         * i386.cc (Scan::local): Check for ordinary symbols.
12016         * sparc.cc (Scan::local): Likewise.
12017         * x86_64.cc (Scan::local): Likewise.
12018         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12019         to symbol_section_and_value.
12020         * testsuite/many_sections_test.cc: New file.
12021         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12022         (check_PROGRAMS): Add many_sections_test.
12023         (many_sections_test_SOURCES): Define.
12024         (many_sections_test_DEPENDENCIES): Define.
12025         (many_sections_test_LDFLAGS): Define.
12026         (BUILT_SOURCES): Add many_sections_define.h.
12027         (many_sections_define.h): New target.
12028         (BUILT_SOURCES): Add many_sections_check.h.
12029         (many_sections_check.h): New target.
12030         (check_PROGRAMS): Add many_sections_r_test.
12031         (many_sections_r_test_SOURCES): Define.
12032         (many_sections_r_test_DEPENDENCIES): Define.
12033         (many_sections_r_test_LDFLAGS): Define.
12034         (many_sections_r_test_LDADD): Define.
12035         (many_sections_r_test.o): New target.
12036         * testsuite/Makefile.in: Rebuild.
12037
12038 2008-04-17  Cary Coutant  <ccoutant@google.com>
12039
12040         * errors.cc (Errors::info): New function.
12041         (gold_info): New function.
12042         * errors.h (Errors::info): New function.
12043         * gold.h (gold_info): New function.
12044         * object.cc (Input_objects::add_object): Print trace output.
12045         * options.cc (options::parse_set): New function.
12046         (General_options::parse_wrap): Deleted.
12047         (General_options::General_options): Deleted initializer.
12048         * options.h (options::String_set): New typedef.
12049         (options::parse_set): New function.
12050         (DEFINE_set): New macro.
12051         (General_options::wrap): Changed to use DEFINE_set. Changed
12052         callers of any_wrap_symbols and is_wrap_symbol.
12053         (General_options::trace, General_options::trace_symbol):
12054         New options.
12055         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12056         (General_options::wrap_symbols_): Deleted.
12057         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12058
12059 2008-04-17  David S. Miller  <davem@davemloft.net>
12060
12061         * options.cc (General_options::parse_V): New function.
12062         * options.h: Add entries for -V and -Qy.
12063
12064 2008-04-17  Ian Lance Taylor  <iant@google.com>
12065
12066         * common.cc (Symbol_table::allocate_commons): Remove options
12067         parameter.  Change caller.
12068         (Symbol_table::do_allocate_commons): Remove options parameter.
12069         Change caller.  Just call do_allocate_commons_list twice.
12070         (Symbol_table::do_allocate_commons_list): New function, broken out
12071         of do_allocate_commons.
12072         * common.h (class Allocate_commons_task): Remove options_ field.
12073         Update constructor.
12074         * symtab.cc (Symbol_table::Symbol_table): Initialize
12075         tls_commons_.
12076         (Symbol_table::add_from_object): Put TLS common symbols on
12077         tls_commons_ list.
12078         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12079         which are IN_OUTPUT_DATA.
12080         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12081         allocate_commons and do_allocate_commons declarations.  Declare
12082         do_allocate_commons_list.
12083         * gold.cc (queue_middle_tasks): Update creation of
12084         Allocate_commons_task to not pass options.
12085         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12086         (TLS_TEST_C_FLAGS): New variable.
12087         (tls_test_c_pic.o): New target.
12088         (tls_test_shared.so): Link in tls_test_c_pic.o.
12089         (tls_test_c_pic_ie.o): New target.
12090         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12091         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12092         (tls_test_c.o): New target.
12093         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12094         (tls_pic_test_LDADD): Likewise.
12095         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12096         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12097         (tls_test_c_gnu2.o): New target.
12098         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12099         tls_test_c_gnu2.o.
12100         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12101         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12102         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12103         * testsuite/tls_test.cc: Include "config.h".
12104         (t_last): Call t11_last.
12105         * testsuite/tls_test.h (t11, t11_last): Declare.
12106         * testsuite/tls_test_c.c: New file.
12107         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12108         * configure.ac: Check for OpenMP support.
12109         * configure, config.in, Makefile.in: Rebuild.
12110         * testsuite/Makefile.in: Rebuild.
12111
12112 2008-04-16  Cary Coutant  <ccoutant@google.com>
12113
12114         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12115         (Target_i386::tls_base_symbol_defined_): New field.
12116         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12117         (Target_i386::Scan::global): Likewise.
12118         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12119         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12120         (Target_x86_64::tls_base_symbol_defined_): New field.
12121         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12122         (Target_x86_64::Scan::global): Likewise.
12123
12124 2008-04-16  Cary Coutant  <ccoutant@google.com>
12125
12126         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12127         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12128         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12129         building shared libraries.
12130         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12131         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12132         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12133         * testsuite/Makefile.in: Rebuild.
12134         * testsuite/weak_undef.h: New file.
12135         * testsuite/weak_undef_file1.cc: Add extra test cases.
12136         * testsuite/weak_undef_file2.cc: Likewise.
12137         * testsuite/weak_undef_test.cc: Likewise.
12138
12139 2008-04-16  David S. Miller  <davem@davemloft.net>
12140
12141         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12142         Add issued_non_pic_error_ field.  Declare check_non_pic.
12143         (Target_sparc::Scan::check_non_pic): New function.
12144         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12145         (Target_sparc::Scan::global): Likewise.
12146
12147         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12148         * configure: Rebuild.
12149
12150         * options.h (DEFINE_enable): New macro.
12151         (new_dtags): New enable option.
12152         (initfirst, interpose, loadfltr, nodefaultlib,
12153         nodelete, nodlopen, nodump): New -z options.
12154         * layout.cc (Layout:finish_dynamic_section): If new
12155         dtags enabled, emit DT_RUNPATH.  Also, emit a
12156         DT_FLAGS_1 containing any specified -z flags.
12157
12158 2008-04-16  Ian Lance Taylor  <iant@google.com>
12159
12160         * copy-relocs.cc: New file.
12161         * copy-relocs.h: New file.
12162         * reloc.cc: Remove Copy_relocs code.
12163         * reloc.h: Likewise.
12164         * reloc-types.h (struct Reloc_types) [both versions]: Add
12165         get_reloc_addend_noerror.
12166         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12167         variants of add_global which take an addend which must be zero.
12168         * i386.cc: Include "copy-relocs.h".
12169         (class Target_i386): Change type of copy_relocs_ to variable,
12170         update initializer.
12171         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12172         Change all callers.
12173         (Target_i386::do_finalize_sections): Change handling of
12174         copy_relocs_.
12175         * sparc.cc: Include "copy-relocs.h".
12176         (class Target_sparc): Change type of copy_relocs_ to variable,
12177         update initializer.
12178         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12179         Change all callers.
12180         (Target_sparc::do_finalize_sections): Change handling of
12181         copy_relocs_.
12182         * x86_64.cc: Include "copy-relocs.h".
12183         (class Target_x86_64): Change type of copy_relocs_ to variable,
12184         update initializer.
12185         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12186         class.  Change all callers.
12187         (Target_x86_64::do_finalize_sections): Change handling of
12188         copy_relocs_.
12189         * Makefile.am (CCFILES): Add copy-relocs.cc.
12190         (HFILES): Add copy-relocs.h.
12191
12192         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12193
12194         * testsuite/script_test_4.sh: Permit leading zeroes.
12195
12196 2008-04-15  Ian Lance Taylor  <iant@google.com>
12197
12198         * script-sections.cc (Script_sections::create_segments): Use
12199         header_size_adjustment even when there is enough room for the
12200         headers.
12201         * testsuite/script_test_4.sh: New file.
12202         * testsuite/script_test_4.t: New file.
12203         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12204         (check_DATA): Add script_test_4.stdout.
12205         (MOSTLYCLEANFILES): Likewise.
12206         (script_test_4): New target.
12207         (script_test_4.stdout): New target.
12208         * testsuite/Makefile.in: Rebuild.
12209
12210         * sparc.cc: Add definitions for Output_data_plt_sparc class
12211         constants.
12212
12213 2008-04-14  David S. Miller  <davem@davemloft.net>
12214
12215         * sparc.cc: New file.
12216         * Makefile.am (TARGETSOURCES): Add sparc.cc
12217         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12218         * configure.tgt: Document targ_extra_size and
12219         targ_extra_big_endian.  Add entries for sparc-* and
12220         sparc64-*.
12221         * configure.ac: Handle targ_extra_size and
12222         targ_extra_big_endian.
12223         * Makefile.in: Rebuild.
12224         * configure: Likewise.
12225         * po/POTFILES.in: Likewise.
12226         * po/gold.pot: Likewise.
12227
12228 2008-04-14  Ian Lance Taylor  <iant@google.com>
12229
12230         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12231         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12232         in the name/type/flags to section mapping.  Don't call
12233         allocate_output_section.
12234         (Layout::choose_output_section): Change parameter from adjust_name
12235         to is_input_section.  Don't permit input sections after sections
12236         are attached to segments.  Don't call allocate_output_section.
12237         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12238         not write_enable_output_section.
12239         (Layout::make_output_section): Don't push to
12240         unattached_section_list_ nor call attach_to_segment.  Call
12241         attach_section_to_segment if sections are attached.
12242         (Layout::attach_sections_to_segments): New function.
12243         (Layout::attach_section_to_segment): New function.
12244         (Layout::attach_allocated_section_to_segment): Rename from
12245         attach_to_segment.  Remove flags parameter.
12246         (Layout::allocate_output_section): Remove function.
12247         (Layout::write_enable_output_section): Remove function.
12248         * layout.h (class Layout): Update for above changes.  Add new
12249         field sections_are_attached_.
12250         * output.h (Output_section::update_flags_for_input_section): New
12251         function.
12252         * output.cc (Output_section::add_input_section): Call
12253         update_flags_for_input_section.
12254         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12255
12256 2008-04-11  Cary Coutant  <ccoutant@google.com>
12257
12258         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12259         thought unnecessary.
12260         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12261
12262 2008-04-11  Ian Lance Taylor  <iant@google.com>
12263
12264         * output.h (class Output_section_data): Remove inline definition
12265         of set_addralign.
12266         * output.cc (Output_section_data::set_addralign): New function.
12267
12268 2008-04-11  Cary Coutant  <ccoutant@google.com>
12269
12270         Add support for TLS descriptors for i386 and x86_64.
12271         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12272         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12273         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12274         GOT_TYPE_TLS_DESC.
12275         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12276         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12277         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12278         relocations.
12279         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12280         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12281         Fix problem with initial-exec relocations.
12282         (Target_i386::Relocate::relocate_tls): Likewise.
12283         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12284         relaxation.
12285         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12286         support for section-plus-offset dynamic table entries.
12287         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12288         (Output_data_dynamic::Dynamic_entry): Add support for
12289         section-plus-offset dynamic table entries.
12290         (Output_data_dynamic::Classification): Likewise.
12291         (Output_data_dynamic::classification_): Renamed offset_.
12292         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12293         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12294         (Target_x86_64::make_plt_section): New function.
12295         (Target_x86_64::reserve_tlsdesc_entries): New function.
12296         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12297         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12298         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12299         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12300         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12301         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12302         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12303         add extra PLT entry for TLS descriptors.
12304         (Output_data_plt_x86_64::got_): New field.
12305         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12306         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12307         fields.
12308         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12309         descriptors.
12310         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12311         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12312         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12313         R_386_TLS_DESC_CALL relocations.
12314         (Target_x86_64::Scan::global): Likewise.
12315         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12316         for TLS descriptors.
12317         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12318         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12319         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12320         GD-to-IE relaxation.
12321         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12322         and TLS_DESCRIPTORS.
12323         * Makefile.in: Rebuild.
12324         * configure: Rebuild.
12325         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12326         (tls_test_shared2.so): New target.
12327         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12328         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12329         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12330         (tls_shared_gd_to_ie_test_LDADD): New variable.
12331         (tls_shared_gnu2_gd_to_ie_test): New target.
12332         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12333         New targets.
12334         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12335         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12336         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12337         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12338         (tls_shared_gnu2_test): New target.
12339         (tls_test_gnu2_shared.so): New target.
12340         (tls_shared_gnu2_test_SOURCES): New variable.
12341         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12342         (tls_shared_gnu2_test_LDFLAGS): New variable.
12343         (tls_shared_gnu2_test_LDADD): New variable.
12344         * testsuite/Makefile.in: Rebuild.
12345         * testsuite/Makefile.
12346
12347 2008-04-11  Ian Lance Taylor  <iant@google.com>
12348
12349         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12350         justsyms.t.
12351         * testsuite/Makefile.in: Rebuild.
12352
12353         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12354         long.
12355         * testsuite/script_test_2.cc (main): Adjust test.
12356
12357 2008-04-11  David S. Miller  <davem@davemloft.net>
12358             Ian Lance Taylor  <iant@google.com>
12359
12360         * options.h (General_options): Add entries for '-Y' and
12361         '-relax'.
12362         * options.cc (General_options:finalize): If -Y was used, add those
12363         entries to the library path instead of the default "/lib" and
12364         "/usr/lib".
12365
12366 2008-04-11  David S. Miller  <davem@davemloft.net>
12367
12368         * testsuite/justsyms.t: Start at 0x100.
12369         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12370         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12371         long.
12372         * testsuite/script_test_2.cc: Adjust string and section length
12373         checks.
12374
12375 2008-04-09  Ian Lance Taylor  <iant@google.com>
12376
12377         PR gold/5996
12378         * script-sections.cc (Sections_element::allocate_to_segment): Add
12379         orphan parameter.
12380         (Output_section_definition::allocate_to_segment): Likewise.
12381         (Orphan_output_section::allocate_to_segment): Likewise.
12382         (Script_sections::attach_sections_using_phdrs_clause): Don't
12383         propagate non-PT_LOAD segments to orphan sections.
12384         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12385         readelf rather than objdump.
12386         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12387         .interp section and PT_INTERP segment are the same size.
12388         * testsuite/Makefile.in: Rebuild.
12389
12390         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12391         aliases for symbols defined in the same object.
12392         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12393         (weak_alias_test_SOURCES): New variable.
12394         (weak_alias_test_DEPENDENCIES): New variable.
12395         (weak_alias_test_LDFLAGS): New variable.
12396         (weak_alias_test_LDADD): New variable.
12397         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12398         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12399         (weak_alias_test_3.o): New target.
12400         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12401         * testsuite/weak_alias_test_main.cc: New file.
12402         * testsuite/weak_alias_test_1.cc: New file.
12403         * testsuite/weak_alias_test_2.cc: New file.
12404         * testsuite/weak_alias_test_3.cc: New file.
12405
12406 2008-04-08  Ian Lance Taylor  <iant@google.com>
12407
12408         * options.h (class General_options): Add --noinhibit-exec option.
12409         * main.cc (main): Check --noinhibit-exec.
12410
12411         * options.h (class General_options): Define --wrap as a special
12412         option.  Add wrap_symbols_ field.
12413         (General_options::any_wrap_symbols): New function.
12414         (General_options::is_wrap_symbol): New function.
12415         * options.cc (General_options::parse_wrap): New function.
12416         (General_options::General_options): Initialize wrap_symbols_.
12417         * symtab.cc (Symbol_table::wrap_symbol): New function.
12418         (Symbol_table::add_from_object): Handle --wrap.
12419         * symtab.h (class Symbol_table): Declare wrap_symbol.
12420         * target.h (Target::wrap_char): New function.
12421         (Target::Target_info): Add wrap_char field.
12422         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12423         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12424         * testsuite/testfile.cc (Target_test::test_target_info):
12425         Likewise.
12426
12427         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12428         there is one.
12429
12430         * layout.h (class Layout): Add added_eh_frame_data_ field.
12431         * layout.cc (Layout::Layout): Initialize new field.
12432         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12433         output section until we find a section we merged successfully.
12434         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12435         that the size be non-zero.
12436
12437         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12438         qualifier.
12439
12440 2008-04-08  Craig Silverstein  <csilvers@google.com>
12441
12442         * configure.ac: Export new conditional variable HAVE_ZLIB.
12443         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12444         on HAVE_ZLIB.
12445         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12446         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12447
12448 2008-04-07  Ian Lance Taylor  <iant@google.com>
12449
12450         * version.cc (version_string): Set to "1.5".
12451
12452         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12453         Add issued_non_pic_error_ field.  Declare check_non_pic.
12454         (Target_x86_64::Scan::check_non_pic): New function.
12455         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12456         (Target_x86_64::Scan::global): Likewise.
12457
12458         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12459         addend parameter.  Change caller.  Handle merge sections.
12460         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12461         Address to Addend.  Don't add in the result of
12462         local_section_offset, pass down the addend and use the returned
12463         value.
12464         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12465         Update declarations of local_section_offset and symbol_value.
12466         * testsuite/two_file_test_1.cc (t18): New function.
12467         * testsuite/two_file_test_2.cc (f18): New function.
12468         * testsuite/two_file_test_main.cc (main): Call t18.
12469         * testsuite/two_file_test.h (t18, f18): Declare.
12470
12471         * configure.ac: Don't test for objdump, c++filt, or readelf.
12472         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12473         conditionals.
12474         (TEST_READELF): New variable.
12475         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12476         (check_PROGRAMS): Add two_file_strip_test.
12477         (two_file_strip_test): New target.
12478         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12479         (two_file_same_shared_strip_test_SOURCES): New variable.
12480         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12481         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12482         (two_file_same_shared_strip_test_LDADD): New variable.
12483         (two_file_shared_strip.so): New target.
12484         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12485         (ver_test_5.syms, ver_test_7.syms): Likewise.
12486         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12487         (strip_test_3.stdout): Use TEST_OBJDUMP.
12488         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12489
12490 2008-04-04  Cary Coutant  <ccoutant@google.com>
12491
12492         * symtab.h (Symbol::is_weak_undefined): New function.
12493         (Symbol::is_strong_undefined): New function.
12494         (Symbol::is_absolute): New function.
12495         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12496         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12497         absolute symbols.
12498         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12499         (weak_undef_test): New target.
12500         * testsuite/Makefile.in: Rebuild.
12501         * testsuite/weak_undef_file1.cc: New file.
12502         * testsuite/weak_undef_file2.cc: New file.
12503         * testsuite/weak_undef_test.cc: New file.
12504
12505 2008-04-03  Craig Silverstein  <csilvers@google.com>
12506
12507         * compressed_output.h (class Output_compressed_section): Use
12508         unsigned buffer.
12509         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12510         add zlib header.
12511         (zlib_compressed_suffix): Removed.
12512         (Output_compressed_section::set_final_data_size): Use unsigned
12513         buffers.
12514         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12515         Fix linker invocation.
12516         (flagstest_o_specialfile_and_compress_debug_sections):
12517         Likewise.
12518         * testsuite/Makefile.in: Regenerated.
12519
12520 2008-04-02  David S. Miller  <davem@davemloft.net>
12521
12522         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12523         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12524
12525 2008-04-02  Craig Silverstein  <csilvers@google.com>
12526
12527         * TODO: New file.
12528
12529 2008-04-02  Ian Lance Taylor  <iant@google.com>
12530
12531         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12532         parameters.  Update for new key type to views_.  Change all
12533         callers.
12534         (File_read::read): Adjust for byteshift in returned view.
12535         (File_read::add_view): New function, broken out of
12536         find_and_make_view.
12537         (File_read::make_view): New function, broken out of
12538         find_and_make_view.
12539         (File_read::find_or_make_view): Add offset and aligned
12540         parameters.  Rewrite accordingly.  Change all callers.
12541         (File_read::get_view): Add offset and aligned parameters.  Adjust
12542         for byteshift in return value.
12543         (File_read::get_lasting_view): Likewise.
12544         * fileread.h (class File_read): Update declarations.
12545         (class File_read::View): Add byteshift_ field.  Add byteshift to
12546         constructor.  Add byteshift method.
12547         * archive.h (Archive::clear_uncached_views): New function.
12548         (Archive::get_view): Add aligned parameter.  Change all callers.
12549         * object.h (Object::get_view): Add aligned parameter.  Change all
12550         callers.
12551         (Object::get_lasting_view): Likewise.
12552
12553         * fileread.cc (File_read::release): Don't call clear_views if
12554         there are multiple objects.
12555         * fileread.h (File_read::clear_uncached_views): New function.
12556         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12557         on the archive.
12558
12559 2008-03-31  Cary Coutant  <ccoutant@google.com>
12560
12561         Add thin archive support.
12562         * archive.cc (Archive::armagt): New const.
12563         (Archive::setup): Remove task parameter and calls to unlock.
12564         (Archive::unlock_nested_archives): New function.
12565         (Archive::read_header): Add nested_off parameter. Change
12566         all callers.
12567         (Archive::interpret_header): Likewise.
12568         (Archive::include_all_members): Change to handle thin
12569         archives.
12570         (Archive::include_member): Likewise.
12571         * archive.h (Archive::Archive): Add new parameters and
12572         initializers.
12573         (Archive::armagt): New const.
12574         (Archive::setup): Remove task parameter.
12575         (Archive::unlock_nested_archives): New function.
12576         (Archive::read_header): Add nested_off parameter.
12577         (Archive::interpret_header): Likewise.
12578         (Archive::Nested_archive_table): New typedef.
12579         (Archive::is_thin_archive_): New field.
12580         (Archive::nested_archives_): New field.
12581         (Archive::options_): New field.
12582         (Archive::dirpath_): New field.
12583         (Archive::task_): New field.
12584         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12585         for thin archives.  Pass additional parameters to
12586         Archive::Archive.  Unlock the archive file after calling
12587         Archive::setup.
12588
12589 2008-03-29  Ian Lance Taylor  <iant@google.com>
12590
12591         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12592         version symbol to be local.
12593         * testsuite/ver_test_4.sh: New file.
12594         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12595         (check_DATA): Add ver_test_4.syms.
12596         (ver_test_4.syms): New target.
12597         * testsuite/Makefile.in: Rebuild.
12598
12599         * output.cc
12600         (Output_section::Input_section_sort_entry::has_priority): New
12601         function.
12602         (Output_section::Input_section_sort_entry::match_file_name): New
12603         function.
12604         (Output_section::Input_section_sort_entry::match_section_name):
12605         Remove.
12606         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12607         Remove.
12608         (Output_section::Input_section_sort_entry::match_section_file):
12609         Remove.
12610         (Output_section::Input_section_sort_compare::operator()): Rewrite
12611         using new Input_section_sort_entry functions.  Sort crtbegin and
12612         crtend first.  Sort sections with no priority before sections with
12613         a priority.
12614         * testsuite/initpri1.c (d3): Check j != 4.
12615         (cd5): New constructor/destructor function.
12616         (main): Check j != 2.
12617
12618         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12619         new symbol when resolving, don't call set_is_default.
12620         * testsuite/ver_test_7.cc: New file.
12621         * testsuite/ver_test_7.sh: New file.
12622         * testsuite/Makefile.am (ver_test_7.so): New target.
12623         (ver_test_7.o): New target.
12624         (check_SCRIPTS): Add ver_test_7.sh.
12625         (check_DATA): Add ver_test_7.syms.
12626         (ver_test_7.syms): New target.
12627
12628 2008-03-28  Ian Lance Taylor  <iant@google.com>
12629
12630         * layout.cc (Layout::layout): If we see an input section with a
12631         name that needs sorting, set the must_sort flag for the output
12632         section.
12633         (Layout::make_output_section): If the name of the output section
12634         indicates that it might require sorting, set the may_sort flag.
12635         * output.h (Output_section::may_sort_attached_input_sections): New
12636         function.
12637         (Output_section::set_may_sort_attached_input_sections): New
12638         function.
12639         (Output_section::must_sort_attached_input_sections): New
12640         function.
12641         (Output_section::set_must_sort_attached_input_sections): New
12642         function.
12643         (class Output_section): Declare Input_section_sort_entry.  Define
12644         Input_section_sort_compare.  Declare
12645         sort_attached_input_sections.  Add new fields:
12646         may_sort_attached_input_sections_,
12647         must_sort_attached_input_sections_,
12648         attached_input_sections_are_sorted_.
12649         * output.cc (Output_section::Output_section): Initialize new
12650         fields.
12651         (Output_section::add_input_section): Add an entry to
12652         input_sections_ if may_sort or must_sort are true.
12653         (Output_section::set_final_data_size): Call
12654         sort_attached_input_sections if necessary.
12655         (Output_section::Input_section_sort_entry): Define new class.
12656         (Output_section::Input_section_sort_compare::operator()): New
12657         function.
12658         (Output_section::sort_attached_input_sections): New function.
12659         * configure.ac: Check whether the compiler supports constructor
12660         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12661         * testsuite/initpri1.c: New file.
12662         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12663         CONSTRUCTOR_PRIORITY.
12664         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12665         (initpri1_LDFLAGS): New variable.
12666         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12667
12668 2008-03-27  Ian Lance Taylor  <iant@google.com>
12669
12670         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12671         * testsuite/common_test_1.c: New file.
12672         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12673         (common_test_1_SOURCES): New variable.
12674         (common_test_1_DEPENDENCIES): New variable.
12675         (common_test_1_LDFLAGS): New variable.
12676
12677         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12678         and commons_ correctly when NAME/VERSION does not override
12679         NAME/NULL.
12680         * testsuite/ver_test_6.c: New file.
12681         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12682         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12683         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12684
12685 2008-03-26  Ian Lance Taylor  <iant@google.com>
12686
12687         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12688         of an undefined symbol from a version script.
12689         * testsuite/Makefile.am (ver_test_5.so): New target.
12690         (ver_test_5.o): New target.
12691         (check_SCRIPTS): Add ver_test_5.sh.
12692         (check_DATA): Add ver_test_5.syms.
12693         (ver_test_5.syms): New target.
12694         * testsuite/ver_test_5.cc: New file.
12695         * testsuite/ver_test_5.script: New file.
12696         * testsuite/ver_test_5.sh: New file.
12697         * Makefile.in, testsuite/Makefile.in: Rebuild.
12698
12699         PR gold/5986
12700         Fix problems building gold with gcc 4.3.0.
12701         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12702         (gold_error_at_location, gold_warning_at_location): Use it.
12703         * configure.ac: Check whether we can compile and use a template
12704         function with a printf attribute.
12705         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12706         when jumping over bytes.
12707         * object.cc: Instantiate Object::read_section_data.
12708         * debug.h: Include <cstring>
12709         * dwarf_reader.cc: Include <algorithm>
12710         * main.cc: Include <cstring>.
12711         * options.cc: Include <cstring>.
12712         * output.cc: Include <cstring>.
12713         * script.cc: Include <cstring>.
12714         * script.h: Include <string>.
12715         * symtab.cc: Include <cstring> and <algorithm>.
12716         * target-select.cc: Include <cstring>.
12717         * version.cc: Include <string>.
12718         * testsuite/testmain.cc: Include <cstdlib>.
12719         * configure, config.in: Rebuild.
12720
12721 2008-03-25  Ian Lance Taylor  <iant@google.com>
12722
12723         * options.cc: Include "../bfd/bfdver.h".
12724         (options::help): Print bug reporting address.
12725
12726         * version.cc (print_version): Adjust output for current value of
12727         BFD_VERSION_STRING.
12728
12729         * NEWS: New file.
12730
12731         * options.cc (options::help): Print list of supported targets.
12732         * target-select.h: Include <vector>.
12733         (class Target_selector): Make machine_, size_, and is_big_endian_
12734         fields const.  Add bfd_name_ and instantiated_target_ fields.
12735         (Target_selector::Target_selector): Add bfd_name parameter.
12736         (Target_selector::recognize): Make non-virtual, call
12737         do_recognize.
12738         (Target_selector::recognize_by_name): Make non-virtual, call
12739         do_recognize_by_name.
12740         (Target_selector::supported_names): New function.
12741         (Target_selector::bfd_name): New function.
12742         (Target_selector::do_instantiate_target): New pure virtual
12743         function.
12744         (Target_selector::do_recognize): New virtual function.
12745         (Target_selector::do_recognize_by_name): New virtual function.
12746         (Target_selector::instantiate_target): New private function.
12747         (supported_target_names): Declare.
12748         * target-select.cc (Target_selector::Target_selector): Update for
12749         new parameter and fields.
12750         (select_target_by_name): Check that the name matches before
12751         calling recognize_by_name.
12752         (supported_target_names): New function.
12753         * i386.cc (class Target_selector_i386): Update Target_selector
12754         constructor call.  Remove recognize and recognize_by_name.  Add
12755         do_instantiate_target.
12756         * x86_64.cc (class Target_selector_x86_64): Likewise.
12757         * testsuite/testfile.cc (class Target_selector_test): Update for
12758         changes to Target_selector.
12759
12760         * README: Rewrite, with some notes on unsupported features.
12761
12762 2008-03-24  Cary Coutant  <ccoutant@google.com>
12763
12764         * i386.cc (Target_i386::Got_type): New enum declaration.
12765         (Target_i386::Scan::local): Updated callers of Output_data_got
12766         member functions.
12767         (Target_i386::Scan::global): Likewise.
12768         (Target_i386::Relocate::relocate): Likewise.
12769         (Target_i386::Relocate::relocate_tls): Likewise.
12770         * object.h (Got_offset_list): New class.
12771         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12772         (Sized_relobj::local_got_offset): Likewise.
12773         (Sized_relobj::set_local_got_offset): Likewise.
12774         (Sized_relobj::local_has_tls_got_offset): Removed.
12775         (Sized_relobj::local_tls_got_offset): Removed.
12776         (Sized_relobj::set_local_tls_got_offset): Removed.
12777         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12778         * output.cc (Output_data_got::add_global): Added got_type parameter.
12779         (Output_data_got::add_global_with_rel): Likewise.
12780         (Output_data_got::add_global_with_rela): Likewise.
12781         (Output_data_got::add_global_pair_with_rel): New function.
12782         (Output_data_got::add_global_pair_with_rela): New function.
12783         (Output_data_got::add_local): Added got_type parameter.
12784         (Output_data_got::add_local_with_rel): Likewise.
12785         (Output_data_got::add_local_with_rela): Likewise.
12786         (Output_data_got::add_local_pair_with_rel): New function.
12787         (Output_data_got::add_local_pair_with_rela): New function.
12788         (Output_data_got::add_global_tls): Removed.
12789         (Output_data_got::add_global_tls_with_rel): Removed.
12790         (Output_data_got::add_global_tls_with_rela): Removed.
12791         (Output_data_got::add_local_tls): Removed.
12792         (Output_data_got::add_local_tls_with_rel): Removed.
12793         (Output_data_got::add_local_tls_with_rela): Removed.
12794         * output.h (Output_data_got::add_global): Added got_type parameter.
12795         (Output_data_got::add_global_with_rel): Likewise.
12796         (Output_data_got::add_global_with_rela): Likewise.
12797         (Output_data_got::add_global_pair_with_rel): New function.
12798         (Output_data_got::add_global_pair_with_rela): New function.
12799         (Output_data_got::add_local): Added got_type parameter.
12800         (Output_data_got::add_local_with_rel): Likewise.
12801         (Output_data_got::add_local_with_rela): Likewise.
12802         (Output_data_got::add_local_pair_with_rel): New function.
12803         (Output_data_got::add_local_pair_with_rela): New function.
12804         (Output_data_got::add_global_tls): Removed.
12805         (Output_data_got::add_global_tls_with_rel): Removed.
12806         (Output_data_got::add_global_tls_with_rela): Removed.
12807         (Output_data_got::add_local_tls): Removed.
12808         (Output_data_got::add_local_tls_with_rel): Removed.
12809         (Output_data_got::add_local_tls_with_rela): Removed.
12810         * resolve.cc (Symbol::override_base_with_special): Removed
12811         reference to has_got_offset_ field.
12812         * symtab.cc (Symbol::init_fields): Replaced initialization
12813         of got_offset_ with got_offsets_.  Removed initialization
12814         of has_got_offset_
12815         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12816         (Symbol::got_offset): Likewise.
12817         (Symbol::set_got_offset): Likewise.
12818         (Symbol::has_tls_got_offset): Removed.
12819         (Symbol::tls_got_offset): Removed.
12820         (Symbol::set_tls_got_offset): Removed.
12821         (Symbol::got_offset_): Removed.
12822         (Symbol::tls_mod_got_offset_): Removed.
12823         (Symbol::tls_pair_got_offset_): Removed.
12824         (Symbol::got_offsets_): New field.
12825         (Symbol::has_got_offset): Removed.
12826         (Symbol::has_tls_mod_got_offset): Removed.
12827         (Symbol::has_tls_pair_got_offset): Removed.
12828         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12829         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12830         member functions.
12831         (Target_x86_64::Scan::global): Likewise.
12832         (Target_x86_64::Relocate::relocate): Likewise.
12833         (Target_x86_64::Relocate::relocate_tls): Likewise.
12834
12835 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12836
12837         * yyscript.y: Fix spelling error in comment.
12838
12839 2008-03-24  Ian Lance Taylor  <iant@google.com>
12840
12841         * options.h (class General_options): Define build_id option.
12842         * layout.h (class Layout): Declare write_build_id, create_note,
12843         create_build_id.  Add build_id_note_ member.
12844         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12845         "libiberty.h", "md5.h", "sha1.h".
12846         (Layout::Layout): Initialize eh_frame_data_,
12847         eh_frame_hdr_section_, and build_id_note_.
12848         (Layout::finalize): Call create_build_id.
12849         (Layout::create_note): New function, broken out of
12850         Layout::create_gold_note.
12851         (Layout::create_gold_note): Call create_note.
12852         (Layout::create_build_id): New function.
12853         (Layout::write_build_id): New function.
12854         (Close_task_runner::run): Call write_build_id.
12855
12856         * x86_64.cc: Correct license to GPLv3.
12857
12858 2008-03-23  Ian Lance Taylor  <iant@google.com>
12859
12860         * options.cc: Include "demangle.h".
12861         (parse_optional_string): New function.
12862         (parse_long_option): Handle takes_optional_argument.
12863         (parse_short_option): Update dash_z initializer.  Handle
12864         takes_optional_argument.
12865         (General_options::General_options): Initialize do_demangle_.
12866         (General_options::finalize): Set do_demangle_.  Handle demangling
12867         style.
12868         * options.h (parse_optional_string): Declare.
12869         (struct One_option): Add optional_arg field.  Update constructor.
12870         Update call constructor calls.  Add takes_optional_argument
12871         function.
12872         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12873         (DEFINE_optional_string): Define.
12874         (General_options::demangle): Change from DEFINE_bool to
12875         DEFINE_optional_string.
12876         (General_options::no_demangle): New function.
12877         (General_options::do_demangle): New function.
12878         (General_options::set_do_demangle): New function.
12879         (General_options::execstack_status_): Move definition to end of
12880         class definition.
12881         (General_options::static_): Likewise.
12882         (General_options::do_demangle_): New field.
12883         * object.cc (big_endian>::get_symbol_location_info): Call
12884         Options::do_demangle, not Options::demangle.
12885         * symtab.cc (demangle): Likewise.
12886
12887 2008-03-22  Ian Lance Taylor  <iant@google.com>
12888
12889         * gold.h: Include <cstddef> and <sys/types.h>
12890         * options.h: Include <cstring>.
12891
12892 2008-03-21  Ian Lance Taylor  <iant@google.com>
12893
12894         * Added source code to GNU binutils.