elfcpp/
[external/binutils.git] / gold / ChangeLog
1 2012-05-01  Cary Coutant  <ccoutant@google.com>
2
3         * dwarf_reader.cc (Dwarf_die::read_attributes)
4         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
6         * reduced_debug_output.cc
7         (Output_reduced_debug_info_section::get_die_end): Remove
8         DW_FORM_GNU_ref_index.  Add default case.
9
10 2012-04-26  Mark Wielaard  <mjw@redhat.com>
11
12         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
13         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
14         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
15         DW_AT_high_pc as offset from DW_AT_low_pc.
16
17         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
18         * testsuite/Makefile.in: Regenerate.
19         * testsuite/gdb_index_test_3.c: New test source file.
20         * testsuite/gdb_index_test_3.sh: New test source file.
21
22 2012-04-25  Ian Lance Taylor  <iant@google.com>
23
24         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
25         pointer.
26         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
27         as a class, not a struct.
28         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
29         (Target_arm::apply_cortex_a8_workaround): Likewise.
30         * gc.h: Declare Reloc_types as a struct, not a class.
31         * object.h: Declare Symbols_data as a struct.
32         * reloc.h: Declare Read_relocs_data as a struct.
33         * target.h: Declare Relocate_info as a struct.
34
35 2012-04-24  David S. Miller  <davem@davemloft.net>
36
37         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
38         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
39         and R_SPARC_WPLT30.
40
41 2012-04-24  Cary Coutant  <ccoutant@google.com>
42
43         * incremental-dump.cc (find_input_containing_global): Replace
44         magic number with symbolic constant.
45         (dump_incremental_inputs): Update version number.
46         * incremental.cc (Output_section_incremental_inputs): Update version
47         number; import symbolic constants from Incremental_inputs_reader.
48         (Incremental_inputs::create_data_sections): Align relocations
49         section correctly for 64-bit targets.
50         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
51         constants; add padding.
52         (Output_section_incremental_inputs::write_header): Add assert for
53         header_size.
54         (Output_section_incremental_inputs::write_input_files): Add assert
55         for input_entry_size.
56         (Output_section_incremental_inputs::write_info_blocks): Add padding;
57         add assert for object_info_size, input_section_entry_size,
58         global_sym_entry_size.
59         * incremental.h (Incremental_inputs_reader): Add symbolic constants
60         for data structure sizes; use them.
61         (Incremental_input_entry_reader): Import symbolic constants from
62         Incremental_inputs_reader; use them.
63
64 2012-04-23  David S. Miller  <davem@davemloft.net>
65
66         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
67         and elf_flags_set_.
68         (Target_sparc::Target_sparc): Initialize new fields.
69         (Target_sparc::do_make_elf_object): New function.
70         (Target_sparc::do_adjust_elf_header): New function.
71
72 2012-04-23  Cary Coutant  <ccoutant@google.com>
73
74         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
75         CU range table of gdb index.
76
77 2012-04-20  David S. Miller  <davem@davemloft.net>
78
79         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
80         instead of false.
81
82 2012-04-16  David S. Miller  <davem@davemloft.net>
83
84         * sparc.cc (Target_sparc::got_address): New function.
85         (Sparc_relocate_functions::gdop_hix22): New function.
86         (Sparc_relocate_functions::gdop_lox10): New function.
87         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
88         relocs.
89         (Target_sparc::Scan::local): Likewise if the global symbol is not
90         preemptible and is not IFUNC.
91         (Target_sparc::Relocate::relocate): Perform GOTDATA code
92         transformations for local and non-preemptible non-IFUNC global
93         symbols.
94
95         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
96         writing out 64-bit part of ranges.
97
98         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
99         -fpic and -fpie respectively.
100         * Makefile.in: Regenerate.
101
102         * sparc.cc (class Target_sparc): Add rela_ifunc_.
103         (Target_sparc::Target_sparc): Initialize new field.
104         (Target_sparc::do_plt_section_for_global): New function.
105         (Target_sparc::do_plt_section_for_local): New function.
106         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
107         (Target_sparc::make_plt_section): New function, broken out of
108         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
109         (Target_sparc::make_plt_entry): Call make_plt_section.
110         (Target_sparc::make_local_ifunc_plt_entry): New function.
111         (Target_sparc::rela_ifunc_section): New function.
112         (Target_sparc::plt_section): Remove const.
113         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
114         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
115         and ifunc_count_ fields.
116         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
117         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
118         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
119         (Output_data_plt_sparc::rela_ifunc): New function.
120         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
121         (Output_data_plt_sparc::has_ifunc_section): New function.
122         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
123         (Output_data_plt_sparc::address_for_global): New function.
124         (Output_data_plt_sparc::address_for_local): New function.
125         (Output_data_plt_sparc::plt_index_to_offset): New function.
126         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
127         and entry_count.
128         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
129         entry_count.
130         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
131         R_SPARC_JMP_IREL to switch.
132         (Target_sparc::Scan::check_non_pic): Likewise.
133         (Target_sparc::Scan::local): Handle IFUNC symbols.
134         (Target_sparc::Scan::local): Likewise.
135         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
136         and plt_address_for_local.
137         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
138         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
139
140         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
141         (class Output_data_reloc): Adjust calls to Output_reloc_type.
142         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
143         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
144         global relocs too.
145         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
146         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
147         calls.
148         * sparc.cc (Target_sparc::Scan::global): Likewise.
149         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
150
151 2012-04-16  Cary Coutant  <ccoutant@google.com>
152
153         * archive.cc (Library_base::should_include_member): Check for
154         --export-dynamic-symbol.
155         * options.h (class General_options): Add --export-dynamic-symbol.
156         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
157         --export-dynamic-symbol.
158         (Symbol_table::gc_mark_undef_symbols): Likewise.
159         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
160
161 2012-04-12  David S. Miller  <davem@davemloft.net>
162
163         * sparc.cc (Reloc::wdisp10): New relocation method.
164         (Reloc::h34): Likewise.
165         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
166         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
167         R_SPARC_WDISP10.
168         (Target_sparc::Scan::local): Likewise.
169         (Target_sparc::Scan::global): Likewise.
170         (Target_sparc::Relocate::relocate): Likewise.
171
172 2012-04-09  Cary Coutant  <ccoutant@google.com>
173
174         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
175         low_pc == 0.
176
177 2012-04-06  Ian Lance Taylor  <iant@google.com>
178
179         * timer.cc: #include <unistd.h>.
180
181 2012-04-06  Roland McGrath  <mcgrathr@google.com>
182
183         * configure.in (AC_CHECK_HEADERS): Add locale.h.
184         * config.in: Regenerate.
185         * configure: Regenerate.
186
187 2012-04-05  Nick Clifton  <nickc@redhat.com>
188
189         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
190         (AM_LC_MESSAGES): Add.
191         * aclocal.m4: Regenerate.
192         * config.in: Regenerate.
193         * configure: Regenerate.
194
195 2012-03-21  Cary Coutant  <ccoutant@google.com>
196
197         * Makefile.am: Add gdb-index.cc, gdb-index.h.
198         * Makefile.in: Regenerate.
199         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
200         (Sized_elf_reloc_mapper::symbol_section): New function.
201         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
202         (make_elf_reloc_mapper): New function.
203         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
204         (Dwarf_abbrev_table::do_read_abbrevs): New function.
205         (Dwarf_abbrev_table::do_get_abbrev): New function.
206         (Dwarf_ranges_table::read_ranges_table): New function.
207         (Dwarf_ranges_table::read_range_list): New function.
208         (Dwarf_pubnames_table::read_section): New function.
209         (Dwarf_pubnames_table::read_header): New function.
210         (Dwarf_pubnames_table::next_name): New function.
211         (Dwarf_die::Dwarf_die): New function.
212         (Dwarf_die::read_attributes): New function.
213         (Dwarf_die::skip_attributes): New function.
214         (Dwarf_die::set_name): New function.
215         (Dwarf_die::set_linkage_name): New function.
216         (Dwarf_die::attribute): New function.
217         (Dwarf_die::string_attribute): New function.
218         (Dwarf_die::int_attribute): New function.
219         (Dwarf_die::uint_attribute): New function.
220         (Dwarf_die::ref_attribute): New function.
221         (Dwarf_die::child_offset): New function.
222         (Dwarf_die::sibling_offset): New function.
223         (Dwarf_info_reader::check_buffer): New function.
224         (Dwarf_info_reader::parse): New function.
225         (Dwarf_info_reader::do_parse): New function.
226         (Dwarf_info_reader::do_read_string_table): New function.
227         (Dwarf_info_reader::lookup_reloc): New function.
228         (Dwarf_info_reader::get_string): New function.
229         (Dwarf_info_reader::visit_compilation_unit): New function.
230         (Dwarf_info_reader::visit_type_unit): New function.
231         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
232         Sized_elf_reloc_mapper.
233         (Sized_dwarf_line_info::symbol_section): Remove function.
234         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
235         (Sized_dwarf_line_info::read_line_mappings): Remove object
236         parameter, adjust callers.
237         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
238         * dwarf_reader.h: Include <sys/types.h>.
239         (class Track_relocs): Remove forward declaration.
240         (class Elf_reloc_mapper): New class.
241         (class Sized_elf_reloc_mapper): New class.
242         (class Dwarf_abbrev_table): New class.
243         (class Dwarf_range_list): New class.
244         (class Dwarf_ranges_table): New class.
245         (class Dwarf_pubnames_table): New class.
246         (class Dwarf_die): New class.
247         (class Dwarf_info_reader): New class.
248         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
249         (Sized_dwarf_line_info::symbol_section): Remove member function.
250         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
251         base class.
252         * gdb-index.cc: New source file.
253         * gdb-index.h: New source file.
254         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
255         and .debug_types sections, call Layout::add_to_gdb_index.
256         (Sized_relobj_incr::do_section_name): Implement.
257         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
258         return type; Implement.
259         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
260         return type.
261         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
262         parameter list and return type.
263         (Sized_incr_dynobj::do_section_contents): Likewise.
264         * layout.cc: Include gdb-index.h.
265         (Layout::Layout): Initialize gdb_index_data_.
266         (Layout::init_fixed_output_section): Check for .gdb_index section.
267         (Layout::add_to_gdb_index): New function. Instantiate.
268         * layout.h: Add forward declaration for class Gdb_index.
269         (Layout::add_to_gdb_index): New member function.
270         (Layout::gdb_index_data_): New data member.
271         * main.cc: Include gdb-index.h.
272         (main): Print statistics for gdb index.
273         * object.cc (Object::section_contents): Move code into
274         do_section_contents.
275         (need_decompressed_section): Check for sections needed when building
276         gdb index.
277         (build_compressed_section_map): Likewise.
278         (Sized_relobj_file::do_read_symbols): Need local symbols when building
279         gdb index.
280         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
281         sections; call Layout::add_to_gdb_index.
282         (Sized_relobj_file::do_decompressed_section_contents): Call
283         do_section_contents directly.
284         * object.h (Object::do_section_contents): Adjust parameter list and
285         return type.
286         (Object::do_decompressed_section_contents): Call do_section_contents
287         directly.
288         (Sized_relobj_file::do_section_contents): Adjust parameter list and
289         return type.
290         * options.h (class General_options): Add --gdb-index option.
291         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
292         list and return type.
293         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
294         * reloc.h (Track_relocs::checkpoint): New function.
295         (Track_relocs::reset): New function.
296
297         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
298         New test cases.
299         * testsuite/Makefile.in: Regenerate.
300         * testsuite/gdb_index_test.cc: New test source file.
301         * testsuite/gdb_index_test_1.sh: New test source file.
302         * testsuite/gdb_index_test_2.sh: New test source file.
303
304 2012-03-19  Doug Kwan  <dougkwan@google.com>
305
306         * arm.cc (Target_arm::do_define_standard_symbols): New method.
307         (Target_arm::do_finalize_sections): Remove code which defines
308         __exidx_start and __exidx_end.  Make symbol table parameter
309         anonymous as it is not used.
310         * gold.cc (queue_middle_tasks): Call target hook to define any
311         target-specific symbols.
312         * target.h (Target::define_standard_symbols): New method.
313         (Target::do_define_standard_symbols): Same.
314         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
315         * testsuite/Makefile.in: Regenerate.
316         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
317         and __exidx_end.
318         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
319         relocations are generated for __exidx_start and __exidx_end.
320
321 2012-03-16  Doug Kwan  <dougkwan@google.com>
322
323         * testsuite/Makefile.am: Disable test initpri3b.
324         * testsuite/Makefile.in: Regenerate.
325
326 2012-03-15  Doug Kwan  <dougkwan@google.com>
327
328         * arm.cc (Target_arm::got_section): Make .got section read-only
329         if -z now is given.
330
331 2012-03-15  Ian Lance Taylor  <iant@google.com>
332
333         PR gold/13850
334         * layout.cc (Layout::make_output_section): Correctly mark
335         SHT_INIT_ARRAY, et. al., as relro.
336
337 2012-03-14  Doug Kwan  <dougkwan@google.com>
338
339         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
340         dynamic relocations for protected symbols in shared objects.
341
342 2012-03-13  Ian Lance Taylor  <iant@google.com>
343
344         * resolve.cc (Symbol_table::resolve): When merging common symbols,
345         keep the larger alignment.
346
347 2012-03-12  Cary Coutant  <ccoutant@google.com>
348
349         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
350         handling of DW_LNE_define_file.
351
352 2012-03-12  Cary Coutant  <ccoutant@google.com>
353
354         * reduced_debug_output.cc
355         (Output_reduced_debug_info_section::get_die_end): Add new FORM
356         codes to switch.
357
358 2012-02-29  Cary Coutant  <ccoutant@google.com>
359
360         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
361
362 2012-02-29  Cary Coutant  <ccoutant@google.com>
363
364         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
365         Call Object::decompressed_section_contents.
366         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
367         New dtor.
368         (Sized_dwarf_line_info::buffer_start_): New data member.
369         * merge.cc (Output_merge_data::do_add_input_section): Call
370         Object::decompressed_section_contents.
371         (Output_merge_string::do_add_input_section): Likewise.
372         * object.cc (need_decompressed_section): New function.
373         (build_compressed_section_map): Decompress sections needed later.
374         (Sized_relobj_file::do_decompressed_section_contents): New function.
375         (Sized_relobj_file::do_discard_decompressed_sections): New function.
376         * object.h (Object::decompressed_section_contents): New function.
377         (Object::discard_decompressed_sections): New function.
378         (Object::do_decompressed_section_contents): New function.
379         (Object::do_discard_decompressed_sections): New function.
380         (Compressed_section_info): New type.
381         (Compressed_section_map): Include decompressed section contents.
382         (Sized_relobj_file::do_decompressed_section_contents): New function.
383         (Sized_relobj_file::do_discard_decompressed_sections): New function.
384
385 2012-02-16  Cary Coutant  <ccoutant@google.com>
386
387         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
388         * testsuite/Makefile.in: Regenerate.
389
390 2012-02-14  Cary Coutant  <ccoutant@google.com>
391
392         * options.cc (General_options::finalize): Disallow -pie and -static.
393
394 2012-02-03  Doug Kwan  <dougkwan@google.com>
395
396         * arm.cc (Arm_relocate_functions::abs8,
397         Arm_relocate_functions::abs16): Use
398         Bits::has_signed_unsigned_overflow32.
399         (Arm_relocate_functions::thm_abs8): Correct range of
400         overflow check.
401         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
402         in assertions.
403
404 2012-02-02  Doug Kwan  <dougkwan@google.com>
405
406         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
407         position independent outputs, not just shared objects.
408
409 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
410
411         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
412         * configure: Regenerated.
413
414 2012-01-27  Ian Lance Taylor  <iant@google.com>
415
416         * reloc.h (Bits): New class with static functions, copied from
417         namespace utils in arm.cc.
418         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
419         instead.
420
421 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
422
423         * incremental.cc (write_info_blocks): Correct relocation offset.
424
425 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
426
427         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
428         (Relocate::tls_gd_to_le): Likewise.
429
430 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
431
432         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
433
434 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
435
436         * configure.ac: Check if -mcmodel=medium works.
437         * configure: Regenerated.
438
439 2012-01-24  Cary Coutant  <ccoutant@google.com>
440
441         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
442         definition and ...
443         (read_unsigned_LEB_128_x): ... this new function.
444         (read_signed_LEB_128): Replaced with inline definition and ...
445         (read_signed_LEB_128_x): ... this new function.
446         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
447         (read_unsigned_LEB_128): Add inline definition.
448         (read_signed_LEB_128_x): New function.
449         (read_signed_LEB_128): Add inline definition.
450         * testsuite/Makefile.am (leb128_unittest): New unit test.
451         * testsuite/Makefile.in: Regenerate.
452         * testsuite/leb128_unittest.cc: New unit test.
453
454 2012-01-23  Ian Lance Taylor  <iant@google.com>
455
456         PR gold/13617
457         * i386.cc (Target_i386::do_code_fill): When using a jmp
458         instruction, pad with nop instructions.
459         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
460
461 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
462
463         * x86_64.cc (gc_process_relocs): Add typename on types used in
464         template.
465         (scan_relocs): Likewise.
466         (relocate_section): Likewise.
467         (apply_relocation): Likewise.
468
469 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
470
471         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
472         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
473         under x32.
474
475 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
476
477         * x86_64.cc: Initial support for x32.
478
479 2012-01-03  Cary Coutant  <ccoutant@google.com>
480
481         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
482         Use abstract base class for GOT.
483         * gold/output.h (class Output_data_got_base): New abstract base class.
484         (class Output_data_got): Derive from new base class, adjust ctors.
485         (Output_data_got::reserve_slot): Make virtual; rename to
486         do_reserve_slot; Adjust callers.
487         * gold/target.h (Sized_target::init_got_plt_for_update): Return
488         pointer to abstract base class.
489         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
490
491 2011-12-18  Ian Lance Taylor  <iant@google.com>
492
493         * object.h (Relobj::local_symbol_value): New function.
494         (Relobj::local_plt_offset): New function.
495         (Relobj::local_has_got_offset): New function.
496         (Relobj::local_got_offset): New function.
497         (Relobj::set_local_got_offset): New function.
498         (Relobj::do_local_symbol_value): New pure virtual function.
499         (Relobj::do_local_plt_offset): Likewise.
500         (Relobj::do_local_has_got_offset): Likewise.
501         (Relobj::do_local_got_offset): Likewise.
502         (Relobj::do_set_local_got_offset): Likewise.
503         (Sized_relobj::do_local_has_got_offset): Rename from
504         local_has_got_offset.
505         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
506         (Sized_relobj::do_set_local_got_offset): Rename from
507         set_local_got_offset.
508         (Sized_relobj_file::do_local_plt_offset): Rename from
509         local_plt_offset.
510         (Sized_relobj_file::do_local_symbol_value): New function.
511         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
512         local_plt_offset.
513         * output.cc (Output_data_got::Got_entry::write): Change object to
514         Relobj.  Use local_symbol_value.
515         (Output_data_got::add_global_with_rel): Change rel_dyn to
516         Output_data_reloc_generic*.  Use add_global_generic.
517         (Output_data_got::add_global_with_rela): Remove.  Change all
518         callers to use add_global_with_rel.
519         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
520         Output_data_reloc_generic*.  Use add_global_generic.
521         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
522         callers to use add_global_pair_with_rel.
523         (Output_data_got::add_local): Change object to Relobj*.
524         (Output_data_got::add_local_plt): Likewise.
525         (Output_data_got::add_local_with_rel): Change object to Relobj*,
526         change rel_dyn to Output_data_reloc_generic*.  Use
527         add_local_generic.
528         (Output_data_got::add_local_with_rela): Remove.  Change all
529         callers to use all_local_with_rel.
530         (Output_data_got::add_local_pair_with_rel): Change object to
531         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
532         add_output_section_generic.
533         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
534         callers to use add_local_pair_with_rel.
535         (Output_data_got::reserve_local): Change object to Relobj*.
536         * output.h: (class Output_data_reloc_generic): Add pure virtual
537         declarations for add_global_generic, add_local_generic,
538         add_output_section_generic.
539         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
540         functions for Output_data_reloc_generic.  Update declarations for
541         changes listed in output.cc.
542         (class Output_data_got): Change template parameter to got_size.
543         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
544         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
545         function.
546         (Sized_relobj_incr::do_local_plt_offset): New function.
547         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
548         add_global_generic.
549
550 2011-12-17  Cary Coutant  <ccoutant@google.com>
551
552         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
553         * resolve.cc (Symbol_table::resolve): Likewise.
554         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
555         arrays.
556         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
557
558 2011-12-16  Ian Lance Taylor  <iant@google.com>
559
560         * output.h (Output_data_reloc_generic::add): Only call
561         add_dynamic_reloc if this is a dynamic reloc section.
562
563 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
564
565         PR gold/13505
566         * target-reloc.h (apply_relocation): Replace <64, false> with
567         <size, big_endian>.
568
569 2011-11-25  Nick Clifton  <nickc@redhat.com>
570
571         * po/it.po: New Italian translation.
572
573 2011-11-17  Sterling Augustine  <saugustine@google.com>
574
575         * script.cc (script_include_directive): Implement.
576         (read_script_file): New local variables name and search_path. Update
577         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
578         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
579         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
580
581 2011-11-11  Sterling Augustine  <saugustine@google.com>
582
583         * yyscript.y (section_cmd): Add support for INCLUDE directive.
584         (file_or_sections_cmd): Likewise.
585
586 2011-11-11  Doug Kwan  <dougkwan@google.com>
587
588         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
589         if --just-symbols is given.
590
591 2011-11-10  Doug Kwan  <dougkwan@google.com>
592
593         PR gold/13362
594         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
595         when processing data relocs.
596         * reloc.h (Relocate_functions::rel_unaligned): New method.
597         (Relocate_functions::pcrel_unaligned): Ditto.
598         (Relocate_functions::rel32_unaligned): Ditto.
599         (Relocate_functions::pcrel32_unaligned): Ditto.
600
601 2011-11-09  Doug Kwan  <dougkwan@google.com>
602
603         PR gold/13362
604         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
605         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
606         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
607         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
608         (Relocate_functions::rel_unaligned): New.
609         (Relocate_functions::rel32_unaligned): New.
610         * target-reloc.h (relocate_for_relocatable): Add code to handle
611         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
612         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
613         arm_unaligned_reloc_r): New targets.
614         * testsuite/Makefile.in: Regenerate.
615         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
616         linking.
617
618 2011-11-02  Ian Lance Taylor  <iant@google.com>
619
620         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
621         NATIVE_LINKER.
622         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
623         * options.cc (General_options::finalize): Use library search path
624         from configure script if specified.  If not native and no sysroot,
625         only search TOOLLIBDIR.
626         * options.h (Search_directory::Search_directory): Change name to
627         const std::string&.
628         (General_options::add_to_library_path_with_sysroot): Change arg to
629         const std::string&.
630         * configure, Makefile.in, config.in: Rebuild.
631
632 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
633
634         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
635         we are working around the ARM1176 Erratum.
636         * options.h (General_options::fix_arm1176): Add option.
637         * testsuite/Makefile.am: Add testcases, and keep current ones
638         working.
639         * testsuite/Makefile.in: Regenerate.
640         * testsuite/arm_fix_1176.s: New file.
641         * testsuite/arm_fix_1176.sh: Likewise.
642
643 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
644
645         * arm.cc (Target_arm::Target_arm): Remove initialisation of
646         may_use_blx_.
647         (Target_arm::may_use_blx): Remove method.
648         (Target_arm::set_may_use_blx): Likewise.
649         (Target_arm::may_use_v4t_interworking): New method.
650         (Target_arm::may_use_v5t_interworking): Likewise.
651         (Target_arm::may_use_blx_): Remove member variable.
652         (Arm_relocate_functions::arm_branch_common): Check for v5T
653         interworking.
654         (Arm_relocate_functions::thumb_branch_common): Likewise.
655         (Reloc_stub::stub_type_for_reloc): Likewise.
656         (Target_arm::do_finalize_sections): Correct interworking checks.
657         * testsuite/Makefile.am: Add new tests.
658         * testsuite/Makefile.in: Regenerate.
659         * testsuite/arm_farcall_arm_arm.s: New test.
660         * testsuite/arm_farcall_arm_arm.sh: Likewise.
661         * testsuite/arm_farcall_arm_thumb.s: Likewise.
662         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
663         * testsuite/arm_farcall_thumb_arm.s: Likewise.
664         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
665         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
666         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
667
668 2011-10-31  Cary Coutant  <ccoutant@google.com>
669
670         PR gold/13023
671         * expression.cc (Expression::eval_with_dot): Add
672         is_section_dot_assignment parameter.
673         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
674         absolute and assigning to dot within a section.
675         * script-sections.cc
676         (Output_section_element_assignment::set_section_addresses): Pass
677         dot_section to set_if_absolute.
678         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
679         as is_section_dot_assignment flag to eval_with_dot.
680         (Output_section_element_dot_assignment::set_section_addresses):
681         Likewise.
682         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
683         parameter.  Also set value if relative to dot_section; set the
684         symbol's output_section.
685         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
686         parameter.  Adjust all callers.
687         (Expression::eval_maybe_dot): Likewise.
688         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
689         Adjust all callers.
690         * testsuite/script_test_2.t: Test assignment of an absolute value
691         to dot within an output section element.
692
693 2011-10-31  Cary Coutant  <ccoutant@google.com>
694
695         * options.h (class General_options): Add --[no-]gnu-unique options.
696         * symtab.cc (Symbol_table::sized_write_globals): Convert
697         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
698
699 2011-10-31  Cary Coutant  <ccoutant@google.com>
700
701         PR gold/13359
702         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
703         unnecessary assertion.
704         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
705
706 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
707
708         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
709         gc_mark_symbol.
710         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
711         gc_mark_symbol.
712         Change to just keep the section associated with symbol.
713         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
714         they are externally visible and --export-dynamic is turned on.
715         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
716
717 2011-10-19  Ian Lance Taylor  <iant@google.com>
718
719         PR gold/13163
720         * script-sections.cc
721         (Output_section_element_dot_assignment::needs_output_section): New
722         function.
723
724 2011-10-19  Ian Lance Taylor  <iant@google.com>
725
726         PR gold/13204
727         * layout.cc (Layout::segment_precedes): Don't assert failure if a
728         --section-start option was seen.
729         * options.h (General_options::any_section_start): New function.
730
731 2011-10-18  David S. Miller  <davem@davemloft.net>
732
733         PR binutils/13301
734         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
735         member to track relocation locations that have moved during TLS
736         reloc optimizations.
737         (Target_sparc::Relocate::Relocate): Initialize to NULL.
738         (Target_sparc::Relocate::relocate): Adjust view down by 4
739         bytes if it matches reloc_adjust_addr_.
740         (Target_sparc::Relocate::relocate_tls): Always move the
741         __tls_get_addr call delay slot instruction forward 4 bytes when
742         performing relaxation.
743
744 2011-10-18  Cary Coutant  <ccoutant@google.com>
745
746         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
747         (Output_file::map_no_anonymous): Check for non-zero
748         return code from posix_fallocate.
749
750 2011-10-17  Cary Coutant  <ccoutant@google.com>
751
752         PR gold/13245
753         * plugin.cc (is_visible_from_outside): Check for symbols
754         referenced from dynamic objects.
755         * resolve.cc (Symbol_table::resolve): Don't count references
756         from dynamic objects as references from real ELF files.
757         * testsuite/plugin_test_2.sh: Adjust expected result.
758
759 2011-10-17  Cary Coutant  <ccoutant@google.com>
760
761         * gold.cc: Include timer.h.
762         (queue_middle_tasks): Stamp time.
763         (queue_final_tasks): Likewise.
764         * main.cc (main): Store timer in parameters.  Print timers
765         for each pass.
766         * parameters.cc (Parameters::Parameters): Initialize timer_.
767         (Parameters::set_timer): New function.
768         (set_parameters_timer): New function.
769         * parameters.h (Parameters::set_timer): New function.
770         (Parameters::timer): New function.
771         (Parameters::timer_): New data member.
772         (set_parameters_timer): New function.
773         * timer.cc (Timer::stamp): New function.
774         (Timer::get_pass_time): New function.
775         * timer.h (Timer::stamp): New function.
776         (Timer::get_pass_time): New function.
777         (Timer::pass_times_): New data member.
778
779 2011-10-17  Cary Coutant  <ccoutant@google.com>
780
781         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
782         task for members of lib groups.
783
784 2011-10-17  Cary Coutant  <ccoutant@google.com>
785
786         PR gold/13288
787         * fileread.cc (File_read::find_view): Add assert.
788         (File_read::make_view): Move bounds check (replace with assert)...
789         (File_read::find_or_make_view): ... to here.
790
791 2011-10-12  Cary Coutant  <ccoutant@google.com>
792
793         * output.cc (Output_file::open_base_file): Handle case where
794         ::read returns less than requested size.
795
796 2011-10-10  Cary Coutant  <ccoutant@google.com>
797
798         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
799         Initialize defined_count_.
800         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
801         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
802         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
803         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
804         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
805         * incremental.h (Sized_relobj_incr::defined_count_): New data
806         member.
807         (Sized_incr_dynobj::defined_count_): New data member.
808         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
809         Return zeroes instead of internal error.
810
811 2011-10-10  Cary Coutant  <ccoutant@google.com>
812
813         PR gold/13249
814         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
815         (Output_reloc::symbol_value): Return PLT offset if flag is set.
816         * output.h (class Output_reloc): Add use_plt_offset flag.
817         (Output_reloc::type_): Adjust size of bit field.
818         (Output_reloc::use_plt_offset_): New bit field.
819         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
820         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
821         flag.  Adjust all callers.
822         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
823         creating RELATIVE relocations.
824
825 2011-10-10  Nick Clifton  <nickc@redhat.com>
826
827         * po/es.po: Updated Spanish translation.
828         * po/fi.po: Updated Finnish translation.
829
830 2011-10-03   Diego Novillo  <dnovillo@google.com>
831
832         * options.cc (parse_uint): Fix dereference of RETVAL.
833
834 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
835
836         * layout.h (section_order_map_): New member.
837         (get_section_order_map): New member function.
838         * output.cc (Output_section::add_input_section): Check for patterns
839         only when --section-ordering-file is specified.
840         * gold.cc (queue_middle_tasks): Delay updating order of sections till
841         output_sections have been formed.
842         * layout.cc (Layout_Layout): Initialize section_order_map_.
843         * plugin.cc (update_section_order): Store order in order_map. Do not
844         update the order.
845         * testsuite/Makefile.am: Add test case for plugin_final_layout.
846         * testsuite/Makefile.in: Regenerate.
847         * testsuite/plugin_section_order.c: New file.
848         * testsuite/plugin_final_layout.cc: New file.
849         * testsuite/plugin_final_layout.sh: New file.
850
851 2011-09-29  Cary Coutant  <ccoutant@google.com>
852
853         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
854         Check for NULL.
855         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
856         symbols during incremental update.
857         (Symbol_table::add_from_dynobj): Likewise.
858
859 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
860             Ian Lance Taylor  <iant@google.com>
861
862         * symtab.cc (Symbol_table::define_special_symbol): Always
863         canonicalize version string.
864
865 2011-09-26  Cary Coutant  <ccoutant@google.com>
866
867         * gold.cc (queue_initial_tasks): Move option checks ...
868         * options.cc (General_options::finalize): ... to here. Disable
869         some options; make others fatal.
870
871 2011-09-26  Cary Coutant  <ccoutant@google.com>
872
873         gcc PR lto/47247
874         * plugin.cc (get_symbols_v2): New function.
875         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
876         (is_referenced_from_outside): New function.
877         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
878         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
879         (get_symbols): Pass version parameter.
880         (get_symbols_v2): New function.
881         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
882         parameter.
883         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
884         (onload): Add LDPT_GET_SYMBOLS_V2.
885         (all_symbols_read_hook): Use get_symbols_v2; check for
886         LDPR_PREVAILING_DEF_IRONLY_EXP.
887         * testsuite/plugin_test_3.sh: Update expected results.
888
889 2011-09-23  Simon Baldwin  <simonb@google.com>
890
891         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
892         configuration options.
893         * configure: Regenerate.
894         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
895         * Makefile.in: Regenerate.
896         * testsuite/Makefile.in: Regenerate.
897
898 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
899
900         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
901
902 2011-09-19  Cary Coutant  <ccoutant@google.com>
903
904         * incremental.cc (can_incremental_update): Fix typo in comment.
905         * incremental.h (can_incremental_update): Likewise.
906
907 2011-09-18  Cary Coutant  <ccoutant@google.com>
908
909         * incremental.cc (can_incremental_update): New function.
910         * incremental.h (can_incremental_update): New function.
911         * layout.cc (Layout::init_fixed_output_section): Call it.
912         (Layout::make_output_section): Don't allow patch space in .eh_frame.
913         * object.cc (Sized_relobj_file::do_layout): Call
914         can_incremental_update.
915
916 2011-09-13  Cary Coutant  <ccoutant@google.com>
917
918         * configure.ac: Check for glibc support for gnu_indirect_function
919         support with static linking, setting automake conditional
920         IFUNC_STATIC.
921         * Makefile.in: Regenerate.
922         * configure: Regenerate.
923
924         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
925         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
926         for IFUNC_STATIC.
927         * testsuite/Makefile.in: Regenerate.
928
929 2011-09-13  Cary Coutant  <ccoutant@google.com>
930
931         * incremental.cc (Sized_relobj_incr::do_layout): Call
932         report_comdat_group for kept comdat sections.
933         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
934         * testsuite/Makefile.in: Regenerate.
935         * testsuite/incr_comdat_test_1.cc: New source file.
936         * testsuite/incr_comdat_test_2_v1.cc: New source file.
937         * testsuite/incr_comdat_test_2_v2.cc: New source file.
938         * testsuite/incr_comdat_test_2_v3.cc: New source file.
939
940 2011-09-13  Ian Lance Taylor  <iant@google.com>
941
942         * object.cc (Sized_relobj_file::do_layout): Remove unused local
943         variable external_symbols_offset.
944
945 2011-09-12  Ian Lance Taylor  <iant@google.com>
946
947         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
948         triggered if object has no symbols.
949
950 2011-09-09  David S. Miller  <davem@davemloft.net>
951
952         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
953         (Output_fill_debug_line::do_write): Likewise.
954
955 2011-08-29  Cary Coutant  <ccoutant@google.com>
956
957         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
958         casts to match formatting specs.
959         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
960
961 2011-08-26  Cary Coutant  <ccoutant@google.com>
962
963         * layout.cc (Free_list::allocate): Provide guarantee of minimum
964         remaining hole size when allocating.
965         (Layout::make_output_section): Set fill methods for debug sections.
966         * layout.h (Free_list::Free_list_node): Move from private to
967         public.
968         (Free_list::set_min_hole_size): New function.
969         (Free_list::begin, Free_list::end): New functions.
970         (Free_list::min_hole_): New data member.
971         * output.cc: Include dwarf.h.
972         (Output_fill_debug_info::do_minimum_hole_size): New function.
973         (Output_fill_debug_info::do_write): New function.
974         (Output_fill_debug_line::do_minimum_hole_size): New function.
975         (Output_fill_debug_line::do_write): New function.
976         (Output_section::Output_section): Initialize new data member.
977         (Output_section::set_final_data_size): Ensure patch space is larger
978         than minimum hole size.
979         (Output_section::do_write): Fill holes in debug sections.
980         * output.h (Output_fill): New class.
981         (Output_fill_debug_info): New class.
982         (Output_fill_debug_line): New class.
983         (Output_section::set_free_space_fill): New function.
984         (Output_section::free_space_fill_): New data member.
985         * testsuite/Makefile.am (incremental_test_3): Add
986         --incremental-patch option.
987         (incremental_test_4): Likewise.
988         (incremental_test_5): Likewise.
989         (incremental_test_6): Likewise.
990         (incremental_copy_test): Likewise.
991         (incremental_common_test_1): Likewise.
992         * testsuite/Makefile.in: Regenerate.
993
994 2011-08-26  Nick Clifton  <nickc@redhat.com>
995
996         * po/es.po: Updated Spanish translation.
997
998 2011-08-01  Cary Coutant  <ccoutant@google.com>
999
1000         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1001         * gold/testsuite/Makefile.in: Regenerate.
1002         * gold/testsuite/justsyms_exec.c: New source file.
1003         * gold/testsuite/justsyms_lib.c: New source file.
1004
1005 2011-08-01  Cary Coutant  <ccoutant@google.com>
1006
1007         * layout.cc (Layout::set_segment_offsets): Don't realign text
1008         segment if -Ttext was specified.
1009         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1010         file type.
1011         * object.h (Sized_relobj_file::e_type): New function.
1012         (Sized_relobj_file::e_type_): New data member.
1013         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1014         base address for ET_EXEC files.
1015         * target.cc (Target::do_make_elf_object_implementation): Allow
1016         ET_EXEC files with --just-symbols option.
1017
1018 2011-07-28  Cary Coutant  <ccoutant@google.com>
1019
1020         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1021         Add thread_number parameter.
1022         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1023         * workqueue-threads.cc
1024         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1025         current thread if its thread number is greater than desired thread
1026         count.
1027         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1028         Add thread_number parameter.
1029         (Workqueue::should_cancel_thread): Likewise.
1030         (Workqueue::find_runnable_or_wait): Pass thread_number to
1031         should_cancel_thread.
1032         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1033         parameter.
1034
1035 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1036
1037         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1038         only after checking if it cannot be forced local.
1039         * symtab.h (is_externally_visible): Check if the symbol is not forced
1040         local.
1041
1042 2011-07-15  Ian Lance Taylor  <iant@google.com>
1043
1044         * options.h (class General_options): Add --print-output-format.
1045         Move -EL next to -EB, for  better --help output.
1046         * target-select.cc: Include <cstdio>, "options.h", and
1047         "parameters.h".
1048         (Target_selector::do_target_bfd_name): New function.
1049         (print_output_format): New function.
1050         * target-select.h (class Target_selector): Update declarations.
1051         (Target_selector::target_bfd_name): New function.
1052         (print_output_format): Declare.
1053         * main.cc: Include "target-select.h".
1054         (main): Handle --print-output-format.
1055         * gold.cc: Include "target-select.h".
1056         (queue_initial_tasks): Handle --print-output-format when there are
1057         no input files.
1058         * parameters.cc (parameters_force_valid_target): Give a better
1059         error message if -EB/-EL does not match target.
1060         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1061         function.
1062
1063 2011-07-15  Ian Lance Taylor  <iant@google.com>
1064
1065         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1066         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1067         (Output_data_plt_i386::do_write): Write address of .dynamic
1068         section to first entry in .got.plt section.
1069         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1070         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1071         Initialize layout_.
1072         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1073         section to first entry in .got.plt section.
1074         * layout.h (Layout::dynamic_section): New function.
1075
1076 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1077
1078         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1079         to claim_file call.
1080         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1081         input_section_position_, and input_section_glob_.
1082         (read_layout_from_file): Call function section_ordering_specified.
1083         * layout.h (is_section_ordering_specified): New function.
1084         (section_ordering_specified): New function.
1085         (section_ordering_specified_): New boolean member.
1086         * main.cc(main): Call load_plugins after layout object is defined.
1087         * output.cc (Output_section::add_input_section): Use
1088         function section_ordering_specified to check if section ordering is
1089         needed.
1090         * output.cc (Output_section::add_relaxed_input_section): Use
1091         function section_ordering_specified to check if section ordering is
1092         needed.
1093         (Output_section::update_section_layout): New function.
1094         (Output_section::sort_attached_input_sections): Check if input section
1095         must be reordered.
1096         * output.h (Output_section::update_section_layout): New function.
1097         * plugin.cc (get_section_count): New function.
1098         (get_section_type): New function.
1099         (get_section_name): New function.
1100         (get_section_contents): New function.
1101         (update_section_order): New function.
1102         (allow_section_ordering): New function.
1103         (Plugin::load): Add the new interfaces to the transfer vector.
1104         (Plugin_manager::load_plugins): New parameter.
1105         (Plugin_manager::all_symbols_read): New parameter.
1106         (Plugin_manager::claim_file): New parameter. Save the elf object for
1107         unclaimed objects.
1108         (Plugin_manager::get_elf_object): New function.
1109         (Plugin_manager::get_view): Change to directly use the bool to check
1110         if get_view is called from claim_file_hook.
1111         * plugin.h (input_objects): New function
1112         (Plugin__manager::load_plugins): New parameter.
1113         (Plugin_manager::claim_file): New parameter.
1114         (Plugin_manager::get_elf_object): New function.
1115         (Plugin_manager::in_claim_file_handler): New function.
1116         (Plugin_manager::in_claim_file_handler_): New member.
1117         (layout): New function.
1118         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1119         handler with an extra parameter. Make the elf object before calling
1120         claim_file handler.
1121         * testsuite/plugin_test.c (get_section_count): New function pointer.
1122         (get_section_type): New function pointer.
1123         (get_section_name): New function pointer.
1124         (get_section_contents): New function pointer.
1125         (update_section_order): New function pointer.
1126         (allow_section_ordering): New function pointer.
1127         (onload): Check if the new interfaces exist.
1128
1129 2011-07-13  Ian Lance Taylor  <iant@google.com>
1130
1131         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1132         relro section.
1133         * x86_64.cc (Target_x86_64::got_section): Likewise.
1134         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1135         (relro_now_test_SOURCES): New variable.
1136         (relro_now_test_DEPENDENCIES): New variable.
1137         (relro_now_test_LDFLAGS): New variable.
1138         (relro_now_test_LDADD): New variable.
1139         (relro_now_test.so): New target.
1140         * testsuite/Makefile.in: Rebuild.
1141
1142 2011-07-12  Ian Lance Taylor  <iant@google.com>
1143
1144         PR gold/12980
1145         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1146         GLOB_DAT relocation rather than a RELATIVE relocation for a
1147         protected symbol when creating a shared library.
1148         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1149         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1150         * testsuite/protected_main_1.cc (main): Test that protected
1151         function has same address.
1152
1153 2011-07-11  Ian Lance Taylor  <iant@google.com>
1154
1155         PR gold/12979
1156         * options.h (class General_options): Add -Bgroup.
1157         * options.cc (General_options::finalize): If -Bgroup is set,
1158         default to --unresolved-symbols=report-all.
1159         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1160         * target-reloc.h (issue_undefined_symbol_error): Handle
1161         --unresolved-symbols=report-all.
1162
1163 2011-07-08  Ian Lance Taylor  <iant@google.com>
1164
1165         PR gold/11985
1166         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1167         if linker script discards key sections.
1168         (Layout::create_dynamic_symtab): Likewise.
1169         (Layout::assign_local_dynsym_offsets): Likewise.
1170         (Layout::sized_create_version_sections): Likewise.
1171         (Layout::create_interp): Likewise.
1172         (Layout::finish_dynamic_section): Likewise.
1173         (Layout::set_dynamic_symbol_size): Likewise.
1174
1175 2011-07-08  Ian Lance Taylor  <iant@google.com>
1176
1177         PR gold/12386
1178         * options.h (class General_options): Add --unresolved-symbols.
1179         * target-reloc.h (issue_undefined_symbol_error): Check
1180         --unresolved-symbols.  Add comments.
1181
1182 2011-07-08  Ian Lance Taylor  <iant@google.com>
1183
1184         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1185         expression more complex.
1186
1187 2011-07-08  Ian Lance Taylor  <iant@google.com>
1188
1189         PR gold/11317
1190         * target-reloc.h (issue_undefined_symbol_error): New inline
1191         function, broken out of relocate_section.
1192         (relocate_section): Call issue_undefined_symbol_error.
1193         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1194         there is no TLS segment if we are about to issue an undefined
1195         symbol error.
1196         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1197
1198 2011-07-08  Ian Lance Taylor  <iant@google.com>
1199
1200         PR gold/12279
1201         * resolve.cc (Symbol_table::should_override): Add fromtype
1202         parameter.  Change all callers.  Give error when linking together
1203         TLS and non-TLS symbol.
1204         (Symbol_table::should_override_with_special): Add fromtype
1205         parameter.  Change all callers.
1206         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1207         there is no TLS segment if we have reported some errors.
1208         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1209
1210 2011-07-08  Ian Lance Taylor  <iant@google.com>
1211
1212         PR gold/12372
1213         * target.h (Target::plt_address_for_global): New function.
1214         (Target::plt_address_for_local): New function.
1215         (Target::plt_section_for_global): Remove.
1216         (Target::plt_section_for_local): Remove.
1217         (Target::do_plt_address_for_global): New virtual function.
1218         (Target::do_plt_address_for_local): New virtual function.
1219         (Target::do_plt_section_for_global): Remove.
1220         (Target::do_plt_section_for_local): Remove.
1221         (Target::register_global_plt_entry): Add Symbol_table and Layout
1222         parameters.
1223         * output.cc (Output_data_got::Got_entry::write): Use
1224         plt_address_for_global and plt_address_for_local.
1225         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1226         address of output section.
1227         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1228         got_irelative_, and irelative_count_ fields.  Update
1229         declarations.
1230         (Output_data_plt_i386::has_irelative_section): New function.
1231         (Output_data_plt_i386::entry_count): Add irelative_count_.
1232         (Output_data_plt_i386::set_final_data_size): Likewise.
1233         (class Target_i386): Add got_irelative_ and rel_irelative_
1234         fields.  Update declarations.
1235         (Target_i386::Target_i386): Initialize new fields.
1236         (Target_i386::do_plt_address_for_global): New function replacing
1237         do_plt_section_for_global.
1238         (Target_i386::do_plt_address_for_local): New function replacing
1239         do_plt_section_for_local.
1240         (Target_i386::got_section): Create got_irelative_.
1241         (Target_i386::rel_irelative_section): New function.
1242         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1243         fields.  Don't define __rel_iplt_{start,end}.
1244         (Output_data_plt_i386::add_entry): Add symtab and layout
1245         parameters.  Change all callers.  Use different PLT and GOT for
1246         IFUNC symbols.
1247         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1248         layout parameters.  Change all callers.  Use different PLT and
1249         GOT.
1250         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1251         (Output_data_plt_i386::rel_irelative): New function.
1252         (Output_data_plt_i386::address_for_global): New function.
1253         (Output_data_plt_i386::address_for_local): New function.
1254         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1255         IRELATIVE GOT when changing IFUNC GOT entries.
1256         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1257         reloc.
1258         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1259         if we didn't create an IRELATIVE GOT.
1260         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1261         plt_address_for_local.
1262         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1263         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1264         got_irelative_, and irelative_count_ fields.  Update
1265         declarations.
1266         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1267         Initialize new fields.  Remove symtab parameter.  Change all
1268         callers.
1269         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1270         irelative_count_.
1271         (Output_data_plt_x86_64::has_irelative_section): New function.
1272         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1273         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1274         fields.  Update declarations.
1275         (Target_x86_64::Target_x86_64): Initialize new fields.
1276         (Target_x86_64::do_plt_address_for_global): New function replacing
1277         do_plt_section_for_global.
1278         (Target_x86_64::do_plt_address_for_local): New function replacing
1279         do_plt_section_for_local.
1280         (Target_x86_64::got_section): Create got_irelative_.
1281         (Target_x86_64::rela_irelative_section): New function.
1282         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1283         all callers.  Don't create __rel_iplt_{start,end}.
1284         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1285         parameters.  Change all callers.  Use different PLT and GOT for
1286         IFUNC symbols.
1287         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1288         layout parameters.  Change all callers.  Use different PLT and
1289         GOT.
1290         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1291         parameters.  Change all callers.  Use different PLT and GOT for
1292         IFUNC symbols.
1293         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1294         (Output_data_plt_x86_64::rela_irelative): New function.
1295         (Output_data_plt_x86_64::address_for_global): New function.
1296         (Output_data_plt_x86_64::address_for_local): New function.
1297         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1298         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1299         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1300         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1301         parameters.
1302         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1303         reloc.
1304         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1305         symbols if we didn't create an IRELATIVE GOT.
1306         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1307         plt_address_for_local.
1308         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1309         * testsuite/ifuncvar1.c: New test file.
1310         * testsuite/ifuncvar2.c: New test file.
1311         * testsuite/ifuncvar3.c: New test file.
1312         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1313         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1314         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1315         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1316         * testsuite/Makefile.in: Rebuild.
1317
1318 2011-07-07  Cary Coutant  <ccoutant@google.com>
1319
1320         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1321         (two_file_test_1_ndebug.o): Likewise.
1322         (two_file_test_1b_ndebug.o): Likewise.
1323         (two_file_test_2_ndebug.o): Likewise.
1324         (two_file_test_main_ndebug.o): Likewise.
1325         (incremental_test_2): Link with no-debug versions.
1326
1327 2011-07-06  Cary Coutant  <ccoutant@google.com>
1328
1329         * gold/incremental.cc
1330         (Output_section_incremental_inputs::write_info_blocks): Check for
1331         hidden and internal symbols.
1332
1333 2011-07-06  Cary Coutant  <ccoutant@google.com>
1334
1335         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1336         Check disposition for startup file.
1337         (Incremental_inputs::report_command_line): Ignore
1338         --incremental-startup-unchanged option.
1339         * options.cc (General_options::parse_incremental_startup_unchanged):
1340         New function.
1341         (General_options::General_options): Initialize new data member.
1342         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1343         (General_options): Add --incremental-startup-unchanged option.
1344         (General_options::incremental_startup_disposition): New function.
1345         (General_options::incremental_startup_disposition_): New data member.
1346
1347 2011-07-06  Cary Coutant  <ccoutant@google.com>
1348
1349         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1350         input file index to Script_info ctor.
1351         (Sized_incremental_binary::do_file_has_changed): Find the
1352         command-line argument for files named in scripts.
1353         * incremental.h (Script_info::Script_info): New ctor
1354         with input file index.
1355         (Script_info::input_file_index): New function.
1356         (Script_info::input_file_index_): New data member.
1357         (Incremental_binary::get_library): Add const.
1358         (Incremental_binary::get_script_info): Add const.
1359         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1360         * testsuite/Makefile.am (incremental_test_5): New test case.
1361         (incremental_test_6): New test case.
1362         * testsuite/Makefile.in: Regenerate.
1363
1364 2011-07-06  Cary Coutant  <ccoutant@google.com>
1365
1366         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1367         debug output when command lines differ.
1368
1369 2011-07-06  Cary Coutant  <ccoutant@google.com>
1370
1371         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1372         --incremental-patch option.
1373         * layout.cc (Free_list::allocate): Extend allocation beyond original
1374         end if enabled.
1375         (Layout::make_output_section): Mark sections that should get
1376         patch space.
1377         * options.cc (parse_percent): New function.
1378         * options.h (parse_percent): New function.
1379         (DEFINE_percent): New macro.
1380         (General_options): Add --incremental-patch option.
1381         * output.cc (Output_section::Output_section): Initialize new data
1382         members.
1383         (Output_section::add_input_section): Print section name when out
1384         of patch space.
1385         (Output_section::add_output_section_data): Likewise.
1386         (Output_section::set_final_data_size): Add patch space when
1387         doing --incremental-full.
1388         (Output_section::do_reset_address_and_file_offset): Remove patch
1389         space.
1390         (Output_segment::set_section_list_addresses): Print debug output
1391         only if --incremental-update.
1392         * output.h (Output_section::set_is_patch_space_allowed): New function.
1393         (Output_section::is_patch_space_allowed_): New data member.
1394         (Output_section::patch_space_): New data member.
1395         * parameters.cc (Parameters::incremental_full): New function.
1396         * parameters.h (Parameters::incremental_full): New function
1397         * testsuite/Makefile.am (incremental_test_2): Add test for
1398         --incremental-patch option.
1399         * testsuite/Makefile.in: Regenerate.
1400         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1401         (t18): Remove function body.
1402
1403 2011-07-05  Doug Kwan  <dougkwan@google.com>
1404
1405         PR gold/12771
1406         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1407         Arm_Address type for relocation result.
1408         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1409         overflow check.
1410         (Arm_relocate_functions::abs32): Use unaligned access.
1411         (Arm_relocate_functions::rel32): Ditto.
1412         (Arm_relocate_functions::prel31): Ditto.
1413         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1414         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1415         static data relocations.
1416         * testsuite/Makefile.in: Regnerate.
1417         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1418
1419 2011-07-05  Ian Lance Taylor  <iant@google.com>
1420
1421         PR gold/12392
1422         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1423         symbols if necessary.
1424         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1425
1426 2011-07-05  Ian Lance Taylor  <iant@google.com>
1427
1428         PR gold/12952
1429         * resolve.cc (Symbol::override_base_with_special): Simply override
1430         version with special symbol version, ignoring previous version.
1431
1432 2011-07-05  Ian Lance Taylor  <iant@google.com>
1433
1434         * object.cc (Sized_relobj_file::include_section_group): Add
1435         information to comment about signature location.
1436
1437 2011-07-02  Ian Lance Taylor  <iant@google.com>
1438
1439         PR gold/12957
1440         * options.h (class General_options): Add -f and -F.
1441         * options.cc (General_options::finalize): Fatal error if -f/-F
1442         are used without -shared.
1443         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1444
1445 2011-07-02  Ian Lance Taylor  <iant@google.com>
1446
1447         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1448
1449 2011-07-01  Ian Lance Taylor  <iant@google.com>
1450
1451         PR gold/12525
1452         PR gold/12952
1453         * resolve.cc (Symbol::override_base_with_special): Don't override
1454         the version if the overriding symbol has a different name.
1455         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1456         all callers.  If we give an error about an undefined version,
1457         define the base version if necessary.
1458         * dynobj.h (class Versions): Update declaration.
1459         * testsuite/weak_alias_test_5.cc: New file.
1460         * testsuite/weak_alias_test.script: New file.
1461         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1462         and versioned_alias have the right value, and call t2.
1463         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1464         weak_alias_test_5.so.
1465         (weak_alias_test_LDADD): Likewise.
1466         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1467         * testsuite/Makefile.in: Rebuild.
1468
1469 2011-07-01  Ian Lance Taylor  <iant@google.com>
1470
1471         PR gold/12525
1472         * options.h (class General_options): Support -z notext.
1473         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1474         -Wl,-z,notext.
1475         (two_file_shared_nonpic.so): Likewise.
1476         (two_file_shared_mixed.so): Likewise.
1477         (two_file_shared_mixed_1.so): Likewise.
1478         (weak_undef_lib_nonpic.so): Likewise.
1479         (alt/weak_undef_lib_nonpic.so): Likewise.
1480         (tls_test_shared_nonpic.so): Likewise.
1481         * testsuite/Makefile.in: Rebuild.
1482
1483 2011-07-01  Ian Lance Taylor  <iant@google.com>
1484
1485         PR gold/12525
1486         * configure.ac: Test whether static linking works, setting
1487         the automake conditional HAVE_STATIC.
1488         * testsuite/Makefile.am: Disable tests using -static if
1489         HAVE_STATIC is not true.
1490         * configure, testsuite/Makefile.in: Rebuild.
1491
1492 2011-07-01  Ian Lance Taylor  <iant@google.com>
1493
1494         PR gold/12525
1495         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1496         Assert if we see DW_EH_PE_indirect.
1497         * target.h (Target::ehframe_datarel_base): New function.
1498         (Target::do_ehframe_datarel_base): New target function.
1499         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1500         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1501         function.
1502
1503 2011-07-01  Ian Lance Taylor  <iant@google.com>
1504
1505         PR gold/12571
1506         * options.h (class General_options): Add
1507         --ld-generated-unwind-info.
1508         * ehframe.cc (Fde::write): Add address parameter.  Change all
1509         callers.  If associated with PLT, fill in address and size.
1510         (Cie::set_output_offset): Only add merge mapping if there is an
1511         object.
1512         (Cie::write): Add address parameter.  Change all callers.
1513         (Eh_frame::add_ehframe_for_plt): New function.
1514         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1515         input_offset_ fields into union u_, with new plt field.
1516         (Fde::Fde): Adjust for new union field.
1517         (Fde::Fde) [Output_data version]: New constructor.
1518         (Fde::add_mapping): Only add merge mapping if there is an object.
1519         (class Cie): Update declarations.
1520         (class Eh_frame): Declare add_ehframe_for_plt.
1521         * layout.cc (Layout::layout_eh_frame): Break out code into
1522         make_eh_frame_section, and call it.
1523         (Layout::make_eh_frame_section): New function.
1524         (Layout::add_eh_frame_for_plt): New function.
1525         * layout.h (class Layout): Update declarations.
1526         * merge.cc (Merge_map::add_mapping): Add assertion.
1527         * i386.cc: Include "dwarf.h".
1528         (class Output_data_plt_i386): Make first_plt_entry,
1529         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1530         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1531         and plt_eh_frame_fde.
1532         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1533         boundary.  Call add_eh_frame_for_plt if appropriate.
1534         * x86_64.cc: Include "dwarf.h".
1535         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1536         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1537         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1538         and plt_eh_frame_fde.
1539         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1540         appropriate.
1541
1542 2011-06-29  Ian Lance Taylor  <iant@google.com>
1543
1544         PR gold/12629
1545         * object.cc (Sized_relobj_file::layout_section): Change shdr
1546         parameter to be const.
1547         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1548         out of do_layout.
1549         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1550         appropriate.  Call layout_eh_frame_section.
1551         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1552         sections.
1553         * object.h (class Sized_relobj_file): Update declarations.
1554
1555 2011-06-29  Ian Lance Taylor  <iant@google.com>
1556
1557         PR gold/12652
1558         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1559         modifier.
1560         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1561
1562 2011-06-29  Ian Lance Taylor  <iant@google.com>
1563
1564         PR gold/12675
1565         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1566         SHT_X86_64_UNWIND.
1567         * layout.cc (Layout::layout_eh_frame): Likewise.
1568
1569 2011-06-29  Ian Lance Taylor  <iant@google.com>
1570
1571         PR gold/12695
1572         * layout.cc (Layout::symtab_section_shndx): New function.
1573         * layout.h (class Layout): Declare symtab_section_shndx.
1574         * output.cc (Output_section::write_header): Call it.
1575
1576 2011-06-29  Ian Lance Taylor  <iant@google.com>
1577
1578         PR gold/12818
1579         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1580         symbols which are not used in a relocation.
1581
1582 2011-06-28  Ian Lance Taylor  <iant@google.com>
1583
1584         PR gold/12898
1585         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1586         script create indistinguishable segments.
1587         (Layout::set_segment_offsets): Use stable_sort when sorting
1588         segments.  Pass this to Compare_segments constructor.
1589         * layout.h (class Layout): Make segment_precedes non-static.
1590         (class Compare_segments): Change from struct to class.  Add
1591         layout_ field.  Add constructor.
1592         * script-sections.cc
1593         (Script_sections::attach_sections_using_phdrs_clause): Rename
1594         local orphan to is_orphan.  Don't report failure to put empty
1595         section in segment.  On attachment failure, report name of
1596         section, and attach to first PT_LOAD segment.
1597
1598 2011-06-28  Ian Lance Taylor  <iant@google.com>
1599
1600         PR gold/12934
1601         * target-select.cc (Target_selector::Target_selector): Add
1602         emulation parameter.  Change all callers.
1603         (select_target_by_bfd_name): Rename from select_target_by_name.
1604         Change all callers.
1605         (select_target_by_emulation): New function.
1606         (supported_emulation_names): New function.
1607         * target-select.h (class Target_selector): Add emulation_ field.
1608         Update declarations.
1609         (Target_selector::recognize_by_bfd_name): Rename from
1610         recognize_by_name.  Change all callers.
1611         (Target_selector::supported_bfd_names): Rename from
1612         supported_names.  Change all callers.
1613         (Target_selector::recognize_by_emulation): New function.
1614         (Target_selector::supported_emulations): New function.
1615         (Target_selector::emulation): New function.
1616         (Target_selector::do_recognize_by_bfd_name): Rename from
1617         do_recognize_by_name.  Change all callers.
1618         (Target_selector::do_supported_bfd_names): Rename from
1619         do_supported_names.  Change all callers.
1620         (Target_selector::do_recognize_by_emulation): New function.
1621         (Target_selector::do_supported_emulations): New function.
1622         (select_target_by_bfd_name): Change name in declaration.
1623         (select_target_by_emulation): Declare.
1624         (supported_emulation_names): Declare.
1625         * parameters.cc (parameters_force_valid_target): Try to find
1626         target based on emulation from -m option.
1627         * options.h (class General_options): Change doc string for -m.
1628         * options.cc (help): Print emulations.
1629         (General_options::parse_V): Likewise.
1630         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1631         Add emulation parameter.  Change all callers.
1632
1633 2011-06-28  Ian Lance Taylor  <iant@google.com>
1634
1635         * target.h (class Target): Add osabi_ field.
1636         (Target::osabi): New function.
1637         (Target::set_osabi): New function.
1638         (Target::Target): Initialize osabi_.
1639         (Target::do_adjust_elf_header): Make pure virtual.
1640         (Sized_target::do_adjust_elf_header): Declare.
1641         * target.cc (Sized_target::do_adjust_elf_header): New function.
1642         (class Sized_target): Instantiate all versions.
1643         * freebsd.h (class Target_freebsd): Remove.
1644         (Target_selector_freebsd::do_recognize): Call set_osabi on
1645         Target.
1646         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1647         (Target_selector_freebsd::set_osabi): Remove.
1648         * i386.cc (class Target_i386): Inherit from Sized_target rather
1649         than Target_freebsd.
1650         * x86_64.cc (class Target_x86_64): Likewise.
1651
1652 2011-06-28  Ian Lance Taylor  <iant@google.com>
1653
1654         * target.h (Target::can_check_for_function_pointers): Rewrite.
1655         Make non-virtual.
1656         (Target::can_icf_inline_merge_sections): Likewise.
1657         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1658         (Target::Target_info): Add can_icf_inline_merge_sections field.
1659         (Target::do_can_check_for_function_pointers): New virtual
1660         function.
1661         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1662         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1663         from can_check_for_function_pointers, move in file.
1664         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1665         section_may_have_icf_unsafe_poineters, move in file.
1666         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1667         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1668         Rename from can_check_for_function_pointers, move in file.
1669         (Target_i386::can_icf_inline_merge_sections): Remove.
1670         (Target_i386::i386_info): Initialize
1671         can_icf_inline_merge_sections.
1672         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1673         Initialize can_icf_inline_merge_sections.
1674         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1675         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1676         Rename from can_check_for_function_pointers, move in file.
1677         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1678         (Target_x86_64::x86_64_info): Initialize
1679         can_icf_inline_merge_sections.
1680         * testsuite/testfile.cc (Target_test::test_target_info):
1681         Likewise.
1682         * icf.cc (get_section_contents): Correct formatting.
1683
1684 2011-06-27  Ian Lance Taylor  <iant@google.com>
1685
1686         * symtab.cc (Symbol::versioned_name): New function.
1687         (Symbol_table::add_to_final_symtab): Use versioned_name when
1688         appropriate.
1689         (Symbol_table::sized_write_symbol): Likewise.
1690         * symtab.h (class Symbol): Declare versioned_name.
1691         * stringpool.h (class Stringpool_template): Add variant of add
1692         which takes a std::basic_string.
1693         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1694         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1695         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1696         (ver_test_12.o): New target.
1697         * testsuite/Makefile.in: Rebuild.
1698
1699 2011-06-27  Doug Kwan  <dougkwan@google.com>
1700
1701         * arm.cc (Arm_relocate_functions::thm_jump8,
1702         Arm_relocate_functions::thm_jump11): Use a wider signed
1703         type to compute offset.
1704         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1705         arm_thm_jump8.
1706         * testsuite/Makefile.in: Regenerate.
1707         * testsuite/arm_branch_in_range.sh: Check test results of
1708         arm_thm_jump11 and arm_thm_jump8.
1709         * testsuite/arm_thm_jump11.s: New test source file.
1710         * testsuite/arm_thm_jump11.t: New linker script.
1711         * testsuite/arm_thm_jump8.s: New test source file.
1712         * testsuite/arm_thm_jump8.t: New linker script.
1713
1714 2011-06-24  Ian Lance Taylor  <iant@google.com>
1715
1716         * layout.cc: Include "object.h".
1717         (ctors_sections_in_init_array): New static variable.
1718         (Layout::is_ctors_in_init_array): New function.
1719         (Layout::layout): Add entry to ctors_sections_in_init_array if
1720         appropriate.
1721         * layout.h (class Layout): Declare is_ctors_in_init_array.
1722         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1723         is_ctors_reverse_view is set.
1724         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1725         all callers.  Set is_ctors_reverse_view field of View_size.
1726         (Sized_relobj_file::reverse_words): New function.
1727         * object.h (Sized_relobj_file::View_size): Add
1728         is_ctors_reverse_view field.
1729         (class Sized_relobj_file): Update declarations.
1730         * testsuite/initpri3.c: New test.
1731         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1732         initpri3b.
1733         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1734         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1735         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1736         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1737         * testsuite/Makefile.in: Rebuild.
1738
1739 2011-06-24  Cary Coutant  <ccoutant@google.com>
1740
1741         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1742         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1743         (debug_msg_cdebug.err): New targets.
1744         * testsuite/Makefile.in: Regenerate.
1745         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1746         Fix checks for link with shared library.
1747
1748 2011-06-24  Doug Kwan  <dougkwan@google.com>
1749
1750         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1751         skip empty text sections.
1752         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1753
1754 2011-06-22  Ian Lance Taylor  <iant@google.com>
1755
1756         PR gold/12910
1757         * options.h (class General_options): Add --ctors-in-init-array.
1758         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1759         friends as SHT_PROGBITS for merging sections.
1760         (Layout::layout): Remove special handling of .init_array and
1761         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1762         and .dtors if ctors_in_init_array.
1763         (Layout::make_output_section): Force correct section types for
1764         .init_array and friends.  Don't sort if doing relocatable link,
1765         Don't sort .ctors and .dtors if ctors_in_init_array.
1766         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1767         (Layout::output_section_name): Add relobj parameter.  Change all
1768         callers.  Handle .ctors. and .dtors. in code rather than table.
1769         Handle .ctors and .dtors if ctors_in_init_array.
1770         (Layout::match_file_name): New function, moved from output.cc.
1771         * layout.h (class Layout): Update declarations.
1772         * output.cc: Include "layout.h".
1773         (Input_section_sort_entry::get_priority): New function.
1774         (Input_section_sort_entry::match_file_name): Just call
1775         Layout::match_file_name.
1776         (Output_section::Input_section_sort_init_fini_compare::operator()):
1777         Handle .ctors and .dtors.  Sort by explicit priority rather than
1778         by name.
1779         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1780         * testsuite/initpri2.c: New test.
1781         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1782         (check_PROGRAMS): Add initpri2.
1783         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1784         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1785         * configure, testsuite/Makefile.in: Rebuild.
1786
1787 2011-06-19  Ian Lance Taylor  <iant@google.com>
1788
1789         PR gold/12880
1790         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1791         .interp section to a PT_INTERP segment even if we have seen a
1792         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1793         clause in a linker script.
1794         (Layout::finalize): Don't create a .interp section if we've
1795         already create a PT_INTERP segment.
1796         (Layout::create_interp): Always call choose_output_section (revert
1797         patch of 2011-06-17).  Don't create PT_INTERP segment.
1798         * script-sections.cc
1799         (Script_sections::create_note_and_tls_segments): Add a .interp
1800         section to a PT_INTERP segment even if we have seen a
1801         --dynamic-linker option.
1802
1803 2011-06-18  Ian Lance Taylor  <iant@google.com>
1804
1805         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1806         merely because a non-PT_LOAD segment has a dynamic reloc.
1807
1808 2011-06-18  Ian Lance Taylor  <iant@google.com>
1809
1810         * layout.cc (Layout::finish_dynamic_section): Don't create
1811         DT_FLAGS entry if not needed.
1812
1813 2011-06-18  Ian Lance Taylor  <iant@google.com>
1814
1815         PR gold/12745
1816         * layout.cc (Layout::layout_eh_frame): Correct handling of
1817         writable .eh_frame section.
1818
1819 2011-06-17  Ian Lance Taylor  <iant@google.com>
1820
1821         PR gold/12893
1822         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1823         symbol is redefined with the exact same object and value.
1824
1825 2011-06-17  Ian Lance Taylor  <iant@google.com>
1826
1827         PR gold/12880
1828         * layout.h (class Layout): Add interp_segment_ field.
1829         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1830         (Layout::attach_allocated_section_to_segment): If making shared
1831         library, put .interp section in PT_INTERP segment.
1832         (Layout::finalize): Also call create_interp if -dynamic-linker
1833         option was used.
1834         (Layout::create_interp): Assert that there is no PT_INTERP
1835         segment.  If not using a SECTIONS clause, use make_output_section.
1836         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1837         * script-sections.cc
1838         (Script_sections::create_note_and_tls_segments): If making shared
1839         library, put .interp section in PT_INTERP segment.
1840
1841 2011-06-17  Ian Lance Taylor  <iant@google.com>
1842
1843         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1844         when making a shared library.
1845
1846 2011-06-17  Ian Lance Taylor  <iant@google.com>
1847
1848         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1849         parameter.  Change all callers.  Don't issue warning about PC32
1850         against locally defined symbol.
1851
1852 2011-06-16  Ian Lance Taylor  <iant@google.com>
1853
1854         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1855         occurs in same object.
1856
1857 2011-06-14  Alan Modra  <amodra@gmail.com>
1858
1859         * po/POTFILES.in: Regenerate.
1860
1861 2011-06-09  Ian Lance Taylor  <iant@google.com>
1862
1863         * script-sections.cc
1864         (Orphan_output_section::set_section_addresses): For a relocatable
1865         link set address to 0.
1866
1867 2011-06-09  Cary Coutant  <ccoutant@google.com>
1868
1869         PR gold/12804
1870         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1871         used with --compress-debug-sections.
1872         * gold/object.cc (Sized_relobj_file::do_layout): Report
1873         uncompressed size of compressed input sections.
1874
1875 2011-06-08  Cary Coutant  <ccoutant@google.com>
1876
1877         PR gold/12804
1878         * testsuite/two_file_test_2_v1.cc: Change initialization of
1879         v2 to keep it in .data.
1880
1881 2011-06-07  Cary Coutant  <ccoutant@google.com>
1882
1883         * common.cc (Symbol_table::do_allocate_commons_list): Call
1884         gold_fallback.
1885         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1886         (Errors::fallback): New function.
1887         (gold_fallback): New function.
1888         * errors.h (Errors::fallback): New function.
1889         * gold.cc (gold_exit): Change status parameter to enum; adjust
1890         all callers.
1891         (queue_initial_tasks): Call gold_fallback.
1892         * gold.h: Include cstdlib.
1893         (Exit_status): New enum type.
1894         (gold_exit): Change status parameter to enum.
1895         (gold_fallback): New function.
1896         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1897         (Layout::create_symtab_sections): Likewise.
1898         (Layout::create_shdrs): Likewise.
1899         * main.cc (main): Adjust call to gold_exit.
1900         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1901         (Output_data_got::add_got_entry_pair): Likewise.
1902         (Output_section::add_input_section): Likewise.
1903         (Output_section::add_output_section_data): Likewise.
1904         (Output_segment::set_section_list_addresses): Likewise.
1905         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1906
1907 2011-06-07  Cary Coutant  <ccoutant@google.com>
1908
1909         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1910         for incremental links.
1911         * output.cc (Output_segment::set_section_list_addresses): Remove
1912         FIXME and test for TLS or BSS.
1913
1914 2011-06-07  Cary Coutant  <ccoutant@google.com>
1915
1916         * testsuite/Makefile.am: Add incremental_copy_test,
1917         incremental_common_test_1.
1918         * testsuite/Makefile.in: Regenerate.
1919         * testsuite/common_test_1_v1.c: New source file.
1920         * testsuite/common_test_1_v2.c: New source file.
1921         * testsuite/copy_test_v1.cc: New source file.
1922
1923 2011-06-07  Cary Coutant  <ccoutant@google.com>
1924
1925         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1926         update, allocate common from bss section's free list.
1927         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1928         linker-defined symbols.
1929         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1930         Skip GOT and PLT entries that are no longer referenced.
1931         (Output_section_incremental_inputs::write_info_blocks): Mark
1932         linker-defined symbols.
1933         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1934         * output.cc (Output_section::allocate): New function.
1935         * output.h (Output_section::allocate): New function.
1936         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1937         linker-defined symbols.
1938         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1939         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1940         (Symbol::init_base_output_data): Likewise.
1941         (Symbol::init_base_output_segment): Likewise.
1942         (Symbol::init_base_constant): Likewise.
1943         (Sized_symbol::init_output_data): Likewise.
1944         (Sized_symbol::init_output_segment): Likewise.
1945         (Sized_symbol::init_constant): Likewise.
1946         (Symbol_table::do_define_in_output_data): Likewise.
1947         (Symbol_table::do_define_in_output_segment): Likewise.
1948         (Symbol_table::do_define_as_constant): Likewise.
1949         * symtab.h (Symbol::is_predefined): New function.
1950         (Symbol::init_base_output_data): Add is_predefined parameter.
1951         (Symbol::init_base_output_segment): Likewise.
1952         (Symbol::init_base_constant): Likewise.
1953         (Symbol::is_predefined_): New data member.
1954         (Sized_symbol::init_output_data): Add is_predefined parameter.
1955         (Sized_symbol::init_output_segment): Likewise.
1956         (Sized_symbol::init_constant): Likewise.
1957         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1958
1959 2011-06-07  Cary Coutant  <ccoutant@google.com>
1960
1961         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1962         instead of emit_copy_reloc.
1963         (Copy_relocs::emit_copy_reloc): Refactor.
1964         (Copy_relocs::make_copy_reloc): New function.
1965         (Copy_relocs::add_copy_reloc): Remove.
1966         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1967         section.
1968         (Copy_relocs::make_copy_reloc): New function.
1969         (Copy_relocs::add_copy_reloc): Remove.
1970         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1971         unchanged input files.
1972         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1973         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1974         Reserve BSS space for COPY relocations.
1975         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1976         (Output_section_incremental_inputs::write_info_blocks): Record
1977         whether a symbol is copied from a shared object.
1978         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1979         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1980         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1981         (Incremental_input_entry_reader::get_output_symbol_index): Add
1982         is_copy parameter.
1983         (Incremental_binary::emit_copy_relocs): New function.
1984         (Incremental_binary::do_emit_copy_relocs): New function.
1985         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1986         new data member.
1987         (Sized_incremental_binary::add_copy_reloc): New function.
1988         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1989         (Sized_incremental_binary::Copy_reloc): New struct.
1990         (Sized_incremental_binary::Copy_relocs): New typedef.
1991         (Sized_incremental_binary::copy_relocs_): New data member.
1992         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1993         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1994         * target.h (Sized_target::emit_copy_reloc): New function.
1995         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1996
1997 2011-06-02  Cary Coutant  <ccoutant@google.com>
1998
1999         PR gold/12163
2000         * gold/archive.cc (Archive::Archive): Initialize new data member.
2001         (Archive::include_all_members): Return if archive has already been
2002         included.
2003         * gold/archive.h (Archive::include_all_members_): New data member.
2004
2005 2011-06-02  Nick Clifton  <nickc@redhat.com>
2006
2007         * dynobj.h: Fix spelling mistake in comment.
2008         * output.cc: Likewise.
2009
2010 2011-05-31  Doug Kwan  <dougkwan@google.com>
2011             Asier Llano
2012
2013         PR gold/12826
2014         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2015         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2016         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2017         redundant arm_exidx_test.so.
2018         * testsuite/Makefile.in: Regenerate.
2019         (check_SCRIPTS): Add pr12826.sh
2020         (check_DATA): Add pr12826.stdout
2021         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2022         * testsuite/pr12826.sh: New file.
2023         * testsuite/pr12826_1.s: Ditto.
2024         * testsuite/pr12826_1.s: Ditto.
2025
2026 2011-05-30  Ian Lance Taylor  <iant@google.com>
2027
2028         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2029         sections.
2030
2031 2011-05-29  Ian Lance Taylor  <iant@google.com>
2032
2033         PR gold/12804
2034         * testsuite/Makefile.am: Use different file name for two_file_test
2035         temporary file for each incremental test.
2036         * testsuite/Makefile.in: Rebuild.
2037
2038 2011-05-29  Ian Lance Taylor  <iant@google.com>
2039
2040         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2041         binary input file is empty.
2042
2043 2011-05-27  Ian Lance Taylor  <iant@google.com>
2044
2045         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2046         (ver_test_9.so): Likewise.
2047         * testsuite/Makefile.in: Rebuild.
2048
2049 2011-05-26 Cary Coutant  <ccoutant@google.com>
2050
2051         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2052         * incremental.cc (Incremental_inputs::report_input_section): Fix
2053         comment, indentation.
2054         (Incremental_inputs::report_comdat_group): New function.
2055         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2056         of data for incremental input file entry.
2057         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2058         group count, COMDAT group signatures.
2059         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2060         an unchanged input file.
2061         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2062         Initialize new data member.
2063         (Incremental_object_entry::add_comdat_group): New function.
2064         (Incremental_object_entry::get_comdat_group_count): New function.
2065         (Incremental_object_entry::get_comdat_signature_key): New function.
2066         (Incremental_object_entry::groups_): New data member.
2067         (Incremental_inputs::report_comdat_group): New function.
2068         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2069         data for incremental input file entry.
2070         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2071         (Incremental_input_entry_reader::get_input_section): Adjust size of
2072         data for incremental input file entry.
2073         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2074         (Incremental_input_entry_reader::get_comdat_group_signature): New
2075         function.
2076         * object.cc (Sized_relobj::include_section_group): Report kept
2077         COMDAT groups for incremental links.
2078
2079 2011-05-24  David Meyer  <pdox@google.com>
2080
2081         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2082         with name parameter.  Add found_name parameter.
2083         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2084         * dirsearch.h (class Dirsearch): Update declaration.
2085
2086 2011-05-24  Ian Lance Taylor  <iant@google.com>
2087
2088         * archive.cc (Library_base::should_include_member): Pull in object
2089         from archive if it defines the entry symbol.
2090         * parameters.cc (Parameters::entry): New function.
2091         * parameters.h (class Parameters): Declare entry.
2092         * output.h (class Output_file_header): Remove entry_ field.
2093         * output.cc (Output_file_header::Output_file_header): Remove entry
2094         parameter.  Change all callers.
2095         (Output_file_header::entry): Use parameters->entry.
2096         * gold.cc (queue_middle_tasks): Likewise.
2097         * plugin.cc (Plugin_hook::run): Likewise.
2098
2099 2011-05-24 Cary Coutant  <ccoutant@google.com>
2100
2101         * gold.cc (queue_initial_tasks): Pass incremental base filename
2102         to Output_file::open_base_file; don't print error message.
2103         * incremental-dump.cc (main): Adjust call to
2104         Output_file::open_for_modification.
2105         * incremental-dump.cc (main): Likewise.
2106         * incremental.cc (Incremental_inputs::report_command_line):
2107         Ignore --incremental-base option when comparing command lines.
2108         Ignore parameter when given as separate argument.
2109         * options.h (class General_options): Add --incremental-base.
2110         * output.cc (Output_file::Output_file):
2111         (Output_file::open_base_file): Add base_name and writable parameters;
2112         read base file into new file; print error message here.
2113         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2114         callers.
2115         * output.h (Output_file::open_for_modification): Rename to...
2116         (Output_file::open_base_file): ...this; add base_name and
2117         writable parameters; adjust all callers.
2118         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2119         callers.
2120         * testsuite/Makefile.am (incremental_test_4): Test
2121         --incremental-base.
2122         * testsuite/Makefile.in: Regenerate.
2123
2124 2011-05-24 Cary Coutant  <ccoutant@google.com>
2125
2126         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2127         incremental_test_4.
2128         * testsuite/Makefile.in: Regenerate.
2129         * testsuite/two_file_test_1_v1.cc: New test source file.
2130         * testsuite/two_file_test_1b_v1.cc: New test source file.
2131         * testsuite/two_file_test_2_v1.cc: New test source file.
2132
2133 2011-05-24 Cary Coutant  <ccoutant@google.com>
2134
2135         * dynobj.h (Dynobj::do_dynobj): New function.
2136         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2137         flag and soname for shared objects.
2138         * incremental.cc (Incremental_inputs::report_object): Make
2139         either Incremental_object_entry or Incremental_dynobj_entry; add
2140         soname to string table.
2141         (Incremental_inputs::report_input_section): Add assertion.
2142         (Output_section_incremental_inputs::set_final_data_size): Adjust
2143         type of input file entry for shared libraries; adjust size of
2144         shared library info entry.
2145         (Output_section_incremental_inputs::write_input_files): Write
2146         as_needed flag for shared libraries.
2147         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2148         of input file entry for shared libraries; write soname.
2149         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2150         soname from incremental info.
2151         * incremental.h (enum Incremental_input_flags): Add
2152         INCREMENTAL_INPUT_AS_NEEDED.
2153         (Incremental_input_entry::Incremental_input_entry): Initialize new
2154         data member.
2155         (Incremental_input_entry::set_as_needed): New function.
2156         (Incremental_input_entry::as_needed): New function.
2157         (Incremental_input_entry::do_dynobj_entry): New function.
2158         (Incremental_input_entry::as_needed_): New data member.
2159         (Incremental_object_entry::Incremental_object_entry): Don't check
2160         for shared library.
2161         (Incremental_object_entry::do_type): Likewise.
2162         (class Incremental_dynobj_entry): New class.
2163         (Incremental_input_entry_reader::as_needed): New function.
2164         (Incremental_input_entry_reader::get_soname): New function.
2165         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2166         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2167         size of shared library info entry.
2168         * layout.cc (Layout::finish_dynamic_section): Don't test for
2169         incremental link when adding DT_NEEDED entries.
2170         * object.h (Object::Object): Initialize new data member.
2171         (Object::dynobj): New function.
2172         (Object::set_as_needed): New function.
2173         (Object::as_needed): New function.
2174         (Object::do_dynobj): New function.
2175         (Object::as_needed_): New data member.
2176
2177 2011-05-24 Cary Coutant  <ccoutant@google.com>
2178
2179         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2180         info; adjust display of GOT entries.
2181         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2182         vector of input objects; remove file_status_.
2183         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2184         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2185         got_plt reader; call target hooks to reserve GOT entries.
2186         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2187         of input file info header and GOT info entry.
2188         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2189         relocation info.
2190         (Got_plt_view_info::got_descriptor): Remove.
2191         (Got_plt_view_info::sym_index): New data member.
2192         (Got_plt_view_info::input_index): New data member.
2193         (Local_got_offset_visitor::visit): Write input file index.
2194         (Global_got_offset_visitor::visit): Write 0 for input file index.
2195         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2196         with sym_index and input_index.
2197         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2198         incremental info GOT entry; replace got_descriptor with input_index.
2199         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2200         map from input file index to object.
2201         (Sized_relobj_incr::do_layout): Replace direct data member reference
2202         with accessor function.
2203         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2204         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2205         Adjust size of input file info header.
2206         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2207         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2208         (Incremental_input_entry_reader::get_input_section): Adjust size of
2209         input file info header.
2210         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2211         of incremental info GOT entry.
2212         (Incremental_got_plt_reader::get_got_desc): Remove.
2213         (Incremental_got_plt_reader::get_got_symndx): New function.
2214         (Incremental_got_plt_reader::get_got_input_index): New function.
2215         (Sized_incremental_binary::Sized_incremental_binary): Remove
2216         file_status_; add input_objects_.
2217         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2218         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2219         (Sized_incremental_binary::file_is_unchanged): Remove.
2220         (Sized_incremental_binary::set_input_object): New function.
2221         (Sized_incremental_binary::input_object): New function.
2222         (Sized_incremental_binary::file_status_): Remove.
2223         (Sized_incremental_binary::input_objects_): New data member.
2224         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2225         references.
2226         (Sized_relobj_incr::invalid_address): Move to base class.
2227         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2228         class.
2229         (Sized_relobj_incr::do_output_section_offset): Likewise.
2230         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2231         (Sized_relobj_incr::section_offsets_): Likewise.
2232         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2233         function.
2234         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2235         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2236         with accessor function.
2237         (Sized_relobj_file::do_layout): Likewise.
2238         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2239         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2240         (Sized_relobj_file::compute_final_local_value): Replace refs to
2241         section_offsets_ with accessor function.
2242         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2243         * object.h (Relobj::Relobj): Initialize new data members.
2244         (Relobj::add_dyn_reloc): New function.
2245         (Relobj::first_dyn_reloc): New function.
2246         (Relobj::dyn_reloc_count): New function.
2247         (Relobj::first_dyn_reloc_): New data member.
2248         (Relobj::dyn_reloc_count_): New data member.
2249         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2250         references.
2251         (Sized_relobj::Address): New typedef.
2252         (Sized_relobj::invalid_address): Move here from child class.
2253         (Sized_relobj::Sized_relobj): Initialize new data members.
2254         (Sized_relobj::sized_relobj): New function.
2255         (Sized_relobj::is_output_section_offset_invalid): Move here from
2256         child class.
2257         (Sized_relobj::get_output_section_offset): Likewise.
2258         (Sized_relobj::local_has_got_offset): Likewise.
2259         (Sized_relobj::local_got_offset): Likewise.
2260         (Sized_relobj::set_local_got_offset): Likewise.
2261         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2262         (Sized_relobj::clear_got_offsets): New function.
2263         (Sized_relobj::section_offsets): Move here from child class.
2264         (Sized_relobj::do_output_section_offset): Likewise.
2265         (Sized_relobj::do_set_section_offset): Likewise.
2266         (Sized_relobj::Local_got_offsets): Likewise.
2267         (Sized_relobj::local_got_offsets_): Likewise.
2268         (Sized_relobj::section_offsets_): Likewise.
2269         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2270         references.
2271         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2272         class.
2273         (Sized_relobj_file::sized_relobj): New function
2274         (Sized_relobj_file::local_has_got_offset): Move to base class.
2275         (Sized_relobj_file::local_got_offset): Likewise.
2276         (Sized_relobj_file::set_local_got_offset): Likewise.
2277         (Sized_relobj_file::get_output_section_offset): Likewise.
2278         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2279         (Sized_relobj_file::do_output_section_offset): Likewise.
2280         (Sized_relobj_file::do_set_section_offset): Likewise.
2281         (Sized_relobj_file::Local_got_offsets): Likewise.
2282         (Sized_relobj_file::local_got_offsets_): Likewise.
2283         (Sized_relobj_file::section_offsets_): Likewise.
2284         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2285         (all constructors).
2286         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2287         (Output_reloc::get_symbol_index): Likewise.
2288         (Output_reloc::local_section_offset): Likewise.
2289         (Output_reloc::get_address): Likewise.
2290         (Output_reloc::symbol_value): Likewise.
2291         (Output_data_got::reserve_slot): Move to class definition.
2292         (Output_data_got::reserve_local): New function.
2293         (Output_data_got::reserve_slot_for_global): Remove.
2294         (Output_data_got::reserve_global): New function.
2295         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2296         (all constructors, two instantiations).
2297         (Output_reloc::get_relobj): New function (two instantiations).
2298         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2299         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2300         (Output_data_reloc::add_global): Adjust type of relobj.
2301         (Output_data_reloc::add_global_relative): Likewise.
2302         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2303         (Output_data_reloc::add_local): Likewise.
2304         (Output_data_reloc::add_local_relative): Likewise.
2305         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2306         (Output_data_reloc::add_local_section): Likewise.
2307         (Output_data_reloc::add_output_section): Likewise.
2308         (Output_data_reloc::add_absolute): Likewise.
2309         (Output_data_reloc::add_target_specific): Likewise.
2310         (Output_data_got::reserve_slot): Move definition here.
2311         (Output_data_got::reserve_local): New function.
2312         (Output_data_got::reserve_global): New function.
2313         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2314         section_offsets_ with accessor function.
2315         (Sized_relobj_file::write_sections): Likewise.
2316         (Sized_relobj_file::do_relocate_sections): Likewise.
2317         * target.h (Sized_target::reserve_local_got_entry): New function.
2318         (Sized_target::reserve_global_got_entry): New function.
2319         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2320         (Target_x86_64::reserve_global_got_entry): New function.
2321         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2322
2323 2011-05-23 Cary Coutant  <ccoutant@google.com>
2324
2325         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2326         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2327         bit when checking got_type.
2328         * incremental.cc (Sized_incremental_binary::setup_readers):
2329         Store symbol table and string table locations; initialize bit vector
2330         of file status flags.
2331         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2332         unchanged files.
2333         (Sized_incremental_binary::do_process_got_plt): New function.
2334         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2335         (Output_section_incremental_inputs::set_final_data_size): Record
2336         file index for each input file.
2337         (Output_section_incremental_inputs::write_got_plt): Store file index
2338         instead of input entry offset for each GOT entry.
2339         * incremental.h
2340         (Incremental_input_entry::Incremental_input_entry): Initialize new
2341         data member.
2342         (Incremental_input_entry::set_offset): Store file index.
2343         (Incremental_input_entry::get_file_index): New function.
2344         (Incremental_input_entry::file_index_): New data member.
2345         (Incremental_binary::process_got_plt): New function.
2346         (Incremental_binary::do_process_got_plt): New function.
2347         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2348         data members.
2349         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2350         (Sized_incremental_binary::set_file_is_unchanged): New function.
2351         (Sized_incremental_binary::file_is_unchanged): New function.
2352         (Sized_incremental_binary::do_process_got_plt): New function.
2353         (Sized_incremental_binary::file_status_): New data member.
2354         (Sized_incremental_binary::main_symtab_loc_): New data member.
2355         (Sized_incremental_binary::main_strtab_loc_): New data member.
2356         * output.cc (Output_data_got::Got_entry::write): Add case
2357         RESERVED_CODE.
2358         (Output_data_got::add_global): Call add_got_entry.
2359         (Output_data_got::add_global_plt): Likewise.
2360         (Output_data_got::add_global_with_rel): Likewise.
2361         (Output_data_got::add_global_with_rela): Likewise.
2362         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2363         (Output_data_got::add_global_pair_with_rela): Likewise.
2364         (Output_data_got::add_local): Call add_got_entry.
2365         (Output_data_got::add_local_plt): Likewise.
2366         (Output_data_got::add_local_with_rel): Likewise.
2367         (Output_data_got::add_local_with_rela): Likewise.
2368         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2369         (Output_data_got::add_local_pair_with_rela): Likewise.
2370         (Output_data_got::reserve_slot): New function.
2371         (Output_data_got::reserve_slot_for_global): New function.
2372         (Output_data_got::add_got_entry): New function.
2373         (Output_data_got::add_got_entry_pair): New function.
2374         (Output_section::add_output_section_data): Edit FIXME.
2375         * output.h
2376         (Output_section_data_build::Output_section_data_build): New
2377         constructor with size parameter.
2378         (Output_data_space::Output_data_space): Likewise.
2379         (Output_data_got::Output_data_got): Initialize new data member; new
2380         constructor with size parameter.
2381         (Output_data_got::add_constant): Call add_got_entry.
2382         (Output_data_got::reserve_slot): New function.
2383         (Output_data_got::reserve_slot_for_global): New function.
2384         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2385         (Output_data_got::add_got_entry): New function.
2386         (Output_data_got::add_got_entry_pair): New function.
2387         (Output_data_got::free_list_): New data member.
2388         * target.h (Sized_target::init_got_plt_for_update): New function.
2389         (Sized_target::register_global_plt_entry): New function.
2390         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2391         Initialize new data member; call init; add constructor with PLT count.
2392         (Output_data_plt_x86_64::init): New function.
2393         (Output_data_plt_x86_64::add_relocation): New function.
2394         (Output_data_plt_x86_64::reserve_slot): New function.
2395         (Output_data_plt_x86_64::free_list_): New data member.
2396         (Target_x86_64::init_got_plt_for_update): New function.
2397         (Target_x86_64::register_global_plt_entry): New function.
2398         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2399         incremental updates.
2400         (Output_data_plt_x86_64::add_relocation): New function.
2401         * testsuite/object_unittest.cc (Object_test): Set default options.
2402
2403 2011-05-16  Ian Lance Taylor  <iant@google.com>
2404
2405         * options.h (class General_options): Make -i a synonym for -r.
2406
2407 2011-05-16  Ian Lance Taylor  <iant@google.com>
2408
2409         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2410
2411 2011-05-10 Cary Coutant  <ccoutant@google.com>
2412
2413         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2414         strip_all (-s).
2415
2416 2011-05-06  Ian Lance Taylor  <iant@google.com>
2417
2418         * layout.cc (Layout::layout): If the output section flags change,
2419         update the ordering.
2420
2421 2011-04-25 Cary Coutant  <ccoutant@google.com>
2422
2423         * incremental-dump.cc (dump_incremental_inputs): Print local
2424         symbol info for each input file.
2425         * incremental.cc
2426         (Output_section_incremental_inputs::set_final_data_size): Add local
2427         symbol info to input file entries in incremental info.
2428         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2429         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2430         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2431         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2432         implementation.
2433         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2434         (Sized_incr_relobj::do_relocate): Write the local symbols.
2435         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2436         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2437         Adjust size of input file header.
2438         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2439         (Incremental_inputs_reader::get_local_symbol_count): New function.
2440         (Incremental_inputs_reader::get_input_section): Adjust size of input
2441         file header.
2442         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2443         (Sized_incr_relobj::This): New typedef.
2444         (Sized_incr_relobj::sym_size): New const data member.
2445         (Sized_incr_relobj::Local_symbol): New struct.
2446         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2447         (Sized_incr_relobj::do_local_symbol_offset): New function.
2448         (Sized_incr_relobj::local_symbol_count_): New data member.
2449         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2450         (Sized_incr_relobj::local_symbol_index_): New data member.
2451         (Sized_incr_relobj::local_symbol_offset_): New data member.
2452         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2453         (Sized_incr_relobj::local_symbols_): New data member.
2454         * object.h (Relobj::output_local_symbol_count): New function.
2455         (Relobj::local_symbol_offset): New function.
2456         (Relobj::do_output_local_symbol_count): New function.
2457         (Relobj::do_local_symbol_offset): New function.
2458         (Sized_relobj::do_output_local_symbol_count): New function.
2459         (Sized_relobj::do_local_symbol_offset): New function.
2460
2461 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2462
2463         * descriptors.cc (set_close_on_exec): New function.
2464         (Descriptors::open): Use set_close_on_exec.
2465         * output.cc (S_ISLNK): Define if not defined.
2466
2467 2011-04-22 Cary Coutant  <ccoutant@google.com>
2468
2469         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2470         global symbol map.
2471         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2472         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2473         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2474         relocations.
2475         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2476         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2477         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2478         * incremental.h
2479         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2480         function.
2481         (Incremental_binary::apply_incremental_relocs): New function.
2482         (Incremental_binary::do_apply_incremental_relocs): New function.
2483         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2484         data member.
2485         (Sized_incremental_binary::add_global_symbol): New function.
2486         (Sized_incremental_binary::global_symbol): New function.
2487         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2488         (Sized_incremental_binary::symbol_map_): New data member.
2489         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2490         * target.h (Sized_target::apply_relocation): New function.
2491         * target-reloc.h (apply_relocation): New function.
2492         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2493
2494 2011-04-22  Doug Kwan  <dougkwan@google.com>
2495
2496         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2497         flag of a SHT_ARM_EXIDX section.
2498         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2499         * testsuite/Makefile.in: Regenerate.
2500         * testsuite/arm_exidx_test.s: New file.
2501         * testsuite/arm_exidx_test.sh: Same.
2502
2503 2011-04-20 Cary Coutant  <ccoutant@google.com>
2504
2505         PR gold/12689
2506         * archive.h (Incremental_archive_entry::Archive_member):
2507         Initialize arg_serial_ (second constructor).
2508
2509 2011-04-17  Ian Lance Taylor  <iant@google.com>
2510
2511         * object.cc (Relocate_info::location): Simplify location string.
2512         * errors.cc (Errors::error_at_location): Don't print program
2513         name.
2514         (Errors::warning_at_location): Likewise.
2515         (Errors::undefined_symbol): Likewise.
2516         * testsuite/debug_msg.sh: Update accordingly.
2517
2518 2011-04-14 Cary Coutant  <ccoutant@google.com>
2519
2520         * gold/layout.cc (Layout::symtab_section_offset): New function.
2521         * gold/layout.h (Layout::symtab_section_offset): New function.
2522         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2523
2524 2011-04-12  Ian Lance Taylor  <iant@google.com>
2525
2526         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2527         with MREMAP_MAYMOVE.
2528         * output.h (class Output_file): Add map_is_allocated_ field.
2529         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2530         not available, provide stubs.  If mremap is not available, #define
2531         it to gold_mremap.
2532         (MREMAP_MAYMOVE): Define if not defined.
2533         (Output_file::Output_file): Initialize map_is_allocated_.
2534         (Output_file::resize): Check map_is_allocated_.
2535         (Output_file::map_anonymous): If mmap fails, use malloc.
2536         (Output_file::unmap): Don't do anything for an anonymous map.
2537         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2538         is not available, provide stubs.
2539         (File_read::View::~View): Use free rather than delete[].
2540         (File_read::make_view): Use malloc rather than new[].  If mmap
2541         fails, use malloc.
2542         (File_read::find_or_make_view): Use malloc rather than new[].
2543         * gold.h: Remove HAVE_REMAP code.
2544         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2545         exists.  Rename mremap to gold_mremap.  If mmap is not available
2546         don't do anything.
2547         * configure, config.in: Rebuild.
2548
2549 2011-04-11  Ian Lance Taylor  <iant@google.com>
2550
2551         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2552         initialize local variable v.
2553
2554 2011-04-11  Cary Coutant  <ccoutant@google.com>
2555
2556         * archive.cc (Archive::include_member): Adjust call to
2557         report_object.
2558         (Add_archive_symbols::run): Track argument serial numbers.
2559         (Lib_group::include_member): Likewise.
2560         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2561         * archive.h (Incremental_archive_entry::Archive_member):
2562         Initialize arg_serial_.
2563         (Archive_member::arg_serial_): New data member.
2564         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2565         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2566         incremental link.
2567         (Sized_dynobj::do_for_all_local_got_entries): New function.
2568         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2569         function.
2570         * fileread.cc (get_mtime): New function.
2571         * fileread.h (get_mtime): New function.
2572         * gold.cc (queue_initial_tasks): Check for incremental update.
2573         (process_incremental_input): New function.
2574         (queue_middle_tasks): Don't force valid target for incremental
2575         update.
2576         * incremental-dump.cc (find_input_containing_global): Adjust
2577         size of symbol info entry.
2578         (dump_incremental_inputs): Dump argument serial number and
2579         in_system_directory flag; bias shndx by 1; print symbol names
2580         when dumping per-file symbol lists; use new symbol info readers.
2581         * incremental.cc
2582         (Output_section_incremental_inputs:update_data_size): New function.
2583         (Sized_incremental_binary::setup_readers): Setup input readers
2584         for each input file; build maps for files added from libraries
2585         and scripts.
2586         (Sized_incremental_binary::check_input_args): New function.
2587         (Sized_incremental_binary::do_check_inputs): Build map of argument
2588         serial numbers to input arguments.
2589         (Sized_incremental_binary::do_file_has_changed): Rename
2590         do_file_is_unchanged to this; compare file modification times.
2591         (Sized_incremental_binary::do_init_layout): New function.
2592         (Sized_incremental_binary::do_reserve_layout): New function.
2593         (Sized_incremental_binary::do_get_input_reader): Remove.
2594         (Sized_incremental_binary::get_symtab_view): New function.
2595         (Incremental_checker::can_incrementally_link_output_file): Remove.
2596         (Incremental_inputs::report_command_line): Exclude --debug options.
2597         (Incremental_inputs::report_archive_begin): Add parameter; track
2598         argument serial numbers; don't put input file entry for archive
2599         before archive members.
2600         (Incremental_inputs::report_archive_end): Put input file entry
2601         for archive after archive members.
2602         (Incremental_inputs::report_object): Add parameter; track argument
2603         serial numbers and in_system_directory flag.
2604         (Incremental_inputs::report_script): Add parameter; track argument
2605         serial numbers.
2606         (Output_section_incremental_inputs::set_final_data_size): Adjust
2607         size of symbol info entry; check for forwarding symbols.
2608         (Output_section_incremental_inputs::write_input_files): Write
2609         in_system_directory flag and argument serial number.
2610         (Output_section_incremental_inputs::write_info_blocks): Map section
2611         indices between incremental info and original input file; store
2612         input section index for each symbol.
2613         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2614         change operator() to visit().
2615         (class Global_got_offset_visitor): Likewise.
2616         (class Global_symbol_visitor_got_plt):
2617         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2618         classes.
2619         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2620         (Sized_incr_relobj::do_read_symbols): New function.
2621         (Sized_incr_relobj::do_layout): New function.
2622         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2623         (Sized_incr_relobj::do_add_symbols): New function.
2624         (Sized_incr_relobj::do_should_include_member): New function.
2625         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2626         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2627         (Sized_incr_relobj::do_section_size): New function.
2628         (Sized_incr_relobj::do_section_name): New function.
2629         (Sized_incr_relobj::do_section_contents): New function.
2630         (Sized_incr_relobj::do_section_flags): New function.
2631         (Sized_incr_relobj::do_section_entsize): New function.
2632         (Sized_incr_relobj::do_section_address): New function.
2633         (Sized_incr_relobj::do_section_type): New function.
2634         (Sized_incr_relobj::do_section_link): New function.
2635         (Sized_incr_relobj::do_section_info): New function.
2636         (Sized_incr_relobj::do_section_addralign): New function.
2637         (Sized_incr_relobj::do_initialize_xindex): New function.
2638         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2639         (Sized_incr_relobj::do_read_relocs): New function.
2640         (Sized_incr_relobj::do_gc_process_relocs): New function.
2641         (Sized_incr_relobj::do_scan_relocs): New function.
2642         (Sized_incr_relobj::do_count_local_symbols): New function.
2643         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2644         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2645         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2646         (Sized_incr_relobj::do_relocate): New function.
2647         (Sized_incr_relobj::do_set_section_offset): New function.
2648         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2649         (Sized_incr_dynobj::do_read_symbols): New function.
2650         (Sized_incr_dynobj::do_layout): New function.
2651         (Sized_incr_dynobj::do_add_symbols): New function.
2652         (Sized_incr_dynobj::do_should_include_member): New function.
2653         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2654         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2655         (Sized_incr_dynobj::do_section_size): New function.
2656         (Sized_incr_dynobj::do_section_name): New function.
2657         (Sized_incr_dynobj::do_section_contents): New function.
2658         (Sized_incr_dynobj::do_section_flags): New function.
2659         (Sized_incr_dynobj::do_section_entsize): New function.
2660         (Sized_incr_dynobj::do_section_address): New function.
2661         (Sized_incr_dynobj::do_section_type): New function.
2662         (Sized_incr_dynobj::do_section_link): New function.
2663         (Sized_incr_dynobj::do_section_info): New function.
2664         (Sized_incr_dynobj::do_section_addralign): New function.
2665         (Sized_incr_dynobj::do_initialize_xindex): New function.
2666         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2667         (make_sized_incremental_object): New function.
2668         (Incremental_library::copy_unused_symbols): New function.
2669         (Incremental_library::do_for_all_unused_symbols): New function.
2670         * incremental.h (enum Incremental_input_flags): New type.
2671         (class Incremental_checker): Remove.
2672         (Incremental_input_entry::Incremental_input_entry): Add argument
2673         serial number.
2674         (Incremental_input_entry::arg_serial): New function.
2675         (Incremental_input_entry::set_is_in_system_directory): New function.
2676         (Incremental_input_entry::is_in_system_directory): New function.
2677         (Incremental_input_entry::arg_serial_): New data member.
2678         (Incremental_input_entry::is_in_system_directory_): New data member.
2679         (class Script_info): Move here from script.h.
2680         (Script_info::Script_info): Add filename parameter.
2681         (Script_info::filename): New function.
2682         (Script_info::filename_): New data member.
2683         (Incremental_script_entry::Incremental_script_entry): Add argument
2684         serial number.
2685         (Incremental_object_entry::Incremental_object_entry): Likewise.
2686         (Incremental_object_entry::add_input_section): Build list of input
2687         sections with map to original shndx.
2688         (Incremental_object_entry::get_input_section_index): New function.
2689         (Incremental_object_entry::shndx_): New data member.
2690         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2691         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2692         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2693         serial number.
2694         (Incremental_inputs::report_archive_begin): Likewise.
2695         (Incremental_inputs::report_object): Likewise.
2696         (Incremental_inputs::report_script): Likewise.
2697         (class Incremental_global_symbol_reader): New class.
2698         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2699         and store flags and input file type.
2700         (Incremental_input_entry_reader::arg_serial): New function.
2701         (Incremental_input_entry_reader::type): Extract type from flags.
2702         (Incremental_input_entry_reader::is_in_system_directory): New function.
2703         (Incremental_input_entry_reader::get_input_section_count): Call
2704         accessor function for type.
2705         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2706         function for type; adjust size of global symbol entry.
2707         (Incremental_input_entry_reader::get_global_symbol_count): Call
2708         accessor function for type.
2709         (Incremental_input_entry_reader::get_object_count): Likewise.
2710         (Incremental_input_entry_reader::get_object_offset): Likewise.
2711         (Incremental_input_entry_reader::get_member_count): Likewise.
2712         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2713         (Incremental_input_entry_reader::get_member_offset): Likewise.
2714         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2715         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2716         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2717         (Incremental_input_entry_reader::get_global_symbol_reader): New
2718         function.
2719         (Incremental_input_entry_reader::get_output_symbol_index): New
2720         function.
2721         (Incremental_input_entry_reader::type_): Remove.
2722         (Incremental_input_entry_reader::flags_): New data member.
2723         (Incremental_inputs_reader::input_file_offset): New function.
2724         (Incremental_inputs_reader::input_file_index): New function.
2725         (Incremental_inputs_reader::input_file): Call input_file_offset.
2726         (Incremental_inputs_reader::input_file_at_offset): New function.
2727         (Incremental_relocs_reader::get_r_type): Reformat.
2728         (Incremental_relocs_reader::get_r_shndx): Reformat.
2729         (Incremental_relocs_reader::get_r_offset): Reformat.
2730         (Incremental_relocs_reader::data): New function.
2731         (Incremental_binary::Incremental_binary): Initialize new data members.
2732         (Incremental_binary::check_inputs): Add cmdline parameter.
2733         (Incremental_binary::file_is_unchanged): Remove.
2734         (Input_reader::arg_serial): New function.
2735         (Input_reader::get_unused_symbol_count): New function.
2736         (Input_reader::get_unused_symbol): New function.
2737         (Input_reader::do_arg_serial): New function.
2738         (Input_reader::do_get_unused_symbol_count): New function.
2739         (Input_reader::do_get_unused_symbol): New function.
2740         (Incremental_binary::input_file_count): New function.
2741         (Incremental_binary::get_input_reader): Change signature to use
2742         index instead of filename.
2743         (Incremental_binary::file_has_changed): New function.
2744         (Incremental_binary::get_input_argument): New function.
2745         (Incremental_binary::get_library): New function.
2746         (Incremental_binary::get_script_info): New function.
2747         (Incremental_binary::init_layout): New function.
2748         (Incremental_binary::reserve_layout): New function.
2749         (Incremental_binary::output_file): New function.
2750         (Incremental_binary::do_check_inputs): New function.
2751         (Incremental_binary::do_file_is_unchanged): Remove.
2752         (Incremental_binary::do_file_has_changed): New function.
2753         (Incremental_binary::do_init_layout): New function.
2754         (Incremental_binary::do_reserve_layout): New function.
2755         (Incremental_binary::do_input_file_count): New function.
2756         (Incremental_binary::do_get_input_reader): Change signature.
2757         (Incremental_binary::input_args_map_): New data member.
2758         (Incremental_binary::library_map_): New data member.
2759         (Incremental_binary::script_map_): New data member.
2760         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2761         new data members.
2762         (Sized_incremental_binary::output_section): New function.
2763         (Sized_incremental_binary::inputs_reader): Add const.
2764         (Sized_incremental_binary::symtab_reader): Add const.
2765         (Sized_incremental_binary::relocs_reader): Add const.
2766         (Sized_incremental_binary::got_plt_reader): Add const.
2767         (Sized_incremental_binary::get_symtab_view): New function.
2768         (Sized_incremental_binary::Inputs_reader): New typedef.
2769         (Sized_incremental_binary::Input_entry_reader): New typedef.
2770         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2771         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2772         (Sized_incremental_binary::do_file_has_changed): New function.
2773         (Sized_incremental_binary::do_init_layout): New function.
2774         (Sized_incremental_binary::do_reserve_layout): New function.
2775         (Sized_input_reader::Inputs_reader): Remove.
2776         (Sized_input_reader::Input_entry_reader): Remove.
2777         (Sized_input_reader::do_arg_serial): New function.
2778         (Sized_input_reader::do_get_unused_symbol_count): New function.
2779         (Sized_input_reader::do_get_unused_symbol): New function.
2780         (Sized_incremental_binary::do_input_file_count): New function.
2781         (Sized_incremental_binary::do_get_input_reader): Change signature;
2782         use index instead of filename.
2783         (Sized_incremental_binary::section_map_): New data member.
2784         (Sized_incremental_binary::input_entry_readers_): New data member.
2785         (class Sized_incr_relobj): New class.
2786         (class Sized_incr_dynobj): New class.
2787         (make_sized_incremental_object): New function.
2788         (class Incremental_library): New class.
2789         * layout.cc (Free_list::num_lists): New static data member.
2790         (Free_list::num_nodes): New static data member.
2791         (Free_list::num_removes): New static data member.
2792         (Free_list::num_remove_visits): New static data member.
2793         (Free_list::num_allocates): New static data member.
2794         (Free_list::num_allocate_visits): New static data member.
2795         (Free_list::init): New function.
2796         (Free_list::remove): New function.
2797         (Free_list::allocate): New function.
2798         (Free_list::dump): New function.
2799         (Free_list::print_stats): New function.
2800         (Layout_task_runner::run): Resize output file for incremental updates.
2801         (Layout::Layout): Initialize new data members.
2802         (Layout::set_incremental_base): New function.
2803         (Layout::init_fixed_output_section): New function.
2804         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2805         incremental updates.
2806         (Layout::create_gold_note): Do not create gold note section for
2807         incremental updates.
2808         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2809         for incremental updates.
2810         (Layout::set_section_offsets): For incremental updates, allocate space
2811         from free list.
2812         (Layout::create_symtab_sections): Layout with offsets relative to
2813         start of section; for incremental updates, allocate space from free
2814         list.
2815         (Layout::create_shdrs): For incremental updates, allocate space from
2816         free list.
2817         (Layout::finish_dynamic_section): For incremental updates, do not
2818         check --as-needed (fixed in subsequent patch).
2819         * layout.h (class Free_list): New class.
2820         (Layout::set_incremental_base): New function.
2821         (Layout::incremental_base): New function.
2822         (Layout::init_fixed_output_section): New function.
2823         (Layout::allocate): New function.
2824         (Layout::incremental_base_): New data member.
2825         (Layout::free_list_): New data member.
2826         * main.cc (main): Print Free_list statistics.
2827         * object.cc (Relobj::finalize_incremental_relocs): Add
2828         clear_counts parameter; clear counts only when clear_counts is set.
2829         (Sized_relobj::Sized_relobj): Initialize new base class.
2830         (Sized_relobj::do_layout): Don't report special sections.
2831         (Sized_relobj::do_for_all_local_got_entries): New function.
2832         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2833         symtab_off to all symbol table offsets.
2834         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2835         * object.h (class Got_offset_list): Move to top of file.
2836         (Object::Object): Allow case where input_file == NULL.
2837         (Object::~Object): Likewise.
2838         (Object::input_file): Assert that input_file != NULL.
2839         (Object::lock): Allow case where input_file == NULL.
2840         (Object::unlock): Likewise.
2841         (Object::is_locked): Likewise.
2842         (Object::token): Likewise.
2843         (Object::release): Likewise.
2844         (Object::is_incremental): New function.
2845         (Object::get_mtime): New function.
2846         (Object::for_all_local_got_entries): New function.
2847         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2848         (Object::set_is_in_system_directory): New function.
2849         (Object::is_in_system_directory): New function.
2850         (Object::do_is_incremental): New function.
2851         (Object::do_get_mtime): New function.
2852         (Object::do_for_all_local_got_entries): New function.
2853         (Object::is_in_system_directory_): New data member.
2854         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2855         (class Sized_relobj_base): New class.
2856         (class Sized_relobj): Derive from Sized_relobj_base.
2857         (class Sized_relobj::Symbols): Redeclare from base class.
2858         (class Sized_relobj::local_got_offset_list): Remove.
2859         (class Sized_relobj::Output_sections): Redeclare from base class.
2860         (class Sized_relobj::do_for_all_local_got_entries): New function.
2861         (class Sized_relobj::write_local_symbols): Add offset parameter.
2862         (class Sized_relobj::local_symbol_offset_): Update comment.
2863         (class Sized_relobj::local_dynsym_offset_): Update comment.
2864         * options.cc (Input_arguments::add_file): Remove const.
2865         * options.h (Input_file_argument::Input_file_argument):
2866         Initialize arg_serial_ (all constructors).
2867         (Input_file_argument::set_arg_serial): New function.
2868         (Input_file_argument::arg_serial): New function.
2869         (Input_file_argument::arg_serial_): New data member.
2870         (Input_arguments::Input_arguments): Initialize file_count_.
2871         (Input_arguments::add_file): Remove const.
2872         (Input_arguments::number_of_input_files): New function.
2873         (Input_arguments::file_count_): New data member.
2874         (Command_line::number_of_input_files): Call
2875         Input_arguments::number_of_input_files.
2876         * output.cc (Output_segment_headers::Output_segment_headers):
2877         Set current size.
2878         (Output_section::Input_section::current_data_size): New function.
2879         (Output_section::Output_section): Initialize new data members.
2880         (Output_section::add_input_section): Don't do merge sections for
2881         an incremental link; allocate space from free list for an
2882         incremental update.
2883         (Output_section::add_output_section_data): Allocate space from
2884         free list for an incremental update.
2885         (Output_section::update_data_size): New function.
2886         (Output_section::set_fixed_layout): New function.
2887         (Output_section::reserve): New function.
2888         (Output_segment::set_section_addresses): Remove const.
2889         (Output_segment::set_section_list_addresses): Remove const; allocate
2890         space from free list for an incremental update.
2891         (Output_segment::set_offset): Adjust size of RELRO segment for an
2892         incremental update.
2893         * output.h (Output_data::current_data_size): Move here from
2894         child classes.
2895         (Output_data::pre_finalize_data_size): New function.
2896         (Output_data::update_data_size): New function.
2897         (Output_section_headers::update_data_size): new function.
2898         (Output_section_data_build::current_data_size): Move to Output_data.
2899         (Output_data_strtab::update_data_size): New function.
2900         (Output_section::current_data_size): Move to Output_data.
2901         (Output_section::set_fixed_layout): New function.
2902         (Output_section::has_fixed_layout): New function.
2903         (Output_section::reserve): New function.
2904         (Output_section::update_data_size): New function.
2905         (Output_section::has_fixed_layout_): New data member.
2906         (Output_section::free_list_): New data member.
2907         (Output_segment::set_section_addresses): Remove const.
2908         (Output_segment::set_section_list_addresses): Remove const.
2909         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2910         New function.
2911         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2912         New function.
2913         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2914         parameter when calling Add_symbols constructor; store argument
2915         serial number for members of a lib group.
2916         (Add_symbols::locks): Allow case where token == NULL.
2917         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2918         (Read_member::~Read_member): New function.
2919         (Read_member::is_runnable): New function.
2920         (Read_member::locks): New function.
2921         (Read_member::run): New function.
2922         (Check_script::~Check_script): New function.
2923         (Check_script::is_runnable): New function.
2924         (Check_script::locks): New function.
2925         (Check_script::run): New function.
2926         (Check_library::~Check_library): New function.
2927         (Check_library::is_runnable): New function.
2928         (Check_library::locks): New function.
2929         (Check_library::run): New function.
2930         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2931         (Add_symbols::library_): New data member.
2932         (class Read_member): New class.
2933         (class Check_script): New class.
2934         (class Check_library): New class.
2935         * reloc.cc (Read_relocs::is_runnable): Allow case where
2936         token == NULL.
2937         (Read_relocs::locks): Likewise.
2938         (Scan_relocs::locks): Likewise.
2939         (Relocate_task::locks): Likewise.
2940         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2941         to clear counters.
2942         (Sized_relobj::incremental_relocs_scan): Fix comment.
2943         (Sized_relobj::do_relocate): Pass output file offset to
2944         write_local_symbols.
2945         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2946         from class declaration.
2947         * script.cc (read_input_script): Allocate Script_info; pass
2948         argument serial number to report_script.
2949         * script.h (class Script_info): Move to incremental.h.
2950         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2951         * symtab.h (Symbol_table::add_from_incrobj): New function.
2952         (Symbol_table::set_file_offset): New function.
2953
2954 2011-04-05  Cary Coutant  <ccoutant@google.com>
2955
2956         * incremental-dump.cc (dump_incremental_inputs): Change signature
2957         to take a Sized_incremental_binary; change caller.  Use readers
2958         in Sized_incremental_binary.
2959         * incremental.cc
2960         (Sized_incremental_binary::find_incremental_inputs_sections):
2961         Rename do_find_incremental_inputs_sections to this.
2962         (Sized_incremental_binary::setup_readers): New function.
2963         (Sized_incremental_binary::do_check_inputs): Check
2964         has_incremental_info_ flag; move setup code to setup_readers;
2965         use input readers.
2966         (Sized_incremental_binary::do_file_is_unchanged): New function.
2967         (Sized_incremental_binary::do_get_input_reader): New function.
2968         * incremental.h (class Incremental_binary): Move to end of file.
2969         (Incremental_binary::file_is_unchanged): New function.
2970         (Incremental_binary::do_file_is_unchanged): New function.
2971         (Incremental_binary::Input_reader): New class.
2972         (Incremental_binary::get_input_reader): New function.
2973         (class Sized_incremental_binary): Move to end of file.
2974         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2975         input section reader classes.
2976         (Sized_incremental_binary::has_incremental_info): New function.
2977         (Sized_incremental_binary::inputs_reader): New function.
2978         (Sized_incremental_binary::symtab_reader): New function.
2979         (Sized_incremental_binary::relocs_reader): New function.
2980         (Sized_incremental_binary::got_plt_reader): New function.
2981         (Sized_incremental_binary::do_file_is_unchanged): New function.
2982         (Sized_incremental_binary::Sized_input_reader): New class.
2983         (Sized_incremental_binary::get_input_reader): New function.
2984         (Sized_incremental_binary::find_incremental_inputs_sections):
2985         Rename do_find_incremental_inputs_sections to this.
2986         (Sized_incremental_binary::setup_readers): New function.
2987         (Sized_incremental_binary::has_incremental_info_): New data member.
2988         (Sized_incremental_binary::inputs_reader_): New data member.
2989         (Sized_incremental_binary::symtab_reader_): New data member.
2990         (Sized_incremental_binary::relocs_reader_): New data member.
2991         (Sized_incremental_binary::got_plt_reader_): New data member.
2992         (Sized_incremental_binary::current_input_file_): New data member.
2993
2994 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2995
2996         PR gold/12640
2997         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2998         violation.
2999
3000 2011-03-30  Cary Coutant  <ccoutant@google.com>
3001
3002         * archive.cc (Archive::include_member): Adjust call to report_object.
3003         (Add_archive_symbols::run): Add script_info to call to
3004         report_archive_begin.
3005         (Lib_group::include_member): Adjust call to report_object.
3006         (Add_lib_group_symbols::run): Adjust call to report_object.
3007         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3008         blocks.  Add object count for script input files.
3009         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3010         script_info parameter; change all callers.
3011         (Incremental_inputs::report_object): Add script_info parameter;
3012         change all callers.
3013         (Incremental_inputs::report_script): Store backpointer to
3014         incremental info entry.
3015         (Output_section_incremental_inputs::set_final_data_size): Record
3016         additional information for scripts.
3017         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3018         * incremental.h (Incremental_script_entry::add_object): New function.
3019         (Incremental_script_entry::get_object_count): New function.
3020         (Incremental_script_entry::get_object): New function.
3021         (Incremental_script_entry::objects_): New data member; adjust
3022         constructor.
3023         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3024         (Incremental_inputs::report_object): Add script_info parameter.
3025         (Incremental_inputs_reader::get_object_count): New function.
3026         (Incremental_inputs_reader::get_object_offset): New function.
3027         * options.cc (Input_arguments::add_file): Return reference to
3028         new input argument.
3029         * options.h (Input_argument::set_script_info): New function.
3030         (Input_argument::script_info): New function.
3031         (Input_argument::script_info_): New data member; adjust all
3032         constructors.
3033         (Input_file_group::add_file): Return reference to new input argument.
3034         (Input_file_lib::add_file): Likewise.
3035         (Input_arguments::add_file): Likewise.
3036         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3037         * script.cc (Parser_closure::Parser_closure): Add script_info
3038         parameter; adjust all callers.
3039         (Parser_closure::script_info): New function.
3040         (Parser_closure::script_info_): New data member.
3041         (read_input_script): Report scripts earlier to incremental info.
3042         (script_add_file): Set script_info in Input_argument.
3043         (script_add_library): Likewise.
3044         * script.h (Script_options::Script_info): Rewrite class.
3045
3046 2011-03-29  Cary Coutant  <ccoutant@google.com>
3047
3048         * archive.cc (Library_base::should_include_member): Move
3049         method here from class Archive.
3050         (Archive::Archive): Initialize base class.
3051         (Archive::should_include_member): Move to base class.
3052         (Archive::do_for_all_unused_symbols): New function.
3053         (Add_archive_symbols::run): Remove redundant access to
3054         incremental_inputs.
3055         (Lib_group::Lib_group): Initialize base class.
3056         (Lib_group::do_filename): New function.
3057         (Lib_group::include_member): Pass pointer to Lib_group to
3058         report_object.
3059         (Lib_group::do_for_all_unused_symbols): New function.
3060         (Add_lib_group_symbols::run): Report archive information for
3061         incremental links.
3062         * archive.h (class Library_base): New base class.
3063         (class Archive): Derive from Library_base.
3064         (Archive::filename): Move to base class.
3065         (Archive::set_incremental_info): Likewise.
3066         (Archive::incremental_info): Likewise.
3067         (Archive::Should_include): Likewise.
3068         (Archive::should_include_member): Likewise.
3069         (Archive::Armap_entry): Remove.
3070         (Archive::Unused_symbol_iterator): Remove.
3071         (Archive::unused_symbols_begin): Remove.
3072         (Archive::unused_symbols_end): Remove.
3073         (Archive::do_filename): New function.
3074         (Archive::do_get_mtime): New function.
3075         (Archive::do_for_all_unused_symbols): New function.
3076         (Archive::task_): Move to base class.
3077         (Archive::incremental_info_): Likewise.
3078         (class Lib_group): Derive from Library_base.
3079         (Lib_group::do_filename): New function.
3080         (Lib_group::do_get_mtime): New function.
3081         (Lib_group::do_for_all_unused_symbols): New function.
3082         (Lib_group::task_): Move to base class.
3083         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3084         function.
3085         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3086         function.
3087         * incremental.cc (Incremental_inputs::report_archive_begin):
3088         Use Library_base; call library's get_mtime; add incremental inputs
3089         entry before members.
3090         (class Unused_symbol_visitor): New class.
3091         (Incremental_inputs::report_archive_end): Use Library_base; use
3092         visitor class to record unused symbols; don't add incremental inputs
3093         entry after members.
3094         (Incremental_inputs::report_object): Use Library_base.
3095         * incremental.h
3096         (Incremental_archive_entry::Incremental_archive_entry): Remove
3097         unused Archive parameter.
3098         (Incremental_inputs::report_archive_begin): Use Library_base.
3099         (Incremental_inputs::report_archive_end): Likewise.
3100         (Incremental_inputs::report_object): Likewise.
3101         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3102         function.
3103         * object.h (Object::for_all_global_symbols): New function.
3104         (Object::do_for_all_global_symbols): New function.
3105         (Sized_relobj::do_for_all_global_symbols): New function.
3106         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3107         function.
3108         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3109         function.
3110
3111 2011-03-27  Ian Lance Taylor  <iant@google.com>
3112
3113         * archive.cc (Archive::interpret_header): Return -1 if something
3114         goes wrong.  Change callers accordingly.
3115
3116 2011-03-25  Cary Coutant  <ccoutant@google.com>
3117
3118         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3119         * testsuite/Makefile.in: Regenerate.
3120
3121 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3122
3123         * plugin.cc (get_view): New.
3124         (Plugin::load): Pass get_view to the plugin.
3125         (Plugin_manager::get_view): New.
3126
3127 2011-03-21  Ian Lance Taylor  <iant@google.com>
3128
3129         * testsuite/final_layout.sh: Rewrite to not use dc.
3130         * testsuite/relro_test.sh: Fail if dc is not present.
3131
3132 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3133
3134         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3135         Change == to -eq.
3136         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3137         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3138         Change == to -eq.
3139         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3140         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3141
3142 2011-03-14  Ian Lance Taylor  <iant@google.com>
3143
3144         * script-sections.cc (Sort_output_sections::script_compare):
3145         Rename from is_before, change return type.
3146         (Sort_output_sections::operator()): Adjust accordingly.
3147
3148 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3149
3150         PR gold/12572
3151         * testsuite/odr_violation2.cc: Add comment to make all error line
3152         numbers double digits.
3153         * testsuite/debug_msg.sh: Adjust expected errors.
3154
3155 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3156
3157         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3158         but mark earlier ones as non-canonical
3159         (offset_to_iterator): Update search target and example
3160         (do_addr2line): Return extra lines in a vector*
3161         (format_file_lineno): Extract from do_addr2line
3162         (one_addr2line): Add vector* out-param
3163         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3164         when a lineno entry appeared last for its instruction
3165         (Dwarf_line_info): Add vector* out-param
3166         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3167         * symtab.cc (Odr_violation_compare): Include the lineno in the
3168         comparison again.
3169         (linenos_from_loc): New. Combine the canonical line for an
3170         address with its other lines.
3171         (True_if_intersect): New. Helper functor to make
3172         std::set_intersection a query.
3173         (detect_odr_violations): Compare sets of lines instead of just
3174         one line for each function. This became less deterministic, but
3175         has fewer false positives.
3176         * symtab.h: Declarations.
3177         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3178         mix an optimized and non-optimized object in the same binary
3179         (odr_violation2.so): Same.
3180         * testsuite/Makefile.in: Regenerate from Makefile.am.
3181         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3182         * testsuite/debug_msg.sh: Update line numbers and add
3183         assertions.
3184         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3185         non-optimized context.
3186         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3187         isn't inlined, and use OdrDerived in an optimized context.
3188         * testsuite/odr_header1.h: Defines OdrDerived, where
3189         optimization will change the
3190         first-instruction-in-the-destructor's file and line number.
3191         * testsuite/odr_header2.h: Defines OdrBase.
3192
3193 2011-03-09  Ian Lance Taylor  <iant@google.com>
3194
3195         * fileread.cc (File_read::clear_views): Don't delete the whole
3196         file view.
3197
3198 2011-03-08  Ian Lance Taylor  <iant@google.com>
3199
3200         PR gold/12525
3201         * fileread.cc: #include <climits>.
3202         (GOLD_IOV_MAX): Define.
3203         (File_read::read_multiple): Limit number of entries by iov_max.
3204         * fileread.h (class File_read): Always set max_readv_entries to
3205         128.
3206
3207 2011-03-07  Ian Lance Taylor  <iant@google.com>
3208
3209         PR gold/12525
3210         * options.h (class General_options): Add -dy and -dn.
3211
3212 2011-03-02  Cary Coutant  <ccoutant@google.com>
3213
3214         * testsuite/script_test_9.t: Add TLS segment.
3215
3216 2011-03-02  Simon Baldwin  <simonb@google.com>
3217
3218         * configure.ac: Add check for gnu_indirect_function support in
3219         the toolchain building binutils.
3220         * configure: Rebuild.
3221
3222 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3223
3224         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3225         plugin only symbols.
3226         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3227         in plugin files as not needed in the symbol table.
3228
3229 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3230
3231         * output.cc (Output_section::add_input_section): Delay fill
3232         generation for section ordering.
3233
3234 2011-02-09  Ian Lance Taylor  <iant@google.com>
3235
3236         PR gold/12316
3237         * object.h (class Sized_relobj): Remove clear_local_symbols.
3238         * reloc.cc (Sized_relobj::do_relocate): Don't call
3239         clear_local_symbols.
3240
3241 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3242
3243         * plugin.cc (is_visible_from_outside): Return true for symbols
3244         in the -u option.
3245
3246 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3247
3248         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3249         filename.
3250
3251 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3252
3253         * icf.h (is_section_foldable_candidate): Change type of parameter
3254         to std::string.
3255         * icf.cc (Icf::find_identical_sections): Change type of local variable
3256         section_name to be std::string.
3257         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3258
3259 2011-01-25  Ian Lance Taylor  <iant@google.com>
3260
3261         * script.cc (script_add_extern): Rewrite to use
3262         add_symbol_reference.
3263
3264 2011-01-25  Doug Kwan  <dougkwan@google.com>
3265
3266         * icf.cc (get_section_contents): Always lock section's object.
3267
3268 2011-01-24  Ian Lance Taylor  <iant@google.com>
3269
3270         * options.h (class General_options): Accept
3271         --no-detect-odr-violations.
3272
3273 2011-01-24  Ian Lance Taylor  <iant@google.com>
3274
3275         * version.cc (version_string): Bump to 1.11.
3276
3277 2011-01-24  Ian Lance Taylor  <iant@google.com>
3278
3279         * plugin.cc (class Plugin_rescan): Define new class.
3280         (Plugin_manager::claim_file): Set any_claimed_.
3281         (Plugin_manager::save_archive): New function.
3282         (Plugin_manager::save_input_group): New function.
3283         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3284         necessary.
3285         (Plugin_manager::new_undefined_symbol): New function.
3286         (Plugin_manager::rescan): New function.
3287         (Plugin_manager::rescannable_defines): New function.
3288         (Plugin_manager::add_input_file): Set any_added_.
3289         * plugin.h (class Plugin_manager): define new fields rescannable_,
3290         undefined_symbols_, any_claimed_, and any_added_.  Declare
3291         Plugin_rescan as friend.  Declare new functions.
3292         (Plugin_manager::Rescannable): Define type.
3293         (Plugin_manager::Rescannable_list): Define type.
3294         (Plugin_manager::Undefined_symbol_list): Define type.
3295         (Plugin_manager::Plugin_manager): Initialize new fields.
3296         * archive.cc (Archive::defines_symbol): New function.
3297         (Add_archive_symbols::run): Pass archive to plugins if any.
3298         * archive.h (class Archive): Declare defines_symbol.
3299         * readsyms.cc (Input_group::~Input_group): New function.
3300         (Finish_group::run): Pass input_group to plugins if any.
3301         * readsyms.h (class Input_group): Declare destructor.
3302         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3303         any.
3304
3305 2011-01-10  Ian Lance Taylor  <iant@google.com>
3306
3307         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3308         section as relro.
3309         (Layout::set_segment_offsets): Reset increase_relro before calling
3310         set_section_addresses a second time.
3311
3312 2011-01-04  Cary Coutant  <ccoutant@google.com>
3313
3314         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3315         sections before NOBITS sections.
3316
3317 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3318
3319         * version.cc (print_version): Update copyright to 2011.
3320
3321 2010-12-23  Cary Coutant  <ccoutant@google.com>
3322
3323         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3324         of OS to this->add.  Add OD parameter to second form of the function.
3325
3326 2010-12-20  Ian Lance Taylor  <iant@google.com>
3327
3328         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3329         second of two consecutive entries with same offset.
3330
3331 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3332
3333         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3334         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3335         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3336         to avoid unneeded links against $(LDADD).
3337         * testsuite/Makefile.in: Regenerate.
3338
3339 2010-12-15  Ian Lance Taylor  <iant@google.com>
3340
3341         PR gold/12324
3342         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3343         for R_X86_64_32 and R_X86_64_PC32.
3344         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3345         ver_matching_def_pic.o.
3346         (ver_matching_def_pic.o): New target.
3347
3348 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3349
3350         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3351         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3352         Move definition before File_read::View member definitions.
3353         (File_read::View::~View): Initialize and hold lock before
3354         updating current_mapped_bytes.
3355
3356 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3357
3358         * dwarf_reader.cc: Remove outdated comment.
3359         * gold-threads.cc: Fix typo in error message.
3360         * archive.cc: Fix typos in comments.
3361         * archive.h: Likewise.
3362         * arm-reloc-property.cc: Likewise.
3363         * arm-reloc-property.h: Likewise.
3364         * arm-reloc.def: Likewise.
3365         * arm.cc: Likewise.
3366         * attributes.h: Likewise.
3367         * cref.cc: Likewise.
3368         * ehframe.cc: Likewise.
3369         * fileread.h: Likewise.
3370         * gold.h: Likewise.
3371         * i386.cc: Likewise.
3372         * icf.cc: Likewise.
3373         * incremental.h: Likewise.
3374         * int_encoding.cc: Likewise.
3375         * layout.h: Likewise.
3376         * main.cc: Likewise.
3377         * merge.h: Likewise.
3378         * object.cc: Likewise.
3379         * object.h: Likewise.
3380         * options.cc: Likewise.
3381         * readsyms.cc: Likewise.
3382         * reduced_debug_output.cc: Likewise.
3383         * reloc.cc: Likewise.
3384         * script-sections.cc: Likewise.
3385         * sparc.cc: Likewise.
3386         * symtab.h: Likewise.
3387         * target-reloc.h: Likewise.
3388         * target.cc: Likewise.
3389         * target.h: Likewise.
3390         * timer.cc: Likewise.
3391         * timer.h: Likewise.
3392         * x86_64.cc: Likewise.
3393
3394 2010-12-09  Cary Coutant  <ccoutant@google.com>
3395
3396         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3397         stack.
3398         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3399         parameter; change all callers.
3400         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3401         * options.h (warn_execstack): New option.
3402
3403 2010-12-07  Doug Kwan  <dougkwan@google.com>
3404
3405         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3406         like function call relocations.
3407
3408 2010-12-07  Ian Lance Taylor  <iant@google.com>
3409
3410         * archive.cc (Archive::get_elf_object_for_member): Permit
3411         punconfigured to be NULL.
3412         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3413         (Archive::include_member): Pass NULL to get_elf_object_for_member
3414         if we searched for the archive and this is the first included
3415         object.
3416
3417 2010-12-01  Ian Lance Taylor  <iant@google.com>
3418
3419         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3420         track_relocs_type_ field.
3421         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3422         Set track_relocs_type_.
3423         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3424         contents when using RELA relocs.
3425         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3426         reloc_map_.
3427         * reloc.cc (Track_relocs::next_addend): New function.
3428         * reloc.h (class Track_relocs): Declare next_addend.
3429
3430 2010-12-01  Ian Lance Taylor  <iant@google.com>
3431
3432         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3433         virtual destructor.
3434
3435 2010-12-01  Ian Lance Taylor  <iant@google.com>
3436
3437         * README: Update compilers known to work and fail.
3438
3439 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3440
3441         * configure.in: For --enable-gold, handle value `default' instead of
3442         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3443         not the default.
3444         * configure: Regenerate.
3445
3446 2010-11-18  Doug Kwan  <dougkwan@google.com>
3447
3448         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3449         and right_alignment to be zero.  Store result alignment only if it is
3450         greater than existing alignment.
3451
3452 2010-11-16  Cary Coutant  <ccoutant@google.com>
3453
3454         PR gold/12220
3455         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3456         Check for ".zdebug_line".
3457
3458 2010-11-16  Doug Kwan  <dougkwan@google.com>
3459             Cary Coutant  <ccoutant@google.com>
3460
3461         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3462         by reference; adjust all callers.
3463         * output.cc (Output_segment::set_section_addresses): Adjust references
3464         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3465         list is empty.
3466         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3467         end at page boundary.
3468
3469 2010-11-16  Cary Coutant  <ccoutant@google.com>
3470
3471         PR gold/12220
3472         * layout.cc (Layout::choose_output_section): Transform names of
3473         compressed sections even when using a script with a SECTIONS clause.
3474         (Layout::output_section_name): Remove code to transform
3475         compressed debug section names.
3476         * output.cc (Output_section::add_input_section): Use uncompressed
3477         section size when tracking input sections.
3478
3479 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3480
3481         * symtab.h (Symbol::NON_PIC_REF): Remove.
3482         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3483         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3484         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3485         (Symbol::use_plt_offset): Take a flags argument and pass it
3486         directly to needs_dynamic_reloc.  Restrict check for undefined
3487         weak symbols to function calls.
3488         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3489         (Target_arm::Scan::global): Use it.
3490         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3491         (Target_arm::Relocate::relocate): Likewise.
3492         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3493         parameter with an r_type parameter.  Use get_reference_flags
3494         to get the flags.
3495         (Target_arm::Relocate::relocate): Update accordingly.
3496         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3497         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3498         (Target_i386::Scan::global): Likewise.
3499         (Target_i386::Relocate::relocate): Likewise.
3500         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3501         parameter with an r_type parameter.  Use get_reference_flags
3502         to get the flags.
3503         (Target_i386::Relocate::relocate): Update accordingly.
3504         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3505         (Target_powerpc::Scan::global): Use it.
3506         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3507         (Target_powerpc::Relocate::relocate): Likewise.
3508         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3509         (Target_sparc::Scan::global): Use it.
3510         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3511         (Target_sparc::Relocate::relocate): Likewise.
3512         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3513         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3514         (Target_x86_64::Scan::global): Likewise.
3515         (Target_x86_64::Relocate::relocate): Likewise.
3516
3517 2010-11-08  Doug Kwan  <dougkwan@google.com>
3518             Cary Coutant  <ccoutant@google.com>
3519
3520         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3521         (Arm_exidx_merge_section::section_contents_): New data member.
3522         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3523         (Arm_input_section::~Arm_input_section): De-allocate memory.
3524         (Arm_input_section::original_contents_): New data member.
3525         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3526         in parameters instead of calling Object::section_contents without
3527         locking.
3528         (Arm_output_section::group_section): New parameter TASK.  Pass it
3529         to callees that need locking objects.
3530         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3531         to lock EXIDX input sections.  Fix a formatting issue.  Call
3532         Arm_exidx_merged_section::build_contents to create merged section
3533         contents.
3534         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3535         to lock object of stub table owner.
3536         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3537         TEXT_SIZE to initialize data member TEXT_SIZE_.
3538         (Arm_exidx_input_section::addralign): Fix typo in comment.
3539         (Arm_exidx_input_section::text_size): New method.
3540         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3541         that require locking objects.  Lock objects before scanning for stubs
3542         and updating local symbols.
3543         (Arm_input_section<big_endian>::init): Copy contents of original
3544         input section.
3545         (Arm_input_section<big_endian>::do_write): Use saved contents of
3546         original input section instead of calling Object::section_contents
3547         without locking.
3548         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3549         size without calling Object::section_size().
3550         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3551         for size.  Allocate a buffer for merged EXIDX entries.
3552         (Arm_exidx_merged_section::build_contents): New method.
3553         (Arm_exidx_merged_section::do_write): Move merge section contents
3554         building code to Arm_exidx_merged_section::build_contetns.  Write
3555         out contetns in buffer instead of building it on the fly.
3556         (Arm_relobj::make_exidx_input_section): Also pass text section size
3557         to Arm_exidx_input_section constructor.
3558         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3559         (Arm_dynobj::do_read_symbols): Fix memory leak.
3560         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3561         * target.h: (class Task): Add forward declaration.
3562         (Target::relax): Add new parameter TASK and pass it to
3563         Target::do_relax().
3564         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3565
3566 2010-11-05  Cary Coutant  <ccoutant@google.com>
3567
3568         PR gold/10708
3569         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3570         object when reading from the file.
3571         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3572         second layout pass.
3573         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3574         when reading section contents.
3575         (get_section_contents): Likewise.
3576         (icf::find_identical_sections): Likewise.
3577         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3578         object when reading from the file.
3579         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3580         the object when doing deferred section layout.
3581
3582 2010-11-03  Nick Clifton  <nickc@redhat.com>
3583
3584         PR gold/12001
3585         * script.h (class Symbol_assignment: name): New member.  Returns
3586         the name of the symbol.
3587         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3588         Returns true if the given symbol name is on the list of
3589         assignments wating to be processed.
3590         * archive.cc (should_incldue_member): If the symbol is undefined,
3591         check to see if it is on the list of symbols pending assignment.
3592
3593 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3594
3595         * script-sections.cc (Script_sections::find_memory_region): Check
3596         for a NULL output section pointer.
3597
3598 2010-10-29  Doug Kwan  <dougkwan@google.com>
3599
3600         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3601         Output_section::add_relaxed_input_section.
3602         * output.cc (Output_section::add_relaxed_input_section): Add new
3603         arguments LAYOUT and NAME.  Set section order index.
3604         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3605         Copy section order index.
3606         * output.h (Output_section::add_relaxed_input_section): Add new
3607         arguments LAYOUT and NAME.
3608
3609 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3610
3611         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3612         NATIVE_OR_CROSS_LINKER.
3613         * testsuite/Makefile.in: Regenerate.
3614
3615 2010-10-20  Doug Kwan  <dougkwan@google.com>
3616
3617         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3618         without SHF_LINK_ORDER flags.
3619         * layout.cc (Layout::choose_output_section): Do not filter
3620         SHF_LINK_ORDER flag in a relocatable link.
3621
3622 2010-10-17  Cary Coutant  <ccoutant@google.com>
3623
3624         * output.h (Output_segment::set_section_addresses): Change function
3625         signature.  Update all callers.
3626         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3627         sections.
3628         (Output_segment::set_section_addresses): Align after last TLS
3629         section.  Add padding before last relro section instead of after.
3630
3631 2010-10-17  Doug Kwan  <dougkwan@google.com>
3632
3633         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3634         GOT output section to be writable.
3635
3636 2010-10-14  Cary Coutant  <ccoutant@google.com>
3637
3638         * debug.h (DEBUG_INCREMENTAL): New flag.
3639         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3640         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3641         mode.
3642         * incremental.cc (report_command_line): Ignore all forms of
3643         --incremental.
3644         * layout.cc (Layout::Layout): Check parameters for incremental link
3645         mode.
3646         * options.cc (General_options::parse_incremental): New function.
3647         (General_options::parse_no_incremental): New function.
3648         (General_options::parse_incremental_full): New function.
3649         (General_options::parse_incremental_update): New function.
3650         (General_options::incremental_mode_): New data member.
3651         (General_options::finalize): Check incremental_mode_.
3652         * options.h (General_options): Update help text for --incremental.
3653         Add --no-incremental, --incremental-full, --incremental-update.
3654         (General_options::Incremental_mode): New enum type.
3655         (General_options::incremental_mode): New function.
3656         (General_options::incremental_mode_): New data member.
3657         * parameters.cc (Parameters::incremental_mode_): New data member.
3658         (Parameters::set_options): Set incremental_mode_.
3659         (Parameters::set_incremental_full): New function.
3660         (Parameters::incremental): New function.
3661         (Parameters::incremental_update): New function.
3662         (set_parameters_incremental_full): New function.
3663         * parameters.h (Parameters::set_incremental_full): New function.
3664         (Parameters::incremental): New function.
3665         (Parameters::incremental_update): New function.
3666         (Parameters::incremental_mode_): New data member.
3667         (set_parameters_incremental_full): New function.
3668         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3669         incremental link mode.
3670         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3671         (Sized_relobj::do_relocate_sections): Likewise.
3672         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3673         option.
3674         * testsuite/Makefile.in: Regenerate.
3675         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3676
3677 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3678
3679         * script-sections.h (class Script_sections): Make
3680         Sections_elements typedef public.
3681         * script-sections.cc (class Sort_output_sections): Add elements_
3682         field.  Add constructor which sets it; change all callers.
3683         (Sort_output_sections::is_before): New function.
3684         (Sort_output_sections::operator()): Call is_before.
3685         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3686         conditional.
3687         * testsuite/script_test_10.sh: New test. Test script section
3688         order.
3689         * testsuite/script_test_10.t: Likewise.
3690         * testsuite/script_test_10.s: Likewise.
3691         * testsuite/Makefile.am: Wrap the cross linker tests and the
3692         common tests into NATIVE_OR_CROSS_LINKER.
3693         (check_SCRIPTS): Add script_test_10.sh.
3694         (check_DATA): Add script_test_10.stdout.
3695         (script_test_10.o, script_test_10): New targets.
3696         (script_test_10.stdout): New target.
3697         * configure, testsuite/Makefile.in: Regenerate.
3698
3699 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3700
3701         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3702         error for the deprecated relocations.
3703         (Target_arm::Scan::global): Likewise.
3704         (Target_arm::Relocate::relocate): Likewise.
3705
3706 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3707
3708         * fileread.cc (Input_file::find_file): Initialize *found_name
3709         and *namep when using the fallback search for case 4.
3710
3711 2010-10-11  Cary Coutant  <ccoutant@google.com>
3712
3713         * options.h (class General_options): Redefine -z lazy as an alias for
3714         the negation of -z now.
3715
3716 2010-10-11  Ian Lance Taylor  <iant@google.com>
3717
3718         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3719         binding.
3720
3721 2010-10-06  Nick Clifton  <nickc@redhat.com>
3722
3723         * script-sections.cc(class Memory_region): Remove
3724         current_lma_offset_ field.  Rename current_vma_offset_ to
3725         current_offset_.  Add last_section_ field.
3726         (Memory_region::get_current_vma_address): Rename to
3727         get_current_address.
3728         (Memory_region::get_current_lma_address): Delete.
3729         (Memory_region::increment_vma_offset): Rename to
3730         increment_offset.
3731         (Memory_region::increment_lma_offset): Delete.
3732         (Memory_region::attributes_compatible): New method.  Returns
3733         true if the provided section is compatible with the region.
3734         (Memory_region::get_last_section): New method.  Returns the last
3735         section to use the region.
3736         (Memory_region::set_last_section): New method.  Stores the last
3737         section to use the region.
3738         (Script_sections::block_in_region): New method.  Returns true if
3739         a block of memory is contained within a region.
3740         (Script_sections::find_memory_region): New method.  Locates a
3741         memory region to be used to set a VMA or LMA address.
3742         (Output_section_definition::set_section_addresses): Add code to
3743         check for addresses set by memory regions.
3744         (Output_segment::set_section_addresses): Remove memory region
3745         walking code.
3746         (Script_sections::create_segment): Add a warning if a header
3747         segment is created outside of any region.
3748         * script-sections.h (class Script_sections): Add prototypes for
3749         find_memory_region and block_in_region methods.
3750         * testsuite/memory_test.s: Use .long instead of .word.
3751         * testsuite/memory_test.t: Add some more output sections.
3752         * testsuite/memory_test.sh: Update expected output.
3753
3754 2010-10-02  Doug Kwan  <dougkwan@google.com>
3755
3756         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3757         defintion to symtab.h
3758         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3759         declaration to defintion.
3760
3761 2010-10-01  Nick Clifton  <nickc@redhat.com>
3762
3763         * expression.cc (eval): Replace dummy argument with NULL.
3764         (eval_maybe_dot): Check for a NULL result section pointer.
3765         (Symbol_expression::value): Likewise.
3766         (Dot_expression::value): Likewise.
3767         (BINARY_EXPRESSION): Likewise.
3768         (Max_expression::value): Likewise.
3769         (Min_expression::value): Likewise.
3770         (Absolute_expression::value): Likewise.
3771         (Addr_expression::value_from_output_section): Likewise.
3772         (Loaddddr_expression::value_from_output_section): Likewise.
3773         (Segment_start_expression::value): Likewise.
3774         * script-sections.cc
3775         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3776         argument with NULL.
3777         (Sections_elememt_dot_assignment::set_section_addresses):
3778         Likewise.
3779         (Output_data_expression::do_write_to_buffer): Likewise.
3780         (Output_section_definition::finalize_symbols): Likewise.
3781         (Output_section_definition::set_section_addresses): Likewise.
3782
3783 2010-09-30  Doug Kwan  <dougkwan@google.com>
3784
3785         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3786
3787 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3788
3789         * target.h (Target::can_icf_inline_merge_sections): New virtual
3790         function.
3791         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3792         virtual function.
3793         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3794         virtual function.
3795         * icf.cc (get_section_contents): Inline merge sections only when
3796         target allows it.
3797
3798 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3799
3800         * configure: Regenerate.
3801
3802 2010-09-17  Ian Lance Taylor  <iant@google.com>
3803
3804         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3805         * testsuite/Makefile.am (memory_test.o): New target.
3806         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3807         memory_test.t.
3808         * testsuite/Makefile.in: Rebuild.
3809
3810 2010-09-17  Doug Kwan  <dougkwan@google.com>
3811
3812         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3813         defintion if relocation uses GOT entries of the symbol.
3814         * testsuite/icf_safe_test.sh: Fix test.
3815         * testsuite/icf_safe_so_test.sh: Fix test.
3816
3817 2010-09-16  Cary Coutant  <ccoutant@google.com>
3818
3819         * script_sections.cc (class Memory_region): Remove "NULL" from
3820         vector initializations.
3821
3822 2010-09-15  Cary Coutant  <ccoutant@google.com>
3823
3824         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3825         Resolve forwarding symbols.
3826
3827 2010-09-15  Doug Kwan  <dougkwan@google.com>
3828
3829         * gold/testsuite/script_test_3.t: Add ARM special sections.
3830         * gold/testsuite/script_test_4.t: Same.
3831         * gold/testsuite/script_test_5.t: Same.
3832         * gold/testsuite/script_test_6.t: Same.
3833         * gold/testsuite/script_test_7.t: Same.
3834         * gold/testsuite/script_test_7.t: Same.
3835         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3836
3837 2010-09-14  Cary Coutant  <ccoutant@google.com>
3838
3839         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3840         (Target_x86_64::Relocate::relocate_tls): Replace check for
3841         saw_tls_block_reloc_ with test for executable section.
3842
3843 2010-09-12  Cary Coutant  <ccoutant@google.com>
3844
3845         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3846         position-independent executables to shared libraries need dynamic
3847         relocations.
3848         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3849         position-independent executables.
3850         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3851         * testsuite/Makefile.in: Regenerate.
3852
3853 2010-09-10  Nick Clifton  <nickc@redhat.com>
3854
3855         PR gold/11997
3856         * testsuite/memory_test.t: Discard any sections that are not
3857         needed.
3858
3859 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3860
3861         PR gold/11996
3862         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3863         "This::" to work around a bug in gcc 4.2.
3864
3865         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3866
3867 2010-09-09  Rafael Espindola  <espindola@google.com>
3868
3869         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3870         sections with different PF_X flags in the same segment.
3871         (Layout::find_first_load_seg): Search all segments to find the first
3872         one.
3873         * options.h (rosegment): New.
3874
3875 2010-09-08  Rafael Espindola  <espindola@google.com>
3876
3877         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3878
3879 2010-09-08  Doug Kwan  <dougkwan@google.com>
3880
3881         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3882         (Arm_relobj::do_relocate_sections): Add new parameter for output
3883         file to match the parent.
3884         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3885         of local symbols instead of input values.  Update code to track
3886         changes in gold::relocate_section.
3887         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3888         (Sized_relobj::compute_final_local_value_internal): New methods.
3889         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3890         body into private version of Sized_relobj::compute_final_local_value.
3891         Call the inline method.
3892         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3893         merged symbol value if there is one.
3894         (Symbol_value::has_output_value): New method defintiion.
3895         (Sized_relobj::Compute_final_local_value_status): New enum type.
3896         (Sized_relobj::compute_final_local_value): New methods.
3897         (Sized_relobj::compute_final_local_value_internal): New methods.
3898         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3899         and arm_cortex_a8.sh.
3900         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3901         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3902         New tests.
3903         * Makefile.in: Regenerate.
3904         * testsuite/arm_bl_out_of_range.s: Update test.
3905         * testsuite/thumb_bl_out_of_range.s: Ditto.
3906         * testsuite/thumb_blx_out_of_range.s: Ditto.
3907         * testsuite/arm_branch_out_of_range.sh: New file.
3908         * testsuite/arm_cortex_a8.sh: Ditto.
3909         * testsuite/arm_cortex_a8_b.s: Ditto.
3910         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3911         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3912         * testsuite/arm_cortex_a8_bl.s: Ditto.
3913         * testsuite/arm_cortex_a8_blx.s: Ditto.
3914         * testsuite/arm_cortex_a8_local.s: Ditto.
3915         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3916         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3917
3918 2010-09-08  Rafael Espindola  <espindola@google.com>
3919
3920         * Makefile.am (memory_test.stdout): Run readelf with -W.
3921         * Makefile.in: Regenerate.
3922         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3923         64 bit output.
3924
3925 2010-09-08  Rafael Espindola  <espindola@google.com>
3926
3927         * script-sections.cc (Script_sections::add_memory_region): Convert
3928         field precision to int.
3929         * script.cc (script_set_section_region, script_set_section_region):
3930         Convert field precision to int.
3931
3932 2010-09-08  Rafael Espindola  <espindola@google.com>
3933
3934         * arm.cc (do_finalize_sections): Create the __exidx_start and
3935         __exdix_end symbols even when the section is missing.
3936
3937 2010-09-08  Nick Clifton  <nickc@redhat.com>
3938
3939         * README: Remove claim that MEMORY is not supported.
3940         * expression.cc (script_exp_function_origin)
3941         (script_exp_function_length): Move from here to ...
3942         * script.cc: ... here.
3943         (script_set_section_region, script_add_memory)
3944         (script_parse_memory_attr, script_include_directive): New
3945         functions.
3946         * script-sections.cc
3947         (class Memory_region): New class.
3948         (class Output_section_definition): Add set_memory_region,
3949         set_section_vma, set_section_lma and get_section_name methods.
3950         (class Script_Sections): Add add_memory_region,
3951         find_memory_region, find_memory_region_origin,
3952         find_memory_region_length and set_memory_region methods.
3953         Have set_section_addresses method walk the list of set memory
3954         regions.
3955         Extend the print methos to display memory regions.
3956         * script-sections.h: Add prototypes for new methods.
3957         Add enum for MEMORY region attributes.
3958         * yyscript.y: Add support for parsing MEMORY regions.
3959         * script-c.h: Add prototypes for new functions.
3960         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3961         * testsuite/Makefile.in: Regenerate.
3962         * testsuite/memory_test.sh: New script.
3963         * testsuite/memory_test.s: New assembler source file.
3964         * testsuite/memory_test.t: New linker script.
3965
3966 2010-08-27  Doug Kwan  <dougkwan@google.com>
3967
3968         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3969         reference override an existing dynamic weak reference.
3970         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3971         * testsuite/Makefile.in: Regenerate.
3972         * testsuite/dyn_weak_ref.sh: New file.
3973         * testsuite/dyn_weak_ref_1.c: Ditto.
3974         * testsuite/dyn_weak_ref_2.c: Ditto.
3975
3976 2010-08-27  Ian Lance Taylor  <iant@google.com>
3977
3978         * incremental.h (class Incremental_input_entry): Add virtual
3979         destructor.
3980
3981 2010-08-27  Ian Lance Taylor  <iant@google.com>
3982
3983         * testsuite/start_lib_test_3.c: Mark t3 as used.
3984
3985 2010-08-27  Nick Clifton  <nickc@redhat.com>
3986
3987         * options.cc (version_script): Fix small typo in previous
3988         whitespace tidyup.
3989
3990 2010-08-25  Nick Clifton  <nickc@redhat.com>
3991
3992         * archive.cc: Formatting fixes: Remove whitespace between
3993         typename and following asterisk.  Remove whitespace between
3994         function name and opening parenthesis.
3995         * archive.h: Likewise.
3996         * arm.cc: Likewise.
3997         * attributes.cc: Likewise.
3998         * attributes.h: Likewise.
3999         * common.cc: Likewise.
4000         * copy-relocs.cc: Likewise.
4001         * dirsearch.h: Likewise.
4002         * dynobj.cc: Likewise.
4003         * ehframe.cc: Likewise.
4004         * ehframe.h: Likewise.
4005         * expression.cc: Likewise.
4006         * fileread.cc: Likewise.
4007         * fileread.h: Likewise.
4008         * gc.h: Likewise.
4009         * gold-threads.cc: Likewise.
4010         * gold.cc: Likewise.
4011         * i386.cc: Likewise.
4012         * icf.h: Likewise.
4013         * incremental-dump.cc: Likewise.
4014         * incremental.cc: Likewise.
4015         * layout.cc: Likewise.
4016         * layout.h: Likewise.
4017         * main.cc: Likewise.
4018         * merge.cc: Likewise.
4019         * merge.h: Likewise.
4020         * object.cc: Likewise.
4021         * object.h: Likewise.
4022         * options.cc: Likewise.
4023         * options.h: Likewise.
4024         * output.cc: Likewise.
4025         * output.h: Likewise.
4026         * plugin.cc: Likewise.
4027         * plugin.h: Likewise.
4028         * powerpc.cc: Likewise.
4029         * reloc.cc: Likewise.
4030         * script-c.h: Likewise.
4031         * script-sections.cc: Likewise.
4032         * script.cc: Likewise.
4033         * stringpool.cc: Likewise.
4034         * symtab.cc: Likewise.
4035         * symtab.h: Likewise.
4036         * target.cc: Likewise.
4037         * timer.cc: Likewise.
4038         * timer.h: Likewise.
4039         * version.cc: Likewise.
4040         * x86_64.cc: Likewise.
4041
4042 2010-08-24  Nick Clifton  <nickc@redhat.com>
4043
4044         PR 11899
4045         * layout.cc (segment_precedes): Sort segments by their physical
4046         addresses, if they have been set.
4047
4048 2010-08-23  Cary Coutant  <ccoutant@google.com>
4049
4050         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4051         symbols data.
4052         (Lib_group::include_member): Unlock object after deleting its
4053         symbols data.
4054         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4055         the bug fixed here.
4056
4057 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4058             Cary Coutant  <ccoutant@google.com>
4059
4060         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4061         constructor, and set_blocker.
4062         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4063         readsyms_blocker_.
4064         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4065         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4066         * testsuite/Makefile.am (start_lib_test): New test case.
4067         * testsuite/Makefile.in: Regenerate.
4068         * testsuite/start_lib_test_main.c: New file.
4069         * testsuite/start_lib_test_1.c: New file.
4070         * testsuite/start_lib_test_2.c: New file.
4071         * testsuite/start_lib_test_3.c: New file.
4072
4073 2010-08-19  Ian Lance Taylor  <iant@google.com>
4074
4075         * Makefile.in: Rebuild with automake 1.11.1.
4076         * aclocal.m4: Likewise.
4077         * testsuite/Makefile.in: Likewise.
4078
4079 2010-08-19  Ian Lance Taylor  <iant@google.com>
4080
4081         PR 10893
4082         * i386.cc (class Output_data_plt_i386): Update declarations.
4083         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4084         local_ifuncs_ fields.
4085         (Target_i386::do_plt_section_for_global): New function.
4086         (Target_i386::do_plt_section_for_local): New function.
4087         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4088         parameter; change all callers.  Initialize global_ifuncs_ and
4089         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4090         __rel_iplt_end.
4091         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4092         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4093         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4094         symbols.
4095         (Target_i386::make_plt_section): New function, broken out of
4096         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4097         (Target_i386::make_plt_entry): Call make_plt_section.
4098         (Target_i386::make_local_ifunc_plt_entry): New function.
4099         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4100         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4101         R_386_IRELATIVE to switch.
4102         (Target_i386::Scan::global): Likewise.
4103         (Target_i386::Relocate::relocate): Likewise.
4104         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4105         switch.
4106         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4107         (Target_x86_64::do_plt_section_for_global): New function.
4108         (Target_x86_64::do_plt_section_for_local): New function.
4109         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4110         parameter; change all callers.  If doing a static link define
4111         __rela_iplt_start and __rela_iplt_end.
4112         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4113         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4114         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4115         to point to .plt.
4116         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4117         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4118         switch.
4119         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4120         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4121         R_X86_64_IRELATIVE to switch.
4122         (Target_x86_64::Scan::global): Likewise.
4123         (Target_x86_64::Relocate::relocate): Likewise.
4124         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4125         switch.
4126         * target.h (class Target): Add plt_section_for_global and
4127         plt_section_for_local functions.  Add do_plt_section_for_global
4128         and do_plt_section_for_local virtual functions.
4129         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4130         clarifying comments.
4131         (Symbol::use_plt_offset): Handle IFUNC symbol.
4132         * object.cc (Sized_relobj::Sized_relobj): Initialize
4133         local_plt_offsets_.
4134         (Sized_relobj::local_has_plt_offset): New function.
4135         (Sized_relobj::local_plt_offset): New function.
4136         (Sized_relobj::set_local_plt_offset): New function.
4137         (Sized_relobj::do_count): Handle IFUNC symbol.
4138         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4139         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4140         is_ifunc_symbol functions.
4141         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4142         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4143         local_plt_offsets_ field.
4144         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4145         * output.h (class Output_section_data): Add non-const
4146         output_section function.
4147         (class Output_data_got): Update declarations.
4148         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4149         Add use_plt_offset parameter to global and local constructors.
4150         Change all callers.  Change local_sym_index_ field to 31 bits.
4151         Change GSYM_CODE and CONSTANT_CODE accordingly.
4152         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4153         doing a static link don't set sh_link field.
4154         (Output_data_got::Got_entry::write): Use PLT offset if
4155         appropriate.
4156         (Output_data_got::add_global_plt): New function.
4157         (Output_data_got::add_local_plt): New function.
4158         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4159         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4160         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4161         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4162         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4163         IFUNC conditional.
4164         * testsuite/ifunc-sel.h: New file.
4165         * testsuite/ifuncmain1.c: New file.
4166         * testsuite/ifuncmain1vis.c: New file.
4167         * testsuite/ifuncmod1.c: New file.
4168         * testsuite/ifuncdep2.c: New file.
4169         * testsuite/ifuncmain2.c: New file.
4170         * testsuite/ifuncmain3.c: New file.
4171         * testsuite/ifuncmod3.c: New file.
4172         * testsuite/ifuncmain4.c: New file.
4173         * testsuite/ifuncmain5.c: New file.
4174         * testsuite/ifuncmod5.c: New file.
4175         * testsuite/ifuncmain6pie.c: New file.
4176         * testsuite/ifuncmod6.c: New file.
4177         * testsuite/ifuncmain7.c: New file.
4178         * configure, testsuite/Makefile.in: Rebuild.
4179
4180 2010-08-18  Ian Lance Taylor  <iant@google.com>
4181
4182         * incremental.cc
4183         (Output_section_incremental_inputs::write_input_files): Add cast
4184         to avoid signed/unsigned comparison warning.
4185         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4186
4187 2010-08-12  Cary Coutant  <ccoutant@google.com>
4188
4189         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4190
4191 2010-08-13  Ian Lance Taylor  <iant@google.com>
4192
4193         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4194
4195 2010-08-12  Cary Coutant  <ccoutant@google.com>
4196             Doug Kwan  <dougkwan@google.com>
4197
4198         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4199         defintion overrides non-weak undef, remember that the original undef
4200         is not weak.
4201         * symtab.cc (Symbol_table::sized_write_global): For undef without
4202         an original weak binding, set binding to global in output.
4203         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4204         * testsuite/Makefile.in: Regenerate.
4205         * testsuite/strong_ref_weak_def.sh: New file.
4206         * testsuite/strong_ref_weak_def_1.c: Ditto.
4207         * testsuite/strong_ref_weak_def_2.c: Ditto.
4208
4209 2010-08-12  Cary Coutant  <ccoutant@google.com>
4210
4211         * testsuite/incremental_test.sh: Rewrite.
4212         * testsuite/incremental_test_1.c: Rewrite.
4213         * testsuite/incremental_test_2.c: Rewrite.
4214
4215 2010-08-12  Cary Coutant  <ccoutant@google.com>
4216
4217         * arm.cc (Target_arm::got_size): Add const.
4218         (Target_arm::got_entry_count): New function.
4219         (Target_arm::plt_entry_count): New function.
4220         (Target_arm::first_plt_entry_offset): New function.
4221         (Target_arm::plt_entry_size): New function.
4222         (Output_data_plt_arm::entry_count): New function.
4223         (Output_data_plt_arm::first_plt_entry_offset): New function.
4224         (Output_data_plt_arm::get_plt_entry_size): New function.
4225         * i386.cc (Target_i386::got_size): Add const.
4226         (Target_i386::got_entry_count): New function.
4227         (Target_i386::plt_entry_count): New function.
4228         (Target_i386::first_plt_entry_offset): New function.
4229         (Target_i386::plt_entry_size): New function.
4230         (Output_data_plt_i386::entry_count): New function.
4231         (Output_data_plt_i386::first_plt_entry_offset): New function.
4232         (Output_data_plt_i386::get_plt_entry_size): New function.
4233         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4234         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4235         * incremental.cc: Include target.h.
4236         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4237         parameter.  Adjust all callers.  Find incremental_got_plt section.
4238         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4239         section.
4240         (Output_section_incremental_inputs::set_final_data_size): Calculate
4241         size of incremental_got_plt section.
4242         (Output_section_incremental_inputs::do_write): Write the
4243         incremental_got_plt section.
4244         (Got_plt_view_info): New struct.
4245         (Local_got_offset_visitor): New class.
4246         (Global_got_offset_visitor): New class.
4247         (Global_symbol_visitor_got_plt): New class.
4248         (Output_section_incremental_inputs::write_got_plt): New function.
4249         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4250         Add parameter.  Adjust all callers.
4251         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4252         (Incremental_inputs::got_plt_section): New function.
4253         (Incremental_inputs::got_plt_section_): New data member.
4254         (Incremental_got_plt_reader): New class.
4255         * layout.cc (Layout::create_incremental_info_sections): Add the
4256         incremental_got_plt section.
4257         * object.h (Got_offset_list::get_list): New function.
4258         (Got offset_list::for_all_got_offsets): New function.
4259         (Sized_relobj::local_got_offset_list): New function.
4260         * powerpc.cc (Target_powerpc::got_size): Add const.
4261         (Target_powerpc::got_entry_count): New function.
4262         (Target_powerpc::plt_entry_count): New function.
4263         (Target_powerpc::first_plt_entry_offset): New function.
4264         (Target_powerpc::plt_entry_size): New function.
4265         (Output_data_plt_powerpc::entry_count): New function.
4266         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4267         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4268         * sparc.cc (Target_sparc::got_size): Add const.
4269         (Target_sparc::got_entry_count): New function.
4270         (Target_sparc::plt_entry_count): New function.
4271         (Target_sparc::first_plt_entry_offset): New function.
4272         (Target_sparc::plt_entry_size): New function.
4273         (Output_data_plt_sparc::entry_count): New function.
4274         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4275         (Output_data_plt_sparc::get_plt_entry_size): New function.
4276         * symtab.h (Symbol::got_offset_list): New function.
4277         (Symbol_table::for_all_symbols): New function.
4278         * target.h (Sized_target::got_entry_count): New function.
4279         (Sized_target::plt_entry_count): New function.
4280         (Sized_target::plt_entry_size): New function.
4281         * x86_64.cc (Target_x86_64::got_size): Add const.
4282         (Target_x86_64::got_entry_count): New function.
4283         (Target_x86_64::plt_entry_count): New function.
4284         (Target_x86_64::first_plt_entry_offset): New function.
4285         (Target_x86_64::plt_entry_size): New function.
4286         (Output_data_plt_x86_64::entry_count): New function.
4287         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4288         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4289
4290 2010-08-12  Cary Coutant  <ccoutant@google.com>
4291
4292         * archive.cc: Include incremental.h.
4293         (Archive::Archive): Initialize incremental_info_.
4294         (Archive::include_member): Record archive members in incremental info.
4295         (Add_archive_symbols::run): Record begin and end of an archive in
4296         incremental info.
4297         (Lib_group::include_member): Record objects in incremental info.
4298         * archive.h (Incremental_archive_entry): Forward declaration.
4299         (Archive::set_incremental_info): New member function.
4300         (Archive::incremental_info): New member function.
4301         (Archive::Unused_symbol_iterator): New class.
4302         (Archive::unused_symbols_begin): New member function.
4303         (Archive::unused_symbols_end): New member function.
4304         (Archive::incremental_info_): New data member.
4305         * incremental-dump.cc (find_input_containing_global): New function.
4306         (dump_incremental_inputs): Dump new incremental info sections.
4307         * incremental.cc: Include symtab.h.
4308         (Output_section_incremental_inputs): New class.
4309         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4310         new incremental info sections.
4311         (Sized_incremental_binary::do_check_inputs): Likewise.
4312         (Incremental_inputs::report_archive): Remove.
4313         (Incremental_inputs::report_archive_begin): New function.
4314         (Incremental_inputs::report_archive_end): New function.
4315         (Incremental_inputs::report_object): New function.
4316         (Incremental_inputs::finalize_inputs): Remove.
4317         (Incremental_inputs::report_input_section): New function.
4318         (Incremental_inputs::report_script): Rewrite.
4319         (Incremental_inputs::finalize): Do nothing but finalize string table.
4320         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4321         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4322         (Incremental_inputs::create_data_sections): New function.
4323         (Incremental_inputs::relocs_entsize): New function.
4324         (Output_section_incremental_inputs::set_final_data_size): New function.
4325         (Output_section_incremental_inputs::do_write): New function.
4326         (Output_section_incremental_inputs::write_header): New function.
4327         (Output_section_incremental_inputs::write_input_files): New function.
4328         (Output_section_incremental_inputs::write_info_blocks): New function.
4329         (Output_section_incremental_inputs::write_symtab): New function.
4330         * incremental.h (Incremental_script_entry): Forward declaration.
4331         (Incremental_object_entry): Forward declaration.
4332         (Incremental_archive_entry): Forward declaration.
4333         (Incremental_inputs): Forward declaration.
4334         (Incremental_inputs_header_data): Remove.
4335         (Incremental_inputs_header): Remove.
4336         (Incremental_inputs_header_write): Remove.
4337         (Incremental_inputs_entry_data): Remove.
4338         (Incremental_inputs_entry): Remove.
4339         (Incremental_inputs_entry_write): Remove.
4340         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4341         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4342         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4343         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4344         Likewise.
4345         (Incremental_input_entry): New class.
4346         (Incremental_script_entry): New class.
4347         (Incremental_object_entry): New class.
4348         (Incremental_archive_entry): New class.
4349         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4350         (Incremental_inputs::report_inputs): Remove.
4351         (Incremental_inputs::report_archive): Remove.
4352         (Incremental_inputs::report_archive_begin): New function.
4353         (Incremental_inputs::report_archive_end): New function.
4354         (Incremental_inputs::report_object): Change prototype.
4355         (Incremental_inputs::report_input_section): New function.
4356         (Incremental_inputs::report_script): Change prototype.
4357         (Incremental_inputs::get_reloc_count): New function.
4358         (Incremental_inputs::set_reloc_count): New function.
4359         (Incremental_inputs::create_data_sections): New function.
4360         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4361         (Incremental_inputs::inputs_section): New function.
4362         (Incremental_inputs::symtab_section): New function.
4363         (Incremental_inputs::relocs_section): New function.
4364         (Incremental_inputs::get_stringpool): Add const.
4365         (Incremental_inputs::command_line): Add const.
4366         (Incremental_inputs::inputs): Remove.
4367         (Incremental_inputs::command_line_key): New function.
4368         (Incremental_inputs::input_file_count): New function.
4369         (Incremental_inputs::input_files): New function.
4370         (Incremental_inputs::relocs_entsize): New function.
4371         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4372         (Incremental_inputs::finalize_inputs): Remove.
4373         (Incremental_inputs::Input_info): Remove.
4374         (Incremental_inputs::lock_): Remove.
4375         (Incremental_inputs::inputs_): Change type.
4376         (Incremental_inputs::inputs_map_): Remove.
4377         (Incremental_inputs::current_object_entry_): New data member.
4378         (Incremental_inputs::inputs_section_): New data member.
4379         (Incremental_inputs::symtab_section_): New data member.
4380         (Incremental_inputs::relocs_section_): New data member.
4381         (Incremental_inputs::reloc_count_): New data member.
4382         (Incremental_inputs_reader): New class.
4383         (Incremental_symtab_reader): New class.
4384         (Incremental_relocs_reader): New class.
4385         * layout.cc (Layout::finalize): Move finalization of incremental info
4386         and creation of incremental info sections to follow finalization of
4387         symbol table.  Set offsets for postprocessing sections.
4388         (Layout::create_incremental_info_sections): Call
4389         Incremental_inputs::create_data_sections.  Add incremental symtab
4390         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4391         sections to layout after input sections.
4392         * layout.h (struct Timespec): Forward declaration.
4393         (Layout::incremental_inputs): Add const.
4394         (Layout::create_incremental_info_sections): Add parameter.
4395         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4396         * object.cc: Include incremental.h.
4397         (Relobj::finalize_incremental_relocs): New function.
4398         (Sized_relobj::do_layout): Record input sections in incremental info.
4399         * object.h (Object::output_section): New function.
4400         (Object::output_section_offset): Moved from Relobj.
4401         (Object::get_incremental_reloc_base): New function.
4402         (Object::get_incremental_reloc_count): New function.
4403         (Object::do_output_section): New function.
4404         (Object::do_output_section_offset): Moved from Relobj.
4405         (Object::do_get_incremental_reloc_base): New function.
4406         (Object::do_get_incremental_reloc_count): New function.
4407         (Object::Object): Initialize new data members.
4408         (Relobj::output_section): Renamed do_output_section and moved to
4409         protected.
4410         (Relobj::output_section_offset): Moved to Object.
4411         (Relobj::do_get_incremental_reloc_base): New function.
4412         (Relobj::do_get_incremental_reloc_count): New function.
4413         (Relobj::allocate_incremental_reloc_counts): New function.
4414         (Relobj::count_incremental_reloc): New function.
4415         (Relobj::finalize_incremental_relocs): New function.
4416         (Relobj::next_incremental_reloc_index): New function.
4417         (Relobj::reloc_counts_): New data member.
4418         (Relobj::reloc_bases_): New data member.
4419         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4420         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4421         (Sized_relobj::incremental_relocs_scan): New function.
4422         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4423         (Sized_relobj::incremental_relocs_write): New function.
4424         (Sized_relobj::incremental_relocs_write_reltype): New function.
4425         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4426         incremental link.
4427         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4428         archives and object files elsewhere.
4429         (Add_symbols::run): Report object files here.
4430         (Finish_group::run): Report end of archive at end of group.
4431         * reloc.cc: Include layout.h, incremental.h.
4432         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4433         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4434         (Sized_relobj::incremental_relocs_scan): New function.
4435         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4436         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4437         (Sized_relobj::incremental_relocs_write): New function.
4438         (Sized_relobj::incremental_relocs_write_reltype): New function.
4439         * script.cc (read_input_script): Rewrite test for incremental link.
4440         Change call to Incremental_inputs::report_script.
4441         * symtab.h (Symbol_table::first_global_index): New function.
4442         (Symbol_table::output_count): New function.
4443
4444 2010-08-12  Doug Kwan  <dougkwan@google.com>
4445
4446         * arm.cc (Target_arm::merge_object_attributes): Check command line
4447         options --no-wchar-size-warning and --no-enum-size-warning.
4448         * options.h (General_options): Add ld-compatible options
4449         --no-enum-size-warning and --no-wchar-size-warning.
4450
4451 2010-08-04  Ian Lance Taylor  <iant@google.com>
4452
4453         * x86_64.cc (Target_x86_64::Scan::local): Use
4454         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4455         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4456         (Target_x86_64::Scan::global): Likewise.
4457         (Target_x86_64::Relocate::relocate): Likewise.
4458         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4459         Likewise.
4460
4461 2010-08-03  Cary Coutant  <ccoutant@google.com>
4462
4463         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4464         to reserve space in merged_strings vector. Keep total input size
4465         for stats.
4466         (Output_merge_string::do_print_merge_stats): Print total input size.
4467         * merge.h (Output_merge_string): Add input_size_ field.
4468         * stringpool.cc (Stringpool_template::string_length): Move
4469         implementations out of Stringpool_template class and place in
4470         stringpool.h.
4471         * stringpool.h (string_length): Move out of Stringpool_template.
4472
4473 2010-08-03  Ian Lance Taylor  <iant@google.com>
4474
4475         PR 11712
4476         * layout.cc (relaxation_loop_body): If address of load segment is
4477         set, adjust address to include headers if possible.
4478
4479 2010-08-03  Ian Lance Taylor  <iant@google.com>
4480
4481         * version.cc (version_string): Bump to 1.10.
4482
4483 2010-08-03  Ian Lance Taylor  <iant@google.com>
4484
4485         PR 11805
4486         * layout.h (enum Output_section_order): Define.
4487         (class Layout): Update declarations.
4488         * layout.cc (Layout::get_output_section): Add order parameter.
4489         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4490         is_first_non_relro parameters.  Change all callers.
4491         (Layout::choose_output_section): Likewise.
4492         (Layout::add_output_section_data): Likewise.
4493         (Layout::make_output_section): Likewise.  Set order.
4494         (Layout::default_section_order): New function.
4495         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4496         * output.cc (Output_section::Output_section): Initialize order_.
4497         Don't initialize deleted fields.
4498         (Output_segment::Output_segment): Don't initialize deleted
4499         fields.
4500         (Output_segment::add_output_section_to_load): New function
4501         replacing add_output_section.  Change all callers to call this or
4502         add_output_section_to_nonload.
4503         (Output_segment::add_output_section_to_nonload): New function.
4504         (Output_segment::remove_output_section): Rewrite.
4505         (Output_segment::add_initial_output_data): Likewise.
4506         (Output_segment::has_any_data_sections): Likewise.
4507         (Output_segment::is_first_section_relro): Likewise.
4508         (Output_segment::maximum_alignment): Likewise.
4509         (Output_segment::has_dynamic_reloc): New function replacing
4510         dynamic_reloc_count.  Change all callers.
4511         (Output_segment::has_dynamic_reloc_list): New function replacing
4512         dynamic_reloc_count_list.  Change all callers.
4513         (Output_segment::set_section_addresses): Rewrite.
4514         (Output_segment::set_offset): Rewrite.
4515         (Output_segment::find_first_and_last_list): Remove.
4516         (Output_segment::set_tls_offsets): Rewrite.
4517         (Output_segment::first_section_load_address): Likewise.
4518         (Output_segment::output_section_count): Likewise.
4519         (Output_segment::section_with_lowest_load_address): Likewise.
4520         (Output_segment::write_section_headers): Likewise.
4521         (Output_segment::print_sections_to_map): Likewise.
4522         * output.h (class Output_data): Remove dynamic_reloc_count_
4523         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4524         (Output_data::add_dynamic_reloc): Rewrite.
4525         (Output_data::has_dynamic_reloc): New function.
4526         (Output_data::dynamic_reloc_count): Remove.
4527         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4528         is_last_relro_, is_first_non_relro_, is_interp_,
4529         is_dynamic_linker_section_ fields.  Add order and set_order
4530         functions.  Remove is_relro_local, set_is_relro_local,
4531         is_last_relro, set_is_last_relro, is_first_non_relro,
4532         set_is_first_non_relro functions, is_interp, set_is_interp,
4533         is_dynamic_linker_section, and set_is_dynamic_linker_section
4534         functions.
4535         (class Output_segment): Change Output_data_list from std::list to
4536         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4537         output_bss_ fields.  Update declarations.
4538
4539 2010-08-02  Ian Lance Taylor  <iant@google.com>
4540
4541         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4542         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4543         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4544
4545 2010-08-02  Ian Lance Taylor  <iant@google.com>
4546
4547         PR 11855
4548         * script.cc (Script_options::Script_options): Initialize
4549         symbol_definitions_ and symbol_references_.
4550         (Script_options::add_symbol_assignment): Update
4551         symbol_definitions_ and symbol_references_.
4552         (Script_options::add_symbol_reference): New function.
4553         (script_symbol): New function.
4554         * script.h (class Script_options): Add symbol_definitions_ and
4555         symbol_references_ fields.
4556         (Script_options::referenced_const_iterator): New type.
4557         (Script_options::referenced_begin): New function.
4558         (Script_options::referenced_end): New function.
4559         (Script_options::is_referenced): New function.
4560         (Script_options::any_unreferenced): New function.
4561         * script-c.h (script_symbol): Declare.
4562         * yyscript.y (exp): Call script_symbol.
4563         * symtab.cc: Include "script.h".
4564         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4565         Change all callers.  Check symbols referenced by scripts.
4566         (Symbol_table::add_undefined_symbols_from_command_line): Add
4567         layout parameter.  Change all callers.
4568         (Symbol_table::do_add_undefined_symbols_from_command_line):
4569         Likewise.  Break out loop body.  Check symbols referenced by
4570         scripts.
4571         (Symbol_table::add_undefined_symbol_from_command_line): New
4572         function broken out of
4573         do_add_undefined_symbols_from_command_line.
4574         * symtab.h (class Symbol_table): Update declarations.
4575         * archive.cc: Include "layout.h".
4576         (Archive::should_include_member): Add layout parameter.  Change
4577         all callers.  Check for symbol mentioned in expression.
4578         * archive.h (class Archive): Update declaration.
4579         * object.cc (Sized_relobj::do_should_include_member): Add layout
4580         parameter.
4581         * object.h (Object::should_include_member): Add layout parameter.
4582         Change all callers.
4583         (Object::do_should_include_member): Add layout parameter.
4584         (class Sized_relobj): Update declaration.
4585         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4586         parameter.
4587         * dynobj.h (class Sized_dynobj): Update declaration.
4588         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4589         layout parameter.
4590         * plugin.h (class Sized_pluginobj): Update declaration.
4591
4592 2010-08-02  Ian Lance Taylor  <iant@google.com>
4593
4594         PR 11866
4595         * output.cc (Output_segment::set_offset): Search for the first and
4596         last sections rather than assuming that the list is in order.
4597         (Output_segment::find_first_and_last_list): New function.
4598         * output.h (class Output_segment): Update declarations.
4599         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4600         (relro_strip_test_SOURCES): New variable.
4601         (relro_strip_test_DEPENDENCIES): New variable.
4602         (relro_strip_test_LDFLAGS): New variable.
4603         (relro_strip_test_LDADD): New variable.
4604         (relro_strip_test.so): New target.
4605
4606 2010-08-02  Ian Lance Taylor  <iant@google.com>
4607
4608         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4609         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4610         (Target_i386::got_tlsdesc_section): New function.
4611         (Target_i386::got_section): Create space for GOT entries for
4612         TLSDESC relocations.
4613         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4614         R_386_TLS_GOTDESC.
4615         (Target_i386::Scan::global): Likewise.
4616         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4617         using TLSDESC GOT.
4618         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4619         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4620         (Target_x86_64::got_tlsdesc_section): New function.
4621         (Target_x86_64::got_section): Create space for GOT entries for
4622         TLSDESC relocations.
4623         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4624         R_386_TLS_GOTDESC.
4625         (Target_x86_64::Scan::global): Likewise.
4626         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4627         using TLSDESC GOT.
4628
4629 2010-08-02  Ian Lance Taylor  <iant@google.com>
4630
4631         * testsuite/final_layout.sh: Use dc to convert from hex to
4632         decimal.
4633
4634 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4635
4636         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4637         paramter to the call to gold::gc_process_relocs.
4638         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4639         paramter to the call to gold::gc_process_relocs.
4640         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4641         parameter to the call to gold::gc_process_relocs.
4642         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4643         template parameter to the call to gold::gc_process_relocs.
4644         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4645         paramter to the call to gold::gc_process_relocs.
4646         * gc.h (get_embedded_addend_size): New function.
4647         (gc_process_relocs): Save the size of the reloc for use by ICF.
4648         * icf.cc (get_section_contents): Get the addend from the text section
4649         for SHT_REL relocation sections.
4650         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4651         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4652         * int_encoding.h (read_from_pointer): New overloaded function.
4653         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4654         * testsuite/icf_sht_rel_addend_test.sh: New file.
4655         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4656         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4657
4658 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4659
4660         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4661         * Makefile.in: Regenerate.
4662         * testsuite/Makefile.in: Regenerate.
4663
4664 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4665
4666         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4667         * gold/testsuite/debug_msg.cc: Likewise.
4668         * gold/testsuite/odr_violation1.cc
4669         * gold/testsuite/odr_violation2.cc
4670
4671 2010-07-21  Cary Coutant  <ccoutant@google.com>
4672
4673         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4674         string, and length fields.
4675         (Output_merge_string::Merged_strings_list): New type.
4676         (Output_merge_string::Merged_strings_lists): New typedef.
4677         (Output_merge_string): Replace merged_strings_ with
4678         merged_strings_lists_.
4679         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4680         Merged_strings_list per input object and section.  Don't store pointer
4681         to the string.  Don't store length with each merged string entry.
4682         (Output_merge_string::finalize_merged_data): Loop over list of merged
4683         strings lists.  Recompute length of each merged string.
4684
4685 2010-07-15  Cary Coutant  <ccoutant@google.com>
4686
4687         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4688         here.
4689
4690 2010-07-14  Ian Lance Taylor  <iant@google.com>
4691
4692         * descriptors.cc (Descriptors::open): Report correct name in error
4693         message.
4694
4695 2010-07-13  Doug Kwan  <dougkwan@google.com>
4696
4697         * arm.cc (Arm_input_section::Arm_input_section): For a
4698         SHT_ARM_EXIDX section, always keeps the input sections.
4699         (Arm_input_section::set_exidx_section_link): New method.
4700         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4701         has_errors_ to false.
4702         (Arm_exidx_input_section::has_errors,
4703         Arm_exidx_input_section::set_has_errors): New methods.
4704         (Arm_exidx_input_section::has_errors_): New data member.
4705         (Arm_relobj::get_exidx_shndx_list): New method.
4706         (Arm_output_section::append_text_sections_to_list): Do not skip
4707         section without SHF_EXECINSTR.
4708         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4709         errors.
4710         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4711         section header.  Make error messages more verbose.  Check for
4712         a non-executable section linked to an EXIDX section.
4713         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4714         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4715         check that there is no deferred EXIDX section if we exit early.
4716         Instead of not making an EXIDX section in case of an error, make one
4717         and set the has_errors flag of it.
4718         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4719         in a relocatable link.
4720         (Target_arm::do_relax): Look for the EXIDX output section instead of
4721         assuming that it is called .ARM.exidx.
4722         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4723         section list.  Do not check for SHF_EXECINSTR section flags but
4724         skip any input section with errors.
4725         * output.cc (Output_section::Output_section): Initialize
4726         always_keeps_input_sections_ to false.
4727         (Output_section::add_input_section): Check for
4728         always_keeps_input_sections_.
4729         *  output.h (Output_section::always_keeps_input_sections,
4730         Output_section::set_always_keeps_input_sections): New methods.
4731         (Output_section::always_keeps_input_sections): New data member.
4732
4733 2010-07-13  Rafael Espindola  <espindola@google.com>
4734
4735         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4736         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4737
4738 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4739             Ian Lance Taylor  <iant@google.com>
4740
4741         * output.h (Output_section_lookup_maps::add_merge_section):
4742         Correct check of whether value was inserted.
4743         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4744         (Output_section_lookup_maps::add_relaxed_input_section):
4745         Likewise.
4746         * arm.cc (Target_arm::got_section): Remove used local os.
4747         * i386.cc (Target_i386::got_section): Likewise.
4748         * x86_64.cc (Target_x86_64::got_section): Likewise.
4749         * sparc.cc (Target_sparc::got_section): Likewise.
4750         (Target_sparc::relocate): Remove unused local have_got_offset.
4751         * powerpc.cc (Target_powerpc::relocate): Likewise.
4752
4753 2010-07-13  Ian Lance Taylor  <iant@google.com>
4754
4755         * compressed_output.cc (zlib_decompress): Fix signature in
4756         !HAVE_ZLIB_H case.
4757
4758         * archive.cc (Archive::include_member): Unlock an external member
4759         of a thin archive.  Don't bother to delete an object we know is
4760         NULL.
4761
4762 2010-07-12  Cary Coutant  <ccoutant@google.com>
4763
4764         * compressed_output.cc (zlib_decompress): New function.
4765         (get_uncompressed_size): New function.
4766         (decompress_input_section): New function.
4767         * compressed_output.h (get_uncompressed_size): New function.
4768         (decompress_input_section): New function.
4769         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4770         Handle compressed debug sections.
4771         * layout.cc (is_compressed_debug_section): New function.
4772         (Layout::output_section_name): Map compressed section names to
4773         canonical names.
4774         * layout.h (is_compressed_debug_section): New function.
4775         (is_debug_info_section): Recognize compressed debug sections.
4776         * merge.cc: Include compressed_output.h.
4777         (Output_merge_data::do_add_input_section): Handle compressed
4778         debug sections.
4779         (Output_merge_string::do_add_input_section): Handle compressed
4780         debug sections.
4781         * object.cc: Include compressed_output.h.
4782         (Sized_relobj::Sized_relobj): Initialize new data members.
4783         (build_compressed_section_map): New function.
4784         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4785         * object.h (Object::section_is_compressed): New method.
4786         (Object::do_section_is_compressed): New method.
4787         (Sized_relobj::Compressed_section_map): New type.
4788         (Sized_relobj::do_section_is_compressed): New method.
4789         (Sized_relobj::compressed_sections_): New data member.
4790         * output.cc (Output_section::add_input_section): Handle compressed
4791         debug sections.
4792         * reloc.cc: Include compressed_output.h.
4793         (Sized_relobj::write_sections): Handle compressed debug sections.
4794
4795 2010-07-08  Cary Coutant  <ccoutant@google.com>
4796
4797         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4798         weak when resolving to a dynamic def.
4799         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4800         for weak undef/dynamic def cases. Adjust callers.
4801         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4802         undef_binding_weak_.
4803         (Symbol_table::sized_write_globals): Adjust symbol binding.
4804         (Symbol_table::sized_write_symbol): Add binding parameter.
4805         * symtab.h (Symbol::set_undef_binding): New method.
4806         (Symbol::is_undef_binding_weak): New method.
4807         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4808         (Symbol_table::should_override): Add new parameter.
4809         (Symbol_table::sized_write_symbol): Add new parameter.
4810
4811         * testsuite/weak_undef_file1.cc: Add new test case.
4812         * testsuite/weak_undef_file2.cc: Fix header comment.
4813         * testsuite/weak_undef_test.cc: Add new test case.
4814
4815 2010-06-29  Doug Kwan  <dougkwan@google.com>
4816
4817         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4818         Initialize USE_SYMBOL_.
4819         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4820         definition.
4821         (Arm_reloc_property::uses_symbol_): New data member declaration.
4822         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4823         uses symbol value and symbol is undefined but not weakly undefined.
4824
4825 2010-06-28  Rafael Espindola  <espindola@google.com>
4826
4827         * plugin.cc (Plugin::load): Use dlerror.
4828
4829 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4830
4831         * symtab.cc (detect_odr_violations): When reporting an ODR
4832         violation, report an object where the symbol is defined.
4833
4834 2010-06-25  Doug Kwan  <dougkwan@google.com>
4835
4836         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4837         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4838         definition.
4839         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4840         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4841         target hook to detect function points.
4842         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4843         * icf.h (Icf::check_section_for_function_pointers): Change type of
4844         parameter SECTION_NAME to const reference to std::string.  Use
4845         target hook to determine if section may have unsafe pointers.
4846         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4847         method definition.
4848
4849 2010-06-21  Rafael Espindola  <espindola@google.com>
4850
4851         * fileread.cc (Input_file::find_fie): New
4852         (Input_file::open): Use Input_file::find_fie.
4853         * fileread.h (Input_file::find_fie): New
4854         * plugin.cc (set_extra_library_path): New.
4855         (Plugin::load): Add set_extra_library_path to the transfer vector.
4856         (Plugin_manager::set_extra_library_path): New.
4857         (Plugin_manager::add_input_file): Use the extra search path if set.
4858         (set_extra_library_path(): New.
4859         * plugin.h (Plugin_manager): Add set_extra_library_path and
4860         extra_search_path_.
4861
4862 2010-06-19  Cary Coutant  <ccoutant@google.com>
4863
4864         * layout.cc (gdb_sections): Add .debug_types.
4865         (lines_only_debug_sections): Likewise.
4866
4867 2010-06-18  Rafael Espindola  <espindola@google.com>
4868
4869         * plugin.cc (add_input_file,add_input_library)
4870         (Plugin_manager::add_input_file): Make filename arguments const.
4871         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4872         const.
4873
4874 2010-06-16  Doug Kwan  <dougkwan@google.com>
4875
4876         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4877         .ARM.attributes section if we have not merged any input
4878         attributes sections.
4879
4880 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4881
4882         * arm.cc: Allow combining objects with no EABI version
4883         information.
4884
4885 2010-06-15  Rafael Espindola  <espindola@google.com>
4886
4887         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4888
4889 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4890
4891         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4892         (struct iovec): Correct !HAVE_READV definition.
4893
4894 2010-06-10  Cary Coutant  <ccoutant@google.com>
4895
4896         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4897         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4898         reloc sections.
4899         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4900
4901         PR 11683
4902         * symtab.h (Symbol::is_placeholder): New member function.
4903         * target-reloc.h (relocate_section): Check for placeholder symbols.
4904
4905         * testsuite/Makefile.am (plugin_test_8): New test.
4906         (plugin_test_9): New test.
4907         * testsuite/Makefile.in: Regenerate.
4908
4909 2010-06-09  Nick Clifton  <nickc@redhat.com>
4910
4911         * yyscript.y (input_list_element): Allow strings prefixed with
4912         the '-' character.  Treat these as libraries.
4913         * script.cc (script_add_library): New function.  Adds a library
4914         specified by "-l<name>" found in an input script.
4915         * script-c.h: Add prototype for script_add_library.
4916
4917 2010-06-07  Doug Kwan  <dougkwan@google.com>
4918
4919         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4920         Restrict stub-group size to be within long conditional branch
4921         range when working around cortex-A8 erratum.
4922
4923 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4924
4925         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4926         #ifdef typo.
4927
4928 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4929
4930         PR gold/11658
4931         * output.cc
4932         (Output_section::Input_section_sort_entry::compare_section_ordering):
4933         Change to return non-zero correctly.
4934         (Output_section::Input_section_sort_section_order_index_compare
4935         ::operator()): Change to fix ambiguity in comparisons.
4936
4937 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4938
4939         * gold.h (is_wildcard_string): New function.
4940         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4941         (Layout::layout_eh_frame): Ditto.
4942         (Layout::find_section_order_index): New method.
4943         (Layout::read_layout_from_file): New method.
4944         * layout.h (Layout::find_section_order_index): New method.
4945         (Layout::read_layout_from_file): New method.
4946         (Layout::input_section_position_): New private member.
4947         (Layout::input_section_glob_): New private member.
4948         * main.cc (main): Call read_layout_from_file here.
4949         * options.h (--section-ordering-file): New option.
4950         * output.cc (Output_section::input_section_order_specified_): New
4951         member.
4952         (Output_section::Output_section): Initialize new member.
4953         (Output_section::add_input_section): Add new parameter.
4954         Keep input sections when --section-ordering-file is used.
4955         (Output_section::set_final_data_size): Sort input sections when
4956         section ordering file is specified.
4957         (Output_section::Input_section_sort_entry): Add new parameter.
4958         Check sorting type.
4959         (Output_section::Input_section_sort_entry::compare_section_ordering):
4960         New method.
4961         (Output_section::Input_section_sort_compare::operator()): Change to
4962         consider section_order_index.
4963         (Output_section::Input_section_sort_init_fini_compare::operator()):
4964         Change to consider section_order_index.
4965         (Output_section::Input_section_sort_section_order_index_compare
4966         ::operator()): New method.
4967         (Output_section::sort_attached_input_sections): Change to sort
4968         according to section order when specified.
4969         (Output_section::add_input_section<32, true>): Add new parameter.
4970         (Output_section::add_input_section<64, true>): Add new parameter.
4971         (Output_section::add_input_section<32, false>): Add new parameter.
4972         (Output_section::add_input_section<64, false>): Add new parameter.
4973         * output.h (Output_section::add_input_section): Add new parameter.
4974         (Output_section::input_section_order_specified): New
4975         method.
4976         (Output_section::set_input_section_order_specified): New method.
4977         (Input_section::Input_section): Initialize section_order_index_.
4978         (Input_section::section_order_index): New method.
4979         (Input_section::set_section_order_index): New method.
4980         (Input_section::section_order_index_): New member.
4981         (Input_section::Input_section_sort_section_order_index_compare): New
4982         struct.
4983         (Output_section::input_section_order_specified_): New member.
4984         * script-sections.cc (is_wildcard_string): Delete and move modified
4985         method to gold.h.
4986         (Output_section_element_input::Output_section_element_input): Modify
4987         call to is_wildcard_string.
4988         (Output_section_element_input::Input_section_pattern
4989         ::Input_section_pattern): Ditto.
4990         (Output_section_element_input::Output_section_element_input): Ditto.
4991         * testsuite/Makefile.am (final_layout): New test case.
4992         * testsuite/Makefile.in: Regenerate.
4993         * testsuite/final_layout.cc: New file.
4994         * testsuite/final_layout.sh: New file.
4995
4996 2010-06-01  Rafael Espindola  <espindola@google.com>
4997
4998         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4999
5000 2010-06-01  Rafael Espindola  <espindola@google.com>
5001
5002         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5003         visibility of symbols.
5004
5005 2010-05-27  Doug Kwan  <dougkwan@google.com>
5006
5007         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5008         from start of output section instead of address for a local symbol
5009         in a merged or relaxed section when doing a relocatable link.
5010
5011 2010-05-26  Rafael Espindola  <espindola@google.com>
5012
5013        PR 11604
5014         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5015         adding sections the garbage collector removed.
5016         * gold/testsuite/Makefile.am: Add test.
5017         * gold/testsuite/Makefile.in: Regenerate.
5018         * gold/testsuite/plugin_test_7.sh: New.
5019         * gold/testsuite/plugin_test_7_1.c: New.
5020         * gold/testsuite/plugin_test_7_2.c: New.
5021
5022 2010-05-26  Rafael Espindola  <espindola@google.com>
5023
5024         * script-sections.cc (Output_section_definition::set_section_addresses):
5025         Check for --section-start.
5026
5027 2010-05-26  Doug Kwan  <dougkwan@google.com>
5028
5029         * arm.cc (Arm_scan_relocatable_relocs): New class.
5030         (Target_arm::relocate_special_relocatable): New method.
5031         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5032         (Arm_relocate_functions::thumb_branch_common): Same.
5033         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5034         instead of Default_scan_relocatable_relocs.
5035         * target-reloc.h (relocate_for_relocatable): Let target handle
5036         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5037         * target.h (Sized_target::relocate_special_relocatable): New method.
5038
5039 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5040
5041         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5042
5043 2010-05-23  Doug Kwan  <dougkwan@google.com>
5044
5045         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5046         instead of a cast.
5047         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5048         with a direct branch, not a conditional branch, to a stub.
5049         * merge.cc (Output_merge_base::record_input_section): New method
5050         defintion.
5051         (Output_merge_data::do_add_input_section): Record input section if
5052         keeps-input-sections flag is set.
5053         (Output_merge_string::do_add_input_section): Ditto.
5054         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5055         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5056         INPUT_SECTIONS_.
5057         (Output_merge_base::keeps_input_sections,
5058         Output_merge_base::set_keeps_input_sections,
5059         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5060         method definitions.
5061         (Output_merge_base::Input_sections): New type declaration.
5062         (Output_merge_base::input_sections_begin,
5063         Output_merge_base::input_sections_end,
5064         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5065         (Output_merge_base::bool keeps_input_sections_,
5066         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5067         Output_merge_base::input_sections_): New data members.
5068         (Output_merge_data::do_set_keeps_input_sections): New method
5069         defintion.
5070         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5071         * output.cc (Output_section::Input_section::relobj): Move method
5072         defintion from class declaration to here and handle merge sections.
5073         (Output_section::Input_section::shndx): Ditto.
5074         (Output_section::Output_section): Remove initializations of removed
5075         data members and initialize new data member LOOKUP_MAPS_.
5076         (Output_section::add_input_section): Set keeps-input-sections flag
5077         for a newly created merge output section as appropriate.  Adjust code
5078         to use Output_section_lookup_maps class.
5079         (Output_section::add_relaxed_input_section): Adjst code for lookup
5080         maps code refactoring.
5081         (Output_section::add_merge_input_section): Add a new parameter
5082         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5083         class.  If adding input section to a newly created merge output
5084         section fails, remove the new merge section.
5085         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5086         Adjust code for use of the Output_section_lookup_maps class.
5087         (Output_section::find_merge_section): Ditto.
5088         (Output_section::build_lookup_maps): New method defintion.
5089         (Output_section::find_relaxed_input_section): Adjust code to use
5090         Output_section_lookup_maps class.
5091         (Output_section::get_input_sections): Export merge sections.  Adjust
5092         code to use Output_section_lookup_maps class.
5093         (Output_section:::add_script_input_section): Adjust code to use
5094         Output_section_lookup_maps class.  Update lookup maps for merge
5095         sections also.
5096         (Output_section::discard_states): Use Output_section_lookup_maps.
5097         (Output_section::restore_states): Same.
5098         * output.h (Merge_section_properties): Move class defintion out of
5099         Output_section.
5100         (Output_section_lookup_maps): New class.
5101         (Output_section::Input_section::is_merge_section): New method
5102         defintion.
5103         (Output_section::Input_section::relobj): Move defintion out of class
5104         defintion.  Declare method only.
5105         (Output_section::Input_section::shndx): Ditto.
5106         (Output_section::Input_section::output_merge_base): New method defintion.
5107         (Output_section::Input_section::u2_.pomb): New union field.
5108         (Output_section::Merge_section_by_properties_map,
5109         Output_section::Output_section_data_by_input_section_map,
5110         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5111         Remove types.
5112         (Output_section::add_merge_input_section): Add new parameter
5113         KEEPS_INPUT_SECTIONS.
5114         (Output_section::build_lookup_maps): New method declaration.
5115         (Output_section::merge_section_map_,
5116         Output_section::merge_section_by_properties_map_,
5117         Output_section::relaxed_input_section_map_,
5118         Output_section::is_relaxed_input_section_map_valid_): Remove data
5119         members.
5120         (Output_section::lookup_maps_): New data member.
5121
5122 2010-05-21  Doug Kwan  <dougkwan@google.com>
5123
5124         PR gold/11619
5125         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5126         avoid a compilation error.
5127
5128 2010-05-19  Rafael Espindola  <espindola@google.com>
5129
5130         * script-sections.cc (Output_section_definition::allocate_to_segment):
5131         Update the phdrs_list even when the output section is NULL.
5132         * testsuite/Makefile.am: Add test.
5133         * testsuite/Makefile.in: Regenerate.
5134         * testsuite/script_test_9.cc: New.
5135         * testsuite/script_test_9.sh: New.
5136         * testsuite/script_test_9.t: New.
5137
5138 2010-05-19  Doug Kwan  <dougkwan@google.com>
5139
5140         * arm.cc (Arm_input_section::original_size): New method.
5141         (Arm_input_section::do_addralign): Add a cast.
5142         (Arm_input_section::do_output_offset): Remove static cast.
5143         (Arm_input_section::original_addralign,
5144          Arm_input_section::original_size_): Change type to uint32_t.
5145         (Arm_input_section::init): Add safe casts for section alignment
5146         and size.
5147         (Arm_input_section::set_final_data_size): Do not set address and
5148         offset of stub table.
5149         (Arm_output_section::fix_exidx_coverage): Change use of of
5150         Output_section::Simple_input_section to that of
5151         Output_section::Input_section.
5152         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5153         except for the first pass.
5154         * output.cc (Output_section::get_input_sections): Change type of
5155         input_sections to std::list<Input_section>.
5156         (Output_section::add_script_input_section): Rename from
5157         Output_section::add_simple_input_section.  Change type of SIS
5158         parameter from Simple_input_section to Input_section.
5159         * output.h (Output_section::Simple_input_section): Remove class.
5160         (Output_section::Input_section): Change class visibility to public.
5161         (Output_section::Input_section::addralign): Use stored alignments
5162         for special input sections if set.
5163         (Output_section::Input_section::set_addralign): New method.
5164         (Output_section::get_input_sections): Change parameter type from
5165         list of Simple_input_section to list of Input_section.
5166         (Output_section::add_script_input_section): Rename from
5167         Output_section::add_simple_input_section. Change first parameter's
5168         type from Simple_input_section to Input_section and remove the
5169         second and third parameters.
5170         * script-sections.cc (Input_section::Input_section_list): Change
5171         type to list of Output_section::Input_section/
5172         (Input_section_info::Input_section_info): Change parameter type of
5173         INPUT_SECTION to Output_section::Input_section.
5174         (Input_section_info::input_section): Change return type.
5175         (Input_section_info::input_section_): Change type to
5176         Output_section::Input_section.
5177         (Output_section_element_input::set_section_addresses): Adjust code
5178         to use Output_section::Input_section instead of
5179         Output_section::Simple_input_section.  Adjust code for renaming
5180         of Output_section::add_simple_input_section.
5181         (Orphan_output_section::set_section_addresses): Ditto.
5182
5183 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5184
5185         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5186         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5187
5188 2010-05-18  Rafael Espindola  <espindola@google.com>
5189
5190         * options.cc (General_options::finalize): Handle -nostdlib.
5191         * options.h (nostdlib): New option.
5192         * script.cc (script_add_search_dir): Handle -nostdlib.
5193
5194 2010-05-12  Doug Kwan  <dougkwan@google.com>
5195
5196         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5197         attributes section only if there no attributes section after merging.
5198         (Target_arm::merge_object_attributes): Move value of
5199         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5200         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5201         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5202         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5203         and arm_attr_merge_7.stdout.
5204         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5205         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5206         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5207         arm_attr_merge_7b.o): New rules.
5208         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5209         arm_attr_merge_7
5210         * testsuite/Makefile.in: Regenerate.
5211         * testsuite/arm_attr_merge.sh: New file.
5212         * testsuite/arm_attr_merge_[67][ab].s: Same.
5213
5214 2010-05-05  Nick Clifton  <nickc@redhat.com>
5215
5216         * po/es.po: Updated Spanish translation.
5217
5218 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5219
5220         * Makefile.am (install-exec-local): Properly install gold as
5221         default cross linker.
5222         * Makefile.in: Regenerated.
5223
5224 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5225             Nick Clifton  <nickc@redhat.com>
5226
5227         * configure.ac (install_as_default): Define and set to false
5228         unless --enable-gold or --enable-gold=both/gold has been
5229         specified.
5230         * configure: Regenerate.
5231
5232         * Makefile.am (install-exec-local): Install the executable as
5233         'ld.gold'.  If install_as_default is true then also install it as
5234         'ld'.
5235         * Makefile.in: Regenerated.
5236
5237 2010-04-24  Ian Lance Taylor  <iant@google.com>
5238
5239         * layout.cc (Layout::layout_reloc): In relocatable link don't
5240         combine reloc sections for grouped sections.
5241
5242 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5243
5244         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5245         sections that are not ordinary to icf.
5246         * icf.cc (get_section_contents): Handle relocation pointing to section
5247         with no object or shndx information.
5248         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5249         * testsuite/Makefile.in: Regenerate.
5250         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5251         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5252
5253 2010-04-22  Ian Lance Taylor  <iant@google.com>
5254
5255         * expression.cc (Expression::Expression_eval_info): Add
5256         result_alignment_pointer field.
5257         (Expression::eval_with_dot): Add result_alignment_pointer
5258         parameter.  Change all callers.
5259         (Expression::eval_maybe_dot): Likewise.
5260         (class Binary_expression): Add alignment_pointer parameter to
5261         left_value and right_value.  Change all callers.
5262         (BINARY_EXPRESSION): Set result alignment.
5263         (class Trinary_expression): Add alignment_pointer parameter to
5264         arg2_value and arg3_value.  Change all callers.
5265         (Trinary_cond::value): Set result alignment.
5266         (Max_expression::value, Min_expression::value): Likewise.
5267         (Align_expression::value): Likewise.
5268         * script-sections.cc (class Sections_element): Add dot_alignment
5269         parameter to set_section_addresses virtual function.  Update
5270         instantiations.
5271         (class Output_section_element): Likewise.
5272         (Script_sections::create_segments): Add dot_alignment parameter.
5273         Change all callers.
5274         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5275         (Script_sections::set_phdrs_clause_addresses): Likewise.
5276         * script-sections.h: Update declarations.
5277         * script.h: Update declarations.
5278         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5279         min_p_align.
5280         * testsuite/script_test_3.t: Set large alignment.
5281         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5282         segment has expected alignment.
5283
5284 2010-04-22  Nick Clifton  <nickc@redhat.com>
5285
5286         * po/gold.pot: Updated by the Translation project.
5287         * po/vi.po: Updated Vietnamese translation.
5288
5289 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5290
5291         * testsuite/Makefile.am (check_PROGRAMS): Add
5292         icf_virtual_function_folding_test.
5293         * testsuite/Makefile.in: Regenerated.
5294
5295 2010-04-15  Andrew Haley  <aph@redhat.com>
5296
5297         * options.h (merge_exidx_entries): New option.
5298         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5299         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5300         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5301         (Target_arm::merge_exidx_entries): New function.
5302         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5303         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5304         to Arm_exidx_fixup constructor.
5305         Add new arg, merge_exidx_entries.
5306         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5307         Arm_output_section::fix_exidx_coverage.
5308
5309 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5310
5311         * icf.cc (get_section_contents): Check for preemptible functions.
5312         Ignore addend when appropriate.
5313         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5314         section folded.
5315         (add_from_relobj): Check for section folded.
5316         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5317         * symtab.h (should_add_dynsym_entry): Add new parameter.
5318         * target-reloc.h (scan_relocs): Check for section folded.
5319         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5320         Check reloc types for function pointers in shared objects.
5321         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5322         case.
5323         (icf_preemptible_functions_test): New test case.
5324         (icf_string_merge_test): New test case.
5325         * testsuite.Makefile.in: Regenerate.
5326         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5327         bar_glob.  Refactor code.
5328         * testsuite/icf_preemptible_functions_test.cc: New file.
5329         * testsuite/icf_preemptible_functions_test.sh: New file.
5330         * testsuite/icf_string_merge_test.cc: New file.
5331         * testsuite/icf_string_merge_test.sh: New file.
5332         * testsuite/icf_virtual_function_folding_test.cc: New file.
5333         * testsuite/icf_virtual_function_folding_test.sh: New file.
5334
5335 2010-04-14  Doug Kwan  <dougkwan@google.com>
5336
5337         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5338         for local symbol recounting if we remove a section due to ICF.
5339         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5340         there are no regular objects in input.
5341
5342 2010-04-13  Doug Kwan  <dougkwan@google.com>
5343
5344         * arm.cc (Arm_input_section::set_final_data_size): Compute
5345         accurate final data size instead of using current data size.
5346
5347 2010-04-09  Doug Kwan  <dougkwan@google.com>
5348
5349         * layout.cc (Layout::choose_output_section): Handle script section
5350         types.
5351         (Layout::make_output_section_for_script): Add section type parameter.
5352         Handle script section types.
5353         * layout.h (Layout::make_output_section_for_script): Add section
5354         type parameter.
5355         * output.cc (Output_section::Output_section): Initialize data member
5356         is_noload_.
5357         (Output_section::do_reset_address_and_file_offset): Do not set address
5358         to 0 if section is a NOLOAD section.
5359         * output.h (Output_section::is_noload): New method.
5360         (Output_section::set_is_noload): Ditto.
5361         (Output_section::is_noload_): New data member.
5362         * script-c.h (Script_section_type): New enum type.
5363         (struct Parser_output_section_header): Add new file section_type.
5364         * script-sections.cc (Sections_element::output_section_name): Add
5365         parameter for returning script section type.
5366         (Output_section_definition::output_section_name): Ditto.
5367         (Output_section_definition::section_type)P; New method.
5368         (Output_section_definiton::script_section_type_name): Ditto.
5369         (Output_section_definition::script_section_type_): New data member.
5370         (Output_section_definition::Output_section_definition): Initialize
5371         data member Output_section_definition::script_section_type_.
5372         (Output_section_definition::create_sections): Pass script section type
5373         to Layout::make_output_section_for_script.
5374         (Output_section_definition::output_section_name): Return script
5375         section type to caller.
5376         (Output_section_definition::set_section_address): Do not advance
5377         dot value and load address if section type is NOLOAD.  Set address
5378         of NOLOAD sections regardless of section flags.
5379         (Output_section_definition::print): Print section type if it is
5380         not SCRIPT_SECTION_TYPE_NONE.
5381         (Output_section_definition::section_type): New method.
5382         (Output_section_definition::script_section_type_name): Ditto.
5383         (Script_sections::output_section_name): Add new parameter
5384         PSECTION_TYPE for returning script section type.  Pass it to
5385         section elements.  Handle discard sections.
5386         (Sort_output_sections::operator()): Handle NOLOAD sections.
5387         * script-sections.h (Script_sections::Section_type): New enum type.
5388         (Script_sections::output_section_name): Add a new parameter for
5389         returning script section type.
5390         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5391         INFO and NOLOAD.
5392         * yyscript.y (union): Add new field SECTION_TYPE.
5393         (COPY, DSECT, INFO, NOLOAD): New tokens.
5394         (opt_address_and_section_type): Change type to output_section_header.
5395         (section_type): New non-terminal
5396         (section_header): Handle section type.
5397         (opt_address_and_section_type): Return section type value.
5398
5399 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5400
5401         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5402         * testsuite/plugin_common_test_2.c (foo): Likewise.
5403
5404 2010-04-08  Doug Kwan  <dougkwan@google.com>
5405
5406         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5407         Output_merge_data.
5408         * output.cc (Output_section::add_merge_input_section): Simplify
5409         code and return status of Output_merge_base::add_input_section.
5410         Update merge section map only if Output_merge_base::add_input_section
5411         returns true.
5412
5413 2010-04-07  Doug Kwan  <dougkwan@google.com>
5414
5415         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5416         if section is marked as containing instructions but has no mapping
5417         symbols.
5418         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5419         correct section index.
5420         (Arm_relobj::find_linked_text_section): Ditto.
5421
5422 2010-04-07  Cary Coutant  <ccoutant@google.com>
5423
5424         * archive.cc (include_member): Destroy Read_symbols_data object before
5425         releasing file.
5426         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5427         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5428         (Read_symbols_data::~Read_symbols_data) New destructor.
5429         (Section_relocs::Section_relocs) New constructor.
5430         (Section_relocs::~Section_relocs) New destructor.
5431         (Read_relocs_data::Read_relocs_data) New constructor.
5432         (Read_relocs_data::~Read_relocs_data) New destructor.
5433         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5434         pointers to NULL after deleting.
5435
5436 2010-04-07  Doug Kwan  <dougkwan@google.com>
5437
5438         * arm.cc: Replace "endianity" with "endianness" in comments.
5439         (Arm_exidx_cantunwind): Ditto.
5440         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5441         (Arm_relobj::merge_flags_and_attributes): New method.
5442         (Arm_relobj::merge_flags_and_attributes_): New data member.
5443         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5444         (Arm_relobj::scan_sections_for_stubs): Ditto.
5445         (Arm_relobj::do_read_symbols): Check to see if we really want to
5446         merge processor-specific flags and attributes.  Exit early if
5447         an object is empty except for section names and the undefined symbol.
5448         (Target_arm::do_finalize_sections): Move check for ELF format to
5449         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5450         attributes from a regular object only when we have determined that
5451         it is aapropriate.  Do not create an .ARM.attributes section in
5452         output if there is no regular input object.
5453         (Target_arm::merge_processor_specific_flags): Check
5454         --warn-mismatch before printing any error.
5455         (Target_arm::merge_object_attributes): Ditto.
5456         * gold.cc (queue_middle_tasks): Handle the case in which there is
5457         no regular object in input.
5458         * options.cc (General_options::parse_EB): New method.
5459         (General_options::parse_EL): Same.
5460         (General_options::General_options): Initialize endianness_.
5461         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5462         New options.
5463         (General_options::Endianness): New enum.
5464         (General_options::endianness): New method.
5465         (General_options::endianness_): New data member.
5466         * parameters.cc (Parameters::set_options): Check target endianness.
5467         (Parameters::set_target_once): Ditto.
5468         (Parameters::check_target_endianness): New method.
5469         (parameters_force_valid_target): If either -EL or -EB is specified,
5470         use it to define endianness of default target.
5471         * parameters.h (Parameters::check_target_endianness): New method
5472         declaration.
5473         * target.h (class Target): Change "endianity" to "endianness"
5474         in comments.
5475
5476 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5477
5478         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5479         * configure: Regenerate.
5480         * Makefile.in: Regenerate.
5481         * testsuite/Makefile.in: Regenerate.
5482
5483 2010-04-06  Cary Coutant  <ccoutant@google.com>
5484
5485         gcc PR lto/42757
5486         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5487         prevailing definitions of common symbols.
5488         * testsuite/plugin_test_6.sh: New test case.
5489         * testsuite/plugin_common_test_1.c: New test case.
5490         * testsuite/plugin_common_test_2.c: New test case.
5491         * testsuite/Makefile.am (plugin_test_6): New test case.
5492         * testsuite/Makefile.in: Regenerate.
5493
5494 2010-04-06  Nick Clifton  <nickc@redhat.com>
5495
5496         * po/vi.po: New Vietnamese translation.
5497
5498 2010-03-30  Doug Kwan  <dougkwan@google.com>
5499
5500         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5501
5502 2010-03-25  Doug Kwan  <dougkwan@google.com>
5503
5504         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5505         to avoid a conversion warning on a 32-bit host.
5506
5507 2010-03-24  Ian Lance Taylor  <iant@google.com>
5508
5509         * testsuite/script_test_3.t: Add a TLS segment.
5510         * testsuite/Makefile.am (check_PROGRAMS): Add
5511         tls_phdrs_script_test.
5512         (tls_phdrs_script_test_SOURCES): Define.
5513         (tls_phdrs_script_test_DEPENDENCIES): Define.
5514         (tls_phdrs_script_test_LDFLAGS): Define.
5515         (tls_phdrs_script_test_LDADD): Define.
5516         * testsuite/Makefile.in: Rebuild.
5517
5518 2010-03-23  Cary Coutant  <ccoutant@google.com>
5519
5520         * fileread.cc (find_or_make_view): Fix comment.
5521
5522 2010-03-23  Ian Lance Taylor  <iant@google.com>
5523
5524         * script-sections.cc (class Orphan_section_placement): Define
5525         PLACE_TLS and PLACE_TLS_BSS.
5526         (Orphan_section_placement::Orphan_section_placement): Initialize
5527         new places.
5528         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5529         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5530         (tls_script_test_SOURCES): Define.
5531         (tls_script_test_DEPENDENCIES): Define.
5532         (tls_script_test_LDFLAGS): Define.
5533         (tls_script_test_LDADD): Define.
5534         * testsuite/Makefile.in: Rebuild.
5535
5536 2010-03-22  Doug Kwan  <dougkwan@google.com>
5537
5538         * arm.cc (Arm_relocate_functions::abs8,
5539         Arm_relocate_functions::abs16): Use correct check for overflow
5540         specified in the ARM ELF specs.
5541         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5542         target of a BLX instruction specially.
5543         (Reloc_stub::stub_type_for_reloc): Ditto.
5544         (Relocate::relocate): Use symbolic names instead of numeric relocation
5545         codes to report error.
5546         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5547         workaround.
5548         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5549         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5550         thumb2_blx_out_of_range.stdout
5551         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5552         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5553         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5554         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5555         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5556         thumb2_blx_in_range, thumb2_blx_in_range.o,
5557         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5558         thumb2_blx_out_of_range.o): New rules.
5559         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5560         thumb2_blx_in_range and thumb2_blx_out_of_range.
5561         * testsuite/Makefile.in: Regenerate.
5562         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5563         * testsuite/thumb_blx_in_range.s: New file.
5564         * testsuite/thumb_blx_out_of_range.s: New file.
5565
5566 2010-03-22  Rafael Espindola  <espindola@google.com>
5567
5568         * archive.cc (Should_include): Move to archive.h.
5569         (should_include_member): Make it a member of Archive.
5570         (Lib_group): New.
5571         (Add_lib_group_symbols): New.
5572         * archive.h: Include options.h.
5573         (Archive_member): Moved from Archive.
5574         (Should_include): Moved from archive.cc.
5575         (Lib_group): New.
5576         (Add_lib_group_symbols): New.
5577         * dynobj.cc (do_should_include_member): New.
5578         * dynobj.h (do_should_include_member): New.
5579         * gold.cc (queue_initial_tasks): Update call to queue.
5580         * main.cc (main): Print lib group stats.
5581         * object.cc (do_should_include_member): New.
5582         * object.h: Include archive.h.
5583         (Object::should_include_member): New.
5584         (Object::do_should_include_member): New.
5585         (Sized_relobj::do_should_include_member): New.
5586         * options.cc (General_options::parse_start_lib): New.
5587         (General_options::parse_end_lib): New.
5588         (Input_arguments::add_file): Handle lib groups.
5589         (Input_arguments::start_group): Check we are not in a lib.
5590         (Input_arguments::start_lib): New.
5591         (Input_arguments::end_lib): New.
5592         * options.h (General_options): Add start_lib and end_lib.
5593         (Input_argument::lib_): New.
5594         (Input_argument::lib): New.
5595         (Input_argument::is_lib): New.
5596         (Input_file_lib): New.
5597         (Input_arguments::in_lib_): New.
5598         (Input_arguments::in_lib): New.
5599         (Input_arguments::start_lib): New.
5600         (Input_arguments::end_lib_): New.
5601         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5602         in unused members as preempted.
5603         (Sized_pluginobj::do_should_include_member): New.
5604         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5605         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5606         return the blocker.
5607         (Read_symbols::do_whole_lib_group): New.
5608         (Read_symbols::do_lib_group): New.
5609         (Read_symbols::do_read_symbols): Handle lib groups.
5610         (Read_symbols::get_name): Handle lib groups.
5611         * readsyms.h (Read_symbols): Add an archive member pointer.
5612         (Read_symbols::do_whole_lib_group): New.
5613         (Read_symbols::do_lib_group): New.
5614         (Read_symbols::member_): New.
5615         * script.cc (read_input_script): Update call to queue_soon.
5616
5617 2010-03-19  Doug Kwan  <dougkwan@google.com>
5618
5619         * arm.cc (Stub_table::Stub_table): Initialize new data members
5620         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5621         (Stub_table::add_reloc_stub): Assign stub offset and update
5622         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5623         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5624         New data members.
5625         (Stub_table::update_data_size_and_addralign): Use
5626         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5627         instead of going over all reloc stubs.
5628         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5629         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5630         Stringpool_template::offset_ to size of Stringpool_char.
5631         (Stringpool_template::new_key_offset): Remove code to initialize
5632         Stringpool_template::offset_.
5633         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5634         Stringpool_template::offset_ to zero.
5635
5636 2010-03-15  Doug Kwan  <dougkwan@google.com>
5637
5638         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5639         offset_.
5640         (Stringpool_template::new_key_offset): New method.
5641         (Stringpool_template::add_string): Assign offsets when adding new
5642         strings.
5643         (Stringpool_template::set_string_offsets): Do not set string offsets
5644         when not optimizing.
5645         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5646         member size_.
5647         (Chunked_vector::clear): Clear size_.
5648         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5649         (Chunked_vector::size): Return size_.
5650         (Chunked_vector::push_back): Use size_ to find insert position.
5651         (Chunked_vector::size_): New data member.
5652         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5653         (Stringpool_template::new_key_offset): New method declaration.
5654         (Stringpool_template::offset_): New data member.
5655
5656 2010-03-15   Rafael Espindola  <espindola@google.com>
5657
5658         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5659         Add_symbols' constructor.
5660         * readsyms.h (Add_symbols): Remove the input_group member.
5661
5662 2010-03-10  Ian Lance Taylor  <iant@google.com>
5663
5664         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5665         target to ask whether a reference to a symbol requires a stack
5666         split.
5667         * target.h (Target::is_call_to_non_split): New function.
5668         (Target::do_is_call_to_non_split): Declare virtual function.
5669         * target.cc: Include "symtab.h".
5670         (Target::do_is_call_to_non_split): New function.
5671         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5672
5673 2010-03-10  Cary Coutant  <ccoutant@google.com>
5674
5675         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5676         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5677         (File_read::open[2]): Add whole_file_view_ to list of views.
5678         (File_read::make_view): Remove test of whole_file_view_.
5679         (File_read::find_or_make_view): Create whole_file_view_ if
5680         necessary.
5681         (File_read::clear_views): Replace bool parameter with enum;
5682         adjust all callers.  Don't delete views with permanent data;
5683         do delete cached views and views from archives if
5684         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5685         if clearing the corresponding view.
5686         * fileread.h (File_read::Clear_views_mode): New enum.
5687         (File_read::View::is_permanent_view): New method.
5688         (File_read::clear_views): Replace bool parameter
5689         with enum; adjust all callers.
5690         * options.h (General_options): Change keep_files_mapped option;
5691         add map_whole_files.
5692         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5693         releasing the file.
5694         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5695         the file.
5696
5697 2010-03-10  David S. Miller  <davem@davemloft.net>
5698
5699         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5700
5701 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5702
5703         * icf.cc (get_section_contents): Add '@' marker after processing the
5704         merge reloc.
5705
5706 2010-03-08  Doug Kwan  <dougkwan@google.com>
5707
5708         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5709         due to a conversion warning.
5710         (Arm_relobj::update_output_local_symbol_count): Check for local
5711         symbol with unset output index.
5712
5713 2010-03-05  Ian Lance Taylor  <iant@google.com>
5714
5715         * options.h (class General_options): Add --spare-dynamic-tags.
5716         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5717         --spare-dynamic-tags.
5718
5719 2010-03-05  Ian Lance Taylor  <iant@google.com>
5720
5721         * incremental.cc: Include "libiberty.h".
5722
5723 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5724
5725         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5726         function, is_info_ member.
5727         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5728         (Versions::Versions): Update caller.
5729         (Versions::define_base_version): Likewise.
5730         (Versions::add_def): Likewise.
5731
5732 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5733
5734         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5735         (Scan::possible_function_pointer_reloc): New function.
5736         (Scan::local_reloc_may_be_function_pointer): Change to call
5737         possible_function_pointer_reloc.
5738         (Scan::global_reloc_may_be_function_pointer): Ditto.
5739         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5740         relocations in ".data.rel.ro._ZTV" section.
5741         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5742         * testsuite/icf_safe_so_test.cc: Ditto.
5743         * testsuite/icf_safe_test.cc: Ditto.
5744         * testsuite/icf_safe_test.sh: Ditto.
5745
5746 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5747             Ian Lance Taylor  <iant@google.com>
5748
5749         * target-reloc.h (relocate_section): Check the symbol table index
5750         for -1U before setting the local symbol index.
5751         (scan_relocatable_relocs): If copying the relocation, record that
5752         the local symbol is required.
5753         * object.h (Symbol_value::is_output_symtab_index_set): New
5754         function.
5755         (Symbol_value::may_be_discarded_from_output_symtab): New
5756         function.
5757         (Symbol_value::has_output_symtab_entry): New function.
5758         (Symbol_value::needs_output_symtab_entry): Remove.
5759         (Symbol_value::output_symtab_index): Make sure the symbol index is
5760         set.
5761         (Symbol_value::set_output_symtab_index): Make sure the symbol
5762         index is not set.  Make sure the new index is valid.
5763         (Symbol_value::set_must_have_output_symtab_entry): New function.
5764         (Symbol_value::has_output_dynsym_entry): New function.
5765         (Symbol_value::set_output_dynsym_index): Make sure the new index
5766         is valid.
5767         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5768         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5769         local symbol if permitted.
5770         (Sized_relobj::do_finalize_local_symbols): Call
5771         is_output_symtab_index_set rather than needs_output_symtab_entry.
5772         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5773         rather than needs_output_symtab_entry.  Call
5774         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5775         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5776         is_output_symtab_index_set rather than needs_output_symtab_entry.
5777         * testsuite/discard_locals_relocatable_test.c: New file.
5778         * testsuite/discard_locals_test.sh: Test -r.
5779         * testsuite/Makefile.am (check_DATA): Add
5780         discard_locals_relocatable_test1.syms,
5781         discard_local_relocatable_test2.syms.
5782         (MOSTLYCLEANFILES): Likewise.  Also add
5783         discard_locals_relocatable_test1.lout and
5784         discard_locals_relocatable_test2.out.
5785         (discard_locals_relocatable_test1.syms): New target.
5786         (discard_locals_relocatable_test.o): New target.
5787         (discard_locals_relocatable_test1.out): New target.
5788         (discard_locals_relocatable_test2.syms): New target.
5789         (discard_locals_relocatable_test2.out): New target.
5790         (various): Add missing ../ld-new dependencies.
5791         * testsuite/Makefile.in: Rebuild.
5792
5793 2010-03-03  Nick Clifton  <nickc@redhat.com>
5794
5795         * po/fi.po: New Finnish translation.
5796
5797 2010-03-01  Doug Kwan  <dougkwan@google.com>
5798
5799         * layout.cc (Layout::Layout): Force section types of .init_array*,
5800         .preinit_array* and .fini_array* sections.
5801         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5802         Fix check of return value of std::string::find.().
5803         (Output_section::Input_section_sort_compare::operator()): Remove
5804         comment about .init_array.
5805         (Output_section::Input_section_sort_init_fini_compare::operator()):
5806         New method.
5807         (Output_section::sort_attached_input_sections): Handle .init_array
5808         and .fini_array specially.
5809         * output.h (Output_section::Inut_section_sort_compare): Update
5810         comment.
5811         (Output_section::Input_section_sort_init_fini_compare): New struct.
5812
5813 2010-02-26  Doug Kwan  <dougkwan@google.com>
5814
5815         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5816         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5817         * testsuite/debug_msg.sh: Avoid matching source line number for
5818         use of global variable undef_int.
5819
5820 2010-02-26  Doug Kwan  <dougkwan@google.com>
5821
5822         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5823         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5824         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5825         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5826         * options.cc (General_options::General_options): Initialize member
5827         fix_v4bx_.
5828         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5829         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5830         and rm_no_fix_v4bx.stdout
5831         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5832         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5833         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5834         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5835         and arm_no_fix_v4bx.
5836         * Makefile.in: Regenerate.
5837         * testsuite/arm_fix_v4bx.s: New file.
5838         * testsuite/arm_fix_v4bx.sh: Ditto.
5839
5840 2010-02-24  Doug Kwan  <dougkwan@google.com>
5841
5842         * arm.cc (Target_arm::got_section): Make the .got section the first
5843         non RELRO section in the data segment.
5844         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5845         suffixes of section names.
5846
5847 2010-02-24  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5850         flags and attributes merging if an input file is a binary file.
5851         * fileread.cc (Input_file::open): Record format of original file.
5852         * fileread.h (Input_file::Format): New enum type.
5853         (Input_file::Input_file): Initialize data member format_.
5854         (Input_file::format): New method definition.
5855         (Input_file::format_):: New data member.
5856
5857 2010-02-24  Doug Kwan  <dougkwan@google.com>
5858
5859         * arm.cc (Arm_output_data_got): New class.
5860         (ARM_TCB_SIZE): New constant
5861         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5862         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5863         If user uses a script with a SECTIONS clause, issue only a warning
5864         for a misplaced EXIDX input section.  Otherwise, issue an error.
5865         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5866         garbage collection.
5867         (Target_arm::got_mode_index_entry): Handle static linking.
5868         (Target_arm::Scan::local): Ditto.
5869         (Target_arm::Scan::global): Ditto.
5870         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5871         all incorrectly implemented relocations.
5872         (Target_arm::fix_exidx_coverage): Pass layout to
5873         Arm_output_section::fix_exidx_coverage.
5874         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5875         from ".ARM.exidx." and ".ARM.extab.".
5876
5877 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5878
5879         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5880         section if it does not already exist.
5881         * attributes.cc (Attributes_section_data::Attributes_section_data):
5882         Don't crash if size is zero.
5883
5884 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5885             Ian Lance Taylor  <iant@google.com>
5886
5887         * gold.cc (queue_middle_tasks): If no input files were opened,
5888         exit.
5889         * workqueue.h (Task_function::Task_function): Assert that there is
5890         a blocker.
5891
5892 2010-02-22  Doug Kwan  <dougkwan@google.com>
5893
5894         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5895         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5896         types to avoid warnings due to different uint64_t implementations
5897         on different hosts.
5898
5899 2010-02-21  Doug Kwan  <dougkwan@google.com>
5900
5901         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5902         handling of the maximum backward branch offset.
5903         (Arm_relocate_functions::thumb_branch_common): Ditto.
5904         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5905         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5906         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5907         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5908         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5909         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5910         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5911         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5912         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5913         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5914         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5915         thumb2_bl_out_of_range.o): New rules.
5916         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5917         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5918         thumb2_bl_out_of_range
5919         * testsuite/Makefile.in: Regenerate.
5920         * testsuite/arm_bl_in_range.s: New file.
5921         * testsuite/arm_bl_out_of_range.s: Ditto.
5922         * testsuite/arm_branch_in_range.sh: Ditto.
5923         * testsuite/arm_branch_range.t: Ditto.
5924         * testsuite/thumb2_branch_range.t: Ditto.
5925         * testsuite/thumb_bl_in_range.s: Ditto.
5926         * testsuite/thumb_bl_out_of_range.s: Ditto.
5927         * testsuite/thumb_branch_range.t: Ditto.
5928
5929 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5930
5931         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5932         Add reloc offset information.
5933         * icf.cc (get_section_contents): Change iterators to point to the new
5934         vectors. Add reloc offset information to the contents.
5935         * icf.h (Icf::Sections_reachable_info): New typedef.
5936         (Icf::Sections_reachable_list): New typedef.
5937         (Icf::Offset_info): New typedef.
5938         (Icf::Reloc_info): New struct typedef.
5939         (Icf::Reloc_info_list): New typedef.
5940         (Icf::symbol_reloc_list): Delete method.
5941         (Icf::addend_reloc_list): Delete method.
5942         (Icf::section_reloc_list): Delete method.
5943         (Icf::reloc_info_list): New method.
5944         (Icf::reloc_info_list_): New member.
5945
5946 2010-02-19  Doug Kwan  <dougkwan@google.com>
5947
5948         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5949         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5950         * arm.cc (Arm_relocation_functions): New forward declaration.
5951         (Target_arm::Target_arm): Initialize new data members
5952         got_mod_index_offset_ and tls_base_symbol_defined_.
5953         (Target_arm::Relocate::relocate_tls): New method.
5954         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5955          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5956         New methods.
5957         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5958         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5959         (Target_arm::got_mod_index_offset_,
5960         Target_arm::tls_base_symbol_defined_): New data members.
5961         (Target_arm::Scan::local, Target::Scan::global,
5962         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5963         relocations.
5964
5965 2010-02-18  Doug Kwan  <dougkwan@google.com>
5966
5967         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5968         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5969         text section as a parameter becuase some broken tools may not set
5970         the link in section header.
5971         (Target_arm::has_got_section): New method.
5972         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5973         without any mapping symbol as data only.  Remove warning.
5974         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5975         link in its section header, try to discover the link by inspecting the
5976         REL31 relocation at the beginning of the section.
5977         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5978         in error message.
5979         (Target_arm::Scan::global): Treat any reference to the symbol
5980         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5981
5982 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5983
5984         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5985         (Scan::global_reloc_may_be_function_pointer): New function.
5986         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5987         (Scan::global_reloc_may_be_function_pointer): New function.
5988         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5989         (Scan::global_reloc_may_be_function_pointer): New function.
5990         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5991         (Scan::global_reloc_may_be_function_pointer): New function.
5992         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5993         (Scan::global_reloc_may_be_function_pointer): New function.
5994         (Scan::possible_function_pointer_reloc): New function.
5995         (Target_x86_64::can_check_for_function_pointers): New function.
5996         * gc.h (gc_process_relocs): Scan relocation types to determine if
5997         function pointers were taken for targets that support it.
5998         * icf.cc (Icf::find_identical_sections): Include functions for
5999         folding in safe ICF whose pointer is not taken.
6000         * icf.h (Secn_fptr_taken_set): New typedef.
6001         (fptr_section_id_): New member.
6002         (section_has_function_pointers): New function.
6003         (set_section_has_function_pointers): New function.
6004         (check_section_for_function_pointers): New function.
6005         * options.h: Fix comment for safe ICF option.
6006         * target.h (can_check_for_function_pointers): New function.
6007         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6008         Modify icf_safe_test for X86-64.
6009         * testsuite/Makefile.in: Regenerate.
6010         * testsuite/icf_safe_so_test.cc: New file.
6011         * testsuite/icf_safe_so_test.sh: New file.
6012         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6013         (main): Change to take pointer to function kept_func_3.
6014         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6015         folding is done correctly for X86-64.
6016
6017 2010-02-12  David S. Miller  <davem@davemloft.net>
6018
6019         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6020         is_symbolless parameter.
6021         (Output_reloc<SHT_REL>::is_symbolless): New.
6022         (Output_reloc<SHT_REL>::is_symbolless_): New.
6023         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6024         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6025         (Output_reloc<SHT_RELA>::is_symbolless): New.
6026         (Output_data_reloc::add_global): Handle is_symbolless.
6027         (Output_data_reloc::add_global_relative): Likewise.
6028         (Output_data_reloc::add_local): Likewise.
6029         (Output_data_reloc::add_local_relative): Likewise.
6030         (Output_data_reloc::add_symbolless_global_addend): New.
6031         (Output_data_reloc::add_symbolless_local_addend): New.
6032         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6033         is_symbolless.
6034         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6035         instead of ->is_relative_
6036         (Output_reloc::write): Likewise.
6037         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6038         (Output_reloc::write_rel): Simplify.
6039
6040         * sparc.cc (Target_sparc::Scan::local): Use
6041         ->add_symbolless_local_addend as needed.
6042         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6043         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6044         based upon relocation offset.
6045
6046 2010-02-11  Doug Kwan  <dougkwan@google.com>
6047
6048         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6049         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6050         beginning of function.
6051         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6052         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6053         parameter is_32bit in calls to should_apply_static_reloc.
6054         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6055         (check_DATA): Add arm_abs_global.stdout.
6056         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6057         arm_abs_global.stdout): New rules.
6058         (MOSTLLYCLEANFILES): Add arm_abs_global
6059         * Makefile.in: Regenerate.
6060         * testsuite/arm_abs_global.s: New file.
6061         * testsuite/arm_abs_global.sh: Ditto.
6062         * testsuite/arm_abs_lib.s: Ditto.
6063
6064 2010-02-11  Ian Lance Taylor  <iant@google.com>
6065
6066         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6067         Read_relocs task.
6068         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6069         Allocate_commons_task first.
6070         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6071         task, rather than symtab_lock_.
6072         (Gc_process_relocs::~Gc_process_relocs): New function.
6073         (Gc_process_relocs::is_runnable): Check this_blocker_.
6074         (Gc_process_relocs::locks): Use next_blocker_ rather than
6075         blocker_.
6076         (Scan_relocs::~Scan_relocs): New function.
6077         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6078         symtab_lock_.
6079         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6080         next_blocker_.
6081         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6082         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6083         constructor accordingly.
6084         (class Gc_process_relocs): Likewise.
6085         (class Scan_relocs): Likewise.
6086         * common.h (class Allocate_commons_task): Remove symtab_lock_
6087         field, and corresponding constructor parameter.
6088         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6089         symtab_lock_.
6090         (Allocate_commons_task::locks): Likewise.
6091
6092 2010-02-11  Ian Lance Taylor  <iant@google.com>
6093
6094         * gold-threads.h (class Once): Define.
6095         (class Initialize_lock): Rewrite as child of Once.
6096         * gold-threads.cc (class Once_initialize): Define.
6097         (once_pointer_control): New static variable.
6098         (once_pointer, once_arg): New static variables.
6099         (c_run_once): New static function.
6100         (Once::Once, Once::run_once, Once::internal_run): New functions.
6101         (class Initialize_lock_once): Remove.
6102         (initialize_lock_control): Remove.
6103         (initialize_lock_pointer): Remove.
6104         (initialize_lock_once): Remove.
6105         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6106         (Initialize_lock::initialize): Rewrite.
6107         (Initialize_lock::do_run_once): New function.
6108         * archive.cc (Archive::interpret_header): Only clear name if it is
6109         not already empty.
6110         * fileread.cc: Include "gold-threads.h"
6111         (file_counts_lock): New static variable.
6112         (file_counts_initialize_lock): Likewise.
6113         (File_read::release): Only increment counts when using --stats.
6114         Use a lock around the increment.
6115         * parameters.cc (class Set_parameters_target_once): Define.
6116         (set_parameters_target_once): New static variable.
6117         (Parameters::Parameters): Move here from parameters.h.
6118         (Parameters::set_target): Rewrite.
6119         (Parameters::set_target_once): New function.
6120         (Parameters::clear_target): Move here and rewrite.
6121         * parameters.h (class Parameters): Update declarations.  Add
6122         set_parameters_target_once_ field.
6123         (Parameters::Parameters): Move to parameters.cc.
6124         (Parameters::clear_target): Likewise.
6125         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6126         task.
6127         (Start_group::~Start_group): New function.
6128         (Start_group::is_runnable): New function.
6129         (Start_group::locks, Start_group::run): New functions.
6130         (Finish_group::run): Change saw_undefined to size_t.
6131         * readsyms.h (class Start_group): Define.
6132         (class Finish_group): Change saw_undefined_ field to size_t.
6133         (Finish_group::Finish_group): Remove saw_undefined and
6134         this_blocker parameters.  Change all callers.
6135         (Finish_group::set_saw_undefined): New function.
6136         (Finish_group::set_blocker): New function.
6137         * symtab.h (class Symbol_table): Change saw_undefined to return
6138         size_t.  Change saw_undefined_ field to size_t.
6139         * target-select.cc (Set_target_once::do_run_once): New function.
6140         (Target_selector::Target_selector): Initialize set_target_once_
6141         field.  Don't initialize lock_ and initialize_lock_ fields.
6142         (Target_selector::instantiate_target): Rewrite.
6143         (Target_selector::set_target): New function.
6144         * target-select.h (class Set_target_once): Define.
6145         (class Target_selector): Update declarations.  Make
6146         Set_target_once a friend.  Remove lock_ and initialize_lock_
6147         fields.  Add set_target_once_ field.
6148
6149 2010-02-10  Ian Lance Taylor  <iant@google.com>
6150
6151         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6152         queueing any tasks.
6153         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6154         (queue_middle_tasks): Add all blockers before queueing any tasks.
6155         (queue_final_tasks): Likewise.
6156         * token.h (Task_token::add_blockers): New function.
6157         * object.h (Input_objects::number_of_relobjs): New function.
6158
6159 2010-02-10  Ian Lance Taylor  <iant@google.com>
6160
6161         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6162         shared, not if not position independent.
6163         * x86_64.cc (Relocate::relocate_tls): Likewise.
6164         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6165         (tls_pie_pic_test): New target.
6166         * testsuite/Makefile.in: Rebuild.
6167
6168         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6169         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6170         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6171         * testsuite/Makefile.in: Rebuild.
6172
6173 2010-02-09  David S. Miller  <davem@davemloft.net>
6174
6175         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6176         R_SPARC_RELATIVE using ->add_local_relative().
6177         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6178
6179         * output.h (Output_data_dynamic::add_section_size): New method
6180         that takes two Output_data objects.
6181         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6182         entry param.  Handle it in initializers.
6183         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6184         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6185         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6186         arg.
6187         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6188         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6189         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6190         for dynrel_includes_plt.
6191         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6192         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6193         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6194         before .rela.plt
6195         (Target_sparc::do_finalize_sections): Update to pass true for
6196         dynrel_includes_plt.
6197         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6198         output before .rela.plt
6199         (Target_powerpc::do_finalize_sections): Update to pass true for
6200         dynrel_includes_plt when 32-bit.
6201
6202 2010-02-08  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6205         method.
6206         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6207         Arm_relobj::scan_section_for_cortex_a8_stubs,
6208         Arm_relobj::do_relocation_section): Instead of calling
6209         Output_section::output_address, use faster
6210         Arm_relobj::simple_input_section_output_address.
6211
6212 2010-02-08  David S. Miller  <davem@davemloft.net>
6213
6214         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6215         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6216         relocation helper function.
6217
6218         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6219         just like R_SPARC_GOT{10,13,22}.
6220         (Target_sparc::Scan::local): Likewise.
6221         (Target_sparc::Relocate:relocate): Likewise.
6222
6223 2010-02-06  Ian Lance Taylor  <iant@google.com>
6224
6225         * configure.ac: Rewrite targetobjs duplicate removal code to use
6226         only shell constructs.
6227         * configure: Rebuild.
6228
6229 2010-02-05  Doug Kwan  <dougkwan@google.com>
6230
6231         PR 11247
6232         * arm.cc (Arm_relobj::section_is_scannable): New method.
6233         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6234         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6235
6236 2010-02-04  Doug Kwan  <dougkwan@google.com>
6237
6238         PR 11247
6239         * arm-reloc-property.cc (cstdio): Include.
6240         * configure.ac (targetobjs): Remove duplicates.
6241         * configure: Regenerate.
6242         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6243         big and little endian version for a given address size.
6244
6245 2010-02-03  Doug Kwan  <dougkwan@google.com>
6246
6247         * arm-reloc-property.cc
6248         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6249         definition.
6250         * arm-reloc-property.h
6251         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6252         New method definition.
6253         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6254         declaration.
6255         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6256         overflow to N.
6257         (GOT_PREL): Change implemented to Y.
6258         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6259         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6260         (Arm_relocate_functions::movw_abs_nc): Remove method.
6261         (Arm_relocate_functions::movt_abs): Ditto.
6262         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6263         (Arm_relocate_functions::thm_movt_abs): Ditto.
6264         (Arm_relocate_functions::movw_rel_nc): Ditto.
6265         (Arm_relocate_functions::movw_rel): Ditto.
6266         (Arm_relocate_functions::movt_rel): Ditto.
6267         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6268         (Arm_relocate_functions:thm_movw_rel): Ditto.
6269         (Arm_relocate_functions:thm_movt_rel): Ditto.
6270         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6271         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6272         New method definitions.
6273         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6274         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6275         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6276         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6277         (Target_arm::Relocate::relocate): Check for non-static or
6278         unimplemented relocation code and exit early.  Change calls to
6279         Target_arm::reloc_uses_thumb_bit and
6280         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6281         instead.  Refactor code to handle similar relocations to increase
6282         code sharing.  Remove check for unsupported relocation code in switch
6283         statement.
6284         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6285         relocation property table to find out size.  Change error message to
6286         print out the name of a relocation code instead of the numeric value.
6287         (Target_arm::scan_reloc_for_stub): Use relocation property table
6288         instead of calling Target_arm::reloc_uses_thumb_bit().
6289
6290 2010-02-02  Doug Kwan  <dougkwan@google.com>
6291
6292         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6293         types of relaxed input section.
6294
6295 2010-02-02  Doug Kwan  <dougkwan@google.com>
6296
6297         * Makefile.am (HFILES): Add arm-reloc-property.h.
6298         (DEFFILES): New.
6299         (TARGETSOURCES): Add arm-reloc-property.cc
6300         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6301         (libgold_a_SOURCES): $(DEFFILES)
6302         * Makefile.in: Regenerate.
6303         * arm-reloc-property.cc: New file.
6304         * arm-reloc-property.h: New file.
6305         * arm-reloc.def: New file.
6306         * arm.cc: Update comments.
6307         (arm-reloc-property.h): New included header.
6308         (arm_reloc_property_table): New global variable.
6309         (Target_arm::do_select_as_default_target): New method definition.
6310         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6311         arm-reloc-property to targ_extra_obj.
6312         * parameters.cc (set_parameters_target): Call
6313         Target::select_as_default_target().
6314         * target.h (Target::select_as_default_target): New method definition.
6315         (Target::do_select_as_default_target): Same.
6316
6317 2010-02-01  Doug Kwan  <dougkwan@google.com>
6318
6319         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6320         first_output_text_section_.
6321         (Arm_exidx_fixup::first_output_text_section): New method definition.
6322         (Arm_exidx_fixup::first_output_text_section_): New data member.
6323         (Arm_exidx_fixup::process_exidx_section): Record the first text
6324         output section seen.
6325         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6326         and entsize in output section header.
6327
6328 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6329
6330         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6331         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6332         (Arm_relocate_functions::thm_alu11): New Method.
6333         (Arm_relocate_functions::thm_pc8): New Method.
6334         (Arm_relocate_functions::thm_pc12): New Method.
6335         (Target_arm::Scan::local): Handle the relocations.
6336         (Target_arm::Scan::global): Likewise.
6337         (Target_arm::Relocate::relocate): Likewise.
6338         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6339
6340 2010-01-29  Doug Kwan  <dougkwan@google.com>
6341
6342         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6343         of relocation types as ld.
6344
6345 2010-01-29  Doug Kwan  <dougkwan@google.com>
6346
6347         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6348         to public.
6349         (Arm_relocate_functions::thumb_branch_common): Ditto.
6350         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6351         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6352         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6353         Arm_relocate_functions::jump24): Remove.
6354         (Target_arm::Relocate::relocate): Adjust code to call
6355         Arm_relocation_functions::arm_branch_common and
6356         Arm_relocation_functions::thumb_branch_common instead of their removed
6357         wrappers.  Merge switch-cases together to reduce source code size.
6358
6359 2010-01-29  Doug Kwan  <dougkwan@google.com>
6360
6361         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6362         output_local_symbol_count_needs_update_.
6363         (Arm_relobj::output_local_symbol_count_needs_update,
6364          Arm_relobj::set_output_local_symbol_count_needs_update,
6365          Arm_relobj::update_output_local_symbol_count): New methods.
6366         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6367         member.
6368         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6369         of pointed function as in a R_ARM_PREL31 relocation.
6370         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6371         for output local symbol count updating.
6372         (Target_arm::do_relax): Update output local symbol counts in objects
6373         if necessary.
6374         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6375
6376 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6377
6378         * arm.cc: Added support for the ARM relocations:
6379         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6380         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6381         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6382         movw_prel_nc).
6383         (Arm_relocate_functions::movw_rel): New method.
6384         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6385         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6386         thm_movw_prel_nc).
6387         (Arm_relocate_functions::thm_movw_rel): New method.
6388         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6389         thm_movt_prel).
6390         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6391         relocations.
6392         (Target_arm::Scan::global): Likewise.
6393         (Target_arm::Relocate::relocate): Likewise.
6394         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6395         Likewise.
6396
6397 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6398
6399         * arm.cc: Added support for ARM group relocations.
6400         (Target_arm::reloc_needs_sym_origin): New method.
6401         (Arm_relocate_functions::calc_grp_kn): New method.
6402         (Arm_relocate_functions::calc_grp_residual): New method.
6403         (Arm_relocate_functions::calc_grp_gn): New method.
6404         (Arm_relocate_functions::arm_grp_alu): New Method.
6405         (Arm_relocate_functions::arm_grp_ldr): New Method.
6406         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6407         (Arm_relocate_functions::arm_grp_ldc): New Method.
6408         (Target_arm::Scan::local): Handle the ARM group relocations.
6409         (Target_arm::Scan::global): Likewise.
6410         (Target_arm::Relocate::relocate): Likewise.
6411         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6412         Likewise.
6413
6414 2010-01-26  Doug Kwan  <dougkwan@google.com>
6415
6416         * arm.cc (set): Include.
6417         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6418         pointer type.
6419         (Arm_output_section::Text_section_list): New type.
6420         (Arm_output_section::append_text_sections_to_list): New method.
6421         (Arm_output_section::fix_exidx_coverage): Ditto.
6422         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6423         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6424         Relobj::set_section_offset() instead of
6425         Sized_relobj::invalidate_section_offset().
6426         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6427         parameter for section headers. Ignore relocation sections for
6428         unallocated sections and EXIDX sections.
6429         (Target_arm::fix_exidx_coverage): New method.
6430         (Target_arm::output_section_address_less_than): New type.
6431         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6432         linked text section instead of the EXIDX section.
6433         (Arm_output_section::create_stub_group): Add an assertion to check
6434         that this is not an EXIDX output section.
6435         (Arm_output_section::append_text_sections_to_list): New method.
6436         (Arm_output_section::fix_exidx_coverage): Ditto.
6437         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6438         Arm_relobj::section_needs_reloc_stub_scanning.
6439         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6440         first pass.
6441         (Target_arm::fix_exidx_coverage): New method.
6442         * object.h (Relobj::set_output_section): New method.
6443         (Sized_relobj::invalidate_section_offset): Remove method.
6444         (Sized_relobj::do_invalidate_section_offset): Remove method.
6445         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6446
6447 2010-01-25  Doug Kwan  <dougkwan@google.com>
6448
6449         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6450         Fix warning due to signed and unsigned comparison on a 32-bit host.
6451
6452 2010-01-22  Doug Kwan  <dougkwan@google.com>
6453
6454         * arm.cc (Target_arm::do_relax): Record an output section for section
6455         offset adjustment it contains any stub table that has changed.
6456         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6457         offsets in an output section if necessary.
6458         * output.cc (Output_section::Output_section): Initialize
6459         section_offsets_need_adjustments_.
6460         (Output_section::add_input_section_for_script): Renamed to
6461         Output_section::add_simple_input_section.
6462         (Output_section::save_states): Add a comment.
6463         (Output_section::discard_states): New method defintion.
6464         (Output_section::adjust_section_offsets): Same.
6465         * output.h (Output_section::add_input_section_for_script): Renamed to
6466         Output_section::add_simple_input_section.
6467         (Output_section::discard_states): New method declaration.
6468         (Output_section::adjust_section_offsets): Same.
6469         (Output_section::section_offsets_need_adjustment,
6470         Output_section::set_section_offsets_need_adjustment): New method
6471         definitions.
6472         (Output_section::section_offsets_need_adjustment_): New data member.
6473         * script-sections.cc
6474         (Output_section_element_input::set_section_address): Adjust code for
6475         renaming of Output_section::add_input_section_for_script.
6476         (Orphan_output_section::set_section_address): Same.
6477
6478 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6479
6480         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6481         Fix_v4bx enum values .
6482         * gold/options.h (General_options): New option definitions.
6483         (General_options::fix_v4bx): New method.
6484         (General_options::Fix_v4bx): New enum.
6485         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6486         (General_options::parse_fix_v4bx_interworking): New method.
6487
6488 2010-01-22  Doug Kwan  <dougkwan@google.com>
6489
6490         * arm.cc (Arm_exidx_fixup): New class.
6491
6492 2010-01-21  Doug Kwan  <dougkwan@google.com>
6493
6494         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6495         classes.
6496         (Arm_exidx_section_offset_map): New type.
6497
6498 2010-01-21  Doug Kwan  <dougkwan@google.com>
6499
6500         * arm.cc (Arm_exidx_input_section): New class.
6501         (Arm_relobj::exidx_input_section_by_link,
6502         Arm_relobj::exidx_input_section_by_shndx,
6503         Arm_relobj::make_exidx_input_section): New methods.
6504         (read_arm_attributes_section): Remove.
6505         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6506         information about them.
6507         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6508         to here.
6509
6510 2010-01-20  Doug Kwan  <dougkwan@google.com>
6511
6512         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6513         Input_section_specifier to Section_id.
6514         (Target_arm::new_arm_input_section: Adjust code for change of key
6515         type.
6516         (Target_arm::find_arm_input_section): Ditto.
6517         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6518         (Section_id): Remove.
6519         (Garbage_collection::Section_id_hash): Remove.
6520         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6521         (Section_id): Remove.
6522         (Icf::Section_id_hash): Remove.
6523         * object.h (Section_id, Const_section_id, Section_id_hash,
6524         Const_section_id_hash): New type definitions.
6525         * output.cc (Output_section::add_relaxed_input_section): Change to
6526         use Const_section_id instead of Input_section_specifier as key type.
6527         (Output_section::add_merge_input_section): Ditto.
6528         (Output_section::build_relaxation_map): Change to use Section_id
6529         instead of Input_section_specifier as key type.
6530         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6531         Ditto.
6532         (Output_section::convert_input_sections_to_relaxed_sections): Change
6533         to use Const_section_id instead of Input_section_specifier as key type.
6534         (Output_section::find_merge_section): Ditto.
6535         (Output_section::find_relaxed_input_section): Ditto.
6536         * output.h (Input_section_specifier): Remove class.
6537         (Output_section::Output_section_data_by_input_section_map): Change
6538         key type to Const_section_id.
6539         (Output_section::Output_relaxed_input_section_by_input_section_map):
6540         Ditto.
6541         (Output_section::Relaxation_map): Change key type to Section_id.
6542
6543 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6544
6545         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6546         (class Arm_v4bx_stub): New class.
6547         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6548         (Stub_factory::make_arm_v4bx_stub): New method.
6549         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6550         (Stub_table::empty): Handle v4bx stubs.
6551         (Stub_table::add_arm_v4bx_stub): New method.
6552         (Stub_table::find_arm_v4bx_stub): New method.
6553         (Arm_relocate_functions::v4bx): New method.
6554         (Target_arm::fix_v4bx): New method.
6555         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6556         (Stub_table::relocate_stubs): Likewise.
6557         (Stub_table::do_write): Likewise.
6558         (Stub_table::update_data_size_and_addralign): Likewise.
6559         (Stub_table::finalize_stubs):  Likewise.
6560         (Target_arm::Scan::local): Likewise.
6561         (Target_arm::Scan::global): Likewise.
6562         (Target_arm::do_finalize_sections): Likewise.
6563         (Target_arm::Relocate::relocate): Likewise.
6564         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6565         Likewise.
6566         (Target_arm::scan_reloc_for_stub): Likewise.
6567         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6568
6569 2010-01-19  Ian Lance Taylor  <iant@google.com>
6570
6571         * output.cc (Output_section_headers::do_sized_write): Write large
6572         segment count to sh_info field.
6573         (Output_file_header::do_sized_write): For large segment count,
6574         write PN_XNUM to e_phnum field.
6575
6576 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6577
6578         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6579         (Arm_relocate_functions::thm_jump8): New function.
6580         (Arm_relocate_functions::thm_jump11): New function.
6581         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6582         R_ARM_THM_JUMP11.
6583         (Target_arm::Scan::global): Likewise.
6584         (Target_arm::Relocate::relocate): Likewise.
6585         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6586         Likewise.
6587
6588 2010-01-14  Doug Kwan  <dougkwan@google.com>
6589
6590         * arm.cc (map, utility): Include headers.
6591         (Target_arm::apply_cortex_a8_workaround): New method.
6592         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6593         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6594         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6595         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6596         the --[no-]fix-cortex-a8 command line options.
6597         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6598         (Target_arm::relocate_stub): Use addend in instruction template.
6599         * options.h (DEFINE_bool): Set the user-set flag.
6600         (General_options): Add --[no-]-fix-cortex options.
6601         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6602         : Update fast look-up map after conversion.
6603
6604 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6605
6606         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6607         in the first pass of do_layout.
6608
6609 2010-01-13  Doug Kwan  <dougkwan@google.com>
6610
6611         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6612         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6613         apparent compiler problem of not folding static constant integral
6614         data members of elfcpp::Elf_sizes<32>.
6615
6616 2010-01-13  Doug Kwan  <dougkwan@google.com>
6617
6618         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6619         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6620         Arm_relobj::scan_section_for_cortex_a8_erratum,
6621         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6622         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6623         sections to scan for relocation stubs into a new method
6624         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6625         relocation and Cortex-A8 stub scanning.
6626         (Target_arm::do_relax): Force stubs to be after stubbed sections
6627         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6628         the beginning of a new relaxation pass.  Update a comment.
6629         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6630
6631 2010-01-12  Ian Lance Taylor  <iant@google.com>
6632
6633         * target-reloc.h (visibility_error): New inline function.
6634         (relocate_section): Call visibility_error.
6635         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6636         (MOSTLYCLEANFILES): Likewise.
6637         (protected_4_pic.o, protected_3.err): New targets.
6638         * testsuite/protected_4.cc: New file.
6639
6640 2010-01-12  Doug Kwan  <dougkwan@google.com>
6641
6642         * arm.cc (Cortex_a8_reloc): New class.
6643         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6644         and cortex_a8_relocs_info_.
6645         (Target_arm::fix_cortex_a8): New method definition.
6646         (Target_arm::Cortex_a8_relocs_info): New type.
6647         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6648         New data member declarations.
6649         (Target_arm::scan_reloc_for_stub): Record information about
6650         relocations for THUMB branches that might be exempted from the
6651         Cortex-A8 workaround.
6652         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6653         at the beginning of a relaxation pass.
6654
6655 2010-01-12  Doug Kwan  <dougkwan@google.com>
6656
6657         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6658         (Arm_relobj::Mapping_symbol_position,
6659          Arm_reloj::Mapping_symbol_position_less,
6660          Arm_relobj::Mapping_symbols_info): New types.
6661         (Target_arm::is_mapping_symbol_name): New method definition.
6662         (Arm_relobj::do_count_local_symbols): Save information about mapping
6663         symbols.
6664
6665 2010-01-11  Doug Kwan  <dougkwan@google.com>
6666
6667         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6668         Arm_relocate_functions::thumb32_branch_upper,
6669         Arm_relocate_functions::thumb32_branch_lower,
6670         Arm_relocate_functions::thumb32_cond_branch_offset,
6671         Arm_relocate_functions::thumb32_cond_branch_upper,
6672         Arm_relocate_functions::thumb32_cond_branch_lower,
6673         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6674         branch offset encoding.
6675         (Arm_relocate_functions::thumb_branch_common): Use new branch
6676         offset encoding methods to avoid code duplication.
6677         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6678         (Stub_addend_reader::operator()): Use new branch encoding method
6679         to avoid code duplication.
6680
6681 2010-01-11  Doug Kwan  <dougkwan@google.com>
6682
6683         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6684         (Target_arm::do_finalize_sections): Define special EXIDX section
6685         symbols only if referenced.
6686         * gc.h (Garbage_collection::add_reference): New method.
6687         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6688         code duplication.
6689
6690 2010-01-11  Ian Lance Taylor  <iant@google.com>
6691
6692         * script.cc (Version_script_info::build_expression_list_lookup):
6693         Change complaing about duplicate wildcard match from error to
6694         warning.
6695
6696         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6697         of 2009-12-30.
6698         (Version_script_info::Version_script_info): Initialize globs_,
6699         default_version_, default_is_global_, and exact_.  Don't
6700         initialize globals_ or locals_.
6701         (Version_script_info::build_lookup_tables): Build local symbols
6702         first.
6703         (Version_script_info::unquote): New function.
6704         (Version_script_info::add_exact_match): New function.
6705         (Version_script_info::build_expression_list_lookup): Remove lookup
6706         parameter.  Add is_global parameter.  Change all callers.  Handle
6707         wildcard pattern specially.  Unquote pattern.  Call
6708         add_exact_match.
6709         (Version_script_info::get_name_to_match): New function.
6710         (Version_script_info::get_symbol_version): New function.
6711         (Version_script_info::get_symbol_version_helper): Remove.
6712         (Version_script_info::check_unmatched_names): Call unquote.
6713         * script.h (class Version_script_info): Change get_symbol_version
6714         to be non-inline and add is_global parameter; change all callers.
6715         Rewrite symbol_is_local.  Update declarations.  Define struct
6716         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6717         Remove globals_ and locals_ members.  Add exact_, globs_,
6718         default_version_, is_global_.
6719         (Version_script_info::Glob): Remove pattern, add expression and
6720         is_global.  Update constructor.  Change all callers.
6721         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6722         default version.
6723         (Versions::symbol_section_contents): If a symbol is undefined, or
6724         defined in a dynamic object, set the version index to
6725         VER_NDX_LOCAL.
6726         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6727         symbol_is_local.
6728         (Symbol_table::add_from_pluginobj): Likewise.
6729         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6730
6731 2010-01-11  Doug Kwan  <dougkwan@google.com>
6732
6733         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6734         (incremental_dump_LDADD): Add linking option for libintl.
6735         * Makefile.in: Regenerate.
6736
6737 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6738
6739         PR gold/11144
6740         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6741         instead of -Ds.
6742         * testsuite/Makefile.in: Regenerated.
6743
6744 2010-01-10  Doug Kwan  <dougkwan@google.com>
6745
6746         * options.h (DEFINE_var): Use parentheses around argument varname__
6747         in macro body to avoid any unintended subsequent substitutions.
6748
6749 2010-01-10  Ian Lance Taylor  <iant@google.com>
6750
6751         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6752         candidates before doing symbol resolution.
6753
6754         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6755         ODR candidates if only one is weak.
6756
6757 2010-01-08  Ian Lance Taylor  <iant@google.com>
6758
6759         * script.cc (Version_script_info::build_expression_list_lookup):
6760         Don't warn about ambiguous version, just record the ambiguity.
6761         (Version_script_info::get_symbol_version_helper): Give error if
6762         version is ambiguous.
6763
6764 2010-01-08  Doug Kwan  <dougkwan@google.com>
6765
6766         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6767           prev_data_size_ and prev_addralign_.  Remove initializer for
6768           deleted data member has_been_changed_.
6769           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6770           to determine if the table is empty.
6771           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6772           Remove.
6773           (Stub_table::add_reloc_stub): Define method in class definition
6774           instead of just declaring it there.
6775           (Stub_table::add_cortex_a8_stub): New method definition.
6776           (Stub_table::update_data_size_and_addralign): Ditto.
6777           (Stub_table::finalize_stubs): Ditto.
6778           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6779           (Stub_table::do_addralign_): Return address alignment in the
6780           (Stub_table::do_reset_address_and_file_offset): Define method in
6781           class definition instead of declaring it there.  Set current data
6782           size to be the data size of the previous pass.
6783           (Stub_table::set_final_data_size): Use current data size as the
6784           final data size.
6785           (Stub_table::relocate_stub): Change parameter type of stub from
6786           Reloc_stub pointer to Stub pointer.
6787           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6788           (Stub_table::Cortex_a8_stub_list): New typedef.
6789           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6790            Stub_table::prev_addralign_): New data member.
6791           (Arm_relobj::Arm_relobj): Initialize data member
6792           section_has_cortex_a8_workaround_.
6793           (Arm_relobj::section_has_cortex_a8_workaround,
6794            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6795            definitions.
6796           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6797           declarations.
6798           (Target_arm::relocate_stub): Change parameter type of stub from
6799           Reloc_stub pointer to Stub pointer.
6800           (Insn_template::size, Insn_template::alignment): Handle
6801           THUMB16_SPECIAL_TYPE.
6802           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6803            Stub_table::update_data_size_and_addralign,
6804            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6805           definitions.
6806           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6807           (Stub_table::do_write): Ditto.
6808           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6809
6810 2010-01-08  Ian Lance Taylor  <iant@google.com>
6811
6812         PR 11108
6813         * symtab.h (class Symbol): Remove fields is_target_special_ and
6814         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6815         (Symbol::is_defined_in_discarded_section): New function.
6816         (Symbol::set_is_defined_in_discarded_section): New function.
6817         (Symbol::has_plt_offset): Rewrite.
6818         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6819         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6820         Don't initialize is_target_special_ or has_plt_offset_.
6821         Initialize is_defined_in_discarded_section_.
6822         (Symbol_table::add_from_relobj): If appropriate, set
6823         is_defined_in_discarded_section.
6824         * resolve.cc (Symbol::override_base_with_special): Don't test
6825         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6826         * target-reloc.h (relocate_section): Do special handling for
6827         symbols defined in discarded sections for global symbols as well
6828         as local symbols.
6829
6830 2010-01-08  Ian Lance Taylor  <iant@google.com>
6831
6832         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6833         the SHT_SYMTAB case.
6834
6835 2010-01-08  Ian Lance Taylor  <iant@google.com>
6836
6837         * object.cc (Sized_relobj::do_layout): Don't get confused if
6838         layout_eh_frame returns NULL.
6839
6840 2010-01-08  Ian Lance Taylor  <iant@google.com>
6841
6842         PR 11084
6843         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6844         dynamic symbol table, use the normal symbol table.
6845         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6846         symbol table.
6847
6848 2010-01-08  Ian Lance Taylor  <iant@google.com>
6849
6850         PR 11072
6851         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6852         sections.
6853
6854 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6855
6856         * version.cc (print_version): Change to "Copyright 2010".
6857
6858 2010-01-08  Ian Lance Taylor  <iant@google.com>
6859
6860         PR 10287
6861         PR 11063
6862         * i386.cc (class Target_i386): Change return type of plt_section
6863         to be non-const.
6864         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6865         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6866         tls_desc_rel_ field.
6867         (Output_data_plt_i386::rel_tls_desc): New function.
6868         (Target_i386::rel_tls_desc_section): New function.
6869         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6870         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6871         R_386_TLS_DESC reloc in rel_tls_desc_section.
6872         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6873         Define struct Tlsdesc_info.
6874         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6875         (Target_x86_64::do_reloc_symbol_index): New function.
6876         (Target_x86_64::add_tlsdesc_info): New function.
6877         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6878         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6879         tlsdesc_rel_ field.
6880         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6881         all callers.
6882         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6883         (Target_x86_64::rela_tlsdesc_section): New function.
6884         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6885         handling.
6886         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6887         (Target_x86_64::do_reloc_addend): New function.
6888         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6889         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6890         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6891         (Output_reloc::type): New function.
6892         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6893         (Output_reloc::is_target_specific): New function.
6894         (Output_reloc::target_arg): New function.
6895         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6896         absolute relocs and target specific relocs.
6897         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6898         add_target_specific.
6899         (class Output_data_reloc) [SHT_RELA]: Likewise.
6900         * output.cc (Output_reloc::Output_reloc): Add four new versions
6901         for absolute relocs and target specific relocs.
6902         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6903         (Output_reloc::get_symbol_index): Likewise.
6904         (Output_reloc::local_section_offset): Check that local_sym_index_
6905         is not TARGET_CODE or 0.
6906         (Output_reloc::symbol_value): Likewise.
6907         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6908         reloc.
6909         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6910         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6911         functions.
6912         * layout.cc (add_target_dynamic_tags): Use output section for
6913         DT_PLTRELSZ and DT_JMPREL.
6914
6915 2010-01-07  Ian Lance Taylor  <iant@google.com>
6916
6917         PR 11061
6918         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6919         function.
6920         (class Output_data_reloc_generic): Define.
6921         (class Output_data_reloc_base): Change base class to
6922         Output_data_reloc_generic.  Change add() method to call
6923         bump_relative_reloc_count for a relative reloc.  Remove
6924         sort_relocs_ field.
6925         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6926         to sort_relocs().
6927         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6928         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6929         appropriate.
6930         * layout.h (class Layout): Update declaration.
6931
6932 2010-01-07  Ian Lance Taylor  <iant@google.com>
6933
6934         * output.h (class Output_data): Add const version of
6935         output_section and do_output_section.
6936         (class Output_section_data): Add const version of
6937         do_output_section.
6938         (class Output_section): Likewise.
6939         * layout.cc (Layout::add_target_dynamic_tags): New function.
6940         * layout.h (class Layout): Update declarations.
6941         * arm.cc (Target_arm::do_finalize_sections): Use
6942         add_target_dynamic_tags.
6943         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6944         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6945         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6946         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6947
6948 2010-01-07  Ian Lance Taylor  <iant@google.com>
6949
6950         PR 11042
6951         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6952         object as needed.
6953
6954 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6955             Ian Lance Taylor  <iant@google.com>
6956
6957         PR 11019
6958         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6959         Xindex::read_symtab_xindex.
6960
6961 2010-01-07  Doug Kwan  <dougkwan@google.com>
6962
6963         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6964         (Insn_template::thumb16_bcond_insn): New method declaration.
6965         (Insn_template): Fix spelling.
6966         (Stub::thumb16_special): New method declaration.
6967         (Stub::do_write): Define virtual method which was previously pure
6968         virtual.
6969         (Stub::do_thumb16_special): New method declaration.
6970         (Stub::do_fixed_endian_write): New template member.
6971         (Reloc_stub::do_write): Remove.
6972         (Reloc_stub::do_fixed_endian_write): Remove.
6973         (Cortex_a8_stub): New class definition.
6974         (Stub_factory::make_cortex_a8_stub): New method definition.
6975         (Stub_factory::Stub_factory): Add missing static storage class
6976         qualifier for elf32_arm_stub_a8_veneer_blx.
6977
6978 2010-01-07  Ian Lance Taylor  <iant@google.com>
6979
6980         PR 10980
6981         * options.h (class General_options): Add --warn-unresolved-symbols
6982         and --error-unresolved-symbols.
6983         * errors.cc (Errors::undefined_symbol): Implement
6984         --warn-unresolved-symbols.
6985
6986         * options.h (class General_options): Add -z text and -z textoff.
6987         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6988
6989 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6990
6991         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6992         (Garbage_collection::cident_sections): New function.
6993         (Garbage_collection::add_cident_section): New function.
6994         (Garbage_collection::cident_sections_): New member.
6995         (gc_process_relocs): Add references to sections whose names are C
6996         identifiers.
6997         * gold.h (cident_section_start_prefix): New constant.
6998         (cident_section_stop_prefix): New constant.
6999         (is_cident): New function.
7000         * layout.cc (Layout::define_section_symbols): Replace string constants
7001         with the newly defined constants.
7002         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7003         C identifiers.
7004         * testsuite/Makefile.am: Add gc_orphan_section_test.
7005         * testsuite/Makefile.in: Regenerate.
7006         * testsuite/gc_orphan_section_test.cc: New file.
7007         * testsuite/gc_orphan_section_test.sh: New file.
7008
7009 2010-01-06  Ian Lance Taylor  <iant@google.com>
7010
7011         PR 10980
7012         * options.h (class General_options): Add --warn-shared-textrel.
7013         * layout.cc (Layout::finish_dynamic_section): Implement
7014         --warn-shared-textrel.
7015
7016         PR 10980
7017         * options.h (class General_options): Add --warn-multiple-gp.
7018
7019 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7020
7021         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7022         $(THREADSLIB) and $(LIBDL).
7023         * Makefile.in: Rebuild.
7024
7025 2010-01-06  Ian Lance Taylor  <iant@google.com>
7026
7027         PR 10980
7028         * options.cc (General_options::parse_section_start): New function.
7029         (General_options::section_start): New function.
7030         (General_options::General_options): Initialize all members.
7031         * options.h: Include <map>
7032         (class General_options): Add --section-start.  Add section_starts_
7033         member.
7034         * layout.cc (Layout::attach_allocated_section_to_segment): If
7035         --section-start was used, set the address of the segment.  Remove
7036         local sort_sections.
7037         (Layout::relaxation_loop_body): If the address of the load segment
7038         has been set by --section-start, don't use it.
7039         * output.h (Output_segment::update_flags_for_output_section): New
7040         function.
7041         * output.cc (Output_segment::add_output_section): Call
7042         update_flags_for_output_section.
7043
7044 2010-01-05  Ian Lance Taylor  <iant@google.com>
7045
7046         PR 10980
7047         * options.h (class General_options): Add --undefined-version.
7048         * script.cc (struct Version_expression): Add was_matched_by_symbol
7049         field.
7050         (Version_script_info::matched_symbol): New function.
7051         (Version_script_info::get_symbol_version_helper): Call
7052         matched_symbol.
7053         (Version_script_info::check_unmatched_names): New function.
7054         * script.h (class Version_script_info): Update declarations.
7055         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7056
7057         * options.h (class General_options): Use DEFINE_bool_alias for
7058         allow_multiple_definition.
7059         * resolve.cc (Symbol_table::should_override): Don't test
7060         allow_multiple_definition.
7061
7062         PR 10980
7063         * options.h (class General_options): Add --cref.
7064         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7065         until after printing cref table.
7066         * cref.cc: Include "symtab.h".
7067         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7068         (Cref_table_compare::operator()): New function.
7069         (Cref_inputs::gather_cref): New function.
7070         (filecol): New static const.
7071         (Cref_inputs::print_cref): New function.
7072         (Cref::print_cref): New function.
7073         * cref.h: Include <cstdio>.
7074         (class Cref): Update declarations.
7075         * mapfile.h (Mapfile::file): New function.
7076         * object.h (class Object): Define Symbols.  Declare virtual
7077         do_get_global_symbols.
7078         (Object::get_global_symbols): New function.
7079         * object.cc (Input_objects::add_object): Pass object to cref_ if
7080         --cref.
7081         (Input_objects::archive_start): Likewise.
7082         (Input_objects::archive_stop): Likewise.
7083         (Input_objects::print_cref): New function.
7084         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7085         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7086         --cref.
7087         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7088         function.
7089         * plugin.h (class Sized_pluginobj): Update declarations.
7090
7091 2010-01-05  Ian Lance Taylor  <iant@google.com>
7092
7093         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7094         to is_default_version.  Rename insdef to insdefault.
7095         (Symbol_table::add_from_relobj): Rename def to is_default_version
7096         and local to is_forced_local.
7097         (Symbol_table::add_from_pluginobj): Likewise.
7098         (Symbol_table::add_from_dynobj): Likewise.
7099         (Symbol_table::define_special_symbol): Rename insdef to
7100         insdefault.
7101
7102 2010-01-04  Ian Lance Taylor  <iant@google.com>
7103
7104         PR 10980
7105         * options.h (class General_options): Add
7106         --allow-multiple-definition and -z muldefs.
7107         * resolve.cc (Symbol_table::should_override): Don't warn about a
7108         multiple symbol definition if --allow-multiple-definition or -z
7109         muldefs.
7110
7111         PR 10980
7112         * options.h (class General_options): Add --add-needed and
7113         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7114         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7115         error if --copy-dt-needed-entries aka --add-needed is used and
7116         would cause a change in behaviour.
7117
7118         PR 10980
7119         * options.h (class General_options): Add -G as a short version of
7120         --shared.  Add no-op options -assert, -g, and -i.
7121
7122 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7123
7124         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7125         check for .text or .gnu.linkonce.t sections.
7126         * icf.cc (Icf::find_identical_sections): Ditto.
7127         Change the detection for mangled function name within the section
7128         name.
7129         * icf.h (is_section_foldable_candidate): New function.
7130
7131 2009-12-30  Ian Lance Taylor  <iant@google.com>
7132
7133         PR 10980
7134         * options.h (class General_options): Permit two dashes with
7135         --retain-symbols-file.
7136
7137 2009-12-30  Ian Lance Taylor  <iant@google.com>
7138
7139         PR 10979
7140         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7141         don't put the file header and segment headers in the text
7142         segment.
7143
7144         PR 10979
7145         * common.cc (Sort_commons::operator()): Stabilize sort when both
7146         entries are NULL.
7147         (Symbol_table::do_allocate_commons_list): When allocating common
7148         symbols, skip a symbol which is no longer common.
7149         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7150         an object before checking its type.
7151         * testsuite/common_test_2.c: New file.
7152         * testsuite/common_test_3.c: New file.
7153         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7154         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7155         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7156         (common_test_2_pic.o, common_test_2.so): New targets.
7157         (common_test_3_pic.o, common_test_3.so): New targets.
7158         * testsuite/Makefile.in: Rebuild.
7159
7160         PR 10979
7161         * script.cc (read_input_script): If we see a new SECTIONS clause,
7162         and we have added an input section, give an error.
7163         * layout.h (class Layout): Add have_added_input_section function.
7164         Add have_added_input_section_ field.
7165         * layout.cc (Layout::Layout): Initialize
7166         have_added_input_section_.
7167         (Layout::layout): Set have_added_input_section_.
7168         (Layout::layout_eh_frame): Likewise.
7169
7170 2009-12-30  Ian Lance Taylor  <iant@google.com>
7171
7172         PR 10931
7173         * options.h (class General_options): Add --sort-common option.
7174         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7175         * common.cc (Sort_common): Add sort_order parameter to
7176         constructor.  Add sort_order_ field.
7177         (Sort_commons::operator): Check sort_order_.
7178         (Symbol_table::allocate_commons): Determine the sort order.
7179         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7180         Change all callers.
7181         (Symbol_table::do_allocate_commons_list): Likewise.
7182
7183 2009-12-30  Ian Lance Taylor  <iant@google.com>
7184
7185         PR 10916
7186         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7187         symbols from this object, don't change the visibility of an
7188         undefined symbol.
7189         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7190
7191 2009-12-30  Ian Lance Taylor  <iant@google.com>
7192
7193         PR 10861
7194         * script.h (class Version_script_info): Define Language enum.
7195         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7196         new fields globals_, locals_, and is_finalized_.
7197         * script.cc: Various formatting fixes.
7198         (class Parser_closure): Change language_stack_ from a vector of
7199         std::string to one of Version_script_info::Language.  Adjust all
7200         uses accordingly.
7201         (class Lazy_demangler): Remove.
7202         (struct Version_expression): Change language from std::string to
7203         Version_script_info::Language.
7204         (Version_script_info::Version_script_info): New function.
7205         (Version_script_info::~Version_script_info): Don't call clear.
7206         (Version_script_info::finalize): New function.
7207         (Version_script_info::build_lookup_tables): New function.
7208         (Version_script_info::build_expression_list_lookup): New
7209         function.
7210         (Version_script_info::get_symbol_version_helper): Rewrite to use
7211         lookup tables.
7212         (Version_script_info::print_expression_list): Adjust to use
7213         Version_script_info::Language.
7214         (script_push_lex_into_version_mode): Check that the version script
7215         has not been finalized.
7216         (version_script_push_lang): Change language string to
7217         Version_script_info::Language.
7218         * options.cc (Command_line::version_script): New function.
7219         * options.h (class General_options): Add finalize_dynamic_list
7220         function.  Change version_script from declaration to definition.
7221         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7222         * testsuite/version_script.map: Remove duplicate def of foo.
7223         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7224         version_script.map.
7225         * testsuite/Makefile.in: Rebuild.
7226
7227 2009-12-30  Ian Lance Taylor  <iant@google.com>
7228
7229         PR 10843
7230         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7231         if the input symbol index is 0, make the output symbol index 0.
7232
7233 2009-12-30  Ian Lance Taylor  <iant@google.com>
7234
7235         PR 10670
7236         * options.h (class General_options): Add -x/--discard-all.
7237         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7238         --discard-all.  If the local symbol needs a dynamic entry, check
7239         that before handling --discard-locals.
7240
7241 2009-12-30  Ian Lance Taylor  <iant@google.com>
7242
7243         PR 10450
7244         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7245         flags to PF_R.
7246         (Output_segment::add_output_section): Don't change the flags if
7247         the type is PT_TLS.
7248
7249         PR 10450
7250         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7251         GNU hash table if they need a dynamic value.  Otherwise, don't add
7252         them if they are defined in a dynamic object or are forced local.
7253
7254 2009-12-29  Ian Lance Taylor  <iant@google.com>
7255
7256         PR 10450
7257         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7258         .gnu.hash table for a 32-bit target.
7259
7260         PR 10450
7261         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7262         regular and a dynamic object only needs a dynamic symbol table
7263         entry if it is externally visible.
7264
7265         PR 10450
7266         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7267         constructor.  Add global_offset_table_ field.
7268         (Target_i386::got_section): Set global_offset_table_.
7269         (Target_i386::do_finalize_sections): Set global_offset_table_
7270         size.
7271         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7272         in constructor.  Add global_offset_table_ field.
7273         (Target_x86_64::got_section): Set global_offset_table_.
7274         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7275         size.
7276
7277         * layout.cc (Layout::Layout): Initialize increase_relro_.
7278         (Layout::get_output_section): Add is_relro, is_last_relro, and
7279         is_first_non_relro parameters.  Change all callers.
7280         (Layout::choose_output_section): Likewise.
7281         (Layout::add_output_section_data): Likewise.
7282         (Layout::make_output_section): Likewise.
7283         (Layout::set_segment_offsets): Clear increase_relro when using a
7284         linker script.
7285         * layout.h (class Layout): Add increase_relro method.  Add
7286         increase_relro_ field.  Update declarations.
7287         * output.cc (Output_section::Output_section): Initialize
7288         is_last_relro_ and is_first_non_relro_.
7289         (Output_segment::add_output_section): Group relro sections is
7290         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7291         (Output_segment::maximum_alignment): Remove relro handling.
7292         (Output_segment::set_section_addresses): Add increase_relro
7293         parameter.  Change all callers.  Add initial alignment to align
7294         relro sections on separate page.  Remove old relro handling.
7295         (Output_segment::set_section_list_addresses): Remove in_relro
7296         parameter.  Change all callers.
7297         (Output_segment::set_offset): Add increase parameter.  Change all
7298         callers.  Remove old relro handling.
7299         * output.h (class Output_section): Add new methods: is_last_relro,
7300         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7301         Add is_last_relro_ and is_first_non_relro_ fields.
7302         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7303         Create separate .got.plt section.  Call increase_relro.
7304         * x86_64.cc (Target_x86_64::got_section): Likewise.
7305         * testsuite/relro_script_test.t: Add .got.plt.
7306
7307         PR 10450
7308         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7309         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7310         (Layout::finalize): Call set_dynamic_symbol_size.
7311         (Layout::set_dynamic_symbol_size): New function.
7312         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7313         set_dynamic_symbol_size.
7314
7315         PR 10450
7316         * output.h (class Output_section): Add is_entsize_zero_ field.
7317         * output.cc (Output_section::Output_section): Initialize
7318         is_entsize_zero_.
7319         (Output_section::set_entsize): If two different entsizes are
7320         requested, force it to zero.
7321         (Output_section::add_input_section): Set flags for .debug_str
7322         before updating section flags.  Set entsize.
7323         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7324         and SHF_STRING if all input sections have those flags.
7325
7326 2009-12-29   Rafael Espindola  <espindola@google.com>
7327
7328         * main.cc (main): Fix the sys time reporting.
7329         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7330         reporting.
7331
7332 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7333
7334         * options.cc (General_options::parse_version): Allow -v to exit
7335         without an error if there is nothing to link.
7336
7337 2009-12-29  Ian Lance Taylor  <iant@google.com>
7338
7339         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7340         using a version of gcc before 4.1.
7341         * configure: Rebuild.
7342
7343 2009-12-28  Chris Demetriou  <cgd@google.com>
7344
7345         * attributes.cc (Output_attributes_section_data::do_write): Use
7346         std::vector::front rather than std::vector::data.
7347
7348 2009-12-28  Ian Lance Taylor  <iant@google.com>
7349
7350         * symtab.h (class Symbol_table): Add enum Defined.
7351         * resolve.cc (Symbol_table::should_override): Add defined
7352         parameter.  Change all callers.  Test whether object is NULL
7353         before calling a method on it.
7354         (Symbol_table::report_resolve_problem): Add defined parameter.
7355         Change all callers.
7356         (Symbol_table::should_override_with_special): Likewise.
7357         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7358         parameter.  Change all callers.
7359         (Symbol_table::do_define_in_output_data): Likewise.
7360         (Symbol_table::define_in_output_segment): Likewise.
7361         (Symbol_table::do_define_in_output_segment): Likewise.
7362         (Symbol_table::define_as_constant): Likewise.
7363         (Symbol_table::do_define_as_constant): Likewise.
7364         * script.h (class Symbol_assignment): Add is_defsym parameter to
7365         constructor; change all callers.
7366         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7367         parameter.  Change all callers.  Add is_defsym_ field.
7368         (class Parser_closure): Add parsing_defsym parameter to
7369         constructor; change all callers.  Add parsing_defsym accessor
7370         function.  Add parsing_defsym_ field.
7371
7372 2009-12-28  Ian Lance Taylor  <iant@google.com>
7373
7374         * gold.cc (queue_middle_tasks): Fix formatting.
7375         * object.cc (Relobj::is_section_name_included): Likewise.
7376
7377 2009-12-23  Ian Lance Taylor  <iant@google.com>
7378
7379         * i386.cc (Target_i386::do_calls_non_split): Recognize
7380         -fsplit-stack prologue for a function with a static chain.
7381         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7382         -fsplit-stack prologue when using %r11.
7383
7384 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7385
7386         * options.cc (General_options::parse_version): Make -v continue and do
7387         the link like GNU ld does.
7388
7389 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7390
7391         * Makefile.am (CCFILES): Add timer.cc.
7392         (HFILES): Add timer.h.
7393         * configure.ac: Check for sysconf and times.
7394         * main.cc: include timer.h.
7395         (main): Use Timer instead of get_run_time.
7396         * timer.cc: New.
7397         * timer.h: New.
7398         * workqueue.cc: include timer.h.
7399         (Workqueue::find_and_run_task):
7400         Report user, sys and wall time.
7401         * Makefile.in: Regenerate.
7402         * config.in: Regenerate.
7403         * configure: Regenerate.
7404
7405 2009-12-16  Doug Kwan  <dougkwan@google.com>
7406
7407         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7408         sections.
7409         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7410         relaxed input sections.
7411         * output.cc (Output_section::find_relaxed_input_section): Change
7412         return type to Output_relaxed_input_section pointer.  Adjust code
7413         for new type of relaxed_input_section_map_.
7414         * output.h (Output_section::find_relaxed_input_section): Change
7415         return type to Output_relaxed_input_section pointer.
7416         (Output_section::Output_relaxed_input_section_by_input_section_map):
7417         New type.
7418         (Output_section::relaxed_input_section_map_): Change type to
7419         Output_section::Output_relaxed_input_section_by_input_section_map.
7420         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7421         input section.
7422
7423 2009-12-15  Ian Lance Taylor  <iant@google.com>
7424
7425         * layout.cc (Layout::create_shstrtab): Only write out after input
7426         sections if we are compressing debug sections.
7427
7428 2009-12-15  Ian Lance Taylor  <iant@google.com>
7429
7430         * archive.cc (Archive::add_symbols): Only look up a symbol without
7431         a version if there is, in fact, a version.
7432
7433 2009-12-14  Ian Lance Taylor  <iant@google.com>
7434
7435         Revert -Wshadow changes, all changes from:
7436         2009-12-11  Doug Kwan  <dougkwan@google.com>
7437         2009-12-11  Nick Clifton  <nickc@redhat.com>
7438         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7439
7440 2009-12-11  Doug Kwan  <dougkwan@google.com>
7441
7442         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7443         due to -Wshadow.
7444         * attributes.cc (Object_attribute::size): Ditto.
7445         (Attributes_section_data::size): Ditto.
7446         (Attributes_section_data::Attributes_section_data): Ditto.
7447         (Output_attributes_section_data::do_write): Ditto.
7448         * attributes.h (Object_attribute::set_type): Ditto.
7449         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7450
7451 2009-12-11  Nick Clifton  <nickc@redhat.com>
7452
7453         * archive.cc: Fix shadowed variable warnings.
7454         * arm.cc: Likewise.
7455         * compressed_output.cc: Likewise.
7456         * compressed_output.h: Likewise.
7457         * configure: Likewise.
7458         * dwarf_reader.cc: Likewise.
7459         * dynobj.cc: Likewise.
7460         * dynobj.h: Likewise.
7461         * ehframe.cc: Likewise.
7462         * ehframe.h: Likewise.
7463         * errors.cc: Likewise.
7464         * expression.cc: Likewise.
7465         * fileread.cc: Likewise.
7466         * fileread.h: Likewise.
7467         * freebsd.h: Likewise.
7468         * i386.cc: Likewise.
7469         * icf.cc: Likewise.
7470         * incremental.h: Likewise.
7471         * layout.cc: Likewise.
7472         * layout.h: Likewise.
7473         * mapfile.cc: Likewise.
7474         * merge.cc: Likewise.
7475         * merge.h: Likewise.
7476         * object.cc: Likewise.
7477         * object.h: Likewise.
7478         * options.h: Likewise.
7479         * output.cc: Likewise.
7480         * output.h: Likewise.
7481         * parameters.cc: Likewise.
7482         * plugin.cc: Likewise.
7483         * powerpc.cc: Likewise.
7484         * reduced_debug_output.cc: Likewise.
7485         * reduced_debug_output.h: Likewise.
7486         * reloc.cc: Likewise.
7487         * reloc.h: Likewise.
7488         * resolve.cc: Likewise.
7489         * script-sections.cc: Likewise.
7490         * script.cc: Likewise.
7491         * script.h: Likewise.
7492         * sparc.cc: Likewise.
7493         * symtab.cc: Likewise.
7494         * symtab.h: Likewise.
7495         * target-select.cc: Likewise.
7496         * target-select.h: Likewise.
7497         * token.h: Likewise.
7498         * workqueue.cc: Likewise.
7499         * workqueue.h: Likewise.
7500         * x86_64.cc: Likewise.
7501
7502 2009-12-10  Doug Kwan  <dougkwan@google.com>
7503
7504         * arm.cc (attributes.h): New include.
7505         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7506         (Arm_relobj::~Arm_relobj): Delete object pointed by
7507         attributes_section_data_.
7508         (Arm_relobj::attributes_section_data): New method definition.
7509         (Arm_relobj::attributes_section_data_): New data member declaration.
7510         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7511         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7512         attributes_section_data_.
7513         (Arm_dynobj::attributes_section_data): New method definition.
7514         (Arm_dynobj::attributes_section_data_): New data member declaration.
7515         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7516         initialization value of may_use_blx_ to false.
7517         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7518         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7519         object attributes to compute results instead of hard-coding.
7520         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7521         Target_arm::get_secondary_compatible_arch,
7522         Target_arm::set_secondary_compatible_arch
7523         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7524         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7525         New method declarations.
7526         (Target_arm::get_aeabi_object_attribute): New method definition.
7527         (Target_arm::attributes_section_data_): New data member declaration.
7528         (read_arm_attributes_section): New template definition.
7529         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7530         (Arm_dynobj::do_read_symbols): Ditto.
7531         (Target_arm::do_finalize_sections): Merge attributes sections from
7532         input.  Check for BLX use after attributes section merging.
7533         Fix __exidx_start and __exidx_end visibility.  Create an
7534         .ARM.attributes section if necessary.
7535         (Target_arm::get_secondary_compatible_arch,
7536         Target_arm::set_secondary_compatible_arch,
7537         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7538         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7539         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7540         New method definitions.
7541
7542 2009-12-09  Ian Lance Taylor  <iant@google.com>
7543
7544         * plugin.cc (Plugin::load): Don't cast from void* to a function
7545         pointer.
7546
7547 2009-12-09  Ian Lance Taylor  <iant@google.com>
7548
7549         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7550         information fields.
7551
7552 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7553
7554         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7555         Replace two_file_shared_1.so with two_file_shared_2.so.
7556         * testsuite/Makefile.in: Regenerated.
7557
7558 2009-12-08  Doug Kwan  <dougkwan@google.com>
7559
7560         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7561         (HFILES): Add attributes.h and int_encoding.h.
7562         * Makefile.in: Regenerate.
7563         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7564         function definitions to int_encoding.cc
7565         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7566         prototypes to int_encoding.h
7567         * reduced_debug_output.cc (int_encoding.h): New include.
7568         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7569         function definitions to int_encoding.cc
7570         (insert_into_vector, read_from_pointer): Move template definitions to
7571         int_encoding.h
7572         * attributes.cc: New file.
7573         * attributes.h: New file.
7574         * int_encoding.cc: New file.
7575         * int_encoding.h: New file.
7576
7577 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7578
7579         PR gold/11055
7580         * incremental-dump.cc (dump_incremental_inputs): New.
7581         (main): Use dump_incremental_inputs.
7582
7583 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7584
7585         PR gold/10893
7586         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7587         checking elfcpp::STT_FUNC.
7588         (Target_i386::Relocate::relocate): Likewise.
7589         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7590
7591         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7592         symbols from shared libraries into normal FUNC symbols.
7593
7594         * symtab.h (Symbol): Add is_func and use it.
7595
7596 2009-12-05  Doug Kwan  <dougkwan@google.com>
7597
7598         * arm.cc (Target_arm::arm_info): Initialize new fields
7599         attributes_section and attributes_vendor.
7600         * i386.cc (Target_i386::i386_info): Same.
7601         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7602         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7603         fields attributes_section and attributes_vendor.
7604         * sparc.cc (Target_sparc::sparc_info): Same.
7605         * target.h (Target::attributes_section, Target::attributes_vendor,
7606         Target::is_attributes_section, Target::attribute_arg_type,
7607         Target::attributes_order): New method definitions.
7608         (Target::Target_info::attributes_section,
7609         Target::Target_info::attributes_vendor): New fields.
7610         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7611         virtual method definitions.
7612         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7613         attributes_section and attributes_vendor.
7614         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7615
7616 2009-12-05  Doug Kwan  <dougkwan@google.com>
7617
7618         * arm.cc: Update comments about interworking and stub generation.
7619         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7620         considered as non-PIC.
7621         (Arm_relocate_functions::base_abs): Fix formatting.
7622         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7623         of function to use GOT entry address instead of offset.
7624         (Target_arm::Scan::global): Issue an error if a symbol would need a
7625         PLT does not get one because it is untyped.  Remove code to create
7626         dynamic symbols for relative branches.
7627         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7628         takes unsigned integer instead of boolean.
7629
7630 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7631
7632         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7633         (two_file_test_LDADD): Likewise.
7634         (common_test_1_LDADD): Likewise.
7635         (exception_test_LDADD) Likewise.
7636         (weak_test_LDADD): Likewise.
7637         (many_sections_test_LDADD): Likewise.
7638         (initpri1_LDADD): Likewise.
7639         (script_test_1_LDADD): Likewise.
7640         (script_test_2_LDADD): Likewise.
7641         (justsyms_LDADD): Likewise.
7642         (binary_test_LDADD): Likewise.
7643         (large_LDADD): Likewise.
7644         * testsuite/Makefile.in: Regenerated.
7645
7646 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7647
7648         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7649         (Symbol_table::override_with_special): Likewise.
7650         (Symbol_table::add_from_object): Likewise.
7651
7652 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7653
7654         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7655         Don't set the data_offset twice.
7656
7657 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7658
7659         * testsuite/Makefile.in: Regenerate.
7660
7661 2009-12-03  Doug Kwan  <dougkwan@google.com>
7662
7663         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7664         (Target_arm::do_finalize_sections): Add parameter for symbol table
7665         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7666         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7667         parameter for symbol table pointer.
7668         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7669         an additional parameter for a pointer to symbol table.
7670         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7671         parameter for a symbol table pointer.
7672         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7673         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7674         Ditto.
7675         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7676         parameter for a symbol table pointer.
7677
7678 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7679
7680         * incremental.cc (Incremental_inputs_header)
7681         (Incremental_inputs_header_write, Incremental_inputs_entry)
7682         (Incremental_inputs_entry_write): Move ...
7683         * incremental.h (Incremental_inputs_header)
7684         (Incremental_inputs_header_write, Incremental_inputs_entry)
7685         (Incremental_inputs_entry_write): here.
7686
7687 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7688
7689         * incremental.cc (make_sized_incremental_binary): Set the target.
7690         Error if it is incompatible.
7691         * output.h (Output_file): Add filename method.
7692
7693 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7694
7695         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7696         from the get_* methods.
7697
7698 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7699
7700         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7701         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7702         Write 0 for the data_offset of scripts.
7703
7704 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7705
7706         * testsuite/Makefile.am: Add the incremental_test.sh test.
7707         * testsuite/incremental_test.sh: New.
7708         * testsuite/incremental_test_1.c: New.
7709         * testsuite/incremental_test_2.c: New.
7710
7711 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7712
7713        * incremental-dump.cc (main): Fix typos.
7714
7715 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7716
7717         PR gold/11025
7718         * incremental-dump.cc (main): Use llu to print 64 bit values.
7719
7720 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7721             H.J. Lu  <hongjiu.lu@intel.com>
7722
7723         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7724         $(LIBDL).
7725         (incremental_dump_LDADD): Likewise.
7726         * Makefile.in: Regenerated.
7727
7728 2009-11-25  Doug Kwan  <dougkwan@google.com>
7729
7730         Revert:
7731
7732         2009-11-25  Doug Kwan  <dougkwan@google.com>
7733
7734                 * arm.cc (Target_arm::Target_arm): Move method definition
7735                 outside of class definition.  Add code to handle
7736                 --target1-rel, --target1-abs and --target2= options.
7737                 (Target_arm::get_reloc_reloc_type): Change method to be
7738                 non-static and const.
7739                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7740                 New data member declaration.
7741                 (Target_arm::Scan::local, Target_arm::Scan::global,
7742                 Target_arm::Relocate::relocate,
7743                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7744                 Adjust call to Target_arm::get_real_reloc_type.
7745                 (Target_arm::get_real_reloc_type): Use command line options
7746                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7747                 * options.h (--target1-rel, --target1-abs, --target2): New
7748                 ARM-only options.
7749
7750 2009-11-25  Doug Kwan  <dougkwan@google.com>
7751
7752         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7753         class definition.  Add code to handle --target1-rel, --target1-abs
7754         and --target2= options.
7755         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7756         and const.
7757         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7758         member declaration.
7759         (Target_arm::Scan::local, Target_arm::Scan::global,
7760         Target_arm::Relocate::relocate,
7761         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7762         call to Target_arm::get_real_reloc_type.
7763         (Target_arm::get_real_reloc_type): Use command line options to
7764         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7765         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7766         options.
7767
7768 2009-11-25  Doug Kwan  <dougkwan@google.com>
7769
7770         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7771         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7772         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7773         formatting.
7774         (Arm_relocate_functions::thm_call): Replace body with a call to
7775         Arm_relocate_functions::thumb_branch_common.
7776         (Arm_relocate_functions::thm_jump24,
7777         Arm_relocate_functions::thm_xpc22): New method definitions.
7778         (Arm_relocate_functions::thumb_branch_common): New method definition.
7779         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7780         operator.
7781         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7782         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7783
7784 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7785
7786         * Makefile.am: Build incremental-dump
7787         * Makefile.in: Regenerate.
7788         * incremental-dump.cc: New.
7789         * incremental.cc (Incremental_inputs_header_data,
7790         Incremental_inputs_entry_data): Move to incremental.h
7791         * incremental.h: (Incremental_inputs_header_data,
7792         Incremental_inputs_entry_data): Move from incremental.cc
7793
7794 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7795
7796         * incremental.cc (Incremental_inputs_header,
7797         Incremental_inputs_header_write, Incremental_inputs_entry,
7798         Incremental_inputs_entry_write): Add a typedef with the data type.
7799
7800 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7801
7802         * incremental.cc (Incremental_inputs_header,
7803         Incremental_inputs_header_write, Incremental_inputs_entry,
7804         Incremental_inputs_entry_write): Update comment about which
7805         type has the filed descriptions.
7806
7807 2009-11-15  Doug Kwan  <dougkwan@google.com>
7808
7809         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7810         (Arm_relocate_functions::arm_branch_common): Change method defintion
7811         in class definition to a method declaration and update list of formal
7812         parameters.
7813         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7814         Arm_relocation_functions::jump24): Adjust call to
7815         Arm_relocate_functions::arm_branch_common.  Update list of formal
7816         parameters.
7817         (Arm_relocate_functions::xpc25): New method definition.
7818         (Arm_relocate_functions::arm_branch_common): Move method defintion
7819         out from class definition.  Use stubs for mode-switching and extending
7820         branch ranges.
7821         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7822         specially.  Change code to enable use of stubs in ARM branches.
7823
7824 2009-11-10  Doug Kwan  <dougkwan@google.com>
7825
7826         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7827         in method declaration.
7828         (Target_arm::relocate_stub): New method declaration.
7829         (Target_arm::default_target): Change to return a pointer instead of
7830         a const reference.
7831         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7832         Target_arm::default_target.
7833         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7834         method definition.
7835         (Target_arm::relocate_section): Adjust view.
7836         (Target_arm::relocate_stub): New method definition.
7837
7838 2009-11-10  Doug Kwan  <dougkwan@google.com>
7839
7840         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7841         a format warning.
7842         * incremental.cc (open_incremental_binary): Initialized local
7843         variables to avoid warnings.
7844         * object.cc (make_elf_object): Ditto.
7845         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7846         a format warning.
7847
7848 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7849
7850         PR gold/10930
7851         * testsuite/plugin_test.c: Include "config.h".
7852
7853 2009-11-09  Doug Kwan  <dougkwan@google.com>
7854
7855         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7856         (arm_symbol_value): Remove.
7857         (Arm_relocate_functions::arm_branch_common,
7858         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7859         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7860         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7861         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7862         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7863         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7864         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7865         Arm_relocate_functions::thm_mobw_abs_nc,
7866         Arm_relocate_functions::thm_mov_abs,
7867         Arm_relocate_functions::movw_prel_nc,
7868         Arm_relocate_functions::thm_movt_abs,
7869         Arm_relocate_functions::movt_prel,
7870         Arm_relocate_functions::thm_movw_prel_nc,
7871         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7872         (Target_arm::Relocate::relocate): Only decompose address into two
7873         parts if relocation type uses the thumb-bit and pass the actual
7874         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7875         calls to methods in Arm_relocate_functions for this change.
7876
7877 2009-11-08  Ian Lance Taylor  <iant@google.com>
7878
7879         PR 10925
7880         * reloc.cc: Instantiate
7881         Sized_relobj::initialize_input_to_output_maps and
7882         Sized_relobj:free_input_to_output_maps.
7883
7884 2009-11-06  Ian Lance Taylor  <iant@google.com>
7885
7886         PR 10876
7887         * defstd.cc (in_segment): Set only_if_ref true for "end".
7888
7889 2009-11-06  Doug Kwan  <dougkwan@google.com>
7890
7891         * arm.cc (class Reloc_stub): Correct a comment.
7892         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7893         (Target_arm::scan_section_for_stubs): New method declaration.
7894         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7895         Change methods from private to protected.
7896         (Target_arm::do_may_relax): New method definition.
7897         (Target_arm::do_relax, Target_arm::group_sections,
7898         Target_arm::scan_reloc_for_stub,
7899         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7900         (Target_arm::arm_input_section_map_): New data member declaration.
7901         (Target_arm::scan_reloc_for_stub,
7902         Target_arm::scan_reloc_section_for_stubs,
7903         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7904         Target_arm::do_relax): New method definitions.
7905
7906 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7907
7908         * configure.ac: Check for (struct stat)::st_mtim
7909         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7910         * config.in: Regenerate.
7911         * configure: Regenerate.
7912
7913 2009-11-05  Ian Lance Taylor  <iant@google.com>
7914
7915         PR 10910
7916         * output.cc (Output_segment::add_output_section): Add missing
7917         return statement.
7918
7919 2009-11-04  Ian Lance Taylor  <iant@google.com>
7920
7921         PR 10880
7922         * object.h (class Object): Add is_needed and set_is_needed
7923         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7924         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7925         defined in a dynamic object and referenced by a regular object,
7926         set is_needed for the dynamic object.
7927         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7928         if the file is marked with as_needed and it is not needed.
7929
7930 2009-11-04  Ian Lance Taylor  <iant@google.com>
7931
7932         PR 10887
7933         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7934         tags if data is discarded by linker script.
7935         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7936         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7937         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7938         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7939
7940 2009-11-04  Ian Lance Taylor  <iant@google.com>
7941
7942         * layout.cc (Layout::get_output_section): Add is_interp and
7943         is_dynamic_linker_section parameters.  Change all callers.
7944         (Layout::choose_output_section): Likewise.
7945         (Layout::make_output_section): Likewise.
7946         (Layout::add_output_section_data): Add is_dynamic_linker_section
7947         parameter.  Change all callers.
7948         * layout.h (class Layout): Update declarations.
7949         * output.h (class Output_section): Add is_interp, set_is_interp,
7950         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7951         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7952         generate_code_fills_at_write_ to a bitfield.
7953         * output.cc (Output_section::Output_sections): Initialize new
7954         fields.
7955         (Output_segment::add_output_section): Add do_sort parameter.
7956         Change all callers.
7957
7958 2009-11-03  Ian Lance Taylor  <iant@google.com>
7959
7960         PR 10860
7961         * options.h (class General_options): Add --warn-common.
7962         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7963         merging two common symbols.
7964         (Symbol_table::should_override): Handle --warn-common when merging
7965         a common symbol with a defined symbol.  Use report_resolve_problem
7966         for multiple definitions.
7967         (Symbol_table::report_resolve_problem): New function.
7968         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7969
7970 2009-11-03  Doug Kwan  <dougkwan@google.com>
7971
7972         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7973         stub_factory_.
7974         (Target_arm::stub_factory): New method definition.
7975         (Target_arm::new_arm_input_section,
7976         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7977         Target_arm::reloc_uses_thumb_bit): New method declarations.
7978         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7979         New type definitions.
7980         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7981         member declarations.
7982         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7983         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7984         New method definitions.
7985
7986 2009-11-03  Ian Lance Taylor  <iant@google.com>
7987
7988         * options.h (class General_options): Add --warn_constructors.
7989
7990 2009-11-03  Ian Lance Taylor  <iant@google.com>
7991
7992         PR 10893
7993         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7994         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7995
7996 2009-11-03  Ian Lance Taylor  <iant@google.com>
7997
7998         PR 10895
7999         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8000         --msgid-bugs-address.
8001         (install-pdf): New target.
8002         (install-data_yes): Look up one directory to find mkinstalldirs.
8003
8004 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8005
8006         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8007         tree.
8008
8009 2009-10-30  Doug Kwan  <dougkwan@google.com>
8010
8011         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8012
8013 2009-10-30  Doug Kwan  <dougkwan@google.com>
8014
8015         * arm.cc (Stub_addend_reader): New struct template definition
8016         and partial specializations.
8017         (Stub_addend_reader::operator()): New method definition for a
8018         partially specialized template.
8019
8020 2009-10-30  Doug Kwan  <dougkwan@google.com>
8021
8022         * arm.cc (Arm_relobj::processor_specific_flags): New method
8023         definition.
8024         (Arm_relobj::do_read_symbols): New method declaration.
8025         (Arm_relobj::processor_specific_flags_): New data member declaration.
8026         (Arm_dynobj): New class definition.
8027         (Target_arm::do_finalize_sections): Add input_objects parameter.
8028         (Target_arm::do_adjust_elf_header): New method declaration.
8029         (Target_arm::are_eabi_versions_compatible,
8030         (Target_arm::merge_processor_specific_flags): New method declaration.
8031         (Target_arm::do_make_elf_object): New overloaded method definitions
8032         and declaration.
8033         (Arm_relobj::do_read_symbols): New method definition.
8034         (Arm_dynobj::do_read_symbols): Ditto.
8035         (Target_arm::do_finalize_sections): Add input_objects parameters.
8036         Merge processor-specific flags from all input objects.
8037         (Target_arm::are_eabi_versions_compatible,
8038         Target_arm::merge_processor_specific_flags,
8039         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8040         New method definitions.
8041         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8042         Input_objects pointer type parameter.
8043         * layout.cc (Layout::finalize): Pass input objects to target's.
8044         finalize_sections function.
8045         * output.cc (Output_file_header::do_sized_write): Set ELF file
8046         header's processor-specific flags.
8047         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8048         Input_objects pointer type parameter.
8049         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8050         * target.h (Input_objects): New forward class declaration.
8051         (Target::processor_specific_flags,
8052         Target::are_processor_specific_flags_sect): New method definitions.
8053         (Target::finalize_sections): Add input_objects parameter.
8054         (Target::Target): Initialize processor_specific_flags_ and
8055         are_processor_specific_flags_set_.
8056         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8057         parameter.
8058         (Target::set_processor_specific_flags): New method definition.
8059         (Target::processor_specific_flags_,
8060         Target::are_processor_specific_flags_set_): New data member
8061         declarations.
8062         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8063         Input_objects pointer type parameter.
8064
8065 2009-10-30  Doug Kwan  <dougkwan@google.com>
8066
8067         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8068
8069 2009-10-28  Ian Lance Taylor  <iant@google.com>
8070
8071         * object.h (class Relobj): Drop options parameter from
8072         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8073         do_scan_relocs, do_relocate.  Change all callers.
8074         (class Sized_relobj): Drop options parameters from
8075         do_gc_process_relocs, do_scan_relocs, do_relocate,
8076         do_relocate_sections, relocate_sections, emit_relocs_scan,
8077         emit_relocs_scan_reltype.  Change all callers.
8078         (struct Relocate_info): Remove options field and all references to
8079         it.
8080         * reloc.h (class Read_relocs): Remove options constructor
8081         parameter and options_ field.  Change all callers.
8082         (class Gc_process_relocs, class Scan_relocs): Likewise.
8083         (class Relocate_task): Likewise.
8084         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8085         all callers.
8086         (scan_relocatable_relocs): Likewise.
8087         * target.h (class Sized_target): Remove options parameter from
8088         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8089         all callers.
8090         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8091         callers.
8092         * arm.cc: Update functions to remove options parameters.
8093         * i386.cc: Likewise.
8094         * powerpc.cc: Likewise.
8095         * sparc.cc: Likewise.
8096         * x86_64.cc: Likewise.
8097         * testsuite/testfile.cc: Likewise.
8098
8099 2009-10-28  Doug Kwan  <dougkwan@google.com>
8100
8101         * arm.cc (Arm_relobj): New class definition.
8102         (Arm_relobj::scan_sections_for_stubs,
8103         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8104         New method definitions.
8105
8106 2009-10-28  Cary Coutant  <ccoutant@google.com>
8107
8108         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8109         (Plugin::cleanup_done_): New member.
8110         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8111         (Plugin_manager::cleanup_done_): Remove.
8112         (Plugin_manager::add_input_file): Edit error message.
8113         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8114         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8115
8116 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8117
8118         * fileread.cc: (File_read::View::~View): Use the new
8119         data_ownership_ filed.
8120         (File_read::~File_read): Dispose the new whole_file_view_.
8121         (File_read::open): Mmap the whole file if needed.
8122         (File_read::open): Use whole_file_view_ instead of contents_.
8123         (File_read::find_view): Use whole_file_view_ if applicable.
8124         (File_read::do_read): Use whole_file_view_ instead of contents_.
8125         (File_read::make_view): Use whole_file_view_ instead of contents_,
8126         update File_read::View::View call.
8127         (File_read::find_or_make_view): Update File_read::View::View
8128         call.
8129         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8130         remove contents_
8131         (File_read::View::Data_ownership): New enum.
8132         (File_read::View::View): Replace bool mapped_ with Data_ownership
8133         argument.
8134         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8135         (File_read::View::data_ownership_): New field.
8136         (File_read::contents_): Remove (replaced by whole_file_view_).
8137         (File_read::whole_file_view_): New field.
8138         * options.h (class General_options): Add --keep-files-mapped.
8139
8140 2009-10-27  Cary Coutant  <ccoutant@google.com>
8141
8142         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8143         * testsuite/Makefile.am (plugin_test_5): New test case.
8144         * testsuite/Makefile.in: Regenerate.
8145
8146 2009-10-25  Doug Kwan  <dougkwan@google.com>
8147
8148         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8149         from private to protected to allow access by child class.
8150         (Sized_relobj::do_relocate_sections): New method declaration.
8151         (Sized_relobj::relocate_sections): Virtualize.
8152         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8153         Sized_relobj::relocate_sections.  Instantiate template explicitly
8154         for different target sizes and endianity.
8155
8156 2009-10-24  Doug Kwan  <dougkwan@google.com>
8157
8158         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8159         (Arm_input_section::as_arm_input_section): New method.
8160         (Arm_output_section): New class definition.
8161         (Arm_output_section::create_stub_group,
8162         Arm_output_section::group_sections): New method definitions.
8163
8164 2009-10-22  Doug Kwan  <dougkwan@google.com>
8165
8166         * arm.cc (Arm_input_section): New class definition.
8167         (Arm_input_section::init, Arm_input_section:do_write,
8168         Arm_input_section::set_final_data_size,
8169         Arm_input_section::do_reset_address_and_file_offset): New method
8170         definitions.
8171
8172 2009-10-21  Doug Kwan  <dougkwan@google.com>
8173
8174         * arm.cc (Stub_table, Arm_input_section): New forward class
8175         declarations.
8176         (Stub_table): New class defintion.
8177         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8178         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8179         New method definition.
8180
8181 2009-10-21  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc: Update copyright comments.
8184         (Target_arm): New forward class template declaration.
8185         (Arm_address): New type.
8186         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8187         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8188         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8189         constants.
8190         (Insn_template): Same.
8191         (DEF_STUBS): New macro.
8192         (Stub_type): New enum type.
8193         (Stub_template): New class definition.
8194         (Stub): Same.
8195         (Reloc_stub): Same.
8196         (Stub_factory): Same.
8197         (Target_arm::Target_arm): Initialize may_use_blx_ and
8198         should_force_pic_veneer_.
8199         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8200         Target_arm::should_force_pic_veneer,
8201         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8202         Target_arm::using_thumb_only, Target_arm:;default_target): New
8203         method defintions.
8204         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8205         New data member declarations.
8206         (Insn_template::size, Insn_template::alignment): New method defintions.
8207         (Stub_template::Stub_template): New method definition.
8208         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8209         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8210         (Stub_factory::Stub_factory): New method definition.
8211         * gold.h (string_hash): New template.
8212         * output.h (Input_section_specifier::hash_value): Use
8213         gold::string_hash.
8214         (Input_section_specifier::string_hash): Remove.
8215         * stringpool.cc (Stringpool_template::string_hash): Use
8216         gold::string_hash.
8217
8218 2009-10-20  Doug Kwan  <dougkwan@google.com>
8219
8220         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8221         symbols of relaxed input sections.
8222         * output.h (Output_section::find_relaxed_input_section): Make
8223         method public.
8224
8225 2009-10-16  Doug Kwan  <dougkwan@google.com>
8226
8227         * dynobj.cc (Versions::Versions): Initialize version_script_.
8228         Only insert base version symbol definition for a shared object
8229         if version script defines any version versions.
8230         (Versions::define_base_version): New method definition.
8231         (Versions::add_def): Check that base version is not needed.
8232         (Versions::add_need): Define base version lazily.
8233         * dynobj.h (Versions::define_base_version): New method declaration.
8234         (Versions::needs_base_version_): New data member declaration.
8235         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8236         (check_DATA): Add no_version_test.stdout.
8237         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8238         New make rules.
8239         * testsuite/Makefile.in: Regenerate.
8240         * testsuite/no_version_test.c: New file.
8241         * testsuite/no_version_test.sh: Ditto.
8242
8243 2009-10-16  Doug Kwan  <dougkwan@google.com>
8244
8245         * expression.cc (class Segment_start_expression): New class definition.
8246         (Segment_start_expression::value): New method definition.
8247         (script_exp_function_segment_start): Return a new
8248         Segment_start_expression.
8249         * gold/script-c.h (script_saw_segment_start_expression): New function
8250         prototype.
8251         * script-sections.cc (Script_sections::Script_sections): Initialize
8252         SAW_SEGMENT_START_EXPRESSION_ to false.
8253         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8254         and -Tbbs options to specify section addresses if given in
8255         command line and no SEGMENT_START expression is seen in a script.
8256         * script-sections.h (Script_sections::saw_segment_start_expression,
8257         Script_sections::set_saw_segment_start_expression): New method
8258         definition.
8259         (Script_sections::saw_segment_start_expression_): New data member
8260         declaration.
8261         * script.cc (script_saw_segment_start_expression): New function.
8262         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8263         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8264         script_test_7.sh and script_test_8.sh.
8265         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8266         script_test_8.stdout.
8267         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8268         (script_test_6, script_test_6.stdout, script_test_7,
8269         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8270         * Makefile.in: Regenerate.
8271         * testsuite/script_test_6.sh: New file.
8272         * testsuite/script_test_6.t: Same.
8273         * testsuite/script_test_7.sh: Same.
8274         * testsuite/script_test_7.t: Same.
8275         * testsuite/script_test_8.sh: Same.
8276
8277 2009-10-16  Doug Kwan  <dougkwan@google.com>
8278
8279         * output.cc (Output_segment::set_section_list_address): Cast
8280         expressions to unsigned long long type to avoid format warnings.
8281
8282 2009-10-15  Ian Lance Taylor  <iant@google.com>
8283
8284         * script.cc (Script_options::add_symbol_assignment): Always add a
8285         dot assignment to script_sections_.
8286         * script-sections.cc (Script_sections::add_dot_assignment):
8287         Initialize if necessary.
8288
8289         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8290         program headers with no load segment if there is a linker script.
8291
8292         * layout.cc (Layout::set_segment_offsets): Align the file offset
8293         to the segment aligment for -N or -n with no load segment.
8294         * output.cc (Output_segment::add_output_section): Don't crash if
8295         the first section is a TLS section.
8296         (Output_segment::set_section_list_addresses): Print an error
8297         message if the address moves backward in a linker script.
8298         * script-sections.cc
8299         (Output_section_element_input::set_section_addresses): Don't
8300         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8301         (Orphan_output_section::set_section_addresses): Likewise.
8302
8303 2009-10-15  Doug Kwan  <dougkwan@google.com>
8304
8305         * layout.cc (Layout::finish_dynamic_section): Generate tags
8306         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8307         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8308         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8309
8310 2009-10-14  Ian Lance Taylor  <iant@google.com>
8311
8312         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8313         fields.
8314         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8315         data_shdr fields of relinfo.
8316         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8317         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8318         R_386_TLS_LDO_32, adjust based on section flags.
8319         (Target_i386::Relocate::fix_up_ldo): Remove.
8320
8321 2009-10-13  Ian Lance Taylor  <iant@google.com>
8322
8323         Add support for -pie.
8324         * options.h (class General_options): Add -pie and
8325         --pic-executable.
8326         (General_options::output_is_position_independent): Test -pie.
8327         (General_options::output_is_executable): Return true if not shared
8328         and not relocatable.
8329         (General_options::output_is_pie): Remove.
8330         * options.cc (General_options::finalize): Reject incompatible uses
8331         of -pie.
8332         * gold.cc (queue_middle_tasks): A -pie link is not static.
8333         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8334         * symtab.cc (Symbol::final_value_is_known): Return false if
8335         output_is_position_independent.
8336         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8337         output_is_position_independent.
8338         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8339         output_is_position_independent.
8340         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8341         output_is_position_independent.
8342         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8343         two_file_pie_test.
8344         (basic_pie_test.o, basic_pie_test): New targets.
8345         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8346         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8347         (two_file_pie_test): New target.
8348         * testsuite/Makefile.in: Rebuild.
8349         * README: Remove note saying that -pie is not supported.
8350
8351 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8352
8353         * options.h (class General_options): Add -init and -fini.
8354         * layout.cc (Layout::finish_dynamic_section): Emit
8355         given init and fini functions.
8356
8357 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8358
8359         * gc.h (gc_process_relocs): Check if icf is enabled using new
8360         function.
8361         * gold.cc (queue_initial_tasks): Likewise.
8362         (queue_middle_tasks): Likewise.
8363         * object.cc (do_layout): Likewise.
8364         * symtab.cc (is_section_folded): Likewise.
8365         * main.cc (main): Likewise.
8366         * reloc.cc (Read_relocs::run): Likewise.
8367         (Sized_relobj::do_scan_relocs): Likewise.
8368         * icf.cc (is_function_ctor_or_dtor): New function.
8369         (Icf::find_identical_sections): Check if function is ctor or dtor when
8370         safe icf is chosen.
8371         * options.h (General_options::icf): Change option to be an enum.
8372         (Icf_status): New enum.
8373         (icf_enabled): New method.
8374         (icf_safe_folding): New method.
8375         (set_icf_status): New method.
8376         (icf_status_): New variable.
8377         * (options.cc) (General_options::finalize): Set icf_status_.
8378         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8379         icf_test and icf_keep_unique_test to use the --icf enum flag.
8380         * testsuite/icf_safe_test.sh: New file.
8381         * testsuite/icf_safe_test.cc: New file.
8382
8383 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8384
8385         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8386         includes to gc.h and icf.h.
8387         * arm.cc: Include gc.h.
8388         * gold.cc: Likewise.
8389         * i386.cc: Likewise.
8390         * powerpc.cc: Likewise.
8391         * sparc.cc: Likewise.
8392         * x86_64.cc: Likewise.
8393         * gc.h: Include icf.h.
8394
8395 2009-10-11  Ian Lance Taylor  <iant@google.com>
8396
8397         * plugin.cc: Include "gold.h" before other header files.
8398
8399 2009-10-10  Chris Demetriou  <cgd@google.com>
8400
8401         * options.h (Input_file_argument::Input_file_type): New enum.
8402         (Input_file_argument::is_lib_): Replace with...
8403         (Input_file_argument::type_): New member.
8404         (Input_file_argument::Input_file_argument): Take Input_file_type
8405         'type' rather than boolean 'is_lib' as second argument.
8406         (Input_file_argument::is_lib): Use type_.
8407         (Input_file_argument::is_searched_file): New function.
8408         (Input_file_argument::may_need_search): Handle is_searched_file.
8409         * options.cc (General_options::parse_library): Support -l:filename.
8410         (General_options::parse_just_symbols): Update for Input_file_argument
8411         changes.
8412         (Command_line::process): Likewise.
8413         * archive.cc (Archive::get_file_and_offset): Likewise.
8414         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8415         * script.cc (read_script_file, script_add_file): Likewise.
8416         * fileread.cc (Input_file::Input_file): Likewise.
8417         (Input_file::will_search_for): Handle is_searched_file.
8418         (Input_file::open): Likewise.
8419         * readsyms.cc (Read_symbols::get_name): Likewise.
8420         * testsuite/Makefile.am (searched_file_test): New test.
8421         * testsuite/Makefile.in: Regenerate.
8422         * testsuite/searched_file_test.cc: New file.
8423         * testsuite/searched_file_test_lib.cc: New file.
8424
8425 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8426             Ian Lance Taylor  <iant@google.com>
8427
8428         * descriptor.cc: Include <cstdio> and "binary-io.h".
8429         (Descriptors::open): Open the files in binary mode always.
8430         * script.cc (Lex::get_token): Treat \r as whitespace.
8431
8432 2009-10-09  Ian Lance Taylor  <iant@google.com>
8433
8434         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8435
8436 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8437             Ian Lance Taylor  <iant@google.com>
8438
8439         * configure.ac: Check for readv function also.
8440         * fileread.cc (readv): Define if not HAVE_READV.
8441         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8442         does not exist.
8443         * config.in: Regenerate.
8444         * configure: Regenerate.
8445
8446 2009-10-09  Doug Kwan  <dougkwan@google.com>
8447
8448         * layout.cc (Layout::make_output_section): Call target hook to make
8449         ordinary output section.
8450         (Layout::finalize): Adjust parameter list of call the
8451         Target::may_relax().
8452         * layout.h (class Layout::section_list): New method.
8453         * merge.h (Output_merge_base::entsize): Change visibility to public.
8454         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8455         New methods.
8456         (Output_merge_string::do_is_string): New method.
8457         * object.cc (Sized_relobj::do_setup): renamed from
8458         Sized_relobj::set_up.
8459         * object.h (Sized_relobj::adjust_shndx,
8460         Sized_relobj::initializ_input_to_output_maps,
8461         Sized_relobj::free_input_to_output_maps): Change visibilities to
8462         protected.
8463         (Sized_relobj::setup): Virtualize.
8464         (Sized_relobj::do_setup): New method declaration.
8465         (Sized_relobj::invalidate_section_offset,
8466         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8467         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8468         * options.cc (parse_int): New function.
8469         * options.h (parse_int): New declaration.
8470         (DEFINE_int): New macro.
8471         (stub_group_size): New option.
8472         * output.cc (Output_section::Output_section): Initialize memebers
8473         merge_section_map_, merge_section_by_properties_map_,
8474         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8475         (Output_section::add_input_section): Handled deferred code-fill
8476         generation and remove an old comment.
8477         (Output_section::add_relaxed_input_section): New method definition.
8478         (Output_section::add_merge_input_section): Use merge section by
8479         properties map to speed to search.  Update merge section maps
8480         as appropriate.
8481         (Output_section::build_relaxation_map): New method definition.
8482         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8483         Same.
8484         (Output_section::relax_input_section): Renamed to
8485         Output_section::convert_input_sections_to_relaxed_sections and change
8486         interface to take a vector of pointers to relaxed sections.
8487         (Output_section::find_merge_section,
8488         Output_section::find_relaxed_input_section): New method definitions.
8489         (Output_section::is_input_address_mapped,
8490         Output_section::output_offset, Output_section::output_address):
8491         Use output section data maps to speed up searching.
8492         (Output_section::find_starting_output_address): Add comments.
8493         (Output_section::do_write,
8494         Output_section::write_to_postprocessing_buffer): Do code-fill
8495         generation as appropriate.
8496         (Output_section::get_input_sections): Invalidate relaxed input section
8497         map.
8498         (Output_section::restore_states): Adjust type of checkpoint .
8499         Invalidate relaxed input section map.
8500         * output.h (Output_merge_base): New class declaration.
8501         (Input_section_specifier): New class defintion.
8502         (class Output_relaxed_input_section) Change base class to
8503         Output_section_data_build.
8504         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8505         base class initializer.
8506         (Output_section::add_relaxed_input_section): New method declaration.
8507         (Output_section::Input_section): Change visibility to protected.
8508         (Output_section::Input_section::relobj,
8509         Output_section::Input_section::shndx): Handle relaxed input sections.
8510         Output_section::input_sections) Change visibility to protected.  Also
8511         define overload to return a non-const pointer.
8512         (Output_section::Merge_section_properties): New class defintion.
8513         (Output_section::Merge_section_by_properties_map,
8514         Output_section::Output_section_data_by_input_section_map,
8515         Output_section::Relaxation_map): New types.
8516         (Output_section::relax_input_section): Rename method to
8517         Output_section::convert_input_sections_to_relaxed_sections and change
8518         interface to take a vector of relaxed section pointers.
8519         (Output_section::find_merge_section,
8520         Output_section::find_relaxed_input_section,
8521         Output_section::build_relaxation_map,
8522         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8523         New method declarations.
8524         (Output_section::merge_section_map_
8525         Output_section::merge_section_by_properties_map_,
8526         Output_section::relaxed_input_section_map_,
8527         Output_section::is_relaxed_input_section_map_valid_,
8528         Output_section::generate_code_fills_at_write_): New data members.
8529         * script-sections.cc
8530         (Output_section_element_input::set_section_addresses): Call
8531         current_data_size and addralign methods of relaxed input sections.
8532         (Orphan_output_section::set_section_addresses): Call current_data_size
8533         and addralign methods of relaxed input sections.
8534         * symtab.cc (Symbol_table::compute_final_value): Extract template
8535         from the body of Symbol_table::sized_finalize_symbol.
8536         (Symbol_table::sized_finalized_symbol): Call
8537         Symbol_table::compute_final_value.
8538         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8539         (Symbol_table::compute_final_value): New templated method declaration.
8540         * target.cc (Target::do_make_output_section): New method defintion.
8541         * target.h (Target::make_output_section): New method declaration.
8542         (Target::relax): Add more parameters for input objects, symbol table
8543         and layout.  Adjust call to do_relax.
8544         (Target::do_make_output_section): New method declaration.
8545         (Target::do_relax): Add parameters for input objects, symbol table
8546         and layout.
8547
8548 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8549
8550         * pread.c: Include stdio.h.
8551
8552 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8553
8554         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8555         defined.
8556
8557 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8558
8559         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8560         Change read_shndx type to unsigned int.
8561         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8562         int.
8563         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8564         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8565         Change read_shndx type to unsigned int.
8566         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8567         int.
8568         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8569         * layout.cc (Layout::create_symtab_sections): Cast the result of
8570         local_symcount * symsize to off_t in the gold_assert.
8571
8572 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8573
8574         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8575         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8576         R_ARM_BASE_ABS.
8577         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8578         (Arm_relocate_functions::thm_abs5): New function.
8579         (Arm_relocate_functions::abs12): New function.
8580         (Arm_relocate_functions::abs16): New function.
8581         (Arm_relocate_functions::base_abs): New function.
8582         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8583         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8584         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8585         R_ARM_BASE_ABS.
8586         (Scan::global): Likewise.
8587         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8588         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8589         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8590         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8591         R_ARM_BASE_ABS.
8592
8593 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8594
8595         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8596         (Arm_relocate_functions::movt_prel): New function.
8597         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8598         (Arm_relocate_functions::thm_movt_prel): New function.
8599         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8600         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8601         (Scan::global, Relocate::relocate): Likewise.
8602         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8603
8604 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8605
8606         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8607         Incremental_checker.
8608         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8609         unsigned int.
8610         (class Incremental_inputs_header): New class.
8611         (Incremental_inputs_header_writer): Edit comment.
8612         (Incremental_inputs_entry): New class.
8613         (Incremental_inputs_entry_writer): Edit comment.
8614         (Sized_incremental_binary::do_find_incremental_inputs_section):
8615         Add *strtab_shndx parameter, fill it.
8616         (Sized_incremental_binary::do_check_inputs): New method.
8617         (Incremental_checker::can_incrementally_link_output_file): Use
8618         Sized_incremental_binary::check_inputs.
8619         (Incremental_inputs::report_command_line): Save command line in
8620         command_line_.
8621         * incremental.h:
8622         (Incremental_binary::find_incremental_inputs_section): New
8623         method.
8624         (Incremental_binary::do_find_incremental_inputs_section): Add
8625         strtab_shndx parameter.
8626         (Incremental_binary::do_check_inputs): New pure virtual method.
8627         (Sized_incremental_binary::do_check_inputs): Declare.
8628         (Incremental_checker::Incremental_checker): Add incremental_inputs
8629         parameter, use it to initialize incremental_inputs_.
8630         (Incremental_checker::incremental_inputs_): New field.
8631         (Incremental_checker::command_line): New method.
8632         (Incremental_checker::inputs): New method.
8633         (Incremental_checker::command_line_): New field.
8634
8635 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8636
8637         * incremental.cc: Include <cstdarg> and "target-select.h".
8638         (vexplain_no_incremental): New function.
8639         (explain_no_incremental): New function.
8640         (Incremental_binary::error): New method.
8641         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8642         method.
8643         (make_sized_incremental_binary): New function.
8644         (open_incremental_binary): New function.
8645         (can_incrementally_link_file): Add checks if output is ELF and has
8646         inputs section.
8647         * incremental.h: Include "elfcpp_file.h" and "output.h".
8648         (Incremental_binary): New class.
8649         (Sized_incremental_binary): New class.
8650         (open_incremental_binary): Declare.
8651         * object.cc (is_elf_object): Use
8652         elfcpp::Elf_recognizer::is_elf_file.
8653         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8654         * output.h (Output_file::filesize): New method.
8655
8656 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8657
8658         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8659         New function.
8660         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8661         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8662         function.
8663         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8664         function.
8665         (Arm_relocate_functions::movw_abs_nc): New function.
8666         (Arm_relocate_functions::movt_abs): New function.
8667         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8668         (Arm_relocate_functions::thm_movt_abs): New function.
8669         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8670         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8671         (Scan::global): Likewise.
8672         (Relocate::relocate): Likewise.
8673         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8674
8675 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8676
8677         * arm.cc (Arm_relocate_functions::got_prel) New function.
8678         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8679         (Relocate::relocate): Likewise.
8680         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8681
8682 2009-10-06  Ian Lance Taylor  <iant@google.com>
8683
8684         * options.h (class General_options): Define
8685         split_stack_adjust_size parameter.
8686         * object.h (class Object): Add uses_split_stack_ and
8687         has_no_split_stack_ fields.  Add uses_split_stack and
8688         has_no_split_stack accessor functions.  Declare
8689         handle_split_stack_section.
8690         (class Reloc_symbol_changes): Define.
8691         (class Sized_relobj): Define Function_offsets.  Declare
8692         split_stack_adjust, split_stack_adjust_reltype, and
8693         find_functions.
8694         * object.cc (Object::handle_split_stack_section): New function.
8695         (Sized_relobj::do_layout): Call handle_split_stack_section.
8696         * dynobj.cc (Sized_dynobj::do_layout): Call
8697         handle_split_stack_section.
8698         * reloc.cc (Sized_relobj::relocate_sections): Call
8699         split_stack_adjust for executable sections in split_stack
8700         objects.  Pass reloc_map to relocate_section.
8701         (Sized_relobj::split_stack_adjust): New function.
8702         (Sized_relobj::split_stack_adjust_reltype): New function.
8703         (Sized_relobj::find_functions): New function.
8704         * target-reloc.h: Include "object.h".
8705         (relocate_section): Add reloc_symbol_changes parameter.  Change
8706         all callers.
8707         * target.h (class Target): Add calls_non_split method.  Declare
8708         do_calls_non_split virtual method.  Declare match_view and
8709         set_view_to_nop.
8710         * target.cc: Include "elfcpp.h".
8711         (Target::do_calls_non_split): New function.
8712         (Target::match_view): New function.
8713         (Target::set_view_to_nop): New function.
8714         * gold.cc (queue_middle_tasks): Give an error if mixing
8715         split-stack and non-split-stack objects with -r.
8716         * i386.cc (Target_i386::relocate_section): Add
8717         reloc_symbol_changes parameter.
8718         (Target_i386::do_calls_non_split): New function.
8719         * x86_64.cc (Target_x86_64::relocate_section): Add
8720         reloc_symbol_changes parameter.
8721         (Target_x86_64::do_calls_non_split): New function.
8722         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8723         parameter.
8724         * powerpc.cc (Target_powerpc::relocate_section): Add
8725         reloc_symbol_changes parameter.
8726         * sparc.cc (Target_sparc::relocate_section): Add
8727         reloc_symbol_changes parameter.
8728         * configure.ac: Call AM_CONDITIONAL for the default target.
8729         * configure: Rebuild.
8730         * testsuite/Makefile.am (TEST_AS): New variable.
8731         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8732         (check_DATA): Add split_i386 and split_x86_64 files.
8733         (SPLIT_DEFSYMS): Define.
8734         (split_i386_[1234n].o): New targets.
8735         (split_i386_[124]): New targets.
8736         (split_i386_[1234r].stdout): New targets.
8737         (split_x86_64_[1234n].o): New targets.
8738         (split_x86_64_[124]): New targets.
8739         (split_x86_64_[1234r].stdout): New targets.
8740         (MOSTLYCLEANFILES): Add new executables.
8741         * testsuite/split_i386.sh: New file.
8742         * testsuite/split_x86_64.sh: New file.
8743         * testsuite/split_i386_1.s: New file.
8744         * testsuite/split_i386_2.s: New file.
8745         * testsuite/split_i386_3.s: New file.
8746         * testsuite/split_i386_4.s: New file.
8747         * testsuite/split_i386_n.s: New file.
8748         * testsuite/split_x86_64_1.s: New file.
8749         * testsuite/split_x86_64_2.s: New file.
8750         * testsuite/split_x86_64_3.s: New file.
8751         * testsuite/split_x86_64_4.s: New file.
8752         * testsuite/split_x86_64_n.s: New file.
8753         * testsuite/testfile.cc (Target_test): Update relocation_section
8754         function.
8755         * testsuite/Makefile.in: Rebuild.
8756
8757 2009-10-06  Ian Lance Taylor  <iant@google.com>
8758
8759         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8760         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8761         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8762         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8763         the address on ldo_addrs_.
8764         (Target_i386::Relocate::fix_up_ldo): New function.
8765
8766 2009-10-06   Rafael Espindola  <espindola@google.com>
8767
8768         * plugin.cc (add_input_library): New.
8769         (Plugin::load): Add add_input_library to tv.
8770         (Plugin_manager::add_input_file): Add the is_lib argument.
8771         (add_input_file): Update call to Plugin_manager::add_input_file.
8772         (add_input_library): New.
8773         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8774
8775 2009-09-30  Doug Kwan  <dougkwan@google.com>
8776
8777         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8778         symbol and call Symbol::may_need_copy_reloc to determine if
8779         a copy reloc is needed.
8780         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8781         nocopyreloc is given in command line.
8782         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8783         given in command line.
8784         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8785         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8786         of the removed Target_i386::may_need_copy_reloc.
8787         * options.h (copyreloc): New option with default value false.
8788         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8789         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8790         instead of the removed Target_powerpc::may_need_copy_reloc.
8791         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8792         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8793         instead of the removed Target_sparc::may_need_copy_reloc.
8794         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8795         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8796         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8797         instead of the removed Target_x86_64::may_need_copy_reloc.
8798
8799 2009-09-30  Ian Lance Taylor  <iant@google.com>
8800
8801         * object.h (class Object): Remove target_ field, and target,
8802         sized_target, and set_target methods.
8803         (Object::sized_target): Remove.
8804         (class Sized_relobj): Update declarations.  Remove sized_target.
8805         * object.cc (Sized_relobj::setup): Remove target parameter.
8806         Change all callers.
8807         (Input_objects::add_object): Don't do anything with the target.
8808         (make_elf_sized_object): Add punconfigured parameter.  Change all
8809         callers.  Set or test parameter target.
8810         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8811         Change all callers.
8812         * parameters.cc (Parameters::set_target): Change parameter type to
8813         be non-const.
8814         (Parameters::default_target): Remove.
8815         (set_parameters_target): Change parameter type to be non-const.
8816         (parameters_force_valid_target): New function.
8817         (parameters_clear_target): New function.
8818         * parameters.h (class Parameters): Update declarations.  Remove
8819         default_target method.  Add sized_target and clear_target
8820         methods.  Change target_ to be non-const.
8821         (set_parameters_target): Update declaration.
8822         (parameters_force_valid_target): Declare.
8823         (parameters_clear_target): Declare.
8824         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8825         as NULL if we aren't searching.
8826         (Add_symbols::run): Don't check for compatible target.
8827         * fileread.cc (Input_file::open_binary): Call
8828         parameters_force_valid_target.
8829         * gold.cc (queue_middle_tasks): Likewise.
8830         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8831         set_target on object.
8832         * dynobj.h (class Sized_dynobj): Update declarations.
8833         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8834         make_elf_object returns NULL.
8835         (Archive::include_member): Don't check whether object target is
8836         compatible.
8837         * output.cc (Output_section::add_input_section): Get target from
8838         parameters.
8839         (Output_section::relax_input_section): Likewise.
8840         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8841         parameters.
8842         (Sized_relobj::do_scan_relocs): Likewise.
8843         (Sized_relobj::relocate_sections): Likewise.
8844         * resolve.cc (Symbol_table::resolve): Likewise.
8845         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8846         parameter.  Change all callers.
8847         (Symbol_table::add_from_object): Get target from parameters.
8848         (Symbol_table::add_from_relobj): Don't check object target.
8849         (Symbol_table::add_from_dynobj): Likewise.
8850         (Symbol_table::define_special_symbol): Get target from
8851         parameters.
8852         * symtab.h (class Symbol_table): Update declaration.
8853         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8854         parameter.  Change all callers.  Clear parameter target.
8855         (Binary_test): Test target here.
8856         * testsuite/object_unittest.cc (gold_testsuite): Remove
8857         target_test_pointer parameter.  Change all callers.
8858         (Object_test): Test target here.
8859
8860 2009-09-26  Ian Lance Taylor  <iant@google.com>
8861
8862         * testsuite/initpri1.c: Don't try to use constructor priorities if
8863         compiling with gcc before 4.3.
8864
8865 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8866
8867         * testsuite/retain_symbols_file_test.sh (check_present): Change
8868         output file name to retain_symbols_file_test.stdout.
8869         (check_absent): Likewise.
8870
8871 2009-09-18  Craig Silverstein  <csilvers@google.com>
8872
8873         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8874         * options.cc: Include <cerrno> and <fstream>.
8875         (General_options::finalize): Parse -retain-symbols-file tag.
8876         * options.h: New flag.
8877         (General_options): New method should_retain_symbol, new
8878         variable symbols_to_retain.
8879         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8880         should_retain_symbol map.
8881         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8882         * testsuite/Makefile.in: Regenerate.
8883         * testsuite/retain_symbols_file_test.sh: New file.
8884
8885 2009-09-18  Nick Clifton  <nickc@redhat.com>
8886
8887         * po/es.po: Updated Spanish translation.
8888
8889 2009-09-17  Doug Kwan  <dougkwan@google.com>
8890
8891         * debug.h (DEBUG_RELAXATION): New constant.
8892         (DEBUG_ALL): Add DEBUG_RELAXATION.
8893         (debug_string_to_enum): Add relaxation debug option.
8894         * layout.cc
8895         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8896         Layout::Relaxation_debug_check::read_sections,
8897         Layout::Relaxation_debug_check::read_sections): New method definitions.
8898         (Layout::Layout): Initialize data members
8899         record_output_section_data_from_scrips_,
8900         script_output_section_data_list_ and relaxation_debug_check_.
8901         (Layout::save_segments, Layout::restore_segments,
8902         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8903         Layout::relaxation_loop_body): New method definitions.
8904         (Layout::finalize): Support relaxation.  Move section layout code to
8905         Layout::relaxation_loop_body.
8906         (Layout::set_asection_address_from_script): Move code for orphan
8907         section placement out.
8908         (Layout::place_orphan_sections_in_script): New method definition.
8909         * layout.h (Output_segment_headers, Output_file_header):
8910         New forward class declarations.
8911         (Layout::~Layout): Define.
8912         (Layout::new_output_section_data_from_script): New method definition.
8913         (Layout::place_orphan_sections_in_script): New method declaration.
8914         (Layout::Segment_states): New type declaration.
8915         (Layout::save_segments, Layout::restore_segments,
8916         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8917         Layout::relaxation_loop_body): New method declarations.
8918         (Layout::Output_section_data_list): New type declaration.
8919         (Layout::Relaxation_debug_check): New class definition.
8920         (Layout::record_output_section_data_from_script_,
8921         Layout::script_output_section_data_list_, Layout::segment_states_,
8922         Layout::relaxation_debug_check_): New data members.
8923         * output.cc: (Output_section_headers::do_size): New method definition.
8924         (Output_section_headers::Output_section_headers): Move size
8925         computation to Output_section_headers::do_size.
8926         (Output_segment_headers::do_size): New method definition.
8927         (Output_file_header::Output_file_header): Move size computation to
8928         Output_file_header::do_size and call it.
8929         (Output_file_header::do_size): New method definition.
8930         (Output_data_group::Output_data_group): Adjust call to
8931         Output_section_data.
8932         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8933         (Output_symtab_xindex::do_write): Add array bound check.
8934         (Output_section::Input_section::print_to_mapfile): Handle
8935         RELAXED_INPUT_SECTION_CODE.
8936         (Output_section::Output_section): Initialize data member checkpoint_.
8937         (Output_section::~Output_section): Delete checkpoint object pointed
8938         by checkpoint_.
8939         (Output_section::add_input_section): Always add an Input_section if
8940         relaxing.
8941         (Output_section::add_merge_input_section): Add assert.
8942         (Output_section::relax_input_section): New method definition.
8943         (Output_section::set_final_data_size): Set load address to zero for
8944         an unallocated section.
8945         (Output_section::do_address_and_file_offset_have_reset_values):
8946         New method definition.
8947         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8948         Handle relaxed input section.
8949         (Output_section::sort_attached_input_sections): Checkpoint input
8950         section list lazily.
8951         (Output_section::get_input_sections): Change type of input_sections to
8952         list of Simple_input_section pointers.  Checkpoint input section list
8953         lazily.  Also handle relaxed input sections.
8954         (Output_section::add_input_section_for_script): Take a reference to
8955         a Simple_input_section object instead of Relobj pointer and section
8956         index as parameter.  Handle relaxed input sections.
8957         (Output_section::save_states, Output_section::restore_states): New
8958         method definitions.
8959         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8960         (Output_data::is_data_size_fixed): New method definition.
8961         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8962         if it is fixed.
8963         (Output_data::address_and_file_offset_have_reset_values): New method
8964         definition.
8965         (Output_data::do_address_and_file_offset_have_reset_values): New method
8966         definition.
8967         (Output_data::set_data_size): Check that data size is not fixed.
8968         (Output_data::fix_data_size): New method definition.
8969         (Output_data::is_data_size_fixed_): New data member.
8970         (Output_section_headers::set_final_data_size): New method definition.
8971         (Output_section_headers::do_size): New method declaration.
8972         (Output_segment_headers::set_final_data_size): New method definition.
8973         (Output_segment_headers::do_size): New method declaration.
8974         (Output_file_header::set_final_data_size)::New method definition.
8975         (Output_file_header::do_size)::New method declaration.
8976         (Output_section_data::Output_section_data): Add new parameter
8977         is_data_size_fixed and use it to fix data size.
8978         (Output_data_const::Output_data_const): Adjust call to base class
8979         constructor and fix data size.
8980         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8981         base class constructor and fix data size.
8982         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8983         base class constructor and fix data size.
8984         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8985         class constructor and fix data size.
8986         (Output_data_group::set_final_data_size): New method definition.
8987         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8988         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8989         class constructor and fix data size.
8990         (Output_relaxed_input_section): New class definition.
8991         (Output_section::Simple_input_section): New class definition.
8992         (Output_section::get_input_sections): Adjust parameter list.
8993         (Output_section::add_input_section_for_script): Same.
8994         (Output_section::save_states, Output_section::restore_states,
8995         Output_section::do_address_and_file_offset_have_reset_values,
8996         (Output_section::Input_section::Input_section): Handle
8997         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8998         Output_relaxed_input_section.
8999         (Output_section::Input_section::is_input_section,
9000         Output_section::Input_section::set_output_section): Handle relaxed
9001         input section.
9002         (Output_section::Input_section::is_relaxed_input_section,
9003         Output_section::Input_section::output_section_data,
9004         Output_section::Input_section::relaxed_input_section): New method
9005         definitions.
9006         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9007         value.
9008         (Output_section::Input_section::u1_): Update comments.
9009         (Output_section::Input_section::u2_): Add new union member poris.
9010         (Output_section::Checkpoint_output_section): New classs definition.
9011         (Output_section::relax_input_section): New method declaration.
9012         (Output_section::checkpoint_): New data member.
9013         (Output_segment): Update comments.
9014         (Output_segment::Output_segment): Un-privatize copy constructor.
9015         (Output_segment::operator=): Un-privatize.
9016         * script-sections.cc (Output_section_element::Input_section_list):
9017         Change element type to Output_section::Simple_input_section.
9018         (Output_section_element_dot_assignment::set_section_addresses):
9019         Register output section data for relaxation clean up.
9020         (Output_data_exression::Output_data_expression): Adjust call to base
9021         constructor to fix data size.
9022         (Output_section_element_data::set_section_addresses): Register
9023         Output_data_expression object for relaxation clean up.
9024         (struct Input_section_info): Replace Relobj pointer and section index
9025         pair with Output_section::Simple_input_section and Convert struct to a
9026         class.
9027         (Input_section_sorter::operator()): Adjust access to
9028         Input_section_info data member to use accessors.
9029         (Output_section_element_input::set_section_addresses): Use layout
9030         parameter.  Adjust code to use Output_section::Simple_input_section
9031         and Input_secction_info classes.  Register filler for relaxation
9032         clean up.
9033         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9034         and section index pair with Output_section::Simple_input_section
9035         class.  Adjust code accordingly.
9036         (Phdrs_element::release_segment): New method definition.
9037         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9038         segment list.
9039         (Script_sections::release_segments): New method definition.
9040         * gold/script-sections.h (Script_sections::release_segments): New
9041         method declaration.
9042         * gold/target.h (Target::may_relax, Target::relax,
9043         Target::do_may_relax, Target::do_relax): New method definitions.
9044
9045 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9046
9047         * arm.cc (has_signed_unsigned_overflow): New function.
9048         (Arm_relocate_functions::abs8): New function.
9049         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9050         (Target_arm::Scan::global): Likewise.
9051         (Target_arm::relocate::relocate): Likewise.
9052         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9053         Likewise.
9054
9055 2009-09-16  Cary Coutant  <ccoutant@google.com>
9056
9057         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9058         * testsuite/Makefile.in: Regenerate.
9059
9060 2009-09-11  Nick Clifton  <nickc@redhat.com>
9061
9062         * po/gold.pot: Updated by the Translation project.
9063
9064 2009-09-08  Cary Coutant  <ccoutant@google.com>
9065
9066         * output.cc (Output_file::open): Add execute permission to empty file.
9067         * testsuite/Makefile.am (permission_test): New test.
9068         * testsuite/Makefile.in: Regenerate.
9069
9070 2009-09-02  Ian Lance Taylor  <iant@google.com>
9071
9072         * output.cc (Output_file::resize): Call map_no_anonymous rather
9073         than map.
9074
9075 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9076
9077         * gold.cc: Include "incremental.h".
9078         (queue_initial_tasks): Call Incremental_checker methods.
9079         * incremental.cc: Include "output.h".
9080         (Incremental_checker::can_incrementally_link_output_file): New
9081         method.
9082         * incremental.h (Incremental_checker): New class.
9083
9084         * output.cc (Output_file::open_for_modification): New method.
9085         (Output_file::map_anonymous): Changed return type to bool.  Record
9086         map in base_ field.
9087         (Output_file::map_no_anonymous): New method, broken out of map.
9088         (Output_file::map): Use map_no_anonymous and map_anonymous.
9089         * output.h (class Output_file): Update declarations.
9090
9091 2009-08-24  Cary Coutant  <ccoutant@google.com>
9092
9093         * options.h (Command_line::Pre_options): New class.
9094         (Command_line::pre_options): New member.
9095         * options.cc (gold::options::ready_to_register): New variable.
9096         (One_option::register_option): Do nothing if not registering options.
9097         Assert if same short option registered twice.
9098         (General_options::General_options): Turn off option registration when
9099         done constructing.
9100         (Command_line::Pre_options::Pre_options): New constructor.
9101
9102 2009-08-24  Cary Coutant  <ccoutant@google.com>
9103
9104         * options.h (General_options::no_keep_memory): Remove incorrect
9105         short option.
9106
9107 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9108
9109         * Makefile.am (am__skiplex, am__skipyacc): New.
9110         * Makefile.in: Regenerate.
9111
9112 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9113
9114         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9115         (INCLUDES): ... this.
9116         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9117         (AM_CPPFLAGS): Renamed from ...
9118         (INCLUDE): ... this.
9119         * Makefile.in, testsuite/Makefile.in: Regenerate.
9120
9121         * Makefile.in: Regenerate.
9122         * aclocal.m4: Likewise.
9123         * config.in: Likewise.
9124         * configure: Likewise.
9125         * testsuite/Makefile.in: Likewise.
9126
9127         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9128         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9129         * Makefile.in: Regenerate.
9130         * testsuite/Makefile.in: Regenerate.
9131
9132 2009-08-19  Cary Coutant  <ccoutant@google.com>
9133
9134         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9135         symbols in shared libraries overridden by hidden or internal symbols
9136         in the main program.
9137
9138 2009-08-19  Chris Demetriou  <cgd@google.com>
9139
9140         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9141         checking source file names in error messages.
9142
9143 2009-08-18  Doug Kwan  <dougkwan@google.com>
9144
9145         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9146         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9147         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9148         an elfcpp::Ehdr as parameter.
9149         * object.cc (Object::set_target): Remove the version that looks up
9150         a target and sets it.
9151         (Sized_relobj::setup): Take a Target object instead of
9152         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9153         (make_elf_sized_object): Find target and ask target to
9154         make an ELF object.
9155         * object.h: (Object::set_target): Remove the version that looks up
9156         a target and sets it.
9157         (Sized_relobj::setup): Take a Target object instead of
9158         an elfcpp:Ehdr as parameter.
9159         * target.cc: Include dynobj.h.
9160         (Target::do_make_elf_object_implementation): New.
9161         (Target::do_make_elf_object): New.
9162         * target.h (Target::make_elf_object): New template declaration.
9163         (Target::do_make_elf_object): New method declarations.
9164         (Target::do_make_elf_object_implementation): New template declaration.
9165
9166 2009-08-14  Ian Lance Taylor  <iant@google.com>
9167
9168         * gold.h (FUNCTION_NAME): Define.
9169         (gold_unreachable): Use FUNCTION_NAME.
9170
9171 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9172
9173         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9174         symbol in the --keep-unique list is not found.
9175
9176 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9177
9178         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9179         been maked as --keep-unique.
9180         (Icf::unfold_section): New function.
9181         * icf.h (Icf::unfold_section): New function.
9182         * options.h (General_options::keep_unique): New option.
9183         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9184         * testsuite/Makefile.in: Regenerate.
9185         * testsuite/icf_keep_unique_test.sh: New file.
9186         * testsuite/icf_keep_unique_test.cc: New file.
9187
9188 2009-08-12  Cary Coutant  <ccoutant@google.com>
9189
9190         PR 10471
9191         * resolve.cc (Symbol_table::resolve): Check for references from
9192         dynamic objects to hidden and internal symbols.
9193         * testsuite/Makefile.am (hidden_test.sh): New test.
9194         * testsuite/Makefile.in: Regenerate.
9195         * testsuite/hidden_test.sh: New script.
9196         * testsuite/hidden_test_1.c: New test source.
9197         * testsuite/hidden_test_main.c: New test source.
9198
9199 2009-08-11  Doug Kwan  <dougkwan@google.com>
9200
9201         * arm.cc: Update comments.
9202         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9203         segment to locate the .ARM.exidx section if present.
9204
9205 2009-08-09  Doug Kwan  <dougkwan@google.com>
9206
9207         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9208         patch.
9209
9210 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9211         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9212         compiler warnings.
9213
9214 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9215
9216         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9217         valid tls_segment only for non-debug-section relocations.
9218         * testsuite/Makefile.am: Add gc_tls_test.
9219         * testsuite/Makefile.in: Regenerate.
9220         * testsuite/gc_tls_test.cc: New file.
9221         * testsuite/gc_tls_test.sh: New file.
9222
9223 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9224
9225         * icf.cc: New file.
9226         * icf.h: New file.
9227         * Makefile.am (CCFILES): Add icf.cc.
9228         (HFILES): Add icf.h
9229         * Makefile.in: Regenerate.
9230         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9231         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9232         section, symbol and addend information for the relocs.
9233         * gold.cc (queue_middle_tasks): Call identical code folding.
9234         * gold.h: Add defines for multimap.
9235         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9236         to the call of finalize_local_symbols.
9237         * main.cc (main): Create object of class Icf.
9238         * object.cc (Sized_relobj::do_layout): Allow this function to be
9239         called twice during icf.
9240         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9241         to sections marked as identical by icf.
9242         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9243         when available.
9244         (Sized_relobj::do_section_entsize): New function.
9245         * object.h (Object::section_entsize): New function.
9246         (Object::do_section_entsize): New pure virtual function.
9247         (Relobj::finalize_local_symbols): Add new parameter.
9248         (Relobj::do_section_entsize): New function.
9249         * options.h (General_options::icf): New option.
9250         (General_options::icf_iterations): New option.
9251         (General_options::print_icf_sections): New option.
9252         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9253         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9254         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9255         icf.
9256         * symtab.cc (Symbol_table::is_section_folded): New function.
9257         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9258         to sections marked as identical by icf.
9259         * symtab.h (Symbol_table::set_icf): New function.
9260         (Symbol_table::icf): New function.
9261         (Symbol_table::is_section_folded): New function.
9262         (Symbol_table::icf_): New data member.
9263         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9264         * testsuite/Makefile.am: Add commands to build icf_test.
9265         * testsuite/Makefile.in: Regenerate.
9266         * testsuite/icf_test.sh: New file.
9267         * testsuite/icf_test.cc: New file.
9268
9269 2009-07-24  Chris Demetriou  <cgd@google.com>
9270
9271         * layout.cc (is_compressible_debug_section): Fix incorrect
9272         comment about compressed section names.
9273
9274 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9275
9276         PR 10419
9277         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9278
9279 2009-07-16  Ian Lance Taylor  <iant@google.com>
9280
9281         PR 10400
9282         * layout.h: #include <map>.
9283         (class Kept_section): Change from struct to class.  Add accessors
9284         and setters.  Add section size to Comdat_group mapping.  Change
9285         Comdat_group to std::map.  Add is_comdat_ field.  Add
9286         linkonce_size field in union.
9287         (class Layout): Update declaration of find_or_add_kept_section.
9288         Don't declare find_kept_object.
9289         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9290         parameter.  Add object, shndx, is_comdat, and is_group_name
9291         parameters.  Change all callers.  Adjust for new Kept_section.
9292         (Layout::find_kept_object): Remove.
9293         * object.cc (Sized_relobj::include_section_group): Update use of
9294         Kept_section.  Rename secnum to shndx.  Only record
9295         Kept_comdat_section if sections are the same size.
9296         (Sized_relobj::include_linkonce_section): Update use of
9297         Kept_section.  Only record Kept_comdat_section if sections are the
9298         same size.  Set size of linkonce section.
9299         (Sized_relobj::map_to_kept_section): Update call to
9300         get_kept_comdat_section.
9301         * object.h (class Sized_relobj): Rename fields in
9302         Kept_comdat_section to drop trailing underscores; change object
9303         field to Relobj*.  Change Kept_comdat_section_table to store
9304         struct rather than pointer.
9305         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9306         Add kept_object and kept_shndx parameters.  Change all callers.
9307         (Sized_relobj::get_kept_comdat_section): Change return type to
9308         bool.  Add kept_object and kept_shndx parameters.  Change all
9309         callers.
9310         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9311         Layout::find_or_add_kept_section.
9312
9313 2009-07-09  Ian Lance Taylor  <iant@google.com>
9314
9315         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9316         Reserve space in the hash table.
9317
9318 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9319
9320         * fileread.cc (File_read::get_mtime): New method.
9321         * fileread.h (Timespec): New structure.
9322         (File_read::get_mtime): New method.
9323         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9324         Renamed from timestamp_nsec.
9325         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9326         Elf_Xword.
9327         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9328         timestamp_nsec.
9329         (Incremental_inputs::report_archive): Save mtime; style fix.
9330         (Incremental_inputs::report_obejct): Save mtime; style fix.
9331         (Incremental_inputs::report_script): Save mtime; style fix.
9332         (Incremental_inputs::finalize_inputs): Style fix.
9333         (Incremental_inputs::finalize): Style fix.
9334         (Incremental_inputs::create_input_section_data): Store inputs
9335         mtime.
9336         * incremental.h (Incremental_inputs::report_script): Add mtime
9337         argument.
9338         (Incremental_inputs::Input_info::Input_info): Intialize only one
9339         union member.
9340         (Incremental_inputs::Input_info::archive): Move to nameless
9341         union.
9342         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9343         (Incremental_inputs::Input_info::script): Move to nameless union.
9344         (Incremental_inputs::mtime): New field.
9345         * script.cc (read_input_script): Pass file mtime to
9346         Incremental_input.
9347         * script.h (Script_info::inputs): Style fix.
9348
9349 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9350
9351         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9352         instead of 32.
9353
9354 2009-06-24  Ian Lance Taylor  <iant@google.com>
9355
9356         PR 10156
9357         * layout.cc (Layout::choose_output_section): If we find an
9358         existing section, update the flags.
9359         (Layout::create_notes): New function, broken out of
9360         Layout::finalize.
9361         (Layout::finalize): Don't create note sections.
9362         (Layout::create_note): Don't crash if linker script discards
9363         section.
9364         (Layout::create_gold_note): Likewise.
9365         (Layout::create_build_id): Likewise.  Don't set
9366         after_input_sections on the section.
9367         (Layout::create_executable_stack_info): Remove target parameter.
9368         Change caller.
9369         * layout.h (class Layout): Declare create_notes.  Update
9370         declaration of create_executable_stack_info.
9371         * gold.cc (queue_middle_tasks): Call create_notes.
9372         * output.cc (Output_section::update_flags_for_input_section): Move
9373         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9374         invalid.
9375         * output.h (Output_data::mark_address_invalid): New function.
9376         (class Output_section): Only declare, not define,
9377         update_flags_for_input_section.  Remove set_flags.
9378
9379 2009-06-24  Ian Lance Taylor  <iant@google.com>
9380
9381         * script-sections.cc (Output_section_definition::
9382         set_section_addresses): Rename shadowing local load_address to
9383         laddr.
9384
9385 2009-06-24  Ian Lance Taylor  <iant@google.com>
9386
9387         PR 10244
9388         * reloc.cc (relocate_sections): Skip empty relocation sections.
9389
9390 2009-06-23  Ian Lance Taylor  <iant@google.com>
9391
9392         PR 10156
9393         * layout.cc (Layout::create_note): Use choose_output_section
9394         rather than make_output_section.
9395
9396 2009-06-23  Ian Lance Taylor  <iant@google.com>
9397
9398         PR 10237
9399         * options.cc (General_options::parse_V): Set printed_version_.
9400         (General_options::General_options): Initialize printed_version_.
9401         * options.h (class General_options): Add printed_version_ field.
9402         * gold.cc (queue_initial_tasks): If there are no input files,
9403         don't give a fatal error if we printed the version information.
9404         (queue_middle_tasks): If using -r with a shared object, give a
9405         fatal error rather than an ordinary error.
9406
9407 2009-06-23  Ian Lance Taylor  <iant@google.com>
9408
9409         PR 10219
9410         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9411         (Layout::make_output_section): Set have_stabstr_section_ if we see
9412         a .stab*str section.
9413         (Layout::finalize): Call link_stabs_sections.
9414         (Layout::link_stabs_sections): New file.
9415         * layout.h (class Layout): Add have_stabstr_section_ field.
9416         Declare link_stabs_sections.
9417
9418 2009-06-23  Doug Kwan  <dougkwan@google.com>
9419
9420         * Makefile.am (libgold_a_LIBADD): New.
9421         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9422         * Makefile.in: Regenerate.
9423         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9424         * configure: Regenerate.
9425         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9426         * fileread.cc: Include sys/state.h
9427         * gold.h: Declare memmem and strndup if found missing.
9428         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9429
9430 2009-06-23  Ian Lance Taylor  <iant@google.com>
9431
9432         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9433         * configure: Rebuild.
9434
9435 2009-06-23  Ian Lance Taylor  <iant@google.com>
9436
9437         PR 10147
9438         * object.cc (Object::section_contents): Don't try to get a view if
9439         the section has length zero.
9440         (Object::handle_gnu_warning_section): If the section is empty, use
9441         the name of the section as the warning.
9442
9443 2009-06-23  Ian Lance Taylor  <iant@google.com>
9444
9445         PR 10133
9446         * stringpool.h (class Stringpool_template): Add optimize_ field.
9447         (Stringpool_template::set_optimize): New function.
9448         * stringpool.cc (Stringpool_template::Stringpool_template):
9449         Initialize optimize_ field.
9450         (Stringpool_template::set_string_offsets): Test local optimize
9451         fild rather than parameter.
9452         * layout.cc (Layout::Layout): Call set_optimize on the section
9453         name stringpool.
9454
9455 2009-06-22  Ian Lance Taylor  <iant@google.com>
9456
9457         PR 10030
9458         * yyscript.y: Parse TARGET.
9459         * script.cc (script_set_target): New function.
9460         * script-c.h (script_set_target): Declare.
9461         * options.cc (General_options::string_to_object_format): Rename
9462         from string_to_object_format in anonymous namespace.  Change
9463         callers.
9464         * options.h (class General_options): Declare
9465         string_to_object_format.
9466
9467 2009-06-22  Ian Lance Taylor  <iant@google.com>
9468
9469         * script-sections.cc (Script_sections::create_segments): Don't put
9470         program headers in a PT_LOAD segment if -n or -N.
9471
9472 2009-06-22  Ian Lance Taylor  <iant@google.com>
9473
9474         PR 10141
9475         * options.h (class General_options): Add -z lazy and -z now.  Sort
9476         -z options into alphabetical order.
9477         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9478
9479 2009-06-21  Ian Lance Taylor  <iant@google.com>
9480
9481         * layout.cc (Layout::make_output_section): Call
9482         Target::new_output_section.
9483         (Layout::attach_allocated_section_to_segment): Put large section
9484         sections in a separate load segment with the large segment flag
9485         set.
9486         (Layout::segment_precedes): Sort large data segments after other
9487         load segments.
9488         (align_file_offset): New static function.
9489         (Layout::set_segment_offsets): Use align_file_offset.
9490         * output.h (class Output_section): Add is_small_section_ and
9491         is_large_section_ fields.
9492         (Output_section::is_small_section): New function.
9493         (Output_section::set_is_small_section):  New function.
9494         (Output_section::is_large_section): New function.
9495         (Output_section::set_is_large_section): New function.
9496         (Output_section::is_large_data_section): New function.
9497         (class Output_segment): Add is_large_data_segment_ field.
9498         (Output_segment::is_large_data_segment): New function.
9499         (Output_segment::set_is_large_data_segment): New function.
9500         * output.cc (Output_section::Output_section): Initialize new
9501         fields.
9502         (Output_segment::Output_segment): Likewise.
9503         (Output_segment::add_output_section): Add assertion that large
9504         data sections always go in large data segments.  Force small data
9505         sections to the end of the list of data sections.  Force small BSS
9506         sections to the start of the list of BSS sections.  For large BSS
9507         sections to the end of the list of BSS sections.
9508         * symtab.h (class Symbol): Declare is_common_shndx.
9509         (Symbol::is_defined): Check Symbol::is_common_shndx.
9510         (Symbol::is_common): Likewise.
9511         (class Symbol_table): Define enum Commons_section_type.  Update
9512         declarations.  Add small_commons_ and large_commons_ fields.
9513         * symtab.cc (Symbol::is_common_shndx): New function.
9514         (Symbol_table::Symbol_table): Initialize new fields.
9515         (Symbol_table::add_from_object): Put small and large common
9516         symbols in the right list.
9517         (Symbol_table::sized_finalized_symbol): Check
9518         Symbol::is_common_shndx.
9519         (Symbol_table::sized_write_globals): Likewise.
9520         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9521         common symbol lists.  Don't call do_allocate_commons_list if the
9522         list is empty.
9523         (Symbol_table::do_allocate_commons_list): Remove is_tls
9524         parameter.  Add comons_section_type parameter.  Change all
9525         callers.  Handle small and large common symbols.
9526         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9527         Symbol::is_common_shndx.
9528         * resolve.cc (symbol_to_bits): Likewise.
9529         * target.h (Target::small_common_shndx): New function.
9530         (Target::small_common_section_flags): New function.
9531         (Target::large_common_shndx): New function.
9532         (Target::large_common_section_flags): New function.
9533         (Target::new_output_section): New function.
9534         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9535         small_common_section_flags, and large_common_section_flags
9536         fields.
9537         (Target::do_new_output_section): New virtual function.
9538         * arm.cc (Target_arm::arm_info): Initialize new fields.
9539         * i386.cc (Target_i386::i386_info): Likewise.
9540         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9541         Likewise.
9542         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9543         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9544         (Target_x86_64::do_new_output_section): New function.
9545         * configure.ac: Define conditional MCMODEL_MEDIUM.
9546         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9547         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9548         (large_LDFLAGS): Define.
9549         * testsuite/large.c: New file.
9550         * testsuite/testfile.cc (Target_test::test_target_info):
9551         Initialize new fields.
9552         * configure, testsuite/Makefile.in: Rebuild.
9553
9554 2009-06-05  Doug Kwan  <dougkwan@google.com>
9555
9556         * Makefile.am (CCFILES): Add target.cc.
9557         * Makefile.in: Regenerate.
9558         * i386.cc (class Target_i386): Define new virtual method to
9559         override do_is_local_label_name in parent.
9560         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9561         local symbols if --discard-locals or -X is given.
9562         * options.h (class General_options): Declare new options
9563         '--discard-locals' and '-X' for discarding locals.
9564         * target.h (class Target): Define new methods is_local_label_name.
9565         Declare new virtual method do_is_local_label_name.
9566         * target.cc: New file.
9567         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9568         (check_SCRIPTS): Add discard_locals_test.sh.
9569         (check_DATA): Add discard_local_tests.syms.
9570         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9571         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9572         * testsuite/Makefile.in: Regenerate.
9573         * testsuite/discard_locals_test.c: New file.
9574         * testsuite/discard_locals_test.sh: Same.
9575
9576 2009-06-05  Doug Kwan  <dougkwan@google.com>
9577
9578         * object.cc (Sized_relobj::Sized_relobj): Initialize
9579         discarded_eh_frame_shndx_ to -1U.
9580         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9581         section.
9582         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9583         a discarded .eh_frame section.
9584         (Sized_relobj::do_finalize_local_symbols): Ditto.
9585         * object.h (class Sized_relobj): Declare new member
9586         discarded_eh_frame_shndx_.
9587         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9588         (local_labels_test.o, local_labels_test): New rules.
9589         * testsuite/Makefile.in: Regenerate.
9590
9591 2009-06-04  Doug Kwan  <dougkwan@google.com>
9592
9593         * layout.cc (Layout::section_name_mapping): Add mapping for
9594         special ARM sections.
9595
9596 2009-06-03  Doug Kwan  <dougkwan@google.com>
9597
9598         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9599         (utils::has_overflow): Same.
9600
9601 2009-06-03  Ian Lance Taylor  <iant@google.com>
9602
9603         * layout.cc (Layout::section_name_mapping): New array, replacing
9604         Layout::linkonce_mapping.
9605         (Layout::section_name_mapping_count): New variable, replacing
9606         Layout::linkonce_mapping_count.
9607         (Layout::linkonce_output_name): Remove.
9608         (Layout::output_section_name): Rewrite.
9609         * layout.h (class Layout): Rename Linkonce_mapping to
9610         Section_name_mapping, linkonce_mapping to section_name_mapping,
9611         linkonce_mapping_count to section_name_mapping_count.  Don't
9612         declare linkonce_output_name.
9613
9614 2009-06-03  Doug Kwan  <dougkwan@google.com>
9615
9616         * gold/arm.cc (namespace utils): New.
9617         (Target_arm::reloc_is_non_pic): Define new method.
9618         (class Arm_relocate_functions): New.
9619         (Target_arm::Relocate::relocate): Handle relocation types used by
9620         Android.
9621
9622 2009-06-03  Ian Lance Taylor  <iant@google.com>
9623
9624         * arm.cc (Target_arm::scan::global): Use || instead of |.
9625
9626 2009-06-02  Doug Kwan  <dougkwan@google.com>
9627
9628         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9629         issued_non_pic_error_.
9630         (class Target_arm::Scan): Declare new method check_non_pic.
9631         Define new method symbol_needs_plt_entry.
9632         Declare new data member issued_non_pic_error_.
9633         (class Target_arm::Relocate): Declare new method
9634         should_apply_static_reloc.
9635         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9636         (Target_arm::Scan::check_non_pic): Define new method.
9637         (Target_arm::Scan::local): Handle a small subset of reloc types used
9638         by Android.
9639         (Target_arm::Scan::local): Same.
9640         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9641
9642 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9643
9644         * incremental.cc (Incremental_inputs::report_command_line): Filter
9645         out --incremental-* options.
9646
9647 2009-05-29  Doug Kwan  <dougkwan@google.com>
9648
9649         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9650         template class.
9651         (class Target_arm): Update comment.
9652         (Target_arm::Target_arm): Initialize new data members GOT_,
9653         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9654         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9655         and Target_arm::rel_dyn_section.
9656         Declare new_enum Target_arm::Got_type.
9657         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9658         and DYNBSS_.
9659         Update commments for member do_dynsym_value.
9660         (Target_arm::got_size, Target_arm::plt_section,
9661         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9662         new methods inside class defintion.
9663         (Target_arm::got_section): Define new method.
9664         (Target_arm::rel_dyn_section): Same.
9665         (Output_data_plt_arm): New template class.
9666         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9667         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9668         (Output_data_plt_arm::add_entry): Same.
9669         (Output_data_plt_arm::first_plt_entry): Define new
9670         static data member for PLT instruction template.
9671         (Output_data_plt_arm::plt_entry): Same.
9672         (Output_data_plt_arm::do_write): Define new method.
9673         (Target_arm::make_plt_entry): Same.
9674         (Target_arm::do_finalize_sections): Same.
9675         (Target_arm::do_dynsym_value): Same.
9676
9677 2009-05-28  Doug Kwan  <dougkwan@google.com>
9678
9679         * Makefile.am (TARGETSOURCES): Add arm.cc.
9680         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9681         * Makefile.in: Regenerate.
9682         * arm.cc: New file.
9683         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9684
9685 2009-05-26  Doug Kwan  <dougkwan@google.com>
9686
9687         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9688         (General_options::check_excluded_libs): Strip off directories in
9689         archive name before matching like GNU ld does.
9690         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9691         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9692         (exclude_libs_test_LDFLAGS): Add linker option
9693         -Wl,--exclude-libs,libexclude_libs_test_3
9694         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9695         an explicit archive without using -l.
9696         (alt/libexclude_libs_test_3.a): New make rule.
9697         * testsuite/Makefile.in: Regenerate.
9698         * testsuite/exclude_libs_test.c : Declare lib3_default().
9699         (main): Call it.
9700         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9701         * exclude_libs_test_3.c: New file.
9702
9703 2009-05-26  Nick Clifton  <nickc@redhat.com>
9704
9705         * po/id.po: New Indonesian translation.
9706         * po/gold.pot: Updated template file.
9707
9708 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9709
9710         * testsuite/Makefile.am: Add -ffunction-sections to compile
9711         gc_comdat_test files.  Add -Wl,--gc-sections to build
9712         gc_comdat_test.
9713         * testsuite/Makefile.in: Regenerate.
9714         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9715
9716 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9717
9718         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9719         kept comdat section was garbage collected.
9720         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9721         * testsuite/Makefile.in: Regenerate.
9722         * testsuite/gc_comdat_test.sh: New file.
9723         * testsuite/gc_comdat_test_1.cc: New file.
9724         * testsuite/gc_comdat_test_2.cc: New file.
9725
9726 2009-05-19  Doug Kwan  <dougkwan@google.com>
9727
9728         * archive.cc (Archive::Archive): Move constructor from archive.h
9729         to here.  Initialize no_export_.
9730         (Archive::get_elf_object_for_member): Set no_export flag of object.
9731         * archive.h (Archive::Archive): Move constructor body to
9732         archive.cc.
9733         (Archive::no_export): New method.
9734         (Archive::no_export_): New field.
9735         * object.h (Object::Object): Initialize no_export_ to false.
9736         (Object::no_export, Object::set_no_export): New methods.
9737         (Object::no_export_): New field.
9738         * options.cc (General_options::parse_exclude_libs): New method.
9739         (General_options::check_excluded_libs) Same.
9740         * options.h (exclude_libs): New option.
9741         (General_options::check_excluded_libs): New method declaration.
9742         (General_options::excluded_libs_): New field.
9743         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9744         default or protected visibility if an object has no-export flag set.
9745         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9746         (check_SCRIPTS): Add exclude_libs_test.sh.
9747         (check_DATA): Add exclude_libs_test.syms.
9748         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9749         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9750         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9751         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9752         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9753         libexclude_libs_test_2.a): New rules.
9754         * testsuite/Makefile.in: Regenerate.
9755         * testsuite/exclude_libs_test.c: New file.
9756         * testsuite/exclude_libs_test.sh: Ditto.
9757         * testsuite/exclude_libs_test_1.c: Ditto.
9758         * testsuite/exclude_libs_test_2.c: Ditto.
9759
9760 2009-05-15  Ian Lance Taylor  <iant@google.com>
9761
9762         * configure.ac: Check for declarations for cases where libiberty.h
9763         checks HAVE_DECL_xxx.
9764         * configure, config.in: Rebuild.
9765
9766 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9767
9768         * gold.h (Incremental_argument_list): Remove (invalid) forward
9769         declaration.
9770         * incremental.cc (Incremental_inputs::report_achive): New method.
9771         (Incremental_inputs::report_object): New method.
9772         (Incremental_inputs::report_script): New method.
9773         (Incremental_inputs::finalize_inputs): New method.
9774         (Incremental_inputs::finalize): Call finalize_inputs().
9775         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9776         Create inputs entries.
9777         * incremental.h (Incremental_input_type): New enum.
9778         (Incremental_inputs::Incremental_input): Initialize new fields.
9779         (Incremental_inputs::report_inputs): New method.
9780         (Incremental_inputs::report_achive): New method.
9781         (Incremental_inputs::report_object): New method.
9782         (Incremental_inputs::report_script): New method.
9783         (Incremental_inputs::finalize_inputs): New method.
9784         (Incremental_inputs::Input_info): New struct.
9785         (Incremental_inputs::Input_info_map): New typedef.
9786         (Incremental_inputs::lock_): New field.
9787         (Incremental_inputs::Inputs_): New field.
9788         (Incremental_inputs::Inputs_map): New field.
9789         * main.cc (main): Call Incremental_input::report_inputs.
9790         * options.h (Input_argument_list): Typedef moved from
9791         Input_arguments.
9792         (Input_file_group::Files): Remove, use ::Input_argument_list.
9793         (Input_file_group::Input_argument_list): Remove, use
9794         ::Input_argument_list.
9795         * plugin.cc (Plugin_manager::add_input_file): Add error in
9796         incremental build.
9797         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9798         functions.
9799         * script.cc (read_input_script): Call
9800         Incremental_input::report_script.
9801         * script.h (Script_info): New class.
9802
9803 2009-04-27  Ian Lance Taylor  <iant@google.com>
9804
9805         * x86_64.cc (do_adjust_output_section): Set entsize to
9806         plt_entry_size.
9807
9808 2009-04-23  Elliott Hughes  <enh@google.com>
9809
9810         * output.cc (Output_file::close): After short writes, continue
9811         writing from the correct offset in the buffer being written.
9812
9813 2009-04-23  Chris Demetriou  <cgd@google.com>
9814
9815         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9816         * configure: Regenerate.
9817         * config.in: Regenerate.
9818         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9819         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9820
9821 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9822
9823         * incremental.cc (Incremental_inputs_header_data): Renamed from
9824         Incremental_input_header_data.
9825         (Incremental_inputs_header_data::data_size): New field.
9826         (Incremental_inputs_header_data::put_input_file_count): Renamed
9827         from input_file_count.
9828         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9829         from command_line_offset.
9830         (Incremental_inputs_header_data::put_reserved): Renamed from
9831         put_reserved.
9832         (Incremental_inputs_entry_data): Renamed from
9833         Incremental_input_entry_data.
9834         (Incremental_inputs_entry_data::data_size): New field.
9835         (Incremental_inputs::report_command_line): New method.
9836         (Incremental_inputs::finalize): New method.
9837         (Incremental_inputs::create_incremental_inputs_data): New method.
9838         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9839         * incremental.h: New file.
9840         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9841        (Layout::finalize): Create incremental inputs section in
9842         incremental builds.
9843        (Layout::create_incremental_info_sections): New method.
9844         * layout.h (Layout::incremental_inputs): New method.
9845        (Layout::create_incremental_info_sections): New method.
9846        (Layout::incremental_inputs_): New field.
9847         * main.cc (main): Notify Incremental_input of the command line.
9848
9849 2009-04-01  Ian Lance Taylor  <iant@google.com>
9850             Mikolaj Zalewski  <mikolajz@google.com>
9851
9852         * gold.h (reserve_unordered_map): Define, three versions, one for
9853         each version of Unordered_map.
9854         * layout.cc (Layout::Layout): Remove options parameter.  Add
9855         number_of_input_files parameter.  Don't initialize options_.
9856         Initialize number_of_input_files_ and resized_signatures_.  Move
9857         sections_are_attached_.
9858         (Layout::layout_group): Reserve space for group_signatures_.
9859         (Layout::find_or_add_kept_section): Change name parameter to be a
9860         reference.  Resize signatures_ map when it gets large enough.
9861         (Layout::layout_eh_frame): Use parameters->options() instead of
9862         this->options_.
9863         (Layout::make_output_section): Likewise.
9864         (Layout::attach_allocated_section_to_segment): Likewise.
9865         (Layout::finalize, Layout::create_executable_stack): Likewise.
9866         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9867         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9868         * layout.h (class Layout): Update declarations.  Remove options_
9869         field.  Add number_of_input_files_ and resized_signatures_
9870         fields.  Move sections_are_attached_ field.
9871         * main.cc (main): Pass number of input files to Layout
9872         constructor.  Don't pass options.
9873
9874 2009-03-30  Ian Lance Taylor  <iant@google.com>
9875
9876         * ffsll.c (ffsll): Correct implementation.
9877
9878 2009-03-27  Ian Lance Taylor  <iant@google.com>
9879
9880         * ffsll.c: New file.
9881         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9882         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9883         * ftruncate.c (ftruncate): Declare before definition.
9884         * mremap.c (mremap): Likewise.
9885         * pread.c (pread): Likewise.
9886         * configure, Makefile.in, config.in: Rebuild.
9887
9888         * mremap.c: New file.
9889         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9890         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9891         (mremap): Declare if HAVE_MREMAP is not defined.
9892         * configure, Makefile.in, config.in: Rebuild.
9893
9894 2009-03-27  Cary Coutant  <ccoutant@google.com>
9895
9896         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9897         position independent.
9898         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9899         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9900
9901 2009-03-24  Cary Coutant  <ccoutant@google.com>
9902
9903         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9904         an executable.
9905         (needs_dynamic_reloc): Likewise.
9906
9907 2009-03-24  Ian Lance Taylor  <iant@google.com>
9908
9909         * yyscript.y (file_cmd): Recognize EXTERN.
9910         (extern_name_list, extern_name_list_body): New nonterminals.
9911         * script.cc (script_add_extern): Define.
9912         * script-c.h (script_add_extern): Declare.
9913
9914 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9915
9916         * object.cc (is_elf_object): Define.
9917         * object.h (is_elf_object): Declare.
9918         * archive.cc (Archive::get_elf_object_for_member): Call
9919         is_elf_object.
9920         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9921
9922 2009-03-24  Elliott Hughes  <enh@google.com>
9923
9924         * output.cc (Output_file::map_anonymous): Define.
9925         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9926         try an anonymous one.  Report the size if the mmap fails.
9927         * output.h (class Output_file): Declare map_anonymous.
9928
9929 2009-03-24  Ian Lance Taylor  <iant@google.com>
9930
9931         * target-select.cc (instantiate_target): Don't acquire the lock if
9932         the instantiated_target_ field has already been set.
9933
9934 2009-03-23  Ian Lance Taylor  <iant@google.com>
9935
9936         * gold-threads.h (class Initialize_lock): Define.
9937         * gold-threads.cc (class Initialize_lock_once): Define.
9938         (initialize_lock_control): New static variable.
9939         (initialize_lock_pointer): New static variable.
9940         (initialize_lock_once): New static function.
9941         (Initialize_lock::Initialize_lock): Define.
9942         (Initialize_lock::initialize): Define.
9943         * target-select.h: Include "gold-threads.h".
9944         (class Target_selector): Add lock_ and initialize_lock_ fields.
9945         Don't define instantiate_target, just declare it.
9946         * target-select.cc (Target_selector::Target_selector): Initialize
9947         new fields.
9948         (Target_selector::instantiate_target): Define.
9949         * descriptors.h: Include "gold-threads.h".
9950         (class Descriptors): Add initialize_lock_ field.
9951         * descriptors.cc (Descriptors::Descriptors): Initialize new
9952         field.
9953         (Descriptors::open): Use initialize_lock_ field
9954         * errors.h (class Errors): Add initialize_lock_ field.
9955         * errors.cc (Errors::Errors): Initialize new field.
9956         (Errors::initialize_lock): Use initialize_lock_ field.
9957         * powerpc.cc (class Target_selector_powerpc): Remove
9958         instantiated_target_ field.  In do_recognize call
9959         instantiate_target rather than do_instantiate_target.  In
9960         do_instantiate_target just allocate a new target.
9961         * sparc.cc (class Target_selector_sparc): Likewise.
9962
9963         * freebsd.h: New file.
9964         * i386.cc: Include "freebsd.h".
9965         (Target_i386): Derive from Target_freebsd rather than
9966         Sized_target.
9967         (Target_selector_i386): Derive from Target_selector_freebsd rather
9968         than Target_selector.
9969         * x86_64.cc: Include "freebsd.h".
9970         (Target_x86_64): Derive from Target_freebsd rather than
9971         Sized_target.
9972         (Target_selector_x86_64): Derive from Target_selector_freebsd
9973         rather than Target_selector.
9974         * target.h (class Target): Add adjust_elf_header and
9975         do_adjust_elf_header.
9976         * output.cc (Output_file_header:: do_sized_write): Call target
9977         adjust_elf_header routine.
9978         * configure.tgt: Set targ_osabi.
9979         * configure.ac: Define GOLD_DEFAULT_OSABI.
9980         * parameters.cc (Parameters::default_target): Pass
9981         GOLD_DEFAULT_OSABI to select_target.
9982         * target-select.h (class Target_selector): Make instantiate_target
9983         protected rather than private.
9984         * Makefile.am (HFILES): Add freebsd.h.
9985         * configure, Makefile.in, config.in: Rebuild.
9986
9987         * merge.cc (do_add_input_section): Correct pend value.  Change
9988         message about last entry not being null terminated from error to
9989         warning.
9990
9991 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9992
9993         * incremental.cc: New file.
9994         * Makefile.am (CCFILES): Add incremental.cc.
9995         * Makefile.in: Rebuild.
9996
9997 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9998
9999         * layout.cc (Layout::output_section_name): Preserve names
10000         of '.note.' sections.
10001
10002 2009-03-19  Ian Lance Taylor  <iant@google.com>
10003
10004         * descriptors.cc (Descriptors::open): Check that the options are
10005         valid before using them.
10006
10007 2009-03-18  Ian Lance Taylor  <iant@google.com>
10008
10009         * script-sections.h: Include <list>.
10010         (class Script_sections): Change Sections_elements from std::vector
10011         to std::list.  Typedef public Elements_iterator.  Add
10012         orphan_section_placement_, data_segment_align_start_, and
10013         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10014         field.
10015         * script-sections.cc (class Orphan_section_placement): New class.
10016         (class Sections_element): Add virtual functions is_relro and
10017         orphan_section_init.  Remove virtual function place_orphan_here.
10018         (class Output_section_definition): Add is_relro and
10019         orphan_section_init.  Remove place_orphan_here.
10020         (class Orphan_output_section): Likewise.
10021         (Script_sections::Script_sections): Update for field changes.
10022         (Script_sections::data_segment_align): Set saw_data_segment_align_
10023         and data_segment_align_start_, not data_segment_align_index.
10024         (Script_sections::data_segment_relro_end): Check
10025         saw_data_segment_align_.  Use data_segment_align_start_ rather
10026         than data_segment_align_index_.
10027         (Script_sections::place_orphan): Rewrite to use
10028         Orphan_section_placement.
10029
10030 2009-03-17  Ian Lance Taylor  <iant@google.com>
10031
10032         * archive.cc (Archive::add_symbols): Check for a version attached
10033         to the symbol name in the archive map.
10034         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10035         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10036         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10037         (ver_test_11.a): New target.
10038         * testsuite/Makefile.in: Rebuild.
10039
10040         * configure.ac: Check for chsize and posix_fallocate.  Replace
10041         ftruncate.
10042         * ftruncate.c: New file, from gnulib.
10043         * output.cc (posix_fallocate): Define dummy version if not
10044         HAVE_POSIX_FALLOCATE.
10045         (Output_file::map): Call posix_fallocate rather than lseek and
10046         write.
10047         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10048         * configure, Makefile.in, config.in: Rebuild.
10049
10050 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10051
10052         * layout.h (Layout::create_note): Add section_name parameter.
10053         * layout.cc (Layout::create_note): Likewise.
10054         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10055
10056 2009-03-17  Ian Lance Taylor  <iant@google.com>
10057
10058         * descriptors.cc: Include "options.h".
10059         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10060         (Descriptors::open): Always use O_CLOEXEC when opening a new
10061         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10062         then set FD_CLOEXEC.
10063
10064         * sparc.cc (class Target_sparc): Add has_got_section.
10065         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10066         make sure we have a GOT section.
10067
10068         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10069         (Target_sparc::Scan::local): Likewise.
10070         (Target_sparc::Scan::global): Likewise.
10071         (Target_sparc::Relocate::relocate): Likewise.
10072         (Target_sparc::Relocate::relocate_tls): Likewise.
10073
10074         * symtab.cc (Symbol_table::define_default_version): New function,
10075         broken out of add_from_object.
10076         (Symbol_table::add_from_object): Call define_default_version.
10077         (Symbol_table::define_special_symbol): Add resolve_oldsym
10078         parameter.  Change all callers.  If the version for a symbol comes
10079         from a version script, resolve it with the symbol with the same
10080         name with no version.  Also add the symbol without a version if
10081         appropriate.
10082         (do_define_in_output_data): If resolving with oldsym, don't delete
10083         sym.
10084         (do_define_in_output_segment): Likewise.
10085         (do_define_as_constant): Likewise.
10086         * symtab.h (class Symbol_table): Update declarations.
10087
10088 2009-03-13  Ian Lance Taylor  <iant@google.com>
10089
10090         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10091         (Read_symbols::requeue): New function.
10092         (Read_symbols::do_read_symbols): If make_elf_object fails because
10093         the target type is not configured, and the file was searched for,
10094         issue a warning and retry with the next directory.
10095         (Add_symbols::run): If the file has an incompatible format, and
10096         it was searched for, requeue the Read_symbols task.  On error,
10097         release the object.
10098         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10099         dirindex parameter to constructor.  Change all callers.  Declare
10100         incompatible_warning and requeue.
10101         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10102         input_argument_ and input_group_ fields.  Add them to
10103         constructor.  Change all callers.
10104         (class Read_script): Add dirindex_ field.  Add it to constructor.
10105         Change all callers.
10106         * archive.cc (Archive::setup): Remove input_objects parameter.
10107         Change all callers.
10108         (Archive::get_file_and_offset): Likewise.
10109         (Archive::read_all_symbols): Likewise.
10110         (Archive::read_symbols): Likewise.
10111         (Archive::get_elf_object_for_member): Remove input_objects
10112         parameter.  Add punconfigured parameter.  Change all callers.
10113         (Archive::add_symbols): Change return type to bool.  Check return
10114         value of include_member.
10115         (Archive::include_all_members): Likewise.
10116         (Archive::include_member): Change return type to bool.  Return
10117         false if first included object has incompatible target.  Set
10118         included_member_ field.
10119         (Add_archive_symbols::run): If add_symbols returns false, requeue
10120         Read_symbols task.
10121         * archive.h (class Archive): Add included_member_ field.
10122         Initialize it in constructor.  Add input_file and searched_for
10123         methods.  Update declarations.
10124         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10125         input_argument_ fields.  Add them to constructor.  Change all
10126         callers.
10127         * script.cc: Include "target-select.h".
10128         (class Parser_closure): Add skip_on_incompatible_target_ and
10129         found_incompatible_target_ fields.  Add
10130         skip_on_incompatible_target parameter to constructor.  Change all
10131         callers.  Add methods skip_on_incompatible_target,
10132         clear_skip_on_incompatible_target, found_incompatible_target, and
10133         set_found_incompatible_target.
10134         (read_input_script): Add dirindex parameter.  Change all callers.
10135         If parser finds an incompatible target, requeue Read_symbols
10136         task.
10137         (script_set_symbol): Clear skip_on_incompatible_target in
10138         closure.
10139         (script_add_assertion, script_parse_option): Likewise.
10140         (script_start_sections, script_add_phdr): Likewise.
10141         (script_check_output_format): New function.
10142         * script.h (read_input_script): Update declaration.
10143         * script-c.h (script_check_output_format): Declare.
10144         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10145         (ignore_cmd): Remove OUTPUT_FORMAT.
10146         * fileread.cc (Input_file::Input_file): Add explicit this.
10147         (Input_file::will_search_for): New function.
10148         (Input_file::open): Add pindex parameter.  Change all callers.
10149         * fileread.h (class Input_file): Add input_file_argument method.
10150         Declare will_search_for.  Update declarations.
10151         * object.cc (make_elf_object): Add punconfigured parameter.
10152         Change all callers.
10153         * object.h (class Object): Make input_file public.  Add
10154         searched_for method.
10155         (make_elf_object): Update declaration.
10156         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10157         restart search.
10158         * dirsearch.h (class Dirsearch): Update declaration.
10159         * options.h (class General_options): Add --warn-search-mismatch.
10160         * parameters.cc (Parameters::is_compatible_target): New function.
10161         * parameters.h (class Parameters): Declare is_compatible_target.
10162         * workqueue.cc (Workqueue::add_blocker): New function.
10163         * workqueue.h (class Workqueue): Declare add_blocker.
10164
10165         * fileread.cc (Input_file::open): Remove options parameter.
10166         Change all callers.
10167         (Input_file::open_binary): Likewise.
10168         * script.cc (read_input_script): Likewise.
10169         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10170         options parameter from constructor.  Change all callers.
10171         (class Read_script): Likewise.
10172         * fileread.h (class Input_file): Update declarations.
10173         * script.h (read_input_script): Update declaration.
10174
10175 2009-03-10  Nick Clifton  <nickc@redhat.com>
10176
10177         * po/es.po: New Spanish translation.
10178
10179 2009-03-06  Cary Coutant  <ccoutant@google.com>
10180
10181         * options.cc (parse_short_option): Keep dash_z from registering itself.
10182
10183 2009-03-03  Ian Lance Taylor  <iant@google.com>
10184
10185         PR 9918
10186         * target-reloc.h (relocate_section): Pass output_section to
10187         relocate.
10188         * i386.cc (Target_i386::should_apply_static_reloc): Add
10189         output_section parameter.  Change all callers.
10190         (Target_i386::Relocate::relocate): Add output_section parameter.
10191         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10192         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10193         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10194         * testsuite/two_file_shared.sh: New script.
10195         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10196         (check_DATA): Add two_file_shared.dbg.
10197         (two_file_shared.dbg): New target.
10198         * testsuite/Makefile.in: Rebuild.
10199
10200 2009-03-01  Ian Lance Taylor  <iant@google.com>
10201
10202         * configure.ac: Check for byteswap.h.
10203         * configure: Rebuild.
10204         * config.in: Rebuild.
10205
10206 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10207
10208         * layout.cc (Layout::find_or_add_kept_section): New function.
10209         (Layout::add_comdat): Removed.
10210         * layout.h (struct Kept_section): Move out of class Layout.
10211         Remove trailing underscores from field names.  Add group_sections
10212         field.  Rename group_ field to is_group.  Change all uses.
10213         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10214         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10215         comdat_groups_ field.
10216         (Sized_relobj::include_section_group): Use
10217         find_or_add_kept_section and Kept_section::group_sections.
10218         (Sized_relobj::include_linkonce_section): Likewise.
10219         * object.cc (class Sized_relobj): Don't define Comdat_group or
10220         Comdat_group_table.  Remove find_comdat_group and
10221         add_comdat_group.  Remove comdat_groups_ field.
10222         * plugin.cc (include_comdat_group): Use
10223         Layout::find_or_add_kept_section.
10224
10225 2009-02-28  Ian Lance Taylor  <iant@google.com>
10226
10227         * README: --gc-sections and map files are now supported.  Document
10228         some build requirements.
10229
10230         PR 6992
10231         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10232         relocatable link set the value of the section symbol to zero.
10233         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10234         relocatable link don't include the section address in the local
10235         symbol value.
10236
10237 2009-02-27  Ian Lance Taylor  <iant@google.com>
10238
10239         PR 6811
10240         * options.h (class Search_directory): Add is_system_directory.
10241         (class General_options): Declare is_in_system_directory.
10242         * options.cc (get_relative_sysroot): Make static.
10243         (get_default_sysroot): Make static.
10244         (General_optoins::is_in_system_directory): New function.
10245         * fileread.cc (Input_file::is_in_system_directory): New function.
10246         * fileread.h (class Input_file): Declare is_in_system_directory.
10247         * object.h (class Object): Add is_in_system_directory.
10248         (class Input_objects): Remove system_library_directory_ field.
10249         * object.cc (Input_objects::add_object): Don't set
10250         system_library_directory_.
10251         (input_objects::found_in_system_library_directory): Remove.
10252         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10253         parameter.  Change all callers.
10254         (Symbol_table::sized_write_globals): Likewise.
10255         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10256         Call Object::is_in_system_directory.
10257         * symtab.h (class Symbol_table): Update declarations.
10258
10259         PR 5990
10260         * descriptors.h (Open_descriptor): Add is_on_stack field.
10261         * descriptors.cc (Descriptors::open): If the descriptor is on the
10262         top of the stack, remove it.  Initialize is_on_stack field.
10263         (Descriptors::release): Only add pod to stack if it is not on the
10264         stack already.
10265         (Descriptors::close_some_descriptor): Clear stack_next and
10266         is_on_stack fields.
10267
10268         PR 7091
10269         * output.cc (Output_section::find_starting_output_address): Rename
10270         from starting_output_address; add PADDR parameter; change return
10271         type.
10272         * output.h (class Output_section): Declare
10273         find_starting_output_address instead of starting_output_address.
10274         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10275         section symbol for which we can't find a merge section.
10276
10277         PR 9836
10278         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10279         hidden or internal, force the symbol to be local.
10280         * resolve.cc (Symbol::override_visibility): Define.
10281         (Symbol::override_base): Use override_visibility.
10282         (Symbol_table::resolve): Likewise.
10283         (Symbol::override_base_with_special): Likewise.
10284         (Symbol_table::override_with_special): If the visibility is hidden
10285         or internal, force the symbol to be local.
10286         * symtab.h (class Symbol): Add set_visibility and
10287         override_visibility.
10288         * testsuite/ver_test_1.sh: New file.
10289         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10290         (check_DATA): Add ver_test_1.syms.
10291         (ver_test_1.syms): New target.
10292         * testsuite/Makefile.in: Rebuild.
10293
10294 2009-02-25  Cary Coutant  <ccoutant@google.com>
10295
10296         * layout.cc (Layout::choose_output_section): Don't rename sections
10297         when using a linker script that has a SECTIONS clause.
10298         * Makefile.in: Regenerate.
10299
10300         * testsuite/Makefile.am (script_test_5.sh): New test case.
10301         * testsuite/Makefile.in: Regenerate.
10302         * testsuite/script_test_5.cc: New file.
10303         * testsuite/script_test_5.sh: New file.
10304         * testsuite/script_test_5.t: New file.
10305
10306 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10307
10308         * archive.cc (Archive::include_member): Update calls to add_symbols.
10309         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10310         the Layout argument.
10311         * dynobj.h (do_add_symbols): Add the Layout argument.
10312         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10313         Layout argument.
10314         * object.h (Object::add_symbols): Add the Layout argument.
10315         (Object::do_add_symbols): Add the Layout argument.
10316         (Sized_relobj::do_add_symbols): Add the Layout argument.
10317         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10318         Unify the two versions.
10319         (Add_plugin_symbols): Remove.
10320         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10321         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10322         (Add_plugin_symbols): Remove.
10323         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10324         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10325         (Add_symbols::run): Make it work with Pulginobj.
10326
10327 2009-02-06  Ian Lance Taylor  <iant@google.com>
10328
10329         * object.cc (Sized_relobj::do_layout): Make info message start
10330         with lower case letter.
10331
10332 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10333
10334         * binary.cc: Fix file comment.
10335
10336         * options.h (enum Incremental_disposition): Define.
10337         (class General_options): Add new options: --incremental,
10338         --incremental_changed, --incremental_unchanged,
10339         --incremental_unknown.  Add incremental_disposition_ and
10340         implicit_incremental_ fields.
10341         (General_options::incremental_disposition): New function.
10342         (class Position_dependent_options): Add incremental_disposition
10343         option.
10344         (Position_dependent_options::copy_from_options): Set incremental
10345         dispositions.
10346         * options.cc (General_options::parse_incremental_changed): New
10347         function.
10348         (General_options::parse_incremental_unchanged): New function.
10349         (General_options::parse_incremental_unknown): New function.
10350         (General_options::General_options): Initialize new fields
10351         incremental_disposition_ and implicit_incremental_.
10352         (General_options::finalize): Check for uasge of --incremental-*
10353         without --incremental.
10354
10355 2009-02-06  Chris Demetriou  <cgd@google.com>
10356
10357         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10358         pointer and to report location as the file name associated with
10359         the symbol.
10360         (gold_undefined_symbol_at_location): New function to replace the
10361         old gold_undefined_symbol functionality.
10362         * target-reloc.h (relocate_section): Update to use
10363         gold_undefined_symbol_at_location.
10364         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10365         Call gold_undefined_symbol function rather than gold_error.
10366         * errors.h (Errors::undefined_symbol): Take location as a
10367         string, rather than calculating it from a relocation.
10368         * errors.cc (Errors::fatal): Print "fatal error:" before the
10369         formatted message.
10370         (Errors::error, Errors::error_at_location): Print "error: "
10371         before the formatted message.
10372         (Errors::undefined_symbol): Take location as a string, rather
10373         than calculating it from a relocation.
10374         (gold_undefined_symbol_at_location): New function akin to
10375         old gold_undefined_symbol, calculates location from relocation.
10376         (gold_undefined_symbol): Change to take only a Symbol pointer
10377         and to report location as the file name associated with the symbol.
10378         * testsuite/debug_msg.sh: Update for changed error messages.
10379         * testsuite/undef_symbol.sh: Likewise.
10380
10381 2009-02-04  Duncan Sands  <baldrick@free.fr>
10382
10383         PR 9812
10384         * reduced_debug_output.h
10385         (Output_reduced_debug_abbrev_section::failed): Use format for
10386         gold_warning.
10387         (Output_reduced_debug_info_section::faild): Likewise.
10388
10389 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10390
10391         * script.cc (Lazy_demangler): New class.
10392         (Version_script_info::get_symbol_version_helper): Demangle a
10393         symbol only once.
10394
10395 2009-01-29  Cary Coutant  <ccoutant@google.com>
10396
10397         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10398         to __tls_get_addr.
10399         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10400
10401 2009-01-28  Ian Lance Taylor  <iant@google.com>
10402
10403         * version.cc (version_string): Bump to 1.9.
10404
10405         * gold.h: Include <cstring> and <stdint.h>.
10406         * version.cc: Include <cstdio>.
10407         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10408         warning.
10409         * reduced_debug_output.cc (insert_into_vector): Rename from
10410         Insert_into_vector; change all callers.  Use Swap_unaligned to
10411         avoid aliasing issue; remove union since it is unnecessary.
10412
10413 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10414
10415         * Makefile.am (CCFILES): Add gc.cc.
10416         (HFILES): Add gc.h.
10417         * Makefile.in: Regenerate.
10418         * gold.cc (Gc_runner): New class.
10419         (queue_initial_tasks): Call garbage collection related tasks
10420         when corresponding options are invoked.
10421         (queue_middle_gc_tasks): New function.
10422         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10423         processed early before laying out sections during garbage collection.
10424         * gold.h (queue_middle_gc_tasks): New function.
10425         (is_prefix_of): Move from "layout.cc".
10426         * i386.cc (Target_i386::gc_process_relocs): New function.
10427         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10428         * main.cc (main): Create object of class "Garbage_collection".
10429         * object.cc (Relobj::copy_symbols_data): New function.
10430         (Relobj::is_section_name_included): New function.
10431         (Sized_relobj::do_layout): Allow this function to be called twice
10432         during garbage collection and defer layout of section during the
10433         first call.
10434         * object.h (Relobj::get_symbols_data): New function.
10435         (Relobj::is_section_name_included): New function.
10436         (Relobj::copy_symbols_data): New function.
10437         (Relobj::set_symbols_data): New function.
10438         (Relobj::get_relocs_data): New function.
10439         (Relobj::set_relocs_data): New function.
10440         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10441         (Relobj::gc_process_relocs): New function.
10442         (Relobj::do_gc_process_relocs): New pure virtual function.
10443         (Relobj::sd_): New data member.
10444         (Sized_relobj::is_output_section_offset_invalid): New function.
10445         (Sized_relobj::do_gc_process_relocs): New function.
10446         * options.h (General_options::gc_sections): Modify to not be a no-op.
10447         (General_options::print_gc_sections): New option.
10448         * plugin.cc (Plugin_finish::run): Remove function call to
10449         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10450         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10451         * reloc.cc (Read_relocs::run): Add task to process relocs and
10452         determine unreferenced sections when doing garbage collection.
10453         (Gc_process_relocs): New class.
10454         (Sized_relobj::do_gc_process_relocs): New function.
10455         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10456         sections that are garbage collected.
10457         * reloc.h (Gc_process_relocs): New class.
10458         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10459         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10460         symbols whose corresponding sections are garbage collected.
10461         (Symbol_table::Symbol_table): Add new parameter for the garbage
10462         collection object.
10463         (Symbol_table::gc_mark_undef_symbols): New function.
10464         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10465         (Symbol_table::gc_mark_dyn_syms): New function.
10466         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10467         as garbage.
10468         (Symbol_table::add_from_object): Likewise.
10469         (Symbol_table::add_from_relobj): When building shared objects, do not
10470         treat externally visible symbols as garbage.
10471         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10472         table information for static and relocatable links.
10473         * symtab.h (Symbol_table::set_gc): New function.
10474         (Symbol_table::gc): New function.
10475         (Symbol_table::gc_mark_undef_symbols): New function.
10476         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10477         (Symbol_table::gc_mark_dyn_syms): New function.
10478         (Symbol_table::gc_): New data member.
10479         * target.h (Sized_target::gc_process_relocs): New pure virtual
10480         function.
10481         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10482         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10483
10484 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10485
10486         * options.h (General_options::gc_sections): Define as a no-op for now.
10487         (General_options::no_keep_memory): Ditto.
10488         (General_options::Bshareable): Define.
10489         * options.cc (General_options::finalize): Honor -Bshareable.
10490
10491 2009-01-20  Andreas Schwab  <schwab@suse.de>
10492
10493         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10494         read the value in the contents, since we don't use it.  Use the
10495         template endianness when writing.
10496         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10497
10498 2009-01-19  Andreas Schwab  <schwab@suse.de>
10499
10500         * configure.tgt (powerpc64-*): Fix targ_obj.
10501
10502 2009-01-15  Ian Lance Taylor  <iant@google.com>
10503
10504         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10505         local symbols when stripping all symbols.
10506
10507 2009-01-14  Cary Coutant  <ccoutant@google.com>
10508
10509         * output.cc (Output_reloc): Add explicit instantiations.
10510
10511 2009-01-14  Cary Coutant  <ccoutant@google.com>
10512
10513         * archive.cc (Archive::get_elf_object_for_member): Remove call
10514         to File_read::claim_for_plugin.
10515         * descriptors.cc (Descriptors::open): Remove reference to
10516         is_claimed.
10517         (Descriptors::claim_for_plugin): Remove.
10518         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10519         (Descriptors::is_claimed): Remove.
10520         (claim_descriptor_for_plugin): Remove.
10521         * fileread.cc (File_read::claim_for_plugin): Remove.
10522         * fileread.h (File_read::claim_for_plugin): Remove.
10523         (File_read::descriptor): Reopen descriptor if necessary.
10524         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10525         (Plugin_manager::all_symbols_read): Add task parameter. Change
10526         all callers.
10527         (Plugin_manager::get_input_file): New function.
10528         (Plugin_manager::release_input_file): New function.
10529         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10530         corresponding data member.
10531         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10532         and pass to base constructor. Change all callers.
10533         (get_input_file, release_input_file): New functions.
10534         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10535         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10536         (Plugin_manager::all_symbols_read): Add task parameter.
10537         (Plugin_manager::get_input_file): New function.
10538         (Plugin_manager::release_input_file): New function.
10539         (Plugin_manager::task_): New data member.
10540         (Pluginobj::Pluginobj): Add filesize parameter.
10541         (Pluginobj::filename): New function.
10542         (Pluginobj::descriptor): New function.
10543         (Pluginobj::filesize): New function.
10544         (Pluginobj::filesize_): New data member.
10545         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10546         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10547         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10548
10549         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10550         with archive libraries.
10551         * testsuite/Makefile.in: Regenerate.
10552         * testsuite/plugin_test.c (struct sym_info): New type.
10553         (get_input_file, release_input_file): New static variables.
10554         (onload): Capture new transfer vector entries.
10555         (claim_file_hook): Stop reading at end of file according to filesize.
10556         Factor out parsing of readelf output into separate function.
10557         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10558         APIs and get the source file name from the symbol table.  Convert
10559         source file name to corresponding object file name.  Print info
10560         message when adding new input files.
10561         (parse_readelf_line): New function.
10562         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10563         * testsuite/plugin_test_2.sh: Likewise.
10564         * testsuite/plugin_test_3.sh: Likewise.
10565         * testsuite/plugin_test_4.sh: New test case.
10566
10567 2009-01-07  Ian Lance Taylor  <iant@google.com>
10568
10569         * version.cc (version_string): Bump to 1.8.
10570
10571 2008-12-23  Cary Coutant  <ccoutant@google.com>
10572
10573         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10574         * plugin.cc (Plugin_manager::finish): Rename as
10575         layout_deferred_objects.  Move cleanup to separate function.
10576         (Plugin_manager::cleanup): New function.
10577         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10578         separately.
10579         * plugin.h (Plugin_manager::finish): Rename as
10580         layout_deferred_objects.
10581         (Plugin_manager::cleanup): New function.
10582         (Plugin_manager::cleanup_done): New field.
10583
10584 2008-12-23  Cary Coutant  <ccoutant@google.com>
10585
10586         * plugin.cc (is_visible_from_outside): New function.
10587         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10588         so we don't return "IR only" status for exported symbols or -r links.
10589
10590         * testsuite/Makefile.am (plugin_test_3): New test case.
10591         * testsuite/Makefile.in: Regenerate.
10592         * testsuite/plugin_test_3.sh: New file.
10593
10594 2008-12-22  Cary Coutant  <ccoutant@google.com>
10595
10596         * object.cc (Sized_relobj::layout_section): New function.
10597         (Sized_relobj::do_layout): Defer layout of input sections until after
10598         plugin has provided replacement files.
10599         (Sized_relobj::do_layout_deferred_sections): New function.
10600         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10601         (Relobj::layout_deferred_sections): New function.
10602         (Relobj::do_layout_deferred_sections): New function.
10603         (Sized_relobj::do_layout_deferred_sections): New function.
10604         (Sized_relobj::layout_section): New function.
10605         (Sized_relobj::Deferred_layout): New structure.
10606         (Sized_relobj::deferred_layout_): New field.
10607         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10608         Change all callers.  Layout deferred sections.
10609         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10610         references.
10611         (Plugin_hook::run): Move code from do_plugin_hook inline.
10612         (Plugin_hook::do_plugin_hook): Remove.
10613         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10614         (Plugin_manager::finish): Renamed, was cleanup.
10615         (Plugin_manager::should_defer_layout): New function.
10616         (Plugin_manager::add_deferred_layout_object): New function.
10617         (Plugin_manager::Deferred_layout_list): New type.
10618         (Plugin_manager::deferred_layout_objects_): New field.
10619         (Plugin_hook::do_plugin_hook): Remove.
10620
10621 2008-12-17  Ian Lance Taylor  <iant@google.com>
10622
10623         * options.h (class General_options): Add --no case for
10624         --export-dynamic.
10625
10626 2008-12-16  Cary Coutant  <ccoutant@google.com>
10627
10628         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10629         vector.
10630         (Plugin_manager::claim_file): Create plugin object even if
10631         plugin did not call the add_symbols callback.
10632         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10633         asking for more symbols than were added.
10634         * testsuite/Makefile.am (plugin_test_1): Add test case with
10635         no global symbols.
10636         (empty.syms): New target.
10637         * testsuite/Makefile.in: Regenerate.
10638         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10639         message. Don't call add_symbols if no globals.
10640         (all_symbols_read_hook): Don't provide replacement for empty
10641         claimed file.
10642
10643 2008-12-12  Ian Lance Taylor  <iant@google.com>
10644
10645         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10646         r_type == 0 for a local symbol with r_sym == 0.
10647         (scan_relocatable_relocs): Pass r_sym to
10648         local_non_section_strategy.
10649         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10650         r_sym parameter.
10651
10652         * configure.ac: Update test for TLS descriptors: they are
10653         supported as of glibc 2.9.
10654         * configure: Rebuild.
10655
10656 2008-12-11  Ian Lance Taylor  <iant@google.com>
10657
10658         PR 7091
10659         * target-reloc.h (Default_scan_relocatable_relocs): For each
10660         function, map r_type == 0 to RELOC_DISCARD.
10661
10662 2008-12-10  Cary Coutant  <ccoutant@google.com>
10663
10664         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10665         object to override a kept COMDAT group from a plugin object.
10666
10667 2008-12-09  Ian Lance Taylor  <iant@google.com>
10668
10669         PR 7088
10670         * yyscript.y (file_cmd): Handle INPUT.
10671
10672         * testsuite/initpri1.c: Change all declarations to be full
10673         prototypes by adding void, to avoid compiler warnings.
10674
10675 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10676
10677         * options.cc (General_options::parse_plugin_opt): New.
10678         (General_options::add_plugin): The argument now is just the filename.
10679         (General_options::add_plugin_option): New.
10680         * options.h (plugin_opt): New.
10681         (add_plugin): Change argument name.
10682         (add_plugin_option): New.
10683         * plugin.cc (Plugin::load): Don't parse the plugin option.
10684         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10685         (Plugin::add_option): New.
10686         (Plugin::args_): Change type.
10687         (Plugin::filename_): New.
10688         (Plugin_manager::add_plugin_option): New.
10689         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10690         * testsuite/Makefile.in: Regenerate.
10691
10692 2008-12-05  Cary Coutant  <ccoutant@google.com>
10693
10694         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10695         Handle --strip-lto-sections option.
10696         * options.h (strip_lto_sections): New option.
10697
10698 2008-12-01  Cary Coutant  <ccoutant@google.com>
10699
10700         * plugin.cc (ld_plugin_message): Change format parameter to const.
10701         Fix mismatch between new[] and delete.
10702
10703 2008-11-14  Cary Coutant  <ccoutant@google.com>
10704
10705         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10706         instead of -1U.
10707
10708 2008-11-05  Craig Silverstein  <csilvers@google.com>
10709
10710         * options.cc (General_options::parse_dynamic_list): New function.
10711         * options.h (General_options): New flags dynamic_list,
10712         dynamic_list_data, dynamic_list_cpp_new, and
10713         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10714         (General_options::in_dynamic_list): New function.
10715         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10716         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10717         (Lex::can_continue_name): Likewise.
10718         (yylex): Likewise.
10719         (read_script_file): New parameter script_options.
10720         (read_dynamic_list): New function.
10721         (Script_options::define_dynamic_list): New function.
10722         (dynamic_list_keyword_parsecodes): New variable.
10723         (dynamic_list_keywords): New variable.
10724         * script.h (Script_options::define_dynamic_list): New function
10725         prototype.
10726         (read_dynamic_list): New function prototype.
10727         * symtab.cc (strprefix): New macro.
10728         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10729         dynamic_list_data, dynamic_list_cpp_new, and
10730         dynamic_list_cpp_typeinfo.
10731         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10732         (dynamic_list_expr): New rule.
10733         (dynamic_list_nodes): Likewise.
10734         (dynamic_list_node): Likewise.
10735         * testsuite/Makefile.am (dynamic_list): New test.
10736         * testsuite/Makefile.in: Regenerated.
10737         * testsuite/dynamic_list.t: New file.
10738         * testsuite/dynamic_list.sh: New file.
10739
10740 2008-11-05  Craig Silverstein  <csilvers@google.com>
10741
10742         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10743         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10744         (t11_last): Likewise.
10745         * testsuite/ver_test_6.c (main): Likewise.
10746
10747 2008-10-07  Cary Coutant  <ccoutant@google.com>
10748
10749         * options.c (General_options::finalize): Add check for -static and
10750         -shared.
10751         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10752         is not empty.
10753
10754 2008-10-02  Cary Coutant  <ccoutant@google.com>
10755
10756         * plugin.cc (make_sized_plugin_object): Fix conditional
10757         compilation to work when not all targets are enabled.
10758
10759 2008-09-29  Cary Coutant  <ccoutant@google.com>
10760
10761         * archive.cc (Archive::get_file_and_offset): Use filename instead
10762         of name to get library path.
10763         (Archive::include_member): Unlock external member of a thin archive.
10764
10765         * testsuite/Makefile.am (TEST_AR): New variable.
10766         (thin_archive_test_1): New test.
10767         (thin_archive_test_2): New test.
10768         * testsuite/Makefile.in: Regenerate.
10769         * testsuite/thin_archive_main.cc: New file.
10770         * testsuite/thin_archive_test_1.cc: New file.
10771         * testsuite/thin_archive_test_2.cc: New file.
10772         * testsuite/thin_archive_test_3.cc: New file.
10773         * testsuite/thin_archive_test_4.cc: New file.
10774
10775 2008-09-29  Cary Coutant  <ccoutant@google.com>
10776
10777         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10778         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10779         instead of -1U.
10780         (Sized_relobj::do_finalize_local_symbols): Likewise.
10781         (Sized_relobj::map_to_kept_section): Likewise.
10782         * object.h (Sized_relobj::invalid_address): New constant.
10783         (Sized_relobj::do_output_section_offset): Check for invalid_address
10784         and return -1ULL.
10785         * output.cc (Output_reloc::local_section_offset): Use constant
10786         invalid_address instead of -1U.
10787         (Output_reloc::get_address): Likewise.
10788         (Output_section::output_address): Change -1U to -1ULL.
10789         * output.h (Output_reloc::invalid_address): New constant.
10790         * reloc.cc (Sized_relobj::write_sections): Use constant
10791         invalid_address instead of -1U.
10792         (Sized_relobj::relocate_sections): Likewise.
10793         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10794         values for merge sections.
10795         * target-reloc.h (relocate_for_relocatable): Use constant
10796         invalid_address instead of -1U.
10797
10798 2008-09-19  Cary Coutant  <ccoutant@google.com>
10799
10800         Add plugin functionality for link-time optimization (LTO).
10801         * configure.ac (plugins): Add --enable-plugins option.
10802         * configure: Regenerate.
10803         * config.in: Regenerate.
10804         * Makefile.am (LIBDL): New variable.
10805         (CCFILES): Add plugin.cc.
10806         (HFILES): Add plugin.h.
10807         (ldadd_var): Add LIBDL.
10808         * Makefile.in: Regenerate.
10809
10810         * archive.cc: Include "plugin.h".
10811         (Archive::setup): Don't preread archive symbols when using a plugin.
10812         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10813         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10814         files.
10815         (Archive::include_member): Add symbols from plugin objects.
10816         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10817         * descriptors.cc (Descriptors::open): Check for file descriptors
10818         abandoned by plugins.
10819         (Descriptors::claim_for_plugin): New function.
10820         * descriptors.h (Descriptors::claim_for_plugin): New function.
10821         (Open_descriptor::is_claimed): New field.
10822         (claim_descriptor_for_plugin): New function.
10823         * fileread.cc (File_read::claim_for_plugin): New function.
10824         * fileread.h (File_read::claim_for_plugin): New function.
10825         (File_read::descriptor): New function.
10826         * gold.cc: Include "plugin.h".
10827         (queue_initial_tasks): Add task to call plugin hooks for generating
10828         new object files.
10829         * main.cc: Include "plugin.h".
10830         (main): Load plugin libraries.
10831         * object.h (Pluginobj): Declare.
10832         (Object::pluginobj): New function.
10833         (Object::do_pluginobj): New function.
10834         (Object::set_target): New function.
10835         * options.cc: Include "plugin.h".
10836         (General_options::parse_plugin): New function.
10837         (General_options::General_options): Initialize plugins_ field.
10838         (General_options::add_plugin): New function.
10839         * options.h (Plugin_manager): Declare.
10840         (General_options): Add --plugin option.
10841         (General_options::has_plugins): New function.
10842         (General_options::plugins): New function.
10843         (General_options::add_plugin): New function.
10844         (General_options::plugins_): New field.
10845         * plugin.cc: New file.
10846         * plugin.h: New file.
10847         * readsyms.cc: Include "plugin.h".
10848         (Read_symbols::do_read_symbols): Check for archive before checking
10849         for ELF file.  Call plugin hooks to claim files.
10850         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10851         from a real object file; force override when processing replacement
10852         files.
10853         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10854         (Symbol::init_base_object): Likewise.
10855         (Symbol::init_base_output_data): Likewise.
10856         (Symbol::init_base_output_segment): Likewise.
10857         (Symbol::init_base_constant): Likewise.
10858         (Symbol::init_base_undefined): Likewise.
10859         (Symbol::output_section): Assert that object is not a plugin.
10860         (Symbol_table::add_from_pluginobj): New function.
10861         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10862         undefined.
10863         (Symbol_table::sized_write_globals): Likewise.
10864         (Symbol_table::add_from_pluginobj): Instantiate template.
10865         * symtab.h (Sized_pluginobj): Declare.
10866         (Symbol::in_real_elf): New function.
10867         (Symbol::set_in_real_elf): New function.
10868         (Symbol::in_real_elf_): New field.
10869         (Symbol_table::add_from_pluginobj): New function.
10870
10871         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10872         (LIBDL): New variable.
10873         (LDADD): Add LIBDL.
10874         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10875         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10876         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10877         (MOSTLYCLEANFILES): Likewise.
10878         * testsuite/Makefile.in: Regenerate.
10879         * testsuite/plugin_test.c: New file.
10880         * testsuite/plugin_test_1.sh: New file.
10881         * testsuite/plugin_test_2.sh: New file.
10882
10883 2008-09-16  Ian Lance Taylor  <iant@google.com>
10884
10885         * target-reloc.h (relocate_section): Check whether a symbol is
10886         defined by the ABI before reporting an undefined symbol error.
10887         * target.h (Target::is_defined_by_abi): Make parameter const.
10888         (Target::do_is_defined_by_abi): Likewise.
10889         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10890         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10891         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10892         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10893         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10894         * testsuite/Makefile.in: Rebuild.
10895
10896         * fileread.cc (make_view): Add casts to avoid warning.
10897
10898 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10899
10900         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10901         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10902
10903 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10904
10905         * options.h (General_options::output_is_executable): New.
10906         (General_options::output_is_pie): New.
10907         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10908         for shared libraries.
10909         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10910
10911 2008-09-11  Chris Demetriou  <cgd@google.com>
10912
10913         * options.h (origin): New -z option.
10914         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10915         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10916         in DT_FLAGS_1.
10917
10918 2008-09-05  Cary Coutant  <ccoutant@google.com>
10919
10920         * fileread.cc (File_read::make_view): Add check for attempt to map
10921         beyond end of file.
10922
10923 2008-09-05  Cary Coutant  <ccoutant@google.com>
10924
10925         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10926         explicit instantiations.
10927
10928 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10929
10930         PR gold/6858
10931         * options.cc (General_options::finalize): Allow undefined symbols
10932         in shlibs if linking -shared.
10933
10934         PR gold/6859
10935         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10936         symbols as not needing a dynsym entry.
10937
10938 2008-08-20  Craig Silverstein  <csilvers@google.com>
10939
10940         * fileread.cc (File_read::open): Do not lock the file unless it
10941         was successfully opened.
10942
10943 2008-08-14  Cary Coutant  <ccoutant@google.com>
10944
10945         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10946         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10947         * testsuite/tls_test.cc (struct int128): 128-bit struct
10948         for testing TLS relocs with non-zero addend.
10949         (v12): New TLS variable.
10950         (t12): New test.
10951         (t_last): Add check for v12.
10952         * testsuite/tls_test.h (t12): New function.
10953         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10954
10955 2008-08-13  Ian Lance Taylor  <iant@google.com>
10956
10957         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10958         set tls_segment_ or relro_segment_.
10959         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10960         when appropriate.
10961         * output.h (Output_section::clear_is_relro): New function.
10962         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10963         sections specially even when output_data_ is empty.
10964         (Output_segment::maximum_alignment): When first section is relro,
10965         only force alignment for PT_LOAD segments.
10966         * script.cc (script_data_segment_align): New function.
10967         (script_data_segment_relro_end): New function.
10968         * script-c.h (script_data_segment_align): Declare.
10969         (script_data_segment_relro_end): Declare.
10970         * script-sections.h (class Script_sections): Declare
10971         data_segment_align and data_segment_relro_end.  Add fields
10972         segment_align_index_ and saw_relro_end_.
10973         * script-sections.cc (class Sections_element): Add set_is_relro
10974         virtual function.  Add new bool* parameter to place_orphan_here.
10975         Add get_output_section virtual function.
10976         (class Output_section_definition): Add set_is_relro.  Add new
10977         bool* parameter to place_orphan_here.  Add get_output_section.
10978         Add is_relro_ field.
10979         (Output_section_definition::Output_section_definition): Initialize
10980         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10981         and is_relro_ fields.
10982         (Output_section_definition::place_orphan_here): Add is_relro
10983         parameter.
10984         (Output_section_definition::set_section_addresses): Set relro for
10985         output section.
10986         (Output_section_definition::alternate_constraint): Likewise.
10987         (class Orphan_output_section): Add new bool* parameter to
10988         place_orphan_here.  Add get_output_section.
10989         (Orphan_output_section::place_orphan_here): Add is_relro
10990         parameter.
10991         (Script_sections::Script_sections): Initialize
10992         data_segment_align_index_ and saw_relro_end_.
10993         (Script_sections::data_segment_align): New function.
10994         (Script_sections::data_segment_relro_end): New function.
10995         (Script_sections::place_orphan): Set or clear is_relro.
10996         (Script_sections::set_section_addresses): Force alignment of first
10997         TLS section.
10998         * yyscript.y (exp): Call script_data_segment_align and
10999         script_data_segment_relro_end.
11000         * testsuite/relro_script_test.t: New file.
11001         * testsuite/relro_test.cc (using_script): Declare.
11002         (t1, t2): Test using_script.
11003         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11004         (relro_script_test_SOURCES): Define.
11005         (relro_script_test_DEPENDENCIES): Define.
11006         (relro_script_test_LDFLAGS): Define.
11007         (relro_script_test_LDADD): Define.
11008         (relro_script_test.so): New target.
11009         * testsuite/Makefile.in: Rebuild.
11010
11011 2008-08-06  Cary Coutant <ccoutant@google.com>
11012
11013         * archive.cc (Archive::total_archives, Archive::total_members)
11014         (Archive::total_members_loaded): New variables.
11015         (Archive::setup): Add parameter.  Add option to preread
11016         archive symbols.
11017         (Archive::read_armap): Add counter.
11018         (Archive::get_file_and_offset): New function.
11019         (Archive::get_elf_object_for_member): New function.
11020         (Archive::read_all_symbols): New function.
11021         (Archive::read_symbols): New function.
11022         (Archive::add_symbols): Add counters.
11023         (Archive::include_all_members): Use armap to find members if it's
11024         already built.
11025         (Archive::include_member): Skip reading symbols if already read.
11026         Factored code into Archive::get_file_and_offset and
11027         Archive::get_elf_object_for_member.  Changed call to
11028         Mapfile::report_include_archive_member.
11029         (Archive::print_stats): New function.
11030         * archive.h: Declare Object and Read_symbols_data classes.
11031         (Archive::Archive): Add initializers for new members.
11032         (Archive::setup): Add parameter.
11033         (Archive::print_stats): New function.
11034         (Archive::total_archives, Archive::total_members)
11035         (Archive::total_members_loaded): New variables.
11036         (Archive::get_file_and_offset): New function.
11037         (Archive::get_elf_object_for_member): New function.
11038         (Archive::read_all_symbols): New function.
11039         (Archive::read_symbols): New function.
11040         (Archive::Archive_member): New class.
11041         (Archive::members_): New member.
11042         (Archive::num_members_): New member.
11043         * main.cc: Include archive.h.
11044         (main): Call Archive::print_stats.
11045         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11046         archive parameter; member_name is now the fully-decorated name.
11047         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11048         * options.h: (General_options): Add --preread-archive-symbols option.
11049         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11050         Archive::setup.
11051
11052 2008-08-04  Ian Lance Taylor  <iant@google.com>
11053
11054         * symtab.h (Symbol::use_plt_offset): New function.
11055         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11056         * powerpc.cc (Relocate::relocate): Likewise.
11057         * sparc.cc (Relocate::relocate): Likewise.
11058         * x86_64.cc (Relocate::relocate): Likewise.
11059         * testsuite/weak_plt.sh: New test.
11060         * testsuite/weak_plt_main.cc: New test.
11061         * testsuite/weak_plt_shared.cc: New test.
11062         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11063         (check_PROGRAMS): Add weak_plt.
11064         (check_DATA): Add weak_plt_shared.so.
11065         (weak_plt_main_pic.o, weak_plt): New targets.
11066         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11067         * testsuite/Makefile.in: Rebuild.
11068
11069         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11070         gcctestdir/ld.
11071         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11072         * testsuite/Makefile.in: Rebuild.
11073
11074 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11075
11076         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11077         * Makefile.in: Regenerate.
11078         * po/POTFILES.in: Regenerate.
11079
11080 2008-07-29  Ian Lance Taylor  <iant@google.com>
11081
11082         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11083         symbols before other symbols.
11084         * testsuite/script_test_2.cc (test_addr): Declare.
11085         (test_addr_alias): Declare.
11086         (main): Check that test_addr and test_addr_alias have the right
11087         values.
11088         * testsuite/script_test_2.t: Define test_addr_alias and
11089         test_addr.
11090
11091 2008-07-24  Ian Lance Taylor  <iant@google.com>
11092
11093         PR 5990
11094         * descriptors.cc: New file.
11095         * descriptors.h: New file.
11096         * gold-threads.h (class Hold_optional_lock): New class.
11097         * fileread.cc: Include "descriptors.h".
11098         (File_read::~File_read): Release descriptor rather than closing
11099         it.
11100         (File_read::open) [file]: Call open_descriptor rather than open.
11101         Set is_descriptor_opened_.
11102         (File_read::open) [memory]: Assert that descriptor is not open.
11103         (File_read::reopen_descriptor): New function.
11104         (File_read::release): Release descriptor.
11105         (File_read::do_read): Make non-const.  Reopen descriptor.
11106         (File_read::read): Make non-const.
11107         (File_read::make_view): Reopen descriptor.
11108         (File_read::do_readv): Likewise.
11109         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11110         Update declarations.
11111         * layout.cc: Include "descriptors.h".
11112         (Layout::create_build_id): Use open_descriptor rather than open.
11113         * output.cc: Include "descriptors.h".
11114         (Output_file::open): Use open_descriptor rather than open.
11115         * archive.cc (Archive::const_iterator): Change Archive to be
11116         non-const.
11117         (Archive::begin, Archive::end): Make non-const.
11118         (Archive::count_members): Likewise.
11119         * archive.h (class Archive): Update declarations.
11120         * object.h (Object::read): Make non-const.
11121         * Makefile.am (CCFILES): Add descriptors.cc.
11122         (HFILES): Add descriptors.h.
11123         * Makefile.in: Rebuild.
11124
11125         PR 6716
11126         * gold.h: Always include <clocale>.  Add Solaris workarounds
11127         following code in binutils/sysdep.h.
11128
11129         PR 6048
11130         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11131         this->eh_frame_hdr_ is NULL before using it.
11132
11133         * dynobj.cc (Versions::Versions): Update comment.
11134
11135         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11136         the base version name.
11137
11138         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11139         array size plus one.
11140         (Stringpool_template::set_string_offsets): Subtract one from key
11141         before using it as an array index.
11142         (Stringpool_template::get_offset_with_length): Likewise.
11143         (Stringpool_template::write_to_buffer): Likewise.
11144         * stringpool.h (Stringpool_template::get_offset_from_key):
11145         Likewise.
11146
11147 2008-07-23  Ian Lance Taylor  <iant@google.com>
11148
11149         PR 6658
11150         * object.h (Merged_symbol_value::value): Do our best to handle a
11151         negative addend.
11152
11153         PR 6647
11154         * script.cc (Version_script_info::get_versions): Don't add empty
11155         version tag to return value.
11156         (Version_script_info::get_symbol_version_helper): Change return
11157         type to bool.  Add pversion parameter.  Change all callers.
11158         (script_register_vers_node): Don't require a non-NULL tag.
11159         * script.h (class Version_script_info): Update declarations.
11160         (Version_script_info::get_symbol_version): Change return type to
11161         bool.  Add version parameter.  Change all callers.
11162         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11163         handling.  Handle an empty version from a version script.
11164         (Symbol_table::define_special_symbol): Likewise.
11165         * testsuite/ver_test_10.script: New file.
11166         * testsuite/ver_test_10.sh: New file.
11167         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11168         (check_DATA): Add ver_test_10.syms.
11169         (ver_test_10.syms, ver_test_10.so): New target.
11170         * testsuite/Makefile.in: Rebuild.
11171
11172 2008-07-23  Simon Baldwin  <simonb@google.com>
11173
11174         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11175         to zero for undefined symbols from dynamic libraries.
11176
11177 2008-07-23  Ian Lance Taylor  <iant@google.com>
11178
11179         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11180         Change all callers.
11181         * symtab.h (class Symbol_table): Update declaration.
11182         * testsuite/ver_test_9.cc: New file.
11183         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11184         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11185         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11186         (ver_test_9.so, ver_test_9.o): New targets.
11187         * testsuite/Makefile.in: Rebuild.
11188
11189 2008-07-22  Ian Lance Taylor  <iant@google.com>
11190
11191         * options.h (class General_options): Define --check-sections.
11192         * layout.cc (Layout::set_segment_offsets): Handle
11193         --check-sections.
11194
11195         * options.h (class General_options): Define -n/--nmagic and
11196         -N/--omagic.
11197         * options.cc (General_options::finalize): For -n/--nmagic or
11198         -N/--omagic, set -static.
11199         * layout.cc (Layout::attach_allocated_section_to_segment): If
11200         -N/--omagic, don't put read-only and read-write sections in
11201         different segments.
11202         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11203         finding a read-only segment.
11204         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11205         don't set the minimum segment alignment to the common page size,
11206         and don't set the file offset to the address modulo the page size.
11207         * script-sections.cc (Script_sections::create_segments): If
11208         -n/--omagic, don't put read-only and read-write sections in
11209         different segments.
11210
11211         * cref.cc: New file.
11212         * cref.h: New file.
11213         * options.h (class General_options): Add --print-symbol-counts.
11214         * main.cc (main): Issue defined symbol report if requested.
11215         * archive.cc (Archive::interpret_header): Make into a const member
11216         function.
11217         (Archive::add_symbols): Call Input_objects::archive_start and
11218         archive_stop.
11219         (Archive::const_iterator): Define new class.
11220         (Archive::begin, Archive::end): New functions.
11221         (Archive::include_all_members): Rewrite to use iterator.
11222         (Archive::count_members): New function.
11223         * archive.h (class Archive): Update declarations.
11224         (Archive::filename): New function.
11225         * object.cc: Include "cref.h".
11226         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11227         (Sized_relobj::do_get_global_symbol_counts): New function.
11228         (Input_objects::add_object): Add object to cross-referencer.
11229         (Input_objects::archive_start): New function.
11230         (Input_objects::archive_stop): New function.
11231         (Input_objects::print_symbol_counts): New function.
11232         * object.h: Declare Cref and Archive.
11233         (Object::get_global_symbol_counts): New function.
11234         (Object::do_get_global_symbol_counts): New pure virtual function.
11235         (class Sized_relobj): Add defined_count_ field.  Update
11236         declarations.
11237         (class Input_objects): Add cref_ field.  Update constructor.
11238         Update declarations.
11239         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11240         defined_count_.
11241         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11242         symbol counts.
11243         (Sized_dynobj::do_get_global_symbol_counts): New function.
11244         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11245         defined_count_.  Update declarations.  Define Symbols typedef.
11246         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11247         parameter.  Change all callers.
11248         (Symbol_table::add_from_dynobj): Add sympointers and defined
11249         parameters.  Change all callers.
11250         * symtab.h (class Symbol_table): Update declarations.
11251         * Makefile.am (CCFILES): Add cref.cc.
11252         (HFILES): Add cref.h.
11253         * Makefile.in: Rebuild.
11254
11255 2008-07-22  Simon Baldwin  <simonb@google.com>
11256
11257         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11258         to zero when writing undefined symbols.
11259
11260 2008-07-22  Ian Lance Taylor  <iant@google.com>
11261
11262         * output.cc (Output_section::add_input_section): Don't try to
11263         merge empty merge sections.
11264
11265 2008-07-21  Craig Silverstein  <csilvers@google.com>
11266
11267         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11268         Include symbol version in error message.
11269
11270 2008-07-20  Chris Demetriou  <cgd@google.com>
11271
11272         * configure.ac (gold_cv_c_random_seed): New configured variable.
11273         (RANDOM_SEED_CFLAGS): New substituted variable.
11274         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11275         * configure: Rebuild.
11276         * Makefile.in: Likewise.
11277         * testsuite/Makefile.in: Likewise.
11278
11279 2008-07-18  Ian Lance Taylor  <iant@google.com>
11280
11281         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11282         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11283         * testsuite/ver_test_main.cc (main): Call t4.
11284         (t4, t4_2a): Define.
11285         * testsuite/ver_test_2.cc (t4_2): Define.
11286         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11287         * testsuite/ver_test_4.cc (t4_2a): Define.
11288         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11289         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11290
11291 2008-07-17  Ian Lance Taylor  <iant@google.com>
11292
11293         * dynobj.cc (Versions::add_def): If we give an error about a
11294         missing version, go ahead and create the version anyhow.
11295
11296 2008-07-10  Ian Lance Taylor  <iant@google.com>
11297
11298         Handle output sections with more than 0x7fffffff bytes.
11299         * object.h (class Relobj): Change map_to_output_ to
11300         output_sections_, and just keep a section pointer.  Change all
11301         uses.  Move comdat group support to Sized_relobj.
11302         (Relobj::is_section_specially_mapped): Remove.
11303         (Relobj::output_section): Remove poff parameter.  Change all
11304         callers.
11305         (Relobj::output_section_offset): New function.
11306         (Relobj::set_section_offset): Rewrite.
11307         (Relobj::map_to_output): Remove.
11308         (Relobj::output_sections): New function.
11309         (Relobj::do_output_section_offset): New pure virtual function.
11310         (Relobj::do_set_section_offset): Likewise.
11311         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11312         group support from Relobj.  Update declarations.
11313         (Sized_relobj::get_output_section_offset): New function.
11314         (Sized_relobj::do_output_section_offset): New function.
11315         (Sized_relobj::do_set_section_offset): New function.
11316         * object.cc (Relobj::output_section_address): Remove.
11317         (Sized_relobj::Sized_relobj): Initialize new fields.
11318         (Sized_relobj::include_section_group): Cast find_kept_object to
11319         Sized_relobj.
11320         (Sized_relobj::include_linkonce_section): Likewise.
11321         (Sized_relobj::do_layout): Use separate arrays for output section
11322         and output offset.
11323         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11324         output_sections.
11325         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11326         output_sections and section_offsets.
11327         (Sized_relobj::write_local_symbols): Likewise.
11328         (map_to_kept_section): Compute output address directly.
11329         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11330         output_sections and section_offsets.
11331         (Sized_relobj::write_sections): Likewise.
11332         (Sized_relobj::relocate_sections): Likewise.
11333         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11334         * output.h (class Output_reloc): Update declarations.  Change
11335         u2_.relobj to Sized_relobj*.
11336         (class Output_data_reloc): Change add functions to use
11337         Sized_relobj*.
11338         * output.cc (Output_reloc::Output_reloc): Change relobj to
11339         Sized_relobj*.
11340         (Output_reloc::local_section_offset): Change return type to
11341         Elf_Addr.  Use get_output_section_offset.
11342         (Output_reloc::get_address): Likewise.
11343         (Output_section::is_input_address_mapped): Don't call
11344         is_section_specially_mapped.
11345         (Output_section::output_offset): Likewise.
11346         (Output_section::output_address): Likewise.
11347         (Output_section::starting_output_address): Likewise.
11348         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11349         parameter to Sized_relobj*.
11350         (Copy_relocs::need_copy_reloc): Likewise.
11351         (Copy_relocs::save): Likewise.
11352         * copy-relocs.h (class Copy_relocs): Update declarations.
11353         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11354         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11355         * target-reloc.h (relocate_for_relocatable): Change
11356         offset_in_output_section type to Elf_Addr.  Change code that uses
11357         it as well.
11358         * layout.cc (Layout::layout): Always set *off.
11359         * mapfile.cc (Mapfile::print_input_section): Use
11360         output_section_offset.
11361         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11362         Sized_relobj*.
11363         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11364         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11365         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11366
11367 2008-07-03  Ian Lance Taylor  <iant@google.com>
11368
11369         * layout.cc (Layout::include_section): Do not discard unrecognized
11370         SHT_STRTAB sections.
11371
11372 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11373
11374         * script.cc (Lex::can_continue_name): Make '?' allowable in
11375         version-script names.
11376         * testsuite/version_script.map: Change glob pattern to use '?'
11377
11378 2008-06-30  Manish Singh  <yosh@gimp.org>
11379
11380         PR 6585
11381         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11382         Correct typo.
11383
11384 2008-06-30  Ian Lance Taylor  <iant@google.com>
11385
11386         PR 6660
11387         PR 6682
11388         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11389         versions]: Don't try to read the value in the contents, since we
11390         don't use it.  Use the template endianness when writing.
11391
11392 2008-06-25  Cary Coutant  <ccoutant@google.com>
11393
11394         * fileread.cc (File_read::make_view): Assert on zero-length view.
11395         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11396         symbol table when there are no symbols to read.
11397
11398 2008-06-23  Craig Silverstein  <csilvers@google.com>
11399
11400         * version.cc (version_string): Bump to 1.7
11401
11402 2008-06-18  Craig Silverstein  <csilvers@google.com>
11403
11404         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11405         constant 0xFFFF to type Valtype.
11406         (Powerpc_relocate_functions::rel16_ha): Likewise.
11407
11408 2008-06-17  Ian Lance Taylor  <iant@google.com>
11409
11410         * output.h (Output_section::Input_section): Initialize p2align_ to
11411         zero for Output_section_data constructors.
11412         (Output_section::Input_section::addralign): If not an input
11413         section, return the alignment of the Output_section_data.
11414         * testsuite/copy_test.cc: New file.
11415         * testsuite/copy_test_1.cc: New file.
11416         * testsuite/copy_test_2.cc: New file.
11417         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11418         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11419         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11420         (copy_test_1_pic.o, copy_test_1.so): New targets.
11421         (copy_test_2_pic.o, copy_test_2.so): New targets.
11422         * testsuite/Makefile.in: Rebuild.
11423
11424         * script-sections.cc (Script_sections::place_orphan): Initialize
11425         local variable exact.
11426
11427 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11428
11429         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11430
11431 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11432             David S. Miller  <davem@davemloft.net>
11433
11434         * powerpc.cc: New file.
11435         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11436         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11437         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11438         * Makefile.in: Rebuild.
11439
11440 2008-06-09  Ian Lance Taylor  <iant@google.com>
11441
11442         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11443         <exception>.
11444         (throwing, orig_terminate): New static variables.
11445         (terminate_handler): New static function.
11446         (t2): Set terminate handler.
11447
11448 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11449
11450         PR 6584
11451         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11452         alignment.
11453
11454 2008-05-30  Cary Coutant  <ccoutant@google.com>
11455
11456         * archive.cc (Archive::include_all_members) Correct to step
11457         over symbol table and extended name table in thin archives.
11458
11459 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11460
11461         PR 6407
11462         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11463         calculation.
11464
11465 2008-05-28  Caleb Howe  <cshowe@google.com>
11466
11467         * reduced_debug_output.cc: New file.
11468         * reduced_debug_output.h: New file.
11469         * options.h (class General_options): Add --strip-debug-non-line.
11470         * options.cc (General_options::finalize): Add strip_debug_non_line
11471         to the strip heirarchy.
11472         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11473         fields.
11474         * layout.cc: Include "reduced_debug_output.h".
11475         (Layout::Layout): Initialize new fields.
11476         (line_only_debug_sections): New static array.
11477         (is_lines_only_debug_sections): New static inline function.
11478         (Layout::include_section): Handle --strip-debug-non-line.
11479         (Layout::make_output_section): If --strip-debug-non-line, build
11480         new output sections for .debug_abbrev and .debug_info.
11481         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11482         gold.  Warn about possible overflow.
11483         (read_signed_LEB_128): Likewise.
11484         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11485         (read_signed_LEB_128): Declare.
11486         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11487         (HFILES): Add reduced_debug_output.h.
11488         * Makefile.in: Rebuild.
11489
11490 2008-05-21  Ian Lance Taylor  <iant@google.com>
11491
11492         * mapfile.cc: New file.
11493         * mapfile.h: New file.
11494         * options.h (class General_options): Add -M/--print-map and -Map.
11495         * options.cc (General_options::finalize): Make -M equivalent to
11496         -Map -.
11497         * main.cc: Include <cstdio> and "mapfile.h".
11498         (main): Open mapfile if requested.
11499         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11500         constructor.  Change caller.
11501         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11502         (queue_middle_tasks): Likewise.
11503         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11504         declarations.
11505         * archive.cc: Include "mapfile.h".
11506         (Archive::add_symbols): Add mapfile parameter.  Change all
11507         callers.  Pass mapfile, symbol, and reason to include_member.
11508         (Archive::include_all_members): Add mapfile parameter.  Change all
11509         callers.
11510         (Archive::include_member): Add mapfile, sym, and why parameters.
11511         Change all callers.  Report inclusion to map file.
11512         * archive.h: Include "fileread.h".
11513         (class Archive): Update declarations.
11514         (Archive::file): New const method.
11515         (class Add_archive_symbols): Add mapfile_ field.  Update
11516         constructor.  Change all callers.
11517         * readsyms.h (class Read_symbols): Likewise.
11518         (class Finish_group): Likewise.
11519         (class Read_script): Likewise.
11520         * common.cc: Include "mapfile.h".
11521         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11522         all callers.
11523         (Symbol_table::do_allocate_commons): Likewise.
11524         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11525         symbol allocation to mapfile.
11526         * common.h (class Allocate_commons_task): Add mapfile_ field.
11527         Update constructor.  Change all callers.
11528         * symtab.h (class Symbol_table): Update declarations.
11529         * layout.cc: Include "mapfile.h".
11530         (Layout_task_runner::run): Print information to mapfile.
11531         (Layout::create_gold_note): Change Output_data_fixed_space to
11532         Output_data_zero_fill.
11533         (Layout::create_build_id): Likewise.
11534         (Layout::print_to_mapfile): New function.
11535         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11536         constructor.  Change caller.
11537         (class Layout): Declare print_to_mapfile.
11538         * output.cc (Output_section::Input_section::print_to_mapfile): New
11539         function.
11540         (Output_section::add_input_section): If producing a map, always
11541         add to input_sections_ list.
11542         (Output_section::do_print_to_mapfile): New function.
11543         (Output_segment::print_sections_to_mapfile): New function.
11544         (Output_segment::print_section_list_to_mapfile): New function.
11545         * output.h: Include "mapfile.h".
11546         (Output_data::print_to_mapfile): New function.
11547         (Output_data::do_print_to_mapfile): New virtual function.
11548         (Output_segment_headers::do_print_to_mapfile): New function.
11549         (Output_file_header::do_print_to_mapfile): New function.
11550         (Output_data_const::do_print_to_mapfile): New function.
11551         (class Output_data_const_buffer): Add map_name_ field.  Update
11552         constructor.  Change all callers.  Add do_print_to_mapfile
11553         function.
11554         (class Output_data_fixed_space): Likewise.
11555         (class Output_data_space): Likewise.
11556         (class Output_data_zero_fill): New class.
11557         (Output_data_strtab::do_print_to_mapfile): New function.
11558         (Output_data_reloc_base::do_print_to_mapfile): New function.
11559         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11560         (Output_data_group::do_print_to_mapfile): New function.
11561         (Output_data_got::do_print_to_mapfile): New function.
11562         (Output_data_dynamic::do_print_to_mapfile): New function.
11563         (Output_symtab_xindex::do_print_to_mapfile): New function.
11564         (class Output_section): Declare do_print_to_mapflie.  Declare
11565         print_to_mapfile in Input_section.
11566         (class Output_segment): Declare new functions.
11567         * object.h (Sized_relobj::symbol_count): New function.
11568         * script-sections.cc
11569         (Output_section_element_dot_assignment::set_section_addresses):
11570         Change Output_data_fixed_space to Output_data_zero_fill.
11571         (Output_data_expression::do_print_to_mapfile): New function.
11572         * script.cc (read_input_script): Add mapfile parameter.  Change
11573         all callers.
11574         * script.h (read_input_script): Update declaration.
11575         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11576         (Eh_frame::do_print_to_mapfile): New function.
11577         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11578         (Output_merge_string::do_print_to_mapfile): New function.
11579         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11580         function.
11581         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11582         function.
11583         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11584         function.
11585         * Makefile.am (CCFILES): Add mapfile.cc.
11586         (HFILES): Add mapfile.h.
11587         * Makefile.in: Rebuild.
11588
11589 2008-05-19  Ian Lance Taylor  <iant@google.com>
11590
11591         * options.h (class General_options): Add -z relro.
11592         * layout.cc (Layout::Layout): Initialize relro_segment_.
11593         (Layout::add_output_section_data): Return the output section.
11594         (Layout::make_output_section): Rcognize relro sections and mark
11595         them appropriately.
11596         (Layout::attach_allocated_section_to_segment): Put relro sections
11597         in a PT_GNU_RELRO segment.
11598         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11599         section as relro.
11600         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11601         PT_TLS segments.
11602         (Layout::linkonce_mapping): Map d.rel.ro.local to
11603         .data.rel.ro.local.
11604         (Layout::output_section_name): Us .data.rel.ro.local for any
11605         section which begins with that.
11606         * layout.h (class Layout): Update add_output_section_data
11607         declaration.  Add relro_segment_ field.
11608         * output.cc (Output_section::Output_section): Initialize is_relro_
11609         and is_relro_local_ fields.
11610         (Output_segment::add_output_section): Group relro sections.
11611         (Output_segment::is_first_section_relro): New function.
11612         (Output_segment::maximum_alignment): If there is a relro section,
11613         align the segment to the common page size.
11614         (Output_segment::set_section_addresses): Track whether we are
11615         looking at relro sections.  If the last section is a relro
11616         section, align to the common page size.
11617         (Output_segment::set_section_list_addresses): Add in_relro
11618         parameter.  Change all callers.  Align to the page size when
11619         moving from relro to non-relro section.
11620         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11621         segment.
11622         * output.h (class Output_section): Add is_relro_ and
11623         is_relro_local_ fields.
11624         (Output_section::is_relro): New function.
11625         (Output_section::set_is_relro): New function.
11626         (Output_section::is_relro_local): New function.
11627         (Output_section::set_is_relro_local): New function.
11628         (class Output_segment): Update declarations.
11629         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11630         * sparc.cc (Target_sparc::got_section): Likewise.
11631         * x86_64.cc (Target_x86_64::got_section): Likewise.
11632         * testsuite/relro_test_main.cc: New file.
11633         * testsuite/relro_test.cc: New file.
11634         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11635         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11636         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11637         (relro_test.so, relro_test_pic.o): New targets.
11638         * testsuite/Makefile.in: Rebuild.
11639
11640 2008-05-16  Ian Lance Taylor  <iant@google.com>
11641
11642         * output.cc (Output_segment::add_output_section): Remove front
11643         parameter.
11644         * output.h (class Output_segment): Remove
11645         add_initial_output_section and overloaded add_output_section.
11646         Update declaration of remaining add_output_section.
11647         * layout.cc (Layout::create_interp): Call add_output_section
11648         rather than add_initial_output_section.
11649         (Layout::finish_dynamic_section): Likewise.
11650
11651         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11652         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11653         know the dynamic type.
11654         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11655         field.  Initialize it in constructor.
11656         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11657         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11658         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11659         reloc.
11660
11661         * output.cc (Output_reloc::get_address): Change return type to
11662         Elf_Addr.
11663         * output.h (class Output_reloc): Update get_address declaration.
11664         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11665         for section addresses.
11666
11667 2008-05-09  Ian Lance Taylor  <iant@google.com>
11668
11669         PR 6493
11670         * gold.cc (gold_nomem): Use return value of write.
11671
11672 2008-05-08  Ian Lance Taylor  <iant@google.com>
11673
11674         * symtab.c (Symbol::init_base_output_data): Add version
11675         parameter.  Change all callers.
11676         (Symbol::init_base_output_segment): Likewise.
11677         (Symbol::init_base_constant): Likewise.
11678         (Symbol::init_base_undefined): Likewise.
11679         (Sized_symbol::init_output_data): Likewise.
11680         (Sized_symbol::init_output_segment): Likewise.
11681         (Sized_symbol::init_constant): Likewise.
11682         (Sized_symbol::init_undefined): Likewise.
11683         (Symbol_table::do_define_in_output_data): If the new symbol has a
11684         version, mark it as the default.
11685         (Symbol_table::do_define_in_output_segment): Likewise.
11686         (Symbol_table::do_define_as_constant): Likewise.
11687         * symtab.h (class Symbol): Update declarations.
11688         (class Sized_symbol): Likewise.
11689         * resolve.cc (Symbol::override_version): New function.
11690         (Symbol::override_base): Call override_version.
11691         (Symbol::override_base_with_special): Likewise.
11692         * testsuite/ver_script_8.script: New file.
11693         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11694         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11695         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11696         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11697
11698 2008-05-06  Ian Lance Taylor  <iant@google.com>
11699
11700         PR 6049
11701         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11702         functions.
11703         (class General_options): Remove existing --undefined, and add
11704         --no-undefined instead.  Add new --undefined as synonym for -u.
11705         * archive.cc (Archive::add_symbols): Check whether symbol was
11706         named with -u.
11707         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11708         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11709         all uses.  Add IS_UNDEFINED.  Update declarations to split
11710         different versions of init_base.  Declare init_base_undefined.
11711         (Symbol::is_defined): Handle IS_UNDEFINED.
11712         (Symbol::is_undefined): Likewise.
11713         (Symbol::is_weak_undefined): Call is_undefined.
11714         (Symbol::is_absolute): Handle IS_CONSTANT.
11715         (class Sized_symbol): Update declarations to split different
11716         versions of init.  Declare init_undefined.
11717         (class Symbol_table): Declare new functions.
11718         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11719         Change all callers.
11720         (Symbol::init_base_output_data): Likewise.
11721         (Symbol::init_base_output_segment): Likewise.
11722         (Symbol::init_base_constant): Likewise.
11723         (Symbol::init_base_undefined): New function.
11724         (Sized_symbol::init_object): Rename from init.  Change all
11725         callers.
11726         (Sized_symbol::init_output_data): Likewise.
11727         (Sized_symbol::init_output_segment): Likewise.
11728         (Sized_symbol::init_constant): Likewise.
11729         (Sized_symbol::init_undefined): New function.
11730         (Symbol_table::add_undefined_symbols_from_command_line): New
11731         function.
11732         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11733         function.
11734         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11735         (Symbol::output_section): Likewise.
11736         (Symbol::set_output_section): Likewise.
11737         (Symbol_table::sized_finalize_symbol): Likewise.
11738         (Symbol_table::sized_write_globals): Likewise.
11739         * resolve.cc (Symbol_table::should_override): Likewise.
11740         (Symbol::override_base_with_special): Likewise.
11741
11742         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11743         symbol, change it to have default visibility.
11744         * testsuite/protected_1.cc: New file.
11745         * testsuite/protected_2.cc: New file.
11746         * testsuite/protected_3.cc: New file.
11747         * testsuite/protected_main_1.cc: New file.
11748         * testsuite/protected_main_2.cc: New file.
11749         * testsuite/protected_main_3.cc: New file.
11750         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11751         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11752         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11753         (protected_1.so): New target.
11754         (protected_1_pic.o, protected_2_pic.o): New targets.
11755         (protected_3_pic.o): New target.
11756         (check_PROGRAMS): Add protected_2.
11757         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11758         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11759         * testsuite/Makefile.in: Rebuild.
11760
11761         * options.h (DEFINE_var): Add set_user_set_##varname__.
11762         (DEFINE_bool_alias): New macro.
11763         (class General_options): Define -Bstatic using DEFINE_bool_alias
11764         rather than DEFINE_special.  Add --undefined as an alias for -z
11765         defs.
11766         * options.cc (General_options::parse_Bstatic): Remove.
11767
11768         * options.h (class General_options): Add --fatal-warnings.
11769         * main.cc (main): Implement --fatal-warnings.
11770         * errors.h (Errors::warning_count): New function.
11771
11772         * options.h (class General_options): Add -Bsymbolic-functions.
11773         * symtab.h (Symbol::is_preemptible): Check for
11774         -Bsymbolic-functions.
11775
11776 2008-05-05  Ian Lance Taylor  <iant@google.com>
11777
11778         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11779         as noVARNAME rather than no-VARNAME.
11780         (class General_options): Add option -z combreloc.
11781         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11782         get_address.
11783         (Output_reloc::sort_before) [SHT_REL]: New function.
11784         (Output_reloc::sort_before) [SHT_RELA]: New function.
11785         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11786         Sort_relocs_comparison.
11787         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11788         parameter.  Change all callers.
11789         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11790         sort_relocs parameter.  Change all callers.
11791         * output.cc (Output_reloc::get_address): New function, broken out
11792         of write_rel.
11793         (Output_reloc::write_rel): Call it.
11794         (Output_reloc::compare): New function.
11795         (Output_data_reloc_base::do_write): Optionally sort relocs.
11796
11797         * configure.ac: If targ_extra_obj is set, link it in.
11798         * configure.tgt: Initialize all variables.
11799         (x86_64*): Set targ_extra_obj and targ_extra_size.
11800         * configure: Rebuild.
11801
11802         * object.cc (Sized_relobj::include_section_group): Adjust section
11803         indexes read from group data.  Build vector to pass to
11804         layout_group.
11805         * layout.cc (Layout::layout_group): Add flags and shndxes
11806         parameters.  Remove contents parameter.  Change caller.  Update
11807         explicit instantiations.
11808         * layout.h (class Layout): Update layout_group declaration.
11809         * output.cc (Output_data_group::Output_data_group): Add flags and
11810         input_shndxes parameters.  Remove contents parameter.  Change
11811         caller.
11812         (Output_data_group::do_write): Change input_sections_ to
11813         input_shndxes_.
11814         * output.h (class Output_data_group): Update constructor
11815         declaration.  Rename input_sections_ to input_shndxes_.
11816         * testsuite/many_sections_test.cc: Add template.
11817
11818 2008-04-30  Cary Coutant  <ccoutant@google.com>
11819
11820         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11821
11822         * layout.cc (Layout::include_section): Refactored check for debug
11823         info section.
11824         (Layout::add_comdat): Add new parameters.  Change type
11825         of signature parameter.  Add object and shndx to signatures table.
11826         (Layout::find_kept_object): New function.
11827         * layout.h: Include <cstring>.
11828         (Layout::is_debug_info_section): New function.
11829         (Layout::add_comdat): Add new parameters.
11830         (Layout::find_kept_object): New function.
11831         (Layout::Kept_section): New struct.
11832         (Layout::Signatures): Change type of map range.
11833         * object.cc (Relobj::output_section_address): New function.
11834         (Sized_relobj::include_section_group): Add new parameters.  Change
11835         calls to Layout::add_comdat.  Change to build table of kept comdat
11836         groups and table mapping discarded sections to kept sections.
11837         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11838         (Sized_relobj::do_layout): Change calls to include_section_group and
11839         include_linkonce_section.
11840         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11841         value to zero when section is discarded.
11842         (Sized_relobj::map_to_kept_section): New function.
11843         * object.h (Relobj::output_section_address): New function.
11844         (Relobj::Comdat_group): New type.
11845         (Relobj::find_comdat_group): New function.
11846         (Relobj::Comdat_group_table): New type.
11847         (Relobj::Kept_comdat_section): New type.
11848         (Relobj::Kept_comdat_section_table): New type.
11849         (Relobj::add_comdat_group): New function.
11850         (Relobj::set_kept_comdat_section): New function.
11851         (Relobj::get_kept_comdat_section): New function.
11852         (Relobj::comdat_groups_): New field.
11853         (Relobj::kept_comdat_sections_): New field.
11854         (Symbol_value::input_value): Update comment.
11855         (Sized_relobj::map_to_kept_section) New function.
11856         (Sized_relobj::include_linkonce_section): Add new parameter.
11857         * target-reloc.h (Comdat_behavior): New type.
11858         (get_comdat_behavior): New function.
11859         (relocate_section): Add code to map a discarded section to the
11860         corresponding kept section when applying a relocation.
11861
11862 2008-04-30  Craig Silverstein  <csilvers@google.com>
11863
11864         * dwarf_reader.cc (next_generation_count): New static var.
11865         (Addr2line_cache_entry): New struct.
11866         (addr2line_cache): New static var.
11867         (Dwarf_line_info::one_addr2line): Added caching.
11868         (Dwarf_line_info::clear_addr2line_cache): New function.
11869         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11870         cache-size parameter.
11871         (Dwarf_line_info::one_addr2line_cache): New function.
11872         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11873         new cache-size argument to one_addr2line(), and clear cache.
11874
11875 2008-04-28  Cary Coutant  <ccoutant@google.com>
11876
11877         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11878         R_386_PC8 relocations.
11879
11880 2008-04-23  Ian Lance Taylor  <iant@google.com>
11881
11882         * object.cc (Sized_relobj::include_section_group): Check for
11883         invalid section group.
11884
11885         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11886         header size.
11887
11888         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11889         than read for file header.
11890         * archive.cc (Archive::include_member): Likewise.
11891
11892 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11893
11894         * aclocal.m4: Regenerate.
11895         * configure: Regenerate.
11896
11897 2008-04-19  Ian Lance Taylor  <iant@google.com>
11898
11899         * version.cc (version_string): Bump to 1.6.
11900
11901         * testsuite/Makefile.am (many_sections_r_test): New target.
11902         (many_sections_r_test_SOURCES): Remove.
11903         (many_sections_r_test_DEPENDENCIES): Remove.
11904         (many_sections_r_test_LDFLAGS): Remove.
11905         (many_sections_r_test_LDADD): Remove.
11906
11907         * object.cc (Sized_relobj::do_add_symbols): Always pass
11908         local_symbol_count_ to add_from_relobj.
11909
11910         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11911         every thousand variables.
11912         * testsuite/Makefile.in: Rebuild.
11913
11914         * object.cc (Xindex::initialize_symtab_xindex): New function.
11915         (Xindex::read_symtab_xindex): New function.
11916         (Xindex::sym_xindex_to_shndx): New function.
11917         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11918         available.
11919         (Sized_relobj::do_initialize_xindex): New function.
11920         (Sized_relobj::do_read_symbols): Adjust section links.
11921         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11922         parameter.  Change all callers.
11923         (Sized_relobj::include_section_group): Adjust section links and
11924         symbol section indexes.
11925         (Sized_relobj::do_layout): Adjust section links.
11926         (Sized_relobj::do_count_local_symbols): Adjust section links and
11927         symbol section indexes.
11928         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11929         ordinary and special symbols.
11930         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11931         dynsym_xindex parameters.  Change all callers.  Adjust section
11932         links.  Use SHN_XINDEX when needed.
11933         (Sized_relobj::get_symbol_location_info): Adjust section links.
11934         Don't get fooled by special symbols.
11935         * object.h (class Xindex): Define.
11936         (class Object): Add xindex_ parameter.  Declare virtual functoin
11937         do_initialize_xindex.
11938         (Object::adjust_sym_shndx): New function.
11939         (Object::set_xindex): New protected function.
11940         (class Symbol_value): Add is_ordinary_shndx_ field.
11941         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11942         (Symbol_value::value): Assert ordinary section.
11943         (Symbol_value::initialize_input_to_output_map): Likewise.
11944         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11945         Change all callers.
11946         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11947         all callers.
11948         (class Sized_relobj): Update declarations.
11949         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11950         parameter.  Change all callers.
11951         (Sized_relobj::adjust_shndx): New function.
11952         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11953         field.
11954         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11955         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11956         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11957         (Sized_dynobj::read_dynsym_section): Adjust section links.
11958         (Sized_dynobj::read_dynamic): Likewise.
11959         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11960         section links.
11961         (Sized_dynobj::do_initialize_xindex): New function.
11962         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11963         do_initialize_xindex.
11964         (Sized_dynobj::adjust_shndx): New function.
11965         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11966         dynsym_xindex_ fields.
11967         (Layout::finalize): Add a call to set_section_indexes before
11968         creating the symtab sections.
11969         (Layout::set_section_indexes): Don't do anything if the section
11970         already has a section index.
11971         (Layout::create_symtab_sections): Add shnum parameter.  Change
11972         caller.  Create .symtab_shndx section if needed.
11973         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11974         caller.
11975         (Layout::allocated_output_section_count): New function.
11976         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11977         needed.
11978         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11979         fields.  Update declarations.
11980         (Layout::symtab_xindex): New function.
11981         (Layout::dynsym_xindex): New function.
11982         (class Write_symbols_task): Add layout_ field.
11983         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11984         Change caller.
11985         * output.cc (Output_section_headers::Output_section_headers): Add
11986         shstrtab_section parameter.  Change all callers.
11987         (Output_section_headers::do_sized_write): Store overflow values
11988         for section count and section string table section index in
11989         section header zero.
11990         (Output_file_header::do_sized_write): Check for overflow of
11991         section count and section string table section index.
11992         (Output_symtab_xindex::do_write): New function.
11993         (Output_symtab_xindex::endian_do_write): New function.
11994         * output.h (class Output_section_headers): Add shstrtab_section_.
11995         Update declarations.
11996         (class Output_symtab_xindex): Define.
11997         (Output_section::has_out_shndx): New function.
11998         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11999         field.
12000         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12001         Change all callers.
12002         (Sized_symbol::init): Likewise.
12003         (Symbol::output_section): Check for ordinary symbol.
12004         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12005         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12006         callers.
12007         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12008         Change all callers.  Simplify handling of symbols from sections
12009         not included in the link.
12010         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12011         distinction.
12012         (Weak_alias_sorter::operator()): Assert that symbols are
12013         ordinary.
12014         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12015         distinction.
12016         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12017         parameters.  Change all callers.
12018         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12019         symbol distinction.  Use SHN_XINDEX when needed.
12020         (Symbol_table::write_section_symbol): Add symtab_xindex
12021         parameter.  Change all callers.
12022         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12023         SHN_XINDEX when needed.
12024         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12025         declarations.
12026         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12027         (Symbol::is_defined): Check is_ordinary.
12028         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12029         (Symbol::is_absolute, Symbol::is_common): Likewise.
12030         (class Sized_symbol): Update declarations.
12031         (class Symbol_table): Update declarations.
12032         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12033         parameters.  Change all callers.
12034         (Sized_symbol::override): Likewise.
12035         (Symbol_table::override): Likewise.
12036         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12037         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12038         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12039         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12040         to be in an ordinary section.
12041         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12042         object and is_ordinary parameters.  Change all callers.
12043         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12044         Change all callers.  Don't add undefined or non-ordinary symbols
12045         to reloc_map_.
12046         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12047         Change all callers.
12048         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12049         declarations.
12050         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12051         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12052         (Sized_relobj::relocate_sections): Likewise.
12053         * target-reloc.h (scan_relocs): Adjust section symbol index.
12054         (scan_relocatable_relocs): Likewise.
12055         * i386.cc (Scan::local): Check for ordinary symbols.
12056         * sparc.cc (Scan::local): Likewise.
12057         * x86_64.cc (Scan::local): Likewise.
12058         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12059         to symbol_section_and_value.
12060         * testsuite/many_sections_test.cc: New file.
12061         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12062         (check_PROGRAMS): Add many_sections_test.
12063         (many_sections_test_SOURCES): Define.
12064         (many_sections_test_DEPENDENCIES): Define.
12065         (many_sections_test_LDFLAGS): Define.
12066         (BUILT_SOURCES): Add many_sections_define.h.
12067         (many_sections_define.h): New target.
12068         (BUILT_SOURCES): Add many_sections_check.h.
12069         (many_sections_check.h): New target.
12070         (check_PROGRAMS): Add many_sections_r_test.
12071         (many_sections_r_test_SOURCES): Define.
12072         (many_sections_r_test_DEPENDENCIES): Define.
12073         (many_sections_r_test_LDFLAGS): Define.
12074         (many_sections_r_test_LDADD): Define.
12075         (many_sections_r_test.o): New target.
12076         * testsuite/Makefile.in: Rebuild.
12077
12078 2008-04-17  Cary Coutant  <ccoutant@google.com>
12079
12080         * errors.cc (Errors::info): New function.
12081         (gold_info): New function.
12082         * errors.h (Errors::info): New function.
12083         * gold.h (gold_info): New function.
12084         * object.cc (Input_objects::add_object): Print trace output.
12085         * options.cc (options::parse_set): New function.
12086         (General_options::parse_wrap): Deleted.
12087         (General_options::General_options): Deleted initializer.
12088         * options.h (options::String_set): New typedef.
12089         (options::parse_set): New function.
12090         (DEFINE_set): New macro.
12091         (General_options::wrap): Changed to use DEFINE_set. Changed
12092         callers of any_wrap_symbols and is_wrap_symbol.
12093         (General_options::trace, General_options::trace_symbol):
12094         New options.
12095         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12096         (General_options::wrap_symbols_): Deleted.
12097         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12098
12099 2008-04-17  David S. Miller  <davem@davemloft.net>
12100
12101         * options.cc (General_options::parse_V): New function.
12102         * options.h: Add entries for -V and -Qy.
12103
12104 2008-04-17  Ian Lance Taylor  <iant@google.com>
12105
12106         * common.cc (Symbol_table::allocate_commons): Remove options
12107         parameter.  Change caller.
12108         (Symbol_table::do_allocate_commons): Remove options parameter.
12109         Change caller.  Just call do_allocate_commons_list twice.
12110         (Symbol_table::do_allocate_commons_list): New function, broken out
12111         of do_allocate_commons.
12112         * common.h (class Allocate_commons_task): Remove options_ field.
12113         Update constructor.
12114         * symtab.cc (Symbol_table::Symbol_table): Initialize
12115         tls_commons_.
12116         (Symbol_table::add_from_object): Put TLS common symbols on
12117         tls_commons_ list.
12118         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12119         which are IN_OUTPUT_DATA.
12120         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12121         allocate_commons and do_allocate_commons declarations.  Declare
12122         do_allocate_commons_list.
12123         * gold.cc (queue_middle_tasks): Update creation of
12124         Allocate_commons_task to not pass options.
12125         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12126         (TLS_TEST_C_FLAGS): New variable.
12127         (tls_test_c_pic.o): New target.
12128         (tls_test_shared.so): Link in tls_test_c_pic.o.
12129         (tls_test_c_pic_ie.o): New target.
12130         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12131         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12132         (tls_test_c.o): New target.
12133         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12134         (tls_pic_test_LDADD): Likewise.
12135         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12136         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12137         (tls_test_c_gnu2.o): New target.
12138         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12139         tls_test_c_gnu2.o.
12140         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12141         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12142         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12143         * testsuite/tls_test.cc: Include "config.h".
12144         (t_last): Call t11_last.
12145         * testsuite/tls_test.h (t11, t11_last): Declare.
12146         * testsuite/tls_test_c.c: New file.
12147         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12148         * configure.ac: Check for OpenMP support.
12149         * configure, config.in, Makefile.in: Rebuild.
12150         * testsuite/Makefile.in: Rebuild.
12151
12152 2008-04-16  Cary Coutant  <ccoutant@google.com>
12153
12154         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12155         (Target_i386::tls_base_symbol_defined_): New field.
12156         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12157         (Target_i386::Scan::global): Likewise.
12158         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12159         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12160         (Target_x86_64::tls_base_symbol_defined_): New field.
12161         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12162         (Target_x86_64::Scan::global): Likewise.
12163
12164 2008-04-16  Cary Coutant  <ccoutant@google.com>
12165
12166         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12167         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12168         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12169         building shared libraries.
12170         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12171         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12172         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12173         * testsuite/Makefile.in: Rebuild.
12174         * testsuite/weak_undef.h: New file.
12175         * testsuite/weak_undef_file1.cc: Add extra test cases.
12176         * testsuite/weak_undef_file2.cc: Likewise.
12177         * testsuite/weak_undef_test.cc: Likewise.
12178
12179 2008-04-16  David S. Miller  <davem@davemloft.net>
12180
12181         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12182         Add issued_non_pic_error_ field.  Declare check_non_pic.
12183         (Target_sparc::Scan::check_non_pic): New function.
12184         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12185         (Target_sparc::Scan::global): Likewise.
12186
12187         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12188         * configure: Rebuild.
12189
12190         * options.h (DEFINE_enable): New macro.
12191         (new_dtags): New enable option.
12192         (initfirst, interpose, loadfltr, nodefaultlib,
12193         nodelete, nodlopen, nodump): New -z options.
12194         * layout.cc (Layout:finish_dynamic_section): If new
12195         dtags enabled, emit DT_RUNPATH.  Also, emit a
12196         DT_FLAGS_1 containing any specified -z flags.
12197
12198 2008-04-16  Ian Lance Taylor  <iant@google.com>
12199
12200         * copy-relocs.cc: New file.
12201         * copy-relocs.h: New file.
12202         * reloc.cc: Remove Copy_relocs code.
12203         * reloc.h: Likewise.
12204         * reloc-types.h (struct Reloc_types) [both versions]: Add
12205         get_reloc_addend_noerror.
12206         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12207         variants of add_global which take an addend which must be zero.
12208         * i386.cc: Include "copy-relocs.h".
12209         (class Target_i386): Change type of copy_relocs_ to variable,
12210         update initializer.
12211         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12212         Change all callers.
12213         (Target_i386::do_finalize_sections): Change handling of
12214         copy_relocs_.
12215         * sparc.cc: Include "copy-relocs.h".
12216         (class Target_sparc): Change type of copy_relocs_ to variable,
12217         update initializer.
12218         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12219         Change all callers.
12220         (Target_sparc::do_finalize_sections): Change handling of
12221         copy_relocs_.
12222         * x86_64.cc: Include "copy-relocs.h".
12223         (class Target_x86_64): Change type of copy_relocs_ to variable,
12224         update initializer.
12225         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12226         class.  Change all callers.
12227         (Target_x86_64::do_finalize_sections): Change handling of
12228         copy_relocs_.
12229         * Makefile.am (CCFILES): Add copy-relocs.cc.
12230         (HFILES): Add copy-relocs.h.
12231
12232         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12233
12234         * testsuite/script_test_4.sh: Permit leading zeroes.
12235
12236 2008-04-15  Ian Lance Taylor  <iant@google.com>
12237
12238         * script-sections.cc (Script_sections::create_segments): Use
12239         header_size_adjustment even when there is enough room for the
12240         headers.
12241         * testsuite/script_test_4.sh: New file.
12242         * testsuite/script_test_4.t: New file.
12243         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12244         (check_DATA): Add script_test_4.stdout.
12245         (MOSTLYCLEANFILES): Likewise.
12246         (script_test_4): New target.
12247         (script_test_4.stdout): New target.
12248         * testsuite/Makefile.in: Rebuild.
12249
12250         * sparc.cc: Add definitions for Output_data_plt_sparc class
12251         constants.
12252
12253 2008-04-14  David S. Miller  <davem@davemloft.net>
12254
12255         * sparc.cc: New file.
12256         * Makefile.am (TARGETSOURCES): Add sparc.cc
12257         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12258         * configure.tgt: Document targ_extra_size and
12259         targ_extra_big_endian.  Add entries for sparc-* and
12260         sparc64-*.
12261         * configure.ac: Handle targ_extra_size and
12262         targ_extra_big_endian.
12263         * Makefile.in: Rebuild.
12264         * configure: Likewise.
12265         * po/POTFILES.in: Likewise.
12266         * po/gold.pot: Likewise.
12267
12268 2008-04-14  Ian Lance Taylor  <iant@google.com>
12269
12270         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12271         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12272         in the name/type/flags to section mapping.  Don't call
12273         allocate_output_section.
12274         (Layout::choose_output_section): Change parameter from adjust_name
12275         to is_input_section.  Don't permit input sections after sections
12276         are attached to segments.  Don't call allocate_output_section.
12277         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12278         not write_enable_output_section.
12279         (Layout::make_output_section): Don't push to
12280         unattached_section_list_ nor call attach_to_segment.  Call
12281         attach_section_to_segment if sections are attached.
12282         (Layout::attach_sections_to_segments): New function.
12283         (Layout::attach_section_to_segment): New function.
12284         (Layout::attach_allocated_section_to_segment): Rename from
12285         attach_to_segment.  Remove flags parameter.
12286         (Layout::allocate_output_section): Remove function.
12287         (Layout::write_enable_output_section): Remove function.
12288         * layout.h (class Layout): Update for above changes.  Add new
12289         field sections_are_attached_.
12290         * output.h (Output_section::update_flags_for_input_section): New
12291         function.
12292         * output.cc (Output_section::add_input_section): Call
12293         update_flags_for_input_section.
12294         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12295
12296 2008-04-11  Cary Coutant  <ccoutant@google.com>
12297
12298         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12299         thought unnecessary.
12300         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12301
12302 2008-04-11  Ian Lance Taylor  <iant@google.com>
12303
12304         * output.h (class Output_section_data): Remove inline definition
12305         of set_addralign.
12306         * output.cc (Output_section_data::set_addralign): New function.
12307
12308 2008-04-11  Cary Coutant  <ccoutant@google.com>
12309
12310         Add support for TLS descriptors for i386 and x86_64.
12311         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12312         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12313         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12314         GOT_TYPE_TLS_DESC.
12315         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12316         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12317         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12318         relocations.
12319         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12320         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12321         Fix problem with initial-exec relocations.
12322         (Target_i386::Relocate::relocate_tls): Likewise.
12323         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12324         relaxation.
12325         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12326         support for section-plus-offset dynamic table entries.
12327         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12328         (Output_data_dynamic::Dynamic_entry): Add support for
12329         section-plus-offset dynamic table entries.
12330         (Output_data_dynamic::Classification): Likewise.
12331         (Output_data_dynamic::classification_): Renamed offset_.
12332         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12333         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12334         (Target_x86_64::make_plt_section): New function.
12335         (Target_x86_64::reserve_tlsdesc_entries): New function.
12336         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12337         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12338         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12339         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12340         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12341         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12342         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12343         add extra PLT entry for TLS descriptors.
12344         (Output_data_plt_x86_64::got_): New field.
12345         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12346         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12347         fields.
12348         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12349         descriptors.
12350         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12351         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12352         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12353         R_386_TLS_DESC_CALL relocations.
12354         (Target_x86_64::Scan::global): Likewise.
12355         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12356         for TLS descriptors.
12357         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12358         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12359         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12360         GD-to-IE relaxation.
12361         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12362         and TLS_DESCRIPTORS.
12363         * Makefile.in: Rebuild.
12364         * configure: Rebuild.
12365         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12366         (tls_test_shared2.so): New target.
12367         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12368         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12369         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12370         (tls_shared_gd_to_ie_test_LDADD): New variable.
12371         (tls_shared_gnu2_gd_to_ie_test): New target.
12372         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12373         New targets.
12374         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12375         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12376         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12377         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12378         (tls_shared_gnu2_test): New target.
12379         (tls_test_gnu2_shared.so): New target.
12380         (tls_shared_gnu2_test_SOURCES): New variable.
12381         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12382         (tls_shared_gnu2_test_LDFLAGS): New variable.
12383         (tls_shared_gnu2_test_LDADD): New variable.
12384         * testsuite/Makefile.in: Rebuild.
12385         * testsuite/Makefile.
12386
12387 2008-04-11  Ian Lance Taylor  <iant@google.com>
12388
12389         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12390         justsyms.t.
12391         * testsuite/Makefile.in: Rebuild.
12392
12393         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12394         long.
12395         * testsuite/script_test_2.cc (main): Adjust test.
12396
12397 2008-04-11  David S. Miller  <davem@davemloft.net>
12398             Ian Lance Taylor  <iant@google.com>
12399
12400         * options.h (General_options): Add entries for '-Y' and
12401         '-relax'.
12402         * options.cc (General_options:finalize): If -Y was used, add those
12403         entries to the library path instead of the default "/lib" and
12404         "/usr/lib".
12405
12406 2008-04-11  David S. Miller  <davem@davemloft.net>
12407
12408         * testsuite/justsyms.t: Start at 0x100.
12409         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12410         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12411         long.
12412         * testsuite/script_test_2.cc: Adjust string and section length
12413         checks.
12414
12415 2008-04-09  Ian Lance Taylor  <iant@google.com>
12416
12417         PR gold/5996
12418         * script-sections.cc (Sections_element::allocate_to_segment): Add
12419         orphan parameter.
12420         (Output_section_definition::allocate_to_segment): Likewise.
12421         (Orphan_output_section::allocate_to_segment): Likewise.
12422         (Script_sections::attach_sections_using_phdrs_clause): Don't
12423         propagate non-PT_LOAD segments to orphan sections.
12424         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12425         readelf rather than objdump.
12426         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12427         .interp section and PT_INTERP segment are the same size.
12428         * testsuite/Makefile.in: Rebuild.
12429
12430         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12431         aliases for symbols defined in the same object.
12432         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12433         (weak_alias_test_SOURCES): New variable.
12434         (weak_alias_test_DEPENDENCIES): New variable.
12435         (weak_alias_test_LDFLAGS): New variable.
12436         (weak_alias_test_LDADD): New variable.
12437         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12438         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12439         (weak_alias_test_3.o): New target.
12440         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12441         * testsuite/weak_alias_test_main.cc: New file.
12442         * testsuite/weak_alias_test_1.cc: New file.
12443         * testsuite/weak_alias_test_2.cc: New file.
12444         * testsuite/weak_alias_test_3.cc: New file.
12445
12446 2008-04-08  Ian Lance Taylor  <iant@google.com>
12447
12448         * options.h (class General_options): Add --noinhibit-exec option.
12449         * main.cc (main): Check --noinhibit-exec.
12450
12451         * options.h (class General_options): Define --wrap as a special
12452         option.  Add wrap_symbols_ field.
12453         (General_options::any_wrap_symbols): New function.
12454         (General_options::is_wrap_symbol): New function.
12455         * options.cc (General_options::parse_wrap): New function.
12456         (General_options::General_options): Initialize wrap_symbols_.
12457         * symtab.cc (Symbol_table::wrap_symbol): New function.
12458         (Symbol_table::add_from_object): Handle --wrap.
12459         * symtab.h (class Symbol_table): Declare wrap_symbol.
12460         * target.h (Target::wrap_char): New function.
12461         (Target::Target_info): Add wrap_char field.
12462         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12463         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12464         * testsuite/testfile.cc (Target_test::test_target_info):
12465         Likewise.
12466
12467         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12468         there is one.
12469
12470         * layout.h (class Layout): Add added_eh_frame_data_ field.
12471         * layout.cc (Layout::Layout): Initialize new field.
12472         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12473         output section until we find a section we merged successfully.
12474         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12475         that the size be non-zero.
12476
12477         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12478         qualifier.
12479
12480 2008-04-08  Craig Silverstein  <csilvers@google.com>
12481
12482         * configure.ac: Export new conditional variable HAVE_ZLIB.
12483         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12484         on HAVE_ZLIB.
12485         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12486         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12487
12488 2008-04-07  Ian Lance Taylor  <iant@google.com>
12489
12490         * version.cc (version_string): Set to "1.5".
12491
12492         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12493         Add issued_non_pic_error_ field.  Declare check_non_pic.
12494         (Target_x86_64::Scan::check_non_pic): New function.
12495         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12496         (Target_x86_64::Scan::global): Likewise.
12497
12498         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12499         addend parameter.  Change caller.  Handle merge sections.
12500         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12501         Address to Addend.  Don't add in the result of
12502         local_section_offset, pass down the addend and use the returned
12503         value.
12504         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12505         Update declarations of local_section_offset and symbol_value.
12506         * testsuite/two_file_test_1.cc (t18): New function.
12507         * testsuite/two_file_test_2.cc (f18): New function.
12508         * testsuite/two_file_test_main.cc (main): Call t18.
12509         * testsuite/two_file_test.h (t18, f18): Declare.
12510
12511         * configure.ac: Don't test for objdump, c++filt, or readelf.
12512         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12513         conditionals.
12514         (TEST_READELF): New variable.
12515         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12516         (check_PROGRAMS): Add two_file_strip_test.
12517         (two_file_strip_test): New target.
12518         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12519         (two_file_same_shared_strip_test_SOURCES): New variable.
12520         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12521         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12522         (two_file_same_shared_strip_test_LDADD): New variable.
12523         (two_file_shared_strip.so): New target.
12524         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12525         (ver_test_5.syms, ver_test_7.syms): Likewise.
12526         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12527         (strip_test_3.stdout): Use TEST_OBJDUMP.
12528         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12529
12530 2008-04-04  Cary Coutant  <ccoutant@google.com>
12531
12532         * symtab.h (Symbol::is_weak_undefined): New function.
12533         (Symbol::is_strong_undefined): New function.
12534         (Symbol::is_absolute): New function.
12535         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12536         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12537         absolute symbols.
12538         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12539         (weak_undef_test): New target.
12540         * testsuite/Makefile.in: Rebuild.
12541         * testsuite/weak_undef_file1.cc: New file.
12542         * testsuite/weak_undef_file2.cc: New file.
12543         * testsuite/weak_undef_test.cc: New file.
12544
12545 2008-04-03  Craig Silverstein  <csilvers@google.com>
12546
12547         * compressed_output.h (class Output_compressed_section): Use
12548         unsigned buffer.
12549         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12550         add zlib header.
12551         (zlib_compressed_suffix): Removed.
12552         (Output_compressed_section::set_final_data_size): Use unsigned
12553         buffers.
12554         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12555         Fix linker invocation.
12556         (flagstest_o_specialfile_and_compress_debug_sections):
12557         Likewise.
12558         * testsuite/Makefile.in: Regenerated.
12559
12560 2008-04-02  David S. Miller  <davem@davemloft.net>
12561
12562         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12563         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12564
12565 2008-04-02  Craig Silverstein  <csilvers@google.com>
12566
12567         * TODO: New file.
12568
12569 2008-04-02  Ian Lance Taylor  <iant@google.com>
12570
12571         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12572         parameters.  Update for new key type to views_.  Change all
12573         callers.
12574         (File_read::read): Adjust for byteshift in returned view.
12575         (File_read::add_view): New function, broken out of
12576         find_and_make_view.
12577         (File_read::make_view): New function, broken out of
12578         find_and_make_view.
12579         (File_read::find_or_make_view): Add offset and aligned
12580         parameters.  Rewrite accordingly.  Change all callers.
12581         (File_read::get_view): Add offset and aligned parameters.  Adjust
12582         for byteshift in return value.
12583         (File_read::get_lasting_view): Likewise.
12584         * fileread.h (class File_read): Update declarations.
12585         (class File_read::View): Add byteshift_ field.  Add byteshift to
12586         constructor.  Add byteshift method.
12587         * archive.h (Archive::clear_uncached_views): New function.
12588         (Archive::get_view): Add aligned parameter.  Change all callers.
12589         * object.h (Object::get_view): Add aligned parameter.  Change all
12590         callers.
12591         (Object::get_lasting_view): Likewise.
12592
12593         * fileread.cc (File_read::release): Don't call clear_views if
12594         there are multiple objects.
12595         * fileread.h (File_read::clear_uncached_views): New function.
12596         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12597         on the archive.
12598
12599 2008-03-31  Cary Coutant  <ccoutant@google.com>
12600
12601         Add thin archive support.
12602         * archive.cc (Archive::armagt): New const.
12603         (Archive::setup): Remove task parameter and calls to unlock.
12604         (Archive::unlock_nested_archives): New function.
12605         (Archive::read_header): Add nested_off parameter. Change
12606         all callers.
12607         (Archive::interpret_header): Likewise.
12608         (Archive::include_all_members): Change to handle thin
12609         archives.
12610         (Archive::include_member): Likewise.
12611         * archive.h (Archive::Archive): Add new parameters and
12612         initializers.
12613         (Archive::armagt): New const.
12614         (Archive::setup): Remove task parameter.
12615         (Archive::unlock_nested_archives): New function.
12616         (Archive::read_header): Add nested_off parameter.
12617         (Archive::interpret_header): Likewise.
12618         (Archive::Nested_archive_table): New typedef.
12619         (Archive::is_thin_archive_): New field.
12620         (Archive::nested_archives_): New field.
12621         (Archive::options_): New field.
12622         (Archive::dirpath_): New field.
12623         (Archive::task_): New field.
12624         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12625         for thin archives.  Pass additional parameters to
12626         Archive::Archive.  Unlock the archive file after calling
12627         Archive::setup.
12628
12629 2008-03-29  Ian Lance Taylor  <iant@google.com>
12630
12631         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12632         version symbol to be local.
12633         * testsuite/ver_test_4.sh: New file.
12634         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12635         (check_DATA): Add ver_test_4.syms.
12636         (ver_test_4.syms): New target.
12637         * testsuite/Makefile.in: Rebuild.
12638
12639         * output.cc
12640         (Output_section::Input_section_sort_entry::has_priority): New
12641         function.
12642         (Output_section::Input_section_sort_entry::match_file_name): New
12643         function.
12644         (Output_section::Input_section_sort_entry::match_section_name):
12645         Remove.
12646         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12647         Remove.
12648         (Output_section::Input_section_sort_entry::match_section_file):
12649         Remove.
12650         (Output_section::Input_section_sort_compare::operator()): Rewrite
12651         using new Input_section_sort_entry functions.  Sort crtbegin and
12652         crtend first.  Sort sections with no priority before sections with
12653         a priority.
12654         * testsuite/initpri1.c (d3): Check j != 4.
12655         (cd5): New constructor/destructor function.
12656         (main): Check j != 2.
12657
12658         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12659         new symbol when resolving, don't call set_is_default.
12660         * testsuite/ver_test_7.cc: New file.
12661         * testsuite/ver_test_7.sh: New file.
12662         * testsuite/Makefile.am (ver_test_7.so): New target.
12663         (ver_test_7.o): New target.
12664         (check_SCRIPTS): Add ver_test_7.sh.
12665         (check_DATA): Add ver_test_7.syms.
12666         (ver_test_7.syms): New target.
12667
12668 2008-03-28  Ian Lance Taylor  <iant@google.com>
12669
12670         * layout.cc (Layout::layout): If we see an input section with a
12671         name that needs sorting, set the must_sort flag for the output
12672         section.
12673         (Layout::make_output_section): If the name of the output section
12674         indicates that it might require sorting, set the may_sort flag.
12675         * output.h (Output_section::may_sort_attached_input_sections): New
12676         function.
12677         (Output_section::set_may_sort_attached_input_sections): New
12678         function.
12679         (Output_section::must_sort_attached_input_sections): New
12680         function.
12681         (Output_section::set_must_sort_attached_input_sections): New
12682         function.
12683         (class Output_section): Declare Input_section_sort_entry.  Define
12684         Input_section_sort_compare.  Declare
12685         sort_attached_input_sections.  Add new fields:
12686         may_sort_attached_input_sections_,
12687         must_sort_attached_input_sections_,
12688         attached_input_sections_are_sorted_.
12689         * output.cc (Output_section::Output_section): Initialize new
12690         fields.
12691         (Output_section::add_input_section): Add an entry to
12692         input_sections_ if may_sort or must_sort are true.
12693         (Output_section::set_final_data_size): Call
12694         sort_attached_input_sections if necessary.
12695         (Output_section::Input_section_sort_entry): Define new class.
12696         (Output_section::Input_section_sort_compare::operator()): New
12697         function.
12698         (Output_section::sort_attached_input_sections): New function.
12699         * configure.ac: Check whether the compiler supports constructor
12700         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12701         * testsuite/initpri1.c: New file.
12702         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12703         CONSTRUCTOR_PRIORITY.
12704         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12705         (initpri1_LDFLAGS): New variable.
12706         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12707
12708 2008-03-27  Ian Lance Taylor  <iant@google.com>
12709
12710         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12711         * testsuite/common_test_1.c: New file.
12712         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12713         (common_test_1_SOURCES): New variable.
12714         (common_test_1_DEPENDENCIES): New variable.
12715         (common_test_1_LDFLAGS): New variable.
12716
12717         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12718         and commons_ correctly when NAME/VERSION does not override
12719         NAME/NULL.
12720         * testsuite/ver_test_6.c: New file.
12721         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12722         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12723         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12724
12725 2008-03-26  Ian Lance Taylor  <iant@google.com>
12726
12727         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12728         of an undefined symbol from a version script.
12729         * testsuite/Makefile.am (ver_test_5.so): New target.
12730         (ver_test_5.o): New target.
12731         (check_SCRIPTS): Add ver_test_5.sh.
12732         (check_DATA): Add ver_test_5.syms.
12733         (ver_test_5.syms): New target.
12734         * testsuite/ver_test_5.cc: New file.
12735         * testsuite/ver_test_5.script: New file.
12736         * testsuite/ver_test_5.sh: New file.
12737         * Makefile.in, testsuite/Makefile.in: Rebuild.
12738
12739         PR gold/5986
12740         Fix problems building gold with gcc 4.3.0.
12741         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12742         (gold_error_at_location, gold_warning_at_location): Use it.
12743         * configure.ac: Check whether we can compile and use a template
12744         function with a printf attribute.
12745         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12746         when jumping over bytes.
12747         * object.cc: Instantiate Object::read_section_data.
12748         * debug.h: Include <cstring>
12749         * dwarf_reader.cc: Include <algorithm>
12750         * main.cc: Include <cstring>.
12751         * options.cc: Include <cstring>.
12752         * output.cc: Include <cstring>.
12753         * script.cc: Include <cstring>.
12754         * script.h: Include <string>.
12755         * symtab.cc: Include <cstring> and <algorithm>.
12756         * target-select.cc: Include <cstring>.
12757         * version.cc: Include <string>.
12758         * testsuite/testmain.cc: Include <cstdlib>.
12759         * configure, config.in: Rebuild.
12760
12761 2008-03-25  Ian Lance Taylor  <iant@google.com>
12762
12763         * options.cc: Include "../bfd/bfdver.h".
12764         (options::help): Print bug reporting address.
12765
12766         * version.cc (print_version): Adjust output for current value of
12767         BFD_VERSION_STRING.
12768
12769         * NEWS: New file.
12770
12771         * options.cc (options::help): Print list of supported targets.
12772         * target-select.h: Include <vector>.
12773         (class Target_selector): Make machine_, size_, and is_big_endian_
12774         fields const.  Add bfd_name_ and instantiated_target_ fields.
12775         (Target_selector::Target_selector): Add bfd_name parameter.
12776         (Target_selector::recognize): Make non-virtual, call
12777         do_recognize.
12778         (Target_selector::recognize_by_name): Make non-virtual, call
12779         do_recognize_by_name.
12780         (Target_selector::supported_names): New function.
12781         (Target_selector::bfd_name): New function.
12782         (Target_selector::do_instantiate_target): New pure virtual
12783         function.
12784         (Target_selector::do_recognize): New virtual function.
12785         (Target_selector::do_recognize_by_name): New virtual function.
12786         (Target_selector::instantiate_target): New private function.
12787         (supported_target_names): Declare.
12788         * target-select.cc (Target_selector::Target_selector): Update for
12789         new parameter and fields.
12790         (select_target_by_name): Check that the name matches before
12791         calling recognize_by_name.
12792         (supported_target_names): New function.
12793         * i386.cc (class Target_selector_i386): Update Target_selector
12794         constructor call.  Remove recognize and recognize_by_name.  Add
12795         do_instantiate_target.
12796         * x86_64.cc (class Target_selector_x86_64): Likewise.
12797         * testsuite/testfile.cc (class Target_selector_test): Update for
12798         changes to Target_selector.
12799
12800         * README: Rewrite, with some notes on unsupported features.
12801
12802 2008-03-24  Cary Coutant  <ccoutant@google.com>
12803
12804         * i386.cc (Target_i386::Got_type): New enum declaration.
12805         (Target_i386::Scan::local): Updated callers of Output_data_got
12806         member functions.
12807         (Target_i386::Scan::global): Likewise.
12808         (Target_i386::Relocate::relocate): Likewise.
12809         (Target_i386::Relocate::relocate_tls): Likewise.
12810         * object.h (Got_offset_list): New class.
12811         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12812         (Sized_relobj::local_got_offset): Likewise.
12813         (Sized_relobj::set_local_got_offset): Likewise.
12814         (Sized_relobj::local_has_tls_got_offset): Removed.
12815         (Sized_relobj::local_tls_got_offset): Removed.
12816         (Sized_relobj::set_local_tls_got_offset): Removed.
12817         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12818         * output.cc (Output_data_got::add_global): Added got_type parameter.
12819         (Output_data_got::add_global_with_rel): Likewise.
12820         (Output_data_got::add_global_with_rela): Likewise.
12821         (Output_data_got::add_global_pair_with_rel): New function.
12822         (Output_data_got::add_global_pair_with_rela): New function.
12823         (Output_data_got::add_local): Added got_type parameter.
12824         (Output_data_got::add_local_with_rel): Likewise.
12825         (Output_data_got::add_local_with_rela): Likewise.
12826         (Output_data_got::add_local_pair_with_rel): New function.
12827         (Output_data_got::add_local_pair_with_rela): New function.
12828         (Output_data_got::add_global_tls): Removed.
12829         (Output_data_got::add_global_tls_with_rel): Removed.
12830         (Output_data_got::add_global_tls_with_rela): Removed.
12831         (Output_data_got::add_local_tls): Removed.
12832         (Output_data_got::add_local_tls_with_rel): Removed.
12833         (Output_data_got::add_local_tls_with_rela): Removed.
12834         * output.h (Output_data_got::add_global): Added got_type parameter.
12835         (Output_data_got::add_global_with_rel): Likewise.
12836         (Output_data_got::add_global_with_rela): Likewise.
12837         (Output_data_got::add_global_pair_with_rel): New function.
12838         (Output_data_got::add_global_pair_with_rela): New function.
12839         (Output_data_got::add_local): Added got_type parameter.
12840         (Output_data_got::add_local_with_rel): Likewise.
12841         (Output_data_got::add_local_with_rela): Likewise.
12842         (Output_data_got::add_local_pair_with_rel): New function.
12843         (Output_data_got::add_local_pair_with_rela): New function.
12844         (Output_data_got::add_global_tls): Removed.
12845         (Output_data_got::add_global_tls_with_rel): Removed.
12846         (Output_data_got::add_global_tls_with_rela): Removed.
12847         (Output_data_got::add_local_tls): Removed.
12848         (Output_data_got::add_local_tls_with_rel): Removed.
12849         (Output_data_got::add_local_tls_with_rela): Removed.
12850         * resolve.cc (Symbol::override_base_with_special): Removed
12851         reference to has_got_offset_ field.
12852         * symtab.cc (Symbol::init_fields): Replaced initialization
12853         of got_offset_ with got_offsets_.  Removed initialization
12854         of has_got_offset_
12855         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12856         (Symbol::got_offset): Likewise.
12857         (Symbol::set_got_offset): Likewise.
12858         (Symbol::has_tls_got_offset): Removed.
12859         (Symbol::tls_got_offset): Removed.
12860         (Symbol::set_tls_got_offset): Removed.
12861         (Symbol::got_offset_): Removed.
12862         (Symbol::tls_mod_got_offset_): Removed.
12863         (Symbol::tls_pair_got_offset_): Removed.
12864         (Symbol::got_offsets_): New field.
12865         (Symbol::has_got_offset): Removed.
12866         (Symbol::has_tls_mod_got_offset): Removed.
12867         (Symbol::has_tls_pair_got_offset): Removed.
12868         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12869         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12870         member functions.
12871         (Target_x86_64::Scan::global): Likewise.
12872         (Target_x86_64::Relocate::relocate): Likewise.
12873         (Target_x86_64::Relocate::relocate_tls): Likewise.
12874
12875 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12876
12877         * yyscript.y: Fix spelling error in comment.
12878
12879 2008-03-24  Ian Lance Taylor  <iant@google.com>
12880
12881         * options.h (class General_options): Define build_id option.
12882         * layout.h (class Layout): Declare write_build_id, create_note,
12883         create_build_id.  Add build_id_note_ member.
12884         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12885         "libiberty.h", "md5.h", "sha1.h".
12886         (Layout::Layout): Initialize eh_frame_data_,
12887         eh_frame_hdr_section_, and build_id_note_.
12888         (Layout::finalize): Call create_build_id.
12889         (Layout::create_note): New function, broken out of
12890         Layout::create_gold_note.
12891         (Layout::create_gold_note): Call create_note.
12892         (Layout::create_build_id): New function.
12893         (Layout::write_build_id): New function.
12894         (Close_task_runner::run): Call write_build_id.
12895
12896         * x86_64.cc: Correct license to GPLv3.
12897
12898 2008-03-23  Ian Lance Taylor  <iant@google.com>
12899
12900         * options.cc: Include "demangle.h".
12901         (parse_optional_string): New function.
12902         (parse_long_option): Handle takes_optional_argument.
12903         (parse_short_option): Update dash_z initializer.  Handle
12904         takes_optional_argument.
12905         (General_options::General_options): Initialize do_demangle_.
12906         (General_options::finalize): Set do_demangle_.  Handle demangling
12907         style.
12908         * options.h (parse_optional_string): Declare.
12909         (struct One_option): Add optional_arg field.  Update constructor.
12910         Update call constructor calls.  Add takes_optional_argument
12911         function.
12912         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12913         (DEFINE_optional_string): Define.
12914         (General_options::demangle): Change from DEFINE_bool to
12915         DEFINE_optional_string.
12916         (General_options::no_demangle): New function.
12917         (General_options::do_demangle): New function.
12918         (General_options::set_do_demangle): New function.
12919         (General_options::execstack_status_): Move definition to end of
12920         class definition.
12921         (General_options::static_): Likewise.
12922         (General_options::do_demangle_): New field.
12923         * object.cc (big_endian>::get_symbol_location_info): Call
12924         Options::do_demangle, not Options::demangle.
12925         * symtab.cc (demangle): Likewise.
12926
12927 2008-03-22  Ian Lance Taylor  <iant@google.com>
12928
12929         * gold.h: Include <cstddef> and <sys/types.h>
12930         * options.h: Include <cstring>.
12931
12932 2008-03-21  Ian Lance Taylor  <iant@google.com>
12933
12934         * Added source code to GNU binutils.