* arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
[external/binutils.git] / gold / ChangeLog
1 2012-04-25  Ian Lance Taylor  <iant@google.com>
2
3         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4         pointer.
5         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
6         as a class, not a struct.
7         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
8         (Target_arm::apply_cortex_a8_workaround): Likewise.
9         * gc.h: Declare Reloc_types as a struct, not a class.
10         * object.h: Declare Symbols_data as a struct.
11         * reloc.h: Declare Read_relocs_data as a struct.
12         * target.h: Declare Relocate_info as a struct.
13
14 2012-04-24  David S. Miller  <davem@davemloft.net>
15
16         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
17         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
18         and R_SPARC_WPLT30.
19
20 2012-04-24  Cary Coutant  <ccoutant@google.com>
21
22         * incremental-dump.cc (find_input_containing_global): Replace
23         magic number with symbolic constant.
24         (dump_incremental_inputs): Update version number.
25         * incremental.cc (Output_section_incremental_inputs): Update version
26         number; import symbolic constants from Incremental_inputs_reader.
27         (Incremental_inputs::create_data_sections): Align relocations
28         section correctly for 64-bit targets.
29         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
30         constants; add padding.
31         (Output_section_incremental_inputs::write_header): Add assert for
32         header_size.
33         (Output_section_incremental_inputs::write_input_files): Add assert
34         for input_entry_size.
35         (Output_section_incremental_inputs::write_info_blocks): Add padding;
36         add assert for object_info_size, input_section_entry_size,
37         global_sym_entry_size.
38         * incremental.h (Incremental_inputs_reader): Add symbolic constants
39         for data structure sizes; use them.
40         (Incremental_input_entry_reader): Import symbolic constants from
41         Incremental_inputs_reader; use them.
42
43 2012-04-23  David S. Miller  <davem@davemloft.net>
44
45         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
46         and elf_flags_set_.
47         (Target_sparc::Target_sparc): Initialize new fields.
48         (Target_sparc::do_make_elf_object): New function.
49         (Target_sparc::do_adjust_elf_header): New function.
50
51 2012-04-23  Cary Coutant  <ccoutant@google.com>
52
53         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
54         CU range table of gdb index.
55
56 2012-04-20  David S. Miller  <davem@davemloft.net>
57
58         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
59         instead of false.
60
61 2012-04-16  David S. Miller  <davem@davemloft.net>
62
63         * sparc.cc (Target_sparc::got_address): New function.
64         (Sparc_relocate_functions::gdop_hix22): New function.
65         (Sparc_relocate_functions::gdop_lox10): New function.
66         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
67         relocs.
68         (Target_sparc::Scan::local): Likewise if the global symbol is not
69         preemptible and is not IFUNC.
70         (Target_sparc::Relocate::relocate): Perform GOTDATA code
71         transformations for local and non-preemptible non-IFUNC global
72         symbols.
73
74         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
75         writing out 64-bit part of ranges.
76
77         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
78         -fpic and -fpie respectively.
79         * Makefile.in: Regenerate.
80
81         * sparc.cc (class Target_sparc): Add rela_ifunc_.
82         (Target_sparc::Target_sparc): Initialize new field.
83         (Target_sparc::do_plt_section_for_global): New function.
84         (Target_sparc::do_plt_section_for_local): New function.
85         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
86         (Target_sparc::make_plt_section): New function, broken out of
87         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
88         (Target_sparc::make_plt_entry): Call make_plt_section.
89         (Target_sparc::make_local_ifunc_plt_entry): New function.
90         (Target_sparc::rela_ifunc_section): New function.
91         (Target_sparc::plt_section): Remove const.
92         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
93         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
94         and ifunc_count_ fields.
95         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
96         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
97         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
98         (Output_data_plt_sparc::rela_ifunc): New function.
99         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
100         (Output_data_plt_sparc::has_ifunc_section): New function.
101         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
102         (Output_data_plt_sparc::address_for_global): New function.
103         (Output_data_plt_sparc::address_for_local): New function.
104         (Output_data_plt_sparc::plt_index_to_offset): New function.
105         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
106         and entry_count.
107         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
108         entry_count.
109         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
110         R_SPARC_JMP_IREL to switch.
111         (Target_sparc::Scan::check_non_pic): Likewise.
112         (Target_sparc::Scan::local): Handle IFUNC symbols.
113         (Target_sparc::Scan::local): Likewise.
114         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
115         and plt_address_for_local.
116         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
117         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
118
119         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
120         (class Output_data_reloc): Adjust calls to Output_reloc_type.
121         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
122         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
123         global relocs too.
124         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
125         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
126         calls.
127         * sparc.cc (Target_sparc::Scan::global): Likewise.
128         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
129
130 2012-04-16  Cary Coutant  <ccoutant@google.com>
131
132         * archive.cc (Library_base::should_include_member): Check for
133         --export-dynamic-symbol.
134         * options.h (class General_options): Add --export-dynamic-symbol.
135         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
136         --export-dynamic-symbol.
137         (Symbol_table::gc_mark_undef_symbols): Likewise.
138         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
139
140 2012-04-12  David S. Miller  <davem@davemloft.net>
141
142         * sparc.cc (Reloc::wdisp10): New relocation method.
143         (Reloc::h34): Likewise.
144         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
145         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
146         R_SPARC_WDISP10.
147         (Target_sparc::Scan::local): Likewise.
148         (Target_sparc::Scan::global): Likewise.
149         (Target_sparc::Relocate::relocate): Likewise.
150
151 2012-04-09  Cary Coutant  <ccoutant@google.com>
152
153         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
154         low_pc == 0.
155
156 2012-04-06  Ian Lance Taylor  <iant@google.com>
157
158         * timer.cc: #include <unistd.h>.
159
160 2012-04-06  Roland McGrath  <mcgrathr@google.com>
161
162         * configure.in (AC_CHECK_HEADERS): Add locale.h.
163         * config.in: Regenerate.
164         * configure: Regenerate.
165
166 2012-04-05  Nick Clifton  <nickc@redhat.com>
167
168         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
169         (AM_LC_MESSAGES): Add.
170         * aclocal.m4: Regenerate.
171         * config.in: Regenerate.
172         * configure: Regenerate.
173
174 2012-03-21  Cary Coutant  <ccoutant@google.com>
175
176         * Makefile.am: Add gdb-index.cc, gdb-index.h.
177         * Makefile.in: Regenerate.
178         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
179         (Sized_elf_reloc_mapper::symbol_section): New function.
180         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
181         (make_elf_reloc_mapper): New function.
182         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
183         (Dwarf_abbrev_table::do_read_abbrevs): New function.
184         (Dwarf_abbrev_table::do_get_abbrev): New function.
185         (Dwarf_ranges_table::read_ranges_table): New function.
186         (Dwarf_ranges_table::read_range_list): New function.
187         (Dwarf_pubnames_table::read_section): New function.
188         (Dwarf_pubnames_table::read_header): New function.
189         (Dwarf_pubnames_table::next_name): New function.
190         (Dwarf_die::Dwarf_die): New function.
191         (Dwarf_die::read_attributes): New function.
192         (Dwarf_die::skip_attributes): New function.
193         (Dwarf_die::set_name): New function.
194         (Dwarf_die::set_linkage_name): New function.
195         (Dwarf_die::attribute): New function.
196         (Dwarf_die::string_attribute): New function.
197         (Dwarf_die::int_attribute): New function.
198         (Dwarf_die::uint_attribute): New function.
199         (Dwarf_die::ref_attribute): New function.
200         (Dwarf_die::child_offset): New function.
201         (Dwarf_die::sibling_offset): New function.
202         (Dwarf_info_reader::check_buffer): New function.
203         (Dwarf_info_reader::parse): New function.
204         (Dwarf_info_reader::do_parse): New function.
205         (Dwarf_info_reader::do_read_string_table): New function.
206         (Dwarf_info_reader::lookup_reloc): New function.
207         (Dwarf_info_reader::get_string): New function.
208         (Dwarf_info_reader::visit_compilation_unit): New function.
209         (Dwarf_info_reader::visit_type_unit): New function.
210         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
211         Sized_elf_reloc_mapper.
212         (Sized_dwarf_line_info::symbol_section): Remove function.
213         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
214         (Sized_dwarf_line_info::read_line_mappings): Remove object
215         parameter, adjust callers.
216         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
217         * dwarf_reader.h: Include <sys/types.h>.
218         (class Track_relocs): Remove forward declaration.
219         (class Elf_reloc_mapper): New class.
220         (class Sized_elf_reloc_mapper): New class.
221         (class Dwarf_abbrev_table): New class.
222         (class Dwarf_range_list): New class.
223         (class Dwarf_ranges_table): New class.
224         (class Dwarf_pubnames_table): New class.
225         (class Dwarf_die): New class.
226         (class Dwarf_info_reader): New class.
227         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
228         (Sized_dwarf_line_info::symbol_section): Remove member function.
229         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
230         base class.
231         * gdb-index.cc: New source file.
232         * gdb-index.h: New source file.
233         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
234         and .debug_types sections, call Layout::add_to_gdb_index.
235         (Sized_relobj_incr::do_section_name): Implement.
236         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
237         return type; Implement.
238         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
239         return type.
240         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
241         parameter list and return type.
242         (Sized_incr_dynobj::do_section_contents): Likewise.
243         * layout.cc: Include gdb-index.h.
244         (Layout::Layout): Initialize gdb_index_data_.
245         (Layout::init_fixed_output_section): Check for .gdb_index section.
246         (Layout::add_to_gdb_index): New function. Instantiate.
247         * layout.h: Add forward declaration for class Gdb_index.
248         (Layout::add_to_gdb_index): New member function.
249         (Layout::gdb_index_data_): New data member.
250         * main.cc: Include gdb-index.h.
251         (main): Print statistics for gdb index.
252         * object.cc (Object::section_contents): Move code into
253         do_section_contents.
254         (need_decompressed_section): Check for sections needed when building
255         gdb index.
256         (build_compressed_section_map): Likewise.
257         (Sized_relobj_file::do_read_symbols): Need local symbols when building
258         gdb index.
259         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
260         sections; call Layout::add_to_gdb_index.
261         (Sized_relobj_file::do_decompressed_section_contents): Call
262         do_section_contents directly.
263         * object.h (Object::do_section_contents): Adjust parameter list and
264         return type.
265         (Object::do_decompressed_section_contents): Call do_section_contents
266         directly.
267         (Sized_relobj_file::do_section_contents): Adjust parameter list and
268         return type.
269         * options.h (class General_options): Add --gdb-index option.
270         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
271         list and return type.
272         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
273         * reloc.h (Track_relocs::checkpoint): New function.
274         (Track_relocs::reset): New function.
275
276         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
277         New test cases.
278         * testsuite/Makefile.in: Regenerate.
279         * testsuite/gdb_index_test.cc: New test source file.
280         * testsuite/gdb_index_test_1.sh: New test source file.
281         * testsuite/gdb_index_test_2.sh: New test source file.
282
283 2012-03-19  Doug Kwan  <dougkwan@google.com>
284
285         * arm.cc (Target_arm::do_define_standard_symbols): New method.
286         (Target_arm::do_finalize_sections): Remove code which defines
287         __exidx_start and __exidx_end.  Make symbol table parameter
288         anonymous as it is not used.
289         * gold.cc (queue_middle_tasks): Call target hook to define any
290         target-specific symbols.
291         * target.h (Target::define_standard_symbols): New method.
292         (Target::do_define_standard_symbols): Same.
293         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
294         * testsuite/Makefile.in: Regenerate.
295         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
296         and __exidx_end.
297         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
298         relocations are generated for __exidx_start and __exidx_end.
299
300 2012-03-16  Doug Kwan  <dougkwan@google.com>
301
302         * testsuite/Makefile.am: Disable test initpri3b.
303         * testsuite/Makefile.in: Regenerate.
304
305 2012-03-15  Doug Kwan  <dougkwan@google.com>
306
307         * arm.cc (Target_arm::got_section): Make .got section read-only
308         if -z now is given.
309
310 2012-03-15  Ian Lance Taylor  <iant@google.com>
311
312         PR gold/13850
313         * layout.cc (Layout::make_output_section): Correctly mark
314         SHT_INIT_ARRAY, et. al., as relro.
315
316 2012-03-14  Doug Kwan  <dougkwan@google.com>
317
318         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
319         dynamic relocations for protected symbols in shared objects.
320
321 2012-03-13  Ian Lance Taylor  <iant@google.com>
322
323         * resolve.cc (Symbol_table::resolve): When merging common symbols,
324         keep the larger alignment.
325
326 2012-03-12  Cary Coutant  <ccoutant@google.com>
327
328         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
329         handling of DW_LNE_define_file.
330
331 2012-03-12  Cary Coutant  <ccoutant@google.com>
332
333         * reduced_debug_output.cc
334         (Output_reduced_debug_info_section::get_die_end): Add new FORM
335         codes to switch.
336
337 2012-02-29  Cary Coutant  <ccoutant@google.com>
338
339         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
340
341 2012-02-29  Cary Coutant  <ccoutant@google.com>
342
343         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
344         Call Object::decompressed_section_contents.
345         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
346         New dtor.
347         (Sized_dwarf_line_info::buffer_start_): New data member.
348         * merge.cc (Output_merge_data::do_add_input_section): Call
349         Object::decompressed_section_contents.
350         (Output_merge_string::do_add_input_section): Likewise.
351         * object.cc (need_decompressed_section): New function.
352         (build_compressed_section_map): Decompress sections needed later.
353         (Sized_relobj_file::do_decompressed_section_contents): New function.
354         (Sized_relobj_file::do_discard_decompressed_sections): New function.
355         * object.h (Object::decompressed_section_contents): New function.
356         (Object::discard_decompressed_sections): New function.
357         (Object::do_decompressed_section_contents): New function.
358         (Object::do_discard_decompressed_sections): New function.
359         (Compressed_section_info): New type.
360         (Compressed_section_map): Include decompressed section contents.
361         (Sized_relobj_file::do_decompressed_section_contents): New function.
362         (Sized_relobj_file::do_discard_decompressed_sections): New function.
363
364 2012-02-16  Cary Coutant  <ccoutant@google.com>
365
366         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
367         * testsuite/Makefile.in: Regenerate.
368
369 2012-02-14  Cary Coutant  <ccoutant@google.com>
370
371         * options.cc (General_options::finalize): Disallow -pie and -static.
372
373 2012-02-03  Doug Kwan  <dougkwan@google.com>
374
375         * arm.cc (Arm_relocate_functions::abs8,
376         Arm_relocate_functions::abs16): Use
377         Bits::has_signed_unsigned_overflow32.
378         (Arm_relocate_functions::thm_abs8): Correct range of
379         overflow check.
380         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
381         in assertions.
382
383 2012-02-02  Doug Kwan  <dougkwan@google.com>
384
385         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
386         position independent outputs, not just shared objects.
387
388 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
389
390         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
391         * configure: Regenerated.
392
393 2012-01-27  Ian Lance Taylor  <iant@google.com>
394
395         * reloc.h (Bits): New class with static functions, copied from
396         namespace utils in arm.cc.
397         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
398         instead.
399
400 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
401
402         * incremental.cc (write_info_blocks): Correct relocation offset.
403
404 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
405
406         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
407         (Relocate::tls_gd_to_le): Likewise.
408
409 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
410
411         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
412
413 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
414
415         * configure.ac: Check if -mcmodel=medium works.
416         * configure: Regenerated.
417
418 2012-01-24  Cary Coutant  <ccoutant@google.com>
419
420         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
421         definition and ...
422         (read_unsigned_LEB_128_x): ... this new function.
423         (read_signed_LEB_128): Replaced with inline definition and ...
424         (read_signed_LEB_128_x): ... this new function.
425         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
426         (read_unsigned_LEB_128): Add inline definition.
427         (read_signed_LEB_128_x): New function.
428         (read_signed_LEB_128): Add inline definition.
429         * testsuite/Makefile.am (leb128_unittest): New unit test.
430         * testsuite/Makefile.in: Regenerate.
431         * testsuite/leb128_unittest.cc: New unit test.
432
433 2012-01-23  Ian Lance Taylor  <iant@google.com>
434
435         PR gold/13617
436         * i386.cc (Target_i386::do_code_fill): When using a jmp
437         instruction, pad with nop instructions.
438         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
439
440 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
441
442         * x86_64.cc (gc_process_relocs): Add typename on types used in
443         template.
444         (scan_relocs): Likewise.
445         (relocate_section): Likewise.
446         (apply_relocation): Likewise.
447
448 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
449
450         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
451         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
452         under x32.
453
454 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
455
456         * x86_64.cc: Initial support for x32.
457
458 2012-01-03  Cary Coutant  <ccoutant@google.com>
459
460         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
461         Use abstract base class for GOT.
462         * gold/output.h (class Output_data_got_base): New abstract base class.
463         (class Output_data_got): Derive from new base class, adjust ctors.
464         (Output_data_got::reserve_slot): Make virtual; rename to
465         do_reserve_slot; Adjust callers.
466         * gold/target.h (Sized_target::init_got_plt_for_update): Return
467         pointer to abstract base class.
468         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
469
470 2011-12-18  Ian Lance Taylor  <iant@google.com>
471
472         * object.h (Relobj::local_symbol_value): New function.
473         (Relobj::local_plt_offset): New function.
474         (Relobj::local_has_got_offset): New function.
475         (Relobj::local_got_offset): New function.
476         (Relobj::set_local_got_offset): New function.
477         (Relobj::do_local_symbol_value): New pure virtual function.
478         (Relobj::do_local_plt_offset): Likewise.
479         (Relobj::do_local_has_got_offset): Likewise.
480         (Relobj::do_local_got_offset): Likewise.
481         (Relobj::do_set_local_got_offset): Likewise.
482         (Sized_relobj::do_local_has_got_offset): Rename from
483         local_has_got_offset.
484         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
485         (Sized_relobj::do_set_local_got_offset): Rename from
486         set_local_got_offset.
487         (Sized_relobj_file::do_local_plt_offset): Rename from
488         local_plt_offset.
489         (Sized_relobj_file::do_local_symbol_value): New function.
490         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
491         local_plt_offset.
492         * output.cc (Output_data_got::Got_entry::write): Change object to
493         Relobj.  Use local_symbol_value.
494         (Output_data_got::add_global_with_rel): Change rel_dyn to
495         Output_data_reloc_generic*.  Use add_global_generic.
496         (Output_data_got::add_global_with_rela): Remove.  Change all
497         callers to use add_global_with_rel.
498         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
499         Output_data_reloc_generic*.  Use add_global_generic.
500         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
501         callers to use add_global_pair_with_rel.
502         (Output_data_got::add_local): Change object to Relobj*.
503         (Output_data_got::add_local_plt): Likewise.
504         (Output_data_got::add_local_with_rel): Change object to Relobj*,
505         change rel_dyn to Output_data_reloc_generic*.  Use
506         add_local_generic.
507         (Output_data_got::add_local_with_rela): Remove.  Change all
508         callers to use all_local_with_rel.
509         (Output_data_got::add_local_pair_with_rel): Change object to
510         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
511         add_output_section_generic.
512         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
513         callers to use add_local_pair_with_rel.
514         (Output_data_got::reserve_local): Change object to Relobj*.
515         * output.h: (class Output_data_reloc_generic): Add pure virtual
516         declarations for add_global_generic, add_local_generic,
517         add_output_section_generic.
518         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
519         functions for Output_data_reloc_generic.  Update declarations for
520         changes listed in output.cc.
521         (class Output_data_got): Change template parameter to got_size.
522         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
523         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
524         function.
525         (Sized_relobj_incr::do_local_plt_offset): New function.
526         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
527         add_global_generic.
528
529 2011-12-17  Cary Coutant  <ccoutant@google.com>
530
531         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
532         * resolve.cc (Symbol_table::resolve): Likewise.
533         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
534         arrays.
535         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
536
537 2011-12-16  Ian Lance Taylor  <iant@google.com>
538
539         * output.h (Output_data_reloc_generic::add): Only call
540         add_dynamic_reloc if this is a dynamic reloc section.
541
542 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
543
544         PR gold/13505
545         * target-reloc.h (apply_relocation): Replace <64, false> with
546         <size, big_endian>.
547
548 2011-11-25  Nick Clifton  <nickc@redhat.com>
549
550         * po/it.po: New Italian translation.
551
552 2011-11-17  Sterling Augustine  <saugustine@google.com>
553
554         * script.cc (script_include_directive): Implement.
555         (read_script_file): New local variables name and search_path. Update
556         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
557         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
558         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
559
560 2011-11-11  Sterling Augustine  <saugustine@google.com>
561
562         * yyscript.y (section_cmd): Add support for INCLUDE directive.
563         (file_or_sections_cmd): Likewise.
564
565 2011-11-11  Doug Kwan  <dougkwan@google.com>
566
567         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
568         if --just-symbols is given.
569
570 2011-11-10  Doug Kwan  <dougkwan@google.com>
571
572         PR gold/13362
573         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
574         when processing data relocs.
575         * reloc.h (Relocate_functions::rel_unaligned): New method.
576         (Relocate_functions::pcrel_unaligned): Ditto.
577         (Relocate_functions::rel32_unaligned): Ditto.
578         (Relocate_functions::pcrel32_unaligned): Ditto.
579
580 2011-11-09  Doug Kwan  <dougkwan@google.com>
581
582         PR gold/13362
583         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
584         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
585         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
586         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
587         (Relocate_functions::rel_unaligned): New.
588         (Relocate_functions::rel32_unaligned): New.
589         * target-reloc.h (relocate_for_relocatable): Add code to handle
590         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
591         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
592         arm_unaligned_reloc_r): New targets.
593         * testsuite/Makefile.in: Regenerate.
594         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
595         linking.
596
597 2011-11-02  Ian Lance Taylor  <iant@google.com>
598
599         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
600         NATIVE_LINKER.
601         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
602         * options.cc (General_options::finalize): Use library search path
603         from configure script if specified.  If not native and no sysroot,
604         only search TOOLLIBDIR.
605         * options.h (Search_directory::Search_directory): Change name to
606         const std::string&.
607         (General_options::add_to_library_path_with_sysroot): Change arg to
608         const std::string&.
609         * configure, Makefile.in, config.in: Rebuild.
610
611 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
612
613         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
614         we are working around the ARM1176 Erratum.
615         * options.h (General_options::fix_arm1176): Add option.
616         * testsuite/Makefile.am: Add testcases, and keep current ones
617         working.
618         * testsuite/Makefile.in: Regenerate.
619         * testsuite/arm_fix_1176.s: New file.
620         * testsuite/arm_fix_1176.sh: Likewise.
621
622 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
623
624         * arm.cc (Target_arm::Target_arm): Remove initialisation of
625         may_use_blx_.
626         (Target_arm::may_use_blx): Remove method.
627         (Target_arm::set_may_use_blx): Likewise.
628         (Target_arm::may_use_v4t_interworking): New method.
629         (Target_arm::may_use_v5t_interworking): Likewise.
630         (Target_arm::may_use_blx_): Remove member variable.
631         (Arm_relocate_functions::arm_branch_common): Check for v5T
632         interworking.
633         (Arm_relocate_functions::thumb_branch_common): Likewise.
634         (Reloc_stub::stub_type_for_reloc): Likewise.
635         (Target_arm::do_finalize_sections): Correct interworking checks.
636         * testsuite/Makefile.am: Add new tests.
637         * testsuite/Makefile.in: Regenerate.
638         * testsuite/arm_farcall_arm_arm.s: New test.
639         * testsuite/arm_farcall_arm_arm.sh: Likewise.
640         * testsuite/arm_farcall_arm_thumb.s: Likewise.
641         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
642         * testsuite/arm_farcall_thumb_arm.s: Likewise.
643         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
644         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
645         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
646
647 2011-10-31  Cary Coutant  <ccoutant@google.com>
648
649         PR gold/13023
650         * expression.cc (Expression::eval_with_dot): Add
651         is_section_dot_assignment parameter.
652         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
653         absolute and assigning to dot within a section.
654         * script-sections.cc
655         (Output_section_element_assignment::set_section_addresses): Pass
656         dot_section to set_if_absolute.
657         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
658         as is_section_dot_assignment flag to eval_with_dot.
659         (Output_section_element_dot_assignment::set_section_addresses):
660         Likewise.
661         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
662         parameter.  Also set value if relative to dot_section; set the
663         symbol's output_section.
664         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
665         parameter.  Adjust all callers.
666         (Expression::eval_maybe_dot): Likewise.
667         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
668         Adjust all callers.
669         * testsuite/script_test_2.t: Test assignment of an absolute value
670         to dot within an output section element.
671
672 2011-10-31  Cary Coutant  <ccoutant@google.com>
673
674         * options.h (class General_options): Add --[no-]gnu-unique options.
675         * symtab.cc (Symbol_table::sized_write_globals): Convert
676         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
677
678 2011-10-31  Cary Coutant  <ccoutant@google.com>
679
680         PR gold/13359
681         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
682         unnecessary assertion.
683         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
684
685 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
686
687         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
688         gc_mark_symbol.
689         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
690         gc_mark_symbol.
691         Change to just keep the section associated with symbol.
692         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
693         they are externally visible and --export-dynamic is turned on.
694         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
695
696 2011-10-19  Ian Lance Taylor  <iant@google.com>
697
698         PR gold/13163
699         * script-sections.cc
700         (Output_section_element_dot_assignment::needs_output_section): New
701         function.
702
703 2011-10-19  Ian Lance Taylor  <iant@google.com>
704
705         PR gold/13204
706         * layout.cc (Layout::segment_precedes): Don't assert failure if a
707         --section-start option was seen.
708         * options.h (General_options::any_section_start): New function.
709
710 2011-10-18  David S. Miller  <davem@davemloft.net>
711
712         PR binutils/13301
713         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
714         member to track relocation locations that have moved during TLS
715         reloc optimizations.
716         (Target_sparc::Relocate::Relocate): Initialize to NULL.
717         (Target_sparc::Relocate::relocate): Adjust view down by 4
718         bytes if it matches reloc_adjust_addr_.
719         (Target_sparc::Relocate::relocate_tls): Always move the
720         __tls_get_addr call delay slot instruction forward 4 bytes when
721         performing relaxation.
722
723 2011-10-18  Cary Coutant  <ccoutant@google.com>
724
725         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
726         (Output_file::map_no_anonymous): Check for non-zero
727         return code from posix_fallocate.
728
729 2011-10-17  Cary Coutant  <ccoutant@google.com>
730
731         PR gold/13245
732         * plugin.cc (is_visible_from_outside): Check for symbols
733         referenced from dynamic objects.
734         * resolve.cc (Symbol_table::resolve): Don't count references
735         from dynamic objects as references from real ELF files.
736         * testsuite/plugin_test_2.sh: Adjust expected result.
737
738 2011-10-17  Cary Coutant  <ccoutant@google.com>
739
740         * gold.cc: Include timer.h.
741         (queue_middle_tasks): Stamp time.
742         (queue_final_tasks): Likewise.
743         * main.cc (main): Store timer in parameters.  Print timers
744         for each pass.
745         * parameters.cc (Parameters::Parameters): Initialize timer_.
746         (Parameters::set_timer): New function.
747         (set_parameters_timer): New function.
748         * parameters.h (Parameters::set_timer): New function.
749         (Parameters::timer): New function.
750         (Parameters::timer_): New data member.
751         (set_parameters_timer): New function.
752         * timer.cc (Timer::stamp): New function.
753         (Timer::get_pass_time): New function.
754         * timer.h (Timer::stamp): New function.
755         (Timer::get_pass_time): New function.
756         (Timer::pass_times_): New data member.
757
758 2011-10-17  Cary Coutant  <ccoutant@google.com>
759
760         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
761         task for members of lib groups.
762
763 2011-10-17  Cary Coutant  <ccoutant@google.com>
764
765         PR gold/13288
766         * fileread.cc (File_read::find_view): Add assert.
767         (File_read::make_view): Move bounds check (replace with assert)...
768         (File_read::find_or_make_view): ... to here.
769
770 2011-10-12  Cary Coutant  <ccoutant@google.com>
771
772         * output.cc (Output_file::open_base_file): Handle case where
773         ::read returns less than requested size.
774
775 2011-10-10  Cary Coutant  <ccoutant@google.com>
776
777         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
778         Initialize defined_count_.
779         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
780         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
781         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
782         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
783         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
784         * incremental.h (Sized_relobj_incr::defined_count_): New data
785         member.
786         (Sized_incr_dynobj::defined_count_): New data member.
787         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
788         Return zeroes instead of internal error.
789
790 2011-10-10  Cary Coutant  <ccoutant@google.com>
791
792         PR gold/13249
793         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
794         (Output_reloc::symbol_value): Return PLT offset if flag is set.
795         * output.h (class Output_reloc): Add use_plt_offset flag.
796         (Output_reloc::type_): Adjust size of bit field.
797         (Output_reloc::use_plt_offset_): New bit field.
798         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
799         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
800         flag.  Adjust all callers.
801         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
802         creating RELATIVE relocations.
803
804 2011-10-10  Nick Clifton  <nickc@redhat.com>
805
806         * po/es.po: Updated Spanish translation.
807         * po/fi.po: Updated Finnish translation.
808
809 2011-10-03   Diego Novillo  <dnovillo@google.com>
810
811         * options.cc (parse_uint): Fix dereference of RETVAL.
812
813 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
814
815         * layout.h (section_order_map_): New member.
816         (get_section_order_map): New member function.
817         * output.cc (Output_section::add_input_section): Check for patterns
818         only when --section-ordering-file is specified.
819         * gold.cc (queue_middle_tasks): Delay updating order of sections till
820         output_sections have been formed.
821         * layout.cc (Layout_Layout): Initialize section_order_map_.
822         * plugin.cc (update_section_order): Store order in order_map. Do not
823         update the order.
824         * testsuite/Makefile.am: Add test case for plugin_final_layout.
825         * testsuite/Makefile.in: Regenerate.
826         * testsuite/plugin_section_order.c: New file.
827         * testsuite/plugin_final_layout.cc: New file.
828         * testsuite/plugin_final_layout.sh: New file.
829
830 2011-09-29  Cary Coutant  <ccoutant@google.com>
831
832         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
833         Check for NULL.
834         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
835         symbols during incremental update.
836         (Symbol_table::add_from_dynobj): Likewise.
837
838 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
839             Ian Lance Taylor  <iant@google.com>
840
841         * symtab.cc (Symbol_table::define_special_symbol): Always
842         canonicalize version string.
843
844 2011-09-26  Cary Coutant  <ccoutant@google.com>
845
846         * gold.cc (queue_initial_tasks): Move option checks ...
847         * options.cc (General_options::finalize): ... to here. Disable
848         some options; make others fatal.
849
850 2011-09-26  Cary Coutant  <ccoutant@google.com>
851
852         gcc PR lto/47247
853         * plugin.cc (get_symbols_v2): New function.
854         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
855         (is_referenced_from_outside): New function.
856         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
857         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
858         (get_symbols): Pass version parameter.
859         (get_symbols_v2): New function.
860         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
861         parameter.
862         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
863         (onload): Add LDPT_GET_SYMBOLS_V2.
864         (all_symbols_read_hook): Use get_symbols_v2; check for
865         LDPR_PREVAILING_DEF_IRONLY_EXP.
866         * testsuite/plugin_test_3.sh: Update expected results.
867
868 2011-09-23  Simon Baldwin  <simonb@google.com>
869
870         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
871         configuration options.
872         * configure: Regenerate.
873         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
874         * Makefile.in: Regenerate.
875         * testsuite/Makefile.in: Regenerate.
876
877 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
878
879         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
880
881 2011-09-19  Cary Coutant  <ccoutant@google.com>
882
883         * incremental.cc (can_incremental_update): Fix typo in comment.
884         * incremental.h (can_incremental_update): Likewise.
885
886 2011-09-18  Cary Coutant  <ccoutant@google.com>
887
888         * incremental.cc (can_incremental_update): New function.
889         * incremental.h (can_incremental_update): New function.
890         * layout.cc (Layout::init_fixed_output_section): Call it.
891         (Layout::make_output_section): Don't allow patch space in .eh_frame.
892         * object.cc (Sized_relobj_file::do_layout): Call
893         can_incremental_update.
894
895 2011-09-13  Cary Coutant  <ccoutant@google.com>
896
897         * configure.ac: Check for glibc support for gnu_indirect_function
898         support with static linking, setting automake conditional
899         IFUNC_STATIC.
900         * Makefile.in: Regenerate.
901         * configure: Regenerate.
902
903         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
904         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
905         for IFUNC_STATIC.
906         * testsuite/Makefile.in: Regenerate.
907
908 2011-09-13  Cary Coutant  <ccoutant@google.com>
909
910         * incremental.cc (Sized_relobj_incr::do_layout): Call
911         report_comdat_group for kept comdat sections.
912         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
913         * testsuite/Makefile.in: Regenerate.
914         * testsuite/incr_comdat_test_1.cc: New source file.
915         * testsuite/incr_comdat_test_2_v1.cc: New source file.
916         * testsuite/incr_comdat_test_2_v2.cc: New source file.
917         * testsuite/incr_comdat_test_2_v3.cc: New source file.
918
919 2011-09-13  Ian Lance Taylor  <iant@google.com>
920
921         * object.cc (Sized_relobj_file::do_layout): Remove unused local
922         variable external_symbols_offset.
923
924 2011-09-12  Ian Lance Taylor  <iant@google.com>
925
926         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
927         triggered if object has no symbols.
928
929 2011-09-09  David S. Miller  <davem@davemloft.net>
930
931         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
932         (Output_fill_debug_line::do_write): Likewise.
933
934 2011-08-29  Cary Coutant  <ccoutant@google.com>
935
936         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
937         casts to match formatting specs.
938         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
939
940 2011-08-26  Cary Coutant  <ccoutant@google.com>
941
942         * layout.cc (Free_list::allocate): Provide guarantee of minimum
943         remaining hole size when allocating.
944         (Layout::make_output_section): Set fill methods for debug sections.
945         * layout.h (Free_list::Free_list_node): Move from private to
946         public.
947         (Free_list::set_min_hole_size): New function.
948         (Free_list::begin, Free_list::end): New functions.
949         (Free_list::min_hole_): New data member.
950         * output.cc: Include dwarf.h.
951         (Output_fill_debug_info::do_minimum_hole_size): New function.
952         (Output_fill_debug_info::do_write): New function.
953         (Output_fill_debug_line::do_minimum_hole_size): New function.
954         (Output_fill_debug_line::do_write): New function.
955         (Output_section::Output_section): Initialize new data member.
956         (Output_section::set_final_data_size): Ensure patch space is larger
957         than minimum hole size.
958         (Output_section::do_write): Fill holes in debug sections.
959         * output.h (Output_fill): New class.
960         (Output_fill_debug_info): New class.
961         (Output_fill_debug_line): New class.
962         (Output_section::set_free_space_fill): New function.
963         (Output_section::free_space_fill_): New data member.
964         * testsuite/Makefile.am (incremental_test_3): Add
965         --incremental-patch option.
966         (incremental_test_4): Likewise.
967         (incremental_test_5): Likewise.
968         (incremental_test_6): Likewise.
969         (incremental_copy_test): Likewise.
970         (incremental_common_test_1): Likewise.
971         * testsuite/Makefile.in: Regenerate.
972
973 2011-08-26  Nick Clifton  <nickc@redhat.com>
974
975         * po/es.po: Updated Spanish translation.
976
977 2011-08-01  Cary Coutant  <ccoutant@google.com>
978
979         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
980         * gold/testsuite/Makefile.in: Regenerate.
981         * gold/testsuite/justsyms_exec.c: New source file.
982         * gold/testsuite/justsyms_lib.c: New source file.
983
984 2011-08-01  Cary Coutant  <ccoutant@google.com>
985
986         * layout.cc (Layout::set_segment_offsets): Don't realign text
987         segment if -Ttext was specified.
988         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
989         file type.
990         * object.h (Sized_relobj_file::e_type): New function.
991         (Sized_relobj_file::e_type_): New data member.
992         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
993         base address for ET_EXEC files.
994         * target.cc (Target::do_make_elf_object_implementation): Allow
995         ET_EXEC files with --just-symbols option.
996
997 2011-07-28  Cary Coutant  <ccoutant@google.com>
998
999         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1000         Add thread_number parameter.
1001         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1002         * workqueue-threads.cc
1003         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1004         current thread if its thread number is greater than desired thread
1005         count.
1006         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1007         Add thread_number parameter.
1008         (Workqueue::should_cancel_thread): Likewise.
1009         (Workqueue::find_runnable_or_wait): Pass thread_number to
1010         should_cancel_thread.
1011         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1012         parameter.
1013
1014 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1015
1016         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1017         only after checking if it cannot be forced local.
1018         * symtab.h (is_externally_visible): Check if the symbol is not forced
1019         local.
1020
1021 2011-07-15  Ian Lance Taylor  <iant@google.com>
1022
1023         * options.h (class General_options): Add --print-output-format.
1024         Move -EL next to -EB, for  better --help output.
1025         * target-select.cc: Include <cstdio>, "options.h", and
1026         "parameters.h".
1027         (Target_selector::do_target_bfd_name): New function.
1028         (print_output_format): New function.
1029         * target-select.h (class Target_selector): Update declarations.
1030         (Target_selector::target_bfd_name): New function.
1031         (print_output_format): Declare.
1032         * main.cc: Include "target-select.h".
1033         (main): Handle --print-output-format.
1034         * gold.cc: Include "target-select.h".
1035         (queue_initial_tasks): Handle --print-output-format when there are
1036         no input files.
1037         * parameters.cc (parameters_force_valid_target): Give a better
1038         error message if -EB/-EL does not match target.
1039         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1040         function.
1041
1042 2011-07-15  Ian Lance Taylor  <iant@google.com>
1043
1044         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1045         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1046         (Output_data_plt_i386::do_write): Write address of .dynamic
1047         section to first entry in .got.plt section.
1048         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1049         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1050         Initialize layout_.
1051         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1052         section to first entry in .got.plt section.
1053         * layout.h (Layout::dynamic_section): New function.
1054
1055 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1056
1057         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1058         to claim_file call.
1059         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1060         input_section_position_, and input_section_glob_.
1061         (read_layout_from_file): Call function section_ordering_specified.
1062         * layout.h (is_section_ordering_specified): New function.
1063         (section_ordering_specified): New function.
1064         (section_ordering_specified_): New boolean member.
1065         * main.cc(main): Call load_plugins after layout object is defined.
1066         * output.cc (Output_section::add_input_section): Use
1067         function section_ordering_specified to check if section ordering is
1068         needed.
1069         * output.cc (Output_section::add_relaxed_input_section): Use
1070         function section_ordering_specified to check if section ordering is
1071         needed.
1072         (Output_section::update_section_layout): New function.
1073         (Output_section::sort_attached_input_sections): Check if input section
1074         must be reordered.
1075         * output.h (Output_section::update_section_layout): New function.
1076         * plugin.cc (get_section_count): New function.
1077         (get_section_type): New function.
1078         (get_section_name): New function.
1079         (get_section_contents): New function.
1080         (update_section_order): New function.
1081         (allow_section_ordering): New function.
1082         (Plugin::load): Add the new interfaces to the transfer vector.
1083         (Plugin_manager::load_plugins): New parameter.
1084         (Plugin_manager::all_symbols_read): New parameter.
1085         (Plugin_manager::claim_file): New parameter. Save the elf object for
1086         unclaimed objects.
1087         (Plugin_manager::get_elf_object): New function.
1088         (Plugin_manager::get_view): Change to directly use the bool to check
1089         if get_view is called from claim_file_hook.
1090         * plugin.h (input_objects): New function
1091         (Plugin__manager::load_plugins): New parameter.
1092         (Plugin_manager::claim_file): New parameter.
1093         (Plugin_manager::get_elf_object): New function.
1094         (Plugin_manager::in_claim_file_handler): New function.
1095         (Plugin_manager::in_claim_file_handler_): New member.
1096         (layout): New function.
1097         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1098         handler with an extra parameter. Make the elf object before calling
1099         claim_file handler.
1100         * testsuite/plugin_test.c (get_section_count): New function pointer.
1101         (get_section_type): New function pointer.
1102         (get_section_name): New function pointer.
1103         (get_section_contents): New function pointer.
1104         (update_section_order): New function pointer.
1105         (allow_section_ordering): New function pointer.
1106         (onload): Check if the new interfaces exist.
1107
1108 2011-07-13  Ian Lance Taylor  <iant@google.com>
1109
1110         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1111         relro section.
1112         * x86_64.cc (Target_x86_64::got_section): Likewise.
1113         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1114         (relro_now_test_SOURCES): New variable.
1115         (relro_now_test_DEPENDENCIES): New variable.
1116         (relro_now_test_LDFLAGS): New variable.
1117         (relro_now_test_LDADD): New variable.
1118         (relro_now_test.so): New target.
1119         * testsuite/Makefile.in: Rebuild.
1120
1121 2011-07-12  Ian Lance Taylor  <iant@google.com>
1122
1123         PR gold/12980
1124         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1125         GLOB_DAT relocation rather than a RELATIVE relocation for a
1126         protected symbol when creating a shared library.
1127         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1128         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1129         * testsuite/protected_main_1.cc (main): Test that protected
1130         function has same address.
1131
1132 2011-07-11  Ian Lance Taylor  <iant@google.com>
1133
1134         PR gold/12979
1135         * options.h (class General_options): Add -Bgroup.
1136         * options.cc (General_options::finalize): If -Bgroup is set,
1137         default to --unresolved-symbols=report-all.
1138         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1139         * target-reloc.h (issue_undefined_symbol_error): Handle
1140         --unresolved-symbols=report-all.
1141
1142 2011-07-08  Ian Lance Taylor  <iant@google.com>
1143
1144         PR gold/11985
1145         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1146         if linker script discards key sections.
1147         (Layout::create_dynamic_symtab): Likewise.
1148         (Layout::assign_local_dynsym_offsets): Likewise.
1149         (Layout::sized_create_version_sections): Likewise.
1150         (Layout::create_interp): Likewise.
1151         (Layout::finish_dynamic_section): Likewise.
1152         (Layout::set_dynamic_symbol_size): Likewise.
1153
1154 2011-07-08  Ian Lance Taylor  <iant@google.com>
1155
1156         PR gold/12386
1157         * options.h (class General_options): Add --unresolved-symbols.
1158         * target-reloc.h (issue_undefined_symbol_error): Check
1159         --unresolved-symbols.  Add comments.
1160
1161 2011-07-08  Ian Lance Taylor  <iant@google.com>
1162
1163         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1164         expression more complex.
1165
1166 2011-07-08  Ian Lance Taylor  <iant@google.com>
1167
1168         PR gold/11317
1169         * target-reloc.h (issue_undefined_symbol_error): New inline
1170         function, broken out of relocate_section.
1171         (relocate_section): Call issue_undefined_symbol_error.
1172         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1173         there is no TLS segment if we are about to issue an undefined
1174         symbol error.
1175         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1176
1177 2011-07-08  Ian Lance Taylor  <iant@google.com>
1178
1179         PR gold/12279
1180         * resolve.cc (Symbol_table::should_override): Add fromtype
1181         parameter.  Change all callers.  Give error when linking together
1182         TLS and non-TLS symbol.
1183         (Symbol_table::should_override_with_special): Add fromtype
1184         parameter.  Change all callers.
1185         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1186         there is no TLS segment if we have reported some errors.
1187         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1188
1189 2011-07-08  Ian Lance Taylor  <iant@google.com>
1190
1191         PR gold/12372
1192         * target.h (Target::plt_address_for_global): New function.
1193         (Target::plt_address_for_local): New function.
1194         (Target::plt_section_for_global): Remove.
1195         (Target::plt_section_for_local): Remove.
1196         (Target::do_plt_address_for_global): New virtual function.
1197         (Target::do_plt_address_for_local): New virtual function.
1198         (Target::do_plt_section_for_global): Remove.
1199         (Target::do_plt_section_for_local): Remove.
1200         (Target::register_global_plt_entry): Add Symbol_table and Layout
1201         parameters.
1202         * output.cc (Output_data_got::Got_entry::write): Use
1203         plt_address_for_global and plt_address_for_local.
1204         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1205         address of output section.
1206         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1207         got_irelative_, and irelative_count_ fields.  Update
1208         declarations.
1209         (Output_data_plt_i386::has_irelative_section): New function.
1210         (Output_data_plt_i386::entry_count): Add irelative_count_.
1211         (Output_data_plt_i386::set_final_data_size): Likewise.
1212         (class Target_i386): Add got_irelative_ and rel_irelative_
1213         fields.  Update declarations.
1214         (Target_i386::Target_i386): Initialize new fields.
1215         (Target_i386::do_plt_address_for_global): New function replacing
1216         do_plt_section_for_global.
1217         (Target_i386::do_plt_address_for_local): New function replacing
1218         do_plt_section_for_local.
1219         (Target_i386::got_section): Create got_irelative_.
1220         (Target_i386::rel_irelative_section): New function.
1221         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1222         fields.  Don't define __rel_iplt_{start,end}.
1223         (Output_data_plt_i386::add_entry): Add symtab and layout
1224         parameters.  Change all callers.  Use different PLT and GOT for
1225         IFUNC symbols.
1226         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1227         layout parameters.  Change all callers.  Use different PLT and
1228         GOT.
1229         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1230         (Output_data_plt_i386::rel_irelative): New function.
1231         (Output_data_plt_i386::address_for_global): New function.
1232         (Output_data_plt_i386::address_for_local): New function.
1233         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1234         IRELATIVE GOT when changing IFUNC GOT entries.
1235         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1236         reloc.
1237         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1238         if we didn't create an IRELATIVE GOT.
1239         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1240         plt_address_for_local.
1241         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1242         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1243         got_irelative_, and irelative_count_ fields.  Update
1244         declarations.
1245         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1246         Initialize new fields.  Remove symtab parameter.  Change all
1247         callers.
1248         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1249         irelative_count_.
1250         (Output_data_plt_x86_64::has_irelative_section): New function.
1251         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1252         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1253         fields.  Update declarations.
1254         (Target_x86_64::Target_x86_64): Initialize new fields.
1255         (Target_x86_64::do_plt_address_for_global): New function replacing
1256         do_plt_section_for_global.
1257         (Target_x86_64::do_plt_address_for_local): New function replacing
1258         do_plt_section_for_local.
1259         (Target_x86_64::got_section): Create got_irelative_.
1260         (Target_x86_64::rela_irelative_section): New function.
1261         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1262         all callers.  Don't create __rel_iplt_{start,end}.
1263         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1264         parameters.  Change all callers.  Use different PLT and GOT for
1265         IFUNC symbols.
1266         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1267         layout parameters.  Change all callers.  Use different PLT and
1268         GOT.
1269         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1270         parameters.  Change all callers.  Use different PLT and GOT for
1271         IFUNC symbols.
1272         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1273         (Output_data_plt_x86_64::rela_irelative): New function.
1274         (Output_data_plt_x86_64::address_for_global): New function.
1275         (Output_data_plt_x86_64::address_for_local): New function.
1276         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1277         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1278         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1279         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1280         parameters.
1281         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1282         reloc.
1283         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1284         symbols if we didn't create an IRELATIVE GOT.
1285         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1286         plt_address_for_local.
1287         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1288         * testsuite/ifuncvar1.c: New test file.
1289         * testsuite/ifuncvar2.c: New test file.
1290         * testsuite/ifuncvar3.c: New test file.
1291         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1292         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1293         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1294         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1295         * testsuite/Makefile.in: Rebuild.
1296
1297 2011-07-07  Cary Coutant  <ccoutant@google.com>
1298
1299         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1300         (two_file_test_1_ndebug.o): Likewise.
1301         (two_file_test_1b_ndebug.o): Likewise.
1302         (two_file_test_2_ndebug.o): Likewise.
1303         (two_file_test_main_ndebug.o): Likewise.
1304         (incremental_test_2): Link with no-debug versions.
1305
1306 2011-07-06  Cary Coutant  <ccoutant@google.com>
1307
1308         * gold/incremental.cc
1309         (Output_section_incremental_inputs::write_info_blocks): Check for
1310         hidden and internal symbols.
1311
1312 2011-07-06  Cary Coutant  <ccoutant@google.com>
1313
1314         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1315         Check disposition for startup file.
1316         (Incremental_inputs::report_command_line): Ignore
1317         --incremental-startup-unchanged option.
1318         * options.cc (General_options::parse_incremental_startup_unchanged):
1319         New function.
1320         (General_options::General_options): Initialize new data member.
1321         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1322         (General_options): Add --incremental-startup-unchanged option.
1323         (General_options::incremental_startup_disposition): New function.
1324         (General_options::incremental_startup_disposition_): New data member.
1325
1326 2011-07-06  Cary Coutant  <ccoutant@google.com>
1327
1328         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1329         input file index to Script_info ctor.
1330         (Sized_incremental_binary::do_file_has_changed): Find the
1331         command-line argument for files named in scripts.
1332         * incremental.h (Script_info::Script_info): New ctor
1333         with input file index.
1334         (Script_info::input_file_index): New function.
1335         (Script_info::input_file_index_): New data member.
1336         (Incremental_binary::get_library): Add const.
1337         (Incremental_binary::get_script_info): Add const.
1338         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1339         * testsuite/Makefile.am (incremental_test_5): New test case.
1340         (incremental_test_6): New test case.
1341         * testsuite/Makefile.in: Regenerate.
1342
1343 2011-07-06  Cary Coutant  <ccoutant@google.com>
1344
1345         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1346         debug output when command lines differ.
1347
1348 2011-07-06  Cary Coutant  <ccoutant@google.com>
1349
1350         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1351         --incremental-patch option.
1352         * layout.cc (Free_list::allocate): Extend allocation beyond original
1353         end if enabled.
1354         (Layout::make_output_section): Mark sections that should get
1355         patch space.
1356         * options.cc (parse_percent): New function.
1357         * options.h (parse_percent): New function.
1358         (DEFINE_percent): New macro.
1359         (General_options): Add --incremental-patch option.
1360         * output.cc (Output_section::Output_section): Initialize new data
1361         members.
1362         (Output_section::add_input_section): Print section name when out
1363         of patch space.
1364         (Output_section::add_output_section_data): Likewise.
1365         (Output_section::set_final_data_size): Add patch space when
1366         doing --incremental-full.
1367         (Output_section::do_reset_address_and_file_offset): Remove patch
1368         space.
1369         (Output_segment::set_section_list_addresses): Print debug output
1370         only if --incremental-update.
1371         * output.h (Output_section::set_is_patch_space_allowed): New function.
1372         (Output_section::is_patch_space_allowed_): New data member.
1373         (Output_section::patch_space_): New data member.
1374         * parameters.cc (Parameters::incremental_full): New function.
1375         * parameters.h (Parameters::incremental_full): New function
1376         * testsuite/Makefile.am (incremental_test_2): Add test for
1377         --incremental-patch option.
1378         * testsuite/Makefile.in: Regenerate.
1379         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1380         (t18): Remove function body.
1381
1382 2011-07-05  Doug Kwan  <dougkwan@google.com>
1383
1384         PR gold/12771
1385         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1386         Arm_Address type for relocation result.
1387         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1388         overflow check.
1389         (Arm_relocate_functions::abs32): Use unaligned access.
1390         (Arm_relocate_functions::rel32): Ditto.
1391         (Arm_relocate_functions::prel31): Ditto.
1392         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1393         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1394         static data relocations.
1395         * testsuite/Makefile.in: Regnerate.
1396         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1397
1398 2011-07-05  Ian Lance Taylor  <iant@google.com>
1399
1400         PR gold/12392
1401         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1402         symbols if necessary.
1403         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1404
1405 2011-07-05  Ian Lance Taylor  <iant@google.com>
1406
1407         PR gold/12952
1408         * resolve.cc (Symbol::override_base_with_special): Simply override
1409         version with special symbol version, ignoring previous version.
1410
1411 2011-07-05  Ian Lance Taylor  <iant@google.com>
1412
1413         * object.cc (Sized_relobj_file::include_section_group): Add
1414         information to comment about signature location.
1415
1416 2011-07-02  Ian Lance Taylor  <iant@google.com>
1417
1418         PR gold/12957
1419         * options.h (class General_options): Add -f and -F.
1420         * options.cc (General_options::finalize): Fatal error if -f/-F
1421         are used without -shared.
1422         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1423
1424 2011-07-02  Ian Lance Taylor  <iant@google.com>
1425
1426         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1427
1428 2011-07-01  Ian Lance Taylor  <iant@google.com>
1429
1430         PR gold/12525
1431         PR gold/12952
1432         * resolve.cc (Symbol::override_base_with_special): Don't override
1433         the version if the overriding symbol has a different name.
1434         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1435         all callers.  If we give an error about an undefined version,
1436         define the base version if necessary.
1437         * dynobj.h (class Versions): Update declaration.
1438         * testsuite/weak_alias_test_5.cc: New file.
1439         * testsuite/weak_alias_test.script: New file.
1440         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1441         and versioned_alias have the right value, and call t2.
1442         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1443         weak_alias_test_5.so.
1444         (weak_alias_test_LDADD): Likewise.
1445         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1446         * testsuite/Makefile.in: Rebuild.
1447
1448 2011-07-01  Ian Lance Taylor  <iant@google.com>
1449
1450         PR gold/12525
1451         * options.h (class General_options): Support -z notext.
1452         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1453         -Wl,-z,notext.
1454         (two_file_shared_nonpic.so): Likewise.
1455         (two_file_shared_mixed.so): Likewise.
1456         (two_file_shared_mixed_1.so): Likewise.
1457         (weak_undef_lib_nonpic.so): Likewise.
1458         (alt/weak_undef_lib_nonpic.so): Likewise.
1459         (tls_test_shared_nonpic.so): Likewise.
1460         * testsuite/Makefile.in: Rebuild.
1461
1462 2011-07-01  Ian Lance Taylor  <iant@google.com>
1463
1464         PR gold/12525
1465         * configure.ac: Test whether static linking works, setting
1466         the automake conditional HAVE_STATIC.
1467         * testsuite/Makefile.am: Disable tests using -static if
1468         HAVE_STATIC is not true.
1469         * configure, testsuite/Makefile.in: Rebuild.
1470
1471 2011-07-01  Ian Lance Taylor  <iant@google.com>
1472
1473         PR gold/12525
1474         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1475         Assert if we see DW_EH_PE_indirect.
1476         * target.h (Target::ehframe_datarel_base): New function.
1477         (Target::do_ehframe_datarel_base): New target function.
1478         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1479         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1480         function.
1481
1482 2011-07-01  Ian Lance Taylor  <iant@google.com>
1483
1484         PR gold/12571
1485         * options.h (class General_options): Add
1486         --ld-generated-unwind-info.
1487         * ehframe.cc (Fde::write): Add address parameter.  Change all
1488         callers.  If associated with PLT, fill in address and size.
1489         (Cie::set_output_offset): Only add merge mapping if there is an
1490         object.
1491         (Cie::write): Add address parameter.  Change all callers.
1492         (Eh_frame::add_ehframe_for_plt): New function.
1493         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1494         input_offset_ fields into union u_, with new plt field.
1495         (Fde::Fde): Adjust for new union field.
1496         (Fde::Fde) [Output_data version]: New constructor.
1497         (Fde::add_mapping): Only add merge mapping if there is an object.
1498         (class Cie): Update declarations.
1499         (class Eh_frame): Declare add_ehframe_for_plt.
1500         * layout.cc (Layout::layout_eh_frame): Break out code into
1501         make_eh_frame_section, and call it.
1502         (Layout::make_eh_frame_section): New function.
1503         (Layout::add_eh_frame_for_plt): New function.
1504         * layout.h (class Layout): Update declarations.
1505         * merge.cc (Merge_map::add_mapping): Add assertion.
1506         * i386.cc: Include "dwarf.h".
1507         (class Output_data_plt_i386): Make first_plt_entry,
1508         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1509         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1510         and plt_eh_frame_fde.
1511         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1512         boundary.  Call add_eh_frame_for_plt if appropriate.
1513         * x86_64.cc: Include "dwarf.h".
1514         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1515         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1516         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1517         and plt_eh_frame_fde.
1518         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1519         appropriate.
1520
1521 2011-06-29  Ian Lance Taylor  <iant@google.com>
1522
1523         PR gold/12629
1524         * object.cc (Sized_relobj_file::layout_section): Change shdr
1525         parameter to be const.
1526         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1527         out of do_layout.
1528         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1529         appropriate.  Call layout_eh_frame_section.
1530         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1531         sections.
1532         * object.h (class Sized_relobj_file): Update declarations.
1533
1534 2011-06-29  Ian Lance Taylor  <iant@google.com>
1535
1536         PR gold/12652
1537         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1538         modifier.
1539         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1540
1541 2011-06-29  Ian Lance Taylor  <iant@google.com>
1542
1543         PR gold/12675
1544         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1545         SHT_X86_64_UNWIND.
1546         * layout.cc (Layout::layout_eh_frame): Likewise.
1547
1548 2011-06-29  Ian Lance Taylor  <iant@google.com>
1549
1550         PR gold/12695
1551         * layout.cc (Layout::symtab_section_shndx): New function.
1552         * layout.h (class Layout): Declare symtab_section_shndx.
1553         * output.cc (Output_section::write_header): Call it.
1554
1555 2011-06-29  Ian Lance Taylor  <iant@google.com>
1556
1557         PR gold/12818
1558         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1559         symbols which are not used in a relocation.
1560
1561 2011-06-28  Ian Lance Taylor  <iant@google.com>
1562
1563         PR gold/12898
1564         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1565         script create indistinguishable segments.
1566         (Layout::set_segment_offsets): Use stable_sort when sorting
1567         segments.  Pass this to Compare_segments constructor.
1568         * layout.h (class Layout): Make segment_precedes non-static.
1569         (class Compare_segments): Change from struct to class.  Add
1570         layout_ field.  Add constructor.
1571         * script-sections.cc
1572         (Script_sections::attach_sections_using_phdrs_clause): Rename
1573         local orphan to is_orphan.  Don't report failure to put empty
1574         section in segment.  On attachment failure, report name of
1575         section, and attach to first PT_LOAD segment.
1576
1577 2011-06-28  Ian Lance Taylor  <iant@google.com>
1578
1579         PR gold/12934
1580         * target-select.cc (Target_selector::Target_selector): Add
1581         emulation parameter.  Change all callers.
1582         (select_target_by_bfd_name): Rename from select_target_by_name.
1583         Change all callers.
1584         (select_target_by_emulation): New function.
1585         (supported_emulation_names): New function.
1586         * target-select.h (class Target_selector): Add emulation_ field.
1587         Update declarations.
1588         (Target_selector::recognize_by_bfd_name): Rename from
1589         recognize_by_name.  Change all callers.
1590         (Target_selector::supported_bfd_names): Rename from
1591         supported_names.  Change all callers.
1592         (Target_selector::recognize_by_emulation): New function.
1593         (Target_selector::supported_emulations): New function.
1594         (Target_selector::emulation): New function.
1595         (Target_selector::do_recognize_by_bfd_name): Rename from
1596         do_recognize_by_name.  Change all callers.
1597         (Target_selector::do_supported_bfd_names): Rename from
1598         do_supported_names.  Change all callers.
1599         (Target_selector::do_recognize_by_emulation): New function.
1600         (Target_selector::do_supported_emulations): New function.
1601         (select_target_by_bfd_name): Change name in declaration.
1602         (select_target_by_emulation): Declare.
1603         (supported_emulation_names): Declare.
1604         * parameters.cc (parameters_force_valid_target): Try to find
1605         target based on emulation from -m option.
1606         * options.h (class General_options): Change doc string for -m.
1607         * options.cc (help): Print emulations.
1608         (General_options::parse_V): Likewise.
1609         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1610         Add emulation parameter.  Change all callers.
1611
1612 2011-06-28  Ian Lance Taylor  <iant@google.com>
1613
1614         * target.h (class Target): Add osabi_ field.
1615         (Target::osabi): New function.
1616         (Target::set_osabi): New function.
1617         (Target::Target): Initialize osabi_.
1618         (Target::do_adjust_elf_header): Make pure virtual.
1619         (Sized_target::do_adjust_elf_header): Declare.
1620         * target.cc (Sized_target::do_adjust_elf_header): New function.
1621         (class Sized_target): Instantiate all versions.
1622         * freebsd.h (class Target_freebsd): Remove.
1623         (Target_selector_freebsd::do_recognize): Call set_osabi on
1624         Target.
1625         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1626         (Target_selector_freebsd::set_osabi): Remove.
1627         * i386.cc (class Target_i386): Inherit from Sized_target rather
1628         than Target_freebsd.
1629         * x86_64.cc (class Target_x86_64): Likewise.
1630
1631 2011-06-28  Ian Lance Taylor  <iant@google.com>
1632
1633         * target.h (Target::can_check_for_function_pointers): Rewrite.
1634         Make non-virtual.
1635         (Target::can_icf_inline_merge_sections): Likewise.
1636         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1637         (Target::Target_info): Add can_icf_inline_merge_sections field.
1638         (Target::do_can_check_for_function_pointers): New virtual
1639         function.
1640         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1641         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1642         from can_check_for_function_pointers, move in file.
1643         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1644         section_may_have_icf_unsafe_poineters, move in file.
1645         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1646         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1647         Rename from can_check_for_function_pointers, move in file.
1648         (Target_i386::can_icf_inline_merge_sections): Remove.
1649         (Target_i386::i386_info): Initialize
1650         can_icf_inline_merge_sections.
1651         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1652         Initialize can_icf_inline_merge_sections.
1653         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1654         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1655         Rename from can_check_for_function_pointers, move in file.
1656         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1657         (Target_x86_64::x86_64_info): Initialize
1658         can_icf_inline_merge_sections.
1659         * testsuite/testfile.cc (Target_test::test_target_info):
1660         Likewise.
1661         * icf.cc (get_section_contents): Correct formatting.
1662
1663 2011-06-27  Ian Lance Taylor  <iant@google.com>
1664
1665         * symtab.cc (Symbol::versioned_name): New function.
1666         (Symbol_table::add_to_final_symtab): Use versioned_name when
1667         appropriate.
1668         (Symbol_table::sized_write_symbol): Likewise.
1669         * symtab.h (class Symbol): Declare versioned_name.
1670         * stringpool.h (class Stringpool_template): Add variant of add
1671         which takes a std::basic_string.
1672         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1673         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1674         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1675         (ver_test_12.o): New target.
1676         * testsuite/Makefile.in: Rebuild.
1677
1678 2011-06-27  Doug Kwan  <dougkwan@google.com>
1679
1680         * arm.cc (Arm_relocate_functions::thm_jump8,
1681         Arm_relocate_functions::thm_jump11): Use a wider signed
1682         type to compute offset.
1683         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1684         arm_thm_jump8.
1685         * testsuite/Makefile.in: Regenerate.
1686         * testsuite/arm_branch_in_range.sh: Check test results of
1687         arm_thm_jump11 and arm_thm_jump8.
1688         * testsuite/arm_thm_jump11.s: New test source file.
1689         * testsuite/arm_thm_jump11.t: New linker script.
1690         * testsuite/arm_thm_jump8.s: New test source file.
1691         * testsuite/arm_thm_jump8.t: New linker script.
1692
1693 2011-06-24  Ian Lance Taylor  <iant@google.com>
1694
1695         * layout.cc: Include "object.h".
1696         (ctors_sections_in_init_array): New static variable.
1697         (Layout::is_ctors_in_init_array): New function.
1698         (Layout::layout): Add entry to ctors_sections_in_init_array if
1699         appropriate.
1700         * layout.h (class Layout): Declare is_ctors_in_init_array.
1701         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1702         is_ctors_reverse_view is set.
1703         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1704         all callers.  Set is_ctors_reverse_view field of View_size.
1705         (Sized_relobj_file::reverse_words): New function.
1706         * object.h (Sized_relobj_file::View_size): Add
1707         is_ctors_reverse_view field.
1708         (class Sized_relobj_file): Update declarations.
1709         * testsuite/initpri3.c: New test.
1710         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1711         initpri3b.
1712         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1713         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1714         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1715         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1716         * testsuite/Makefile.in: Rebuild.
1717
1718 2011-06-24  Cary Coutant  <ccoutant@google.com>
1719
1720         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1721         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1722         (debug_msg_cdebug.err): New targets.
1723         * testsuite/Makefile.in: Regenerate.
1724         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1725         Fix checks for link with shared library.
1726
1727 2011-06-24  Doug Kwan  <dougkwan@google.com>
1728
1729         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1730         skip empty text sections.
1731         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1732
1733 2011-06-22  Ian Lance Taylor  <iant@google.com>
1734
1735         PR gold/12910
1736         * options.h (class General_options): Add --ctors-in-init-array.
1737         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1738         friends as SHT_PROGBITS for merging sections.
1739         (Layout::layout): Remove special handling of .init_array and
1740         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1741         and .dtors if ctors_in_init_array.
1742         (Layout::make_output_section): Force correct section types for
1743         .init_array and friends.  Don't sort if doing relocatable link,
1744         Don't sort .ctors and .dtors if ctors_in_init_array.
1745         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1746         (Layout::output_section_name): Add relobj parameter.  Change all
1747         callers.  Handle .ctors. and .dtors. in code rather than table.
1748         Handle .ctors and .dtors if ctors_in_init_array.
1749         (Layout::match_file_name): New function, moved from output.cc.
1750         * layout.h (class Layout): Update declarations.
1751         * output.cc: Include "layout.h".
1752         (Input_section_sort_entry::get_priority): New function.
1753         (Input_section_sort_entry::match_file_name): Just call
1754         Layout::match_file_name.
1755         (Output_section::Input_section_sort_init_fini_compare::operator()):
1756         Handle .ctors and .dtors.  Sort by explicit priority rather than
1757         by name.
1758         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1759         * testsuite/initpri2.c: New test.
1760         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1761         (check_PROGRAMS): Add initpri2.
1762         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1763         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1764         * configure, testsuite/Makefile.in: Rebuild.
1765
1766 2011-06-19  Ian Lance Taylor  <iant@google.com>
1767
1768         PR gold/12880
1769         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1770         .interp section to a PT_INTERP segment even if we have seen a
1771         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1772         clause in a linker script.
1773         (Layout::finalize): Don't create a .interp section if we've
1774         already create a PT_INTERP segment.
1775         (Layout::create_interp): Always call choose_output_section (revert
1776         patch of 2011-06-17).  Don't create PT_INTERP segment.
1777         * script-sections.cc
1778         (Script_sections::create_note_and_tls_segments): Add a .interp
1779         section to a PT_INTERP segment even if we have seen a
1780         --dynamic-linker option.
1781
1782 2011-06-18  Ian Lance Taylor  <iant@google.com>
1783
1784         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1785         merely because a non-PT_LOAD segment has a dynamic reloc.
1786
1787 2011-06-18  Ian Lance Taylor  <iant@google.com>
1788
1789         * layout.cc (Layout::finish_dynamic_section): Don't create
1790         DT_FLAGS entry if not needed.
1791
1792 2011-06-18  Ian Lance Taylor  <iant@google.com>
1793
1794         PR gold/12745
1795         * layout.cc (Layout::layout_eh_frame): Correct handling of
1796         writable .eh_frame section.
1797
1798 2011-06-17  Ian Lance Taylor  <iant@google.com>
1799
1800         PR gold/12893
1801         * resolve.cc (Symbol_table::resolve): Don't give an error if a
1802         symbol is redefined with the exact same object and value.
1803
1804 2011-06-17  Ian Lance Taylor  <iant@google.com>
1805
1806         PR gold/12880
1807         * layout.h (class Layout): Add interp_segment_ field.
1808         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1809         (Layout::attach_allocated_section_to_segment): If making shared
1810         library, put .interp section in PT_INTERP segment.
1811         (Layout::finalize): Also call create_interp if -dynamic-linker
1812         option was used.
1813         (Layout::create_interp): Assert that there is no PT_INTERP
1814         segment.  If not using a SECTIONS clause, use make_output_section.
1815         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1816         * script-sections.cc
1817         (Script_sections::create_note_and_tls_segments): If making shared
1818         library, put .interp section in PT_INTERP segment.
1819
1820 2011-06-17  Ian Lance Taylor  <iant@google.com>
1821
1822         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1823         when making a shared library.
1824
1825 2011-06-17  Ian Lance Taylor  <iant@google.com>
1826
1827         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1828         parameter.  Change all callers.  Don't issue warning about PC32
1829         against locally defined symbol.
1830
1831 2011-06-16  Ian Lance Taylor  <iant@google.com>
1832
1833         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1834         occurs in same object.
1835
1836 2011-06-14  Alan Modra  <amodra@gmail.com>
1837
1838         * po/POTFILES.in: Regenerate.
1839
1840 2011-06-09  Ian Lance Taylor  <iant@google.com>
1841
1842         * script-sections.cc
1843         (Orphan_output_section::set_section_addresses): For a relocatable
1844         link set address to 0.
1845
1846 2011-06-09  Cary Coutant  <ccoutant@google.com>
1847
1848         PR gold/12804
1849         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1850         used with --compress-debug-sections.
1851         * gold/object.cc (Sized_relobj_file::do_layout): Report
1852         uncompressed size of compressed input sections.
1853
1854 2011-06-08  Cary Coutant  <ccoutant@google.com>
1855
1856         PR gold/12804
1857         * testsuite/two_file_test_2_v1.cc: Change initialization of
1858         v2 to keep it in .data.
1859
1860 2011-06-07  Cary Coutant  <ccoutant@google.com>
1861
1862         * common.cc (Symbol_table::do_allocate_commons_list): Call
1863         gold_fallback.
1864         * errors.cc (Errors::fatal): Adjust call to gold_exit.
1865         (Errors::fallback): New function.
1866         (gold_fallback): New function.
1867         * errors.h (Errors::fallback): New function.
1868         * gold.cc (gold_exit): Change status parameter to enum; adjust
1869         all callers.
1870         (queue_initial_tasks): Call gold_fallback.
1871         * gold.h: Include cstdlib.
1872         (Exit_status): New enum type.
1873         (gold_exit): Change status parameter to enum.
1874         (gold_fallback): New function.
1875         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1876         (Layout::create_symtab_sections): Likewise.
1877         (Layout::create_shdrs): Likewise.
1878         * main.cc (main): Adjust call to gold_exit.
1879         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1880         (Output_data_got::add_got_entry_pair): Likewise.
1881         (Output_section::add_input_section): Likewise.
1882         (Output_section::add_output_section_data): Likewise.
1883         (Output_segment::set_section_list_addresses): Likewise.
1884         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1885
1886 2011-06-07  Cary Coutant  <ccoutant@google.com>
1887
1888         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1889         for incremental links.
1890         * output.cc (Output_segment::set_section_list_addresses): Remove
1891         FIXME and test for TLS or BSS.
1892
1893 2011-06-07  Cary Coutant  <ccoutant@google.com>
1894
1895         * testsuite/Makefile.am: Add incremental_copy_test,
1896         incremental_common_test_1.
1897         * testsuite/Makefile.in: Regenerate.
1898         * testsuite/common_test_1_v1.c: New source file.
1899         * testsuite/common_test_1_v2.c: New source file.
1900         * testsuite/copy_test_v1.cc: New source file.
1901
1902 2011-06-07  Cary Coutant  <ccoutant@google.com>
1903
1904         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1905         update, allocate common from bss section's free list.
1906         * incremental-dump.cc (dump_incremental_inputs): Print flag for
1907         linker-defined symbols.
1908         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1909         Skip GOT and PLT entries that are no longer referenced.
1910         (Output_section_incremental_inputs::write_info_blocks): Mark
1911         linker-defined symbols.
1912         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1913         * output.cc (Output_section::allocate): New function.
1914         * output.h (Output_section::allocate): New function.
1915         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1916         linker-defined symbols.
1917         (Symbol::override_base_with_special): Copy is_predefined_ flag.
1918         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1919         (Symbol::init_base_output_data): Likewise.
1920         (Symbol::init_base_output_segment): Likewise.
1921         (Symbol::init_base_constant): Likewise.
1922         (Sized_symbol::init_output_data): Likewise.
1923         (Sized_symbol::init_output_segment): Likewise.
1924         (Sized_symbol::init_constant): Likewise.
1925         (Symbol_table::do_define_in_output_data): Likewise.
1926         (Symbol_table::do_define_in_output_segment): Likewise.
1927         (Symbol_table::do_define_as_constant): Likewise.
1928         * symtab.h (Symbol::is_predefined): New function.
1929         (Symbol::init_base_output_data): Add is_predefined parameter.
1930         (Symbol::init_base_output_segment): Likewise.
1931         (Symbol::init_base_constant): Likewise.
1932         (Symbol::is_predefined_): New data member.
1933         (Sized_symbol::init_output_data): Add is_predefined parameter.
1934         (Sized_symbol::init_output_segment): Likewise.
1935         (Sized_symbol::init_constant): Likewise.
1936         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1937
1938 2011-06-07  Cary Coutant  <ccoutant@google.com>
1939
1940         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1941         instead of emit_copy_reloc.
1942         (Copy_relocs::emit_copy_reloc): Refactor.
1943         (Copy_relocs::make_copy_reloc): New function.
1944         (Copy_relocs::add_copy_reloc): Remove.
1945         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1946         section.
1947         (Copy_relocs::make_copy_reloc): New function.
1948         (Copy_relocs::add_copy_reloc): Remove.
1949         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1950         unchanged input files.
1951         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1952         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1953         Reserve BSS space for COPY relocations.
1954         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1955         (Output_section_incremental_inputs::write_info_blocks): Record
1956         whether a symbol is copied from a shared object.
1957         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1958         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1959         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1960         (Incremental_input_entry_reader::get_output_symbol_index): Add
1961         is_copy parameter.
1962         (Incremental_binary::emit_copy_relocs): New function.
1963         (Incremental_binary::do_emit_copy_relocs): New function.
1964         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1965         new data member.
1966         (Sized_incremental_binary::add_copy_reloc): New function.
1967         (Sized_incremental_binary::do_emit_copy_relocs): New function.
1968         (Sized_incremental_binary::Copy_reloc): New struct.
1969         (Sized_incremental_binary::Copy_relocs): New typedef.
1970         (Sized_incremental_binary::copy_relocs_): New data member.
1971         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1972         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1973         * target.h (Sized_target::emit_copy_reloc): New function.
1974         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1975
1976 2011-06-02  Cary Coutant  <ccoutant@google.com>
1977
1978         PR gold/12163
1979         * gold/archive.cc (Archive::Archive): Initialize new data member.
1980         (Archive::include_all_members): Return if archive has already been
1981         included.
1982         * gold/archive.h (Archive::include_all_members_): New data member.
1983
1984 2011-06-02  Nick Clifton  <nickc@redhat.com>
1985
1986         * dynobj.h: Fix spelling mistake in comment.
1987         * output.cc: Likewise.
1988
1989 2011-05-31  Doug Kwan  <dougkwan@google.com>
1990             Asier Llano
1991
1992         PR gold/12826
1993         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1994         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1995         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
1996         redundant arm_exidx_test.so.
1997         * testsuite/Makefile.in: Regenerate.
1998         (check_SCRIPTS): Add pr12826.sh
1999         (check_DATA): Add pr12826.stdout
2000         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2001         * testsuite/pr12826.sh: New file.
2002         * testsuite/pr12826_1.s: Ditto.
2003         * testsuite/pr12826_1.s: Ditto.
2004
2005 2011-05-30  Ian Lance Taylor  <iant@google.com>
2006
2007         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2008         sections.
2009
2010 2011-05-29  Ian Lance Taylor  <iant@google.com>
2011
2012         PR gold/12804
2013         * testsuite/Makefile.am: Use different file name for two_file_test
2014         temporary file for each incremental test.
2015         * testsuite/Makefile.in: Rebuild.
2016
2017 2011-05-29  Ian Lance Taylor  <iant@google.com>
2018
2019         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2020         binary input file is empty.
2021
2022 2011-05-27  Ian Lance Taylor  <iant@google.com>
2023
2024         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2025         (ver_test_9.so): Likewise.
2026         * testsuite/Makefile.in: Rebuild.
2027
2028 2011-05-26 Cary Coutant  <ccoutant@google.com>
2029
2030         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2031         * incremental.cc (Incremental_inputs::report_input_section): Fix
2032         comment, indentation.
2033         (Incremental_inputs::report_comdat_group): New function.
2034         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2035         of data for incremental input file entry.
2036         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2037         group count, COMDAT group signatures.
2038         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2039         an unchanged input file.
2040         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2041         Initialize new data member.
2042         (Incremental_object_entry::add_comdat_group): New function.
2043         (Incremental_object_entry::get_comdat_group_count): New function.
2044         (Incremental_object_entry::get_comdat_signature_key): New function.
2045         (Incremental_object_entry::groups_): New data member.
2046         (Incremental_inputs::report_comdat_group): New function.
2047         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2048         data for incremental input file entry.
2049         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2050         (Incremental_input_entry_reader::get_input_section): Adjust size of
2051         data for incremental input file entry.
2052         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2053         (Incremental_input_entry_reader::get_comdat_group_signature): New
2054         function.
2055         * object.cc (Sized_relobj::include_section_group): Report kept
2056         COMDAT groups for incremental links.
2057
2058 2011-05-24  David Meyer  <pdox@google.com>
2059
2060         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2061         with name parameter.  Add found_name parameter.
2062         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2063         * dirsearch.h (class Dirsearch): Update declaration.
2064
2065 2011-05-24  Ian Lance Taylor  <iant@google.com>
2066
2067         * archive.cc (Library_base::should_include_member): Pull in object
2068         from archive if it defines the entry symbol.
2069         * parameters.cc (Parameters::entry): New function.
2070         * parameters.h (class Parameters): Declare entry.
2071         * output.h (class Output_file_header): Remove entry_ field.
2072         * output.cc (Output_file_header::Output_file_header): Remove entry
2073         parameter.  Change all callers.
2074         (Output_file_header::entry): Use parameters->entry.
2075         * gold.cc (queue_middle_tasks): Likewise.
2076         * plugin.cc (Plugin_hook::run): Likewise.
2077
2078 2011-05-24 Cary Coutant  <ccoutant@google.com>
2079
2080         * gold.cc (queue_initial_tasks): Pass incremental base filename
2081         to Output_file::open_base_file; don't print error message.
2082         * incremental-dump.cc (main): Adjust call to
2083         Output_file::open_for_modification.
2084         * incremental-dump.cc (main): Likewise.
2085         * incremental.cc (Incremental_inputs::report_command_line):
2086         Ignore --incremental-base option when comparing command lines.
2087         Ignore parameter when given as separate argument.
2088         * options.h (class General_options): Add --incremental-base.
2089         * output.cc (Output_file::Output_file):
2090         (Output_file::open_base_file): Add base_name and writable parameters;
2091         read base file into new file; print error message here.
2092         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2093         callers.
2094         * output.h (Output_file::open_for_modification): Rename to...
2095         (Output_file::open_base_file): ...this; add base_name and
2096         writable parameters; adjust all callers.
2097         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2098         callers.
2099         * testsuite/Makefile.am (incremental_test_4): Test
2100         --incremental-base.
2101         * testsuite/Makefile.in: Regenerate.
2102
2103 2011-05-24 Cary Coutant  <ccoutant@google.com>
2104
2105         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2106         incremental_test_4.
2107         * testsuite/Makefile.in: Regenerate.
2108         * testsuite/two_file_test_1_v1.cc: New test source file.
2109         * testsuite/two_file_test_1b_v1.cc: New test source file.
2110         * testsuite/two_file_test_2_v1.cc: New test source file.
2111
2112 2011-05-24 Cary Coutant  <ccoutant@google.com>
2113
2114         * dynobj.h (Dynobj::do_dynobj): New function.
2115         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2116         flag and soname for shared objects.
2117         * incremental.cc (Incremental_inputs::report_object): Make
2118         either Incremental_object_entry or Incremental_dynobj_entry; add
2119         soname to string table.
2120         (Incremental_inputs::report_input_section): Add assertion.
2121         (Output_section_incremental_inputs::set_final_data_size): Adjust
2122         type of input file entry for shared libraries; adjust size of
2123         shared library info entry.
2124         (Output_section_incremental_inputs::write_input_files): Write
2125         as_needed flag for shared libraries.
2126         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2127         of input file entry for shared libraries; write soname.
2128         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2129         soname from incremental info.
2130         * incremental.h (enum Incremental_input_flags): Add
2131         INCREMENTAL_INPUT_AS_NEEDED.
2132         (Incremental_input_entry::Incremental_input_entry): Initialize new
2133         data member.
2134         (Incremental_input_entry::set_as_needed): New function.
2135         (Incremental_input_entry::as_needed): New function.
2136         (Incremental_input_entry::do_dynobj_entry): New function.
2137         (Incremental_input_entry::as_needed_): New data member.
2138         (Incremental_object_entry::Incremental_object_entry): Don't check
2139         for shared library.
2140         (Incremental_object_entry::do_type): Likewise.
2141         (class Incremental_dynobj_entry): New class.
2142         (Incremental_input_entry_reader::as_needed): New function.
2143         (Incremental_input_entry_reader::get_soname): New function.
2144         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2145         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2146         size of shared library info entry.
2147         * layout.cc (Layout::finish_dynamic_section): Don't test for
2148         incremental link when adding DT_NEEDED entries.
2149         * object.h (Object::Object): Initialize new data member.
2150         (Object::dynobj): New function.
2151         (Object::set_as_needed): New function.
2152         (Object::as_needed): New function.
2153         (Object::do_dynobj): New function.
2154         (Object::as_needed_): New data member.
2155
2156 2011-05-24 Cary Coutant  <ccoutant@google.com>
2157
2158         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2159         info; adjust display of GOT entries.
2160         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2161         vector of input objects; remove file_status_.
2162         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2163         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2164         got_plt reader; call target hooks to reserve GOT entries.
2165         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2166         of input file info header and GOT info entry.
2167         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2168         relocation info.
2169         (Got_plt_view_info::got_descriptor): Remove.
2170         (Got_plt_view_info::sym_index): New data member.
2171         (Got_plt_view_info::input_index): New data member.
2172         (Local_got_offset_visitor::visit): Write input file index.
2173         (Global_got_offset_visitor::visit): Write 0 for input file index.
2174         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2175         with sym_index and input_index.
2176         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2177         incremental info GOT entry; replace got_descriptor with input_index.
2178         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2179         map from input file index to object.
2180         (Sized_relobj_incr::do_layout): Replace direct data member reference
2181         with accessor function.
2182         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2183         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2184         Adjust size of input file info header.
2185         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2186         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2187         (Incremental_input_entry_reader::get_input_section): Adjust size of
2188         input file info header.
2189         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2190         of incremental info GOT entry.
2191         (Incremental_got_plt_reader::get_got_desc): Remove.
2192         (Incremental_got_plt_reader::get_got_symndx): New function.
2193         (Incremental_got_plt_reader::get_got_input_index): New function.
2194         (Sized_incremental_binary::Sized_incremental_binary): Remove
2195         file_status_; add input_objects_.
2196         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2197         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2198         (Sized_incremental_binary::file_is_unchanged): Remove.
2199         (Sized_incremental_binary::set_input_object): New function.
2200         (Sized_incremental_binary::input_object): New function.
2201         (Sized_incremental_binary::file_status_): Remove.
2202         (Sized_incremental_binary::input_objects_): New data member.
2203         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2204         references.
2205         (Sized_relobj_incr::invalid_address): Move to base class.
2206         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2207         class.
2208         (Sized_relobj_incr::do_output_section_offset): Likewise.
2209         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2210         (Sized_relobj_incr::section_offsets_): Likewise.
2211         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2212         function.
2213         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2214         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2215         with accessor function.
2216         (Sized_relobj_file::do_layout): Likewise.
2217         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2218         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2219         (Sized_relobj_file::compute_final_local_value): Replace refs to
2220         section_offsets_ with accessor function.
2221         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2222         * object.h (Relobj::Relobj): Initialize new data members.
2223         (Relobj::add_dyn_reloc): New function.
2224         (Relobj::first_dyn_reloc): New function.
2225         (Relobj::dyn_reloc_count): New function.
2226         (Relobj::first_dyn_reloc_): New data member.
2227         (Relobj::dyn_reloc_count_): New data member.
2228         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2229         references.
2230         (Sized_relobj::Address): New typedef.
2231         (Sized_relobj::invalid_address): Move here from child class.
2232         (Sized_relobj::Sized_relobj): Initialize new data members.
2233         (Sized_relobj::sized_relobj): New function.
2234         (Sized_relobj::is_output_section_offset_invalid): Move here from
2235         child class.
2236         (Sized_relobj::get_output_section_offset): Likewise.
2237         (Sized_relobj::local_has_got_offset): Likewise.
2238         (Sized_relobj::local_got_offset): Likewise.
2239         (Sized_relobj::set_local_got_offset): Likewise.
2240         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2241         (Sized_relobj::clear_got_offsets): New function.
2242         (Sized_relobj::section_offsets): Move here from child class.
2243         (Sized_relobj::do_output_section_offset): Likewise.
2244         (Sized_relobj::do_set_section_offset): Likewise.
2245         (Sized_relobj::Local_got_offsets): Likewise.
2246         (Sized_relobj::local_got_offsets_): Likewise.
2247         (Sized_relobj::section_offsets_): Likewise.
2248         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2249         references.
2250         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2251         class.
2252         (Sized_relobj_file::sized_relobj): New function
2253         (Sized_relobj_file::local_has_got_offset): Move to base class.
2254         (Sized_relobj_file::local_got_offset): Likewise.
2255         (Sized_relobj_file::set_local_got_offset): Likewise.
2256         (Sized_relobj_file::get_output_section_offset): Likewise.
2257         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2258         (Sized_relobj_file::do_output_section_offset): Likewise.
2259         (Sized_relobj_file::do_set_section_offset): Likewise.
2260         (Sized_relobj_file::Local_got_offsets): Likewise.
2261         (Sized_relobj_file::local_got_offsets_): Likewise.
2262         (Sized_relobj_file::section_offsets_): Likewise.
2263         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2264         (all constructors).
2265         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2266         (Output_reloc::get_symbol_index): Likewise.
2267         (Output_reloc::local_section_offset): Likewise.
2268         (Output_reloc::get_address): Likewise.
2269         (Output_reloc::symbol_value): Likewise.
2270         (Output_data_got::reserve_slot): Move to class definition.
2271         (Output_data_got::reserve_local): New function.
2272         (Output_data_got::reserve_slot_for_global): Remove.
2273         (Output_data_got::reserve_global): New function.
2274         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2275         (all constructors, two instantiations).
2276         (Output_reloc::get_relobj): New function (two instantiations).
2277         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2278         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2279         (Output_data_reloc::add_global): Adjust type of relobj.
2280         (Output_data_reloc::add_global_relative): Likewise.
2281         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2282         (Output_data_reloc::add_local): Likewise.
2283         (Output_data_reloc::add_local_relative): Likewise.
2284         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2285         (Output_data_reloc::add_local_section): Likewise.
2286         (Output_data_reloc::add_output_section): Likewise.
2287         (Output_data_reloc::add_absolute): Likewise.
2288         (Output_data_reloc::add_target_specific): Likewise.
2289         (Output_data_got::reserve_slot): Move definition here.
2290         (Output_data_got::reserve_local): New function.
2291         (Output_data_got::reserve_global): New function.
2292         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2293         section_offsets_ with accessor function.
2294         (Sized_relobj_file::write_sections): Likewise.
2295         (Sized_relobj_file::do_relocate_sections): Likewise.
2296         * target.h (Sized_target::reserve_local_got_entry): New function.
2297         (Sized_target::reserve_global_got_entry): New function.
2298         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2299         (Target_x86_64::reserve_global_got_entry): New function.
2300         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2301
2302 2011-05-23 Cary Coutant  <ccoutant@google.com>
2303
2304         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2305         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2306         bit when checking got_type.
2307         * incremental.cc (Sized_incremental_binary::setup_readers):
2308         Store symbol table and string table locations; initialize bit vector
2309         of file status flags.
2310         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2311         unchanged files.
2312         (Sized_incremental_binary::do_process_got_plt): New function.
2313         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2314         (Output_section_incremental_inputs::set_final_data_size): Record
2315         file index for each input file.
2316         (Output_section_incremental_inputs::write_got_plt): Store file index
2317         instead of input entry offset for each GOT entry.
2318         * incremental.h
2319         (Incremental_input_entry::Incremental_input_entry): Initialize new
2320         data member.
2321         (Incremental_input_entry::set_offset): Store file index.
2322         (Incremental_input_entry::get_file_index): New function.
2323         (Incremental_input_entry::file_index_): New data member.
2324         (Incremental_binary::process_got_plt): New function.
2325         (Incremental_binary::do_process_got_plt): New function.
2326         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2327         data members.
2328         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2329         (Sized_incremental_binary::set_file_is_unchanged): New function.
2330         (Sized_incremental_binary::file_is_unchanged): New function.
2331         (Sized_incremental_binary::do_process_got_plt): New function.
2332         (Sized_incremental_binary::file_status_): New data member.
2333         (Sized_incremental_binary::main_symtab_loc_): New data member.
2334         (Sized_incremental_binary::main_strtab_loc_): New data member.
2335         * output.cc (Output_data_got::Got_entry::write): Add case
2336         RESERVED_CODE.
2337         (Output_data_got::add_global): Call add_got_entry.
2338         (Output_data_got::add_global_plt): Likewise.
2339         (Output_data_got::add_global_with_rel): Likewise.
2340         (Output_data_got::add_global_with_rela): Likewise.
2341         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2342         (Output_data_got::add_global_pair_with_rela): Likewise.
2343         (Output_data_got::add_local): Call add_got_entry.
2344         (Output_data_got::add_local_plt): Likewise.
2345         (Output_data_got::add_local_with_rel): Likewise.
2346         (Output_data_got::add_local_with_rela): Likewise.
2347         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2348         (Output_data_got::add_local_pair_with_rela): Likewise.
2349         (Output_data_got::reserve_slot): New function.
2350         (Output_data_got::reserve_slot_for_global): New function.
2351         (Output_data_got::add_got_entry): New function.
2352         (Output_data_got::add_got_entry_pair): New function.
2353         (Output_section::add_output_section_data): Edit FIXME.
2354         * output.h
2355         (Output_section_data_build::Output_section_data_build): New
2356         constructor with size parameter.
2357         (Output_data_space::Output_data_space): Likewise.
2358         (Output_data_got::Output_data_got): Initialize new data member; new
2359         constructor with size parameter.
2360         (Output_data_got::add_constant): Call add_got_entry.
2361         (Output_data_got::reserve_slot): New function.
2362         (Output_data_got::reserve_slot_for_global): New function.
2363         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2364         (Output_data_got::add_got_entry): New function.
2365         (Output_data_got::add_got_entry_pair): New function.
2366         (Output_data_got::free_list_): New data member.
2367         * target.h (Sized_target::init_got_plt_for_update): New function.
2368         (Sized_target::register_global_plt_entry): New function.
2369         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2370         Initialize new data member; call init; add constructor with PLT count.
2371         (Output_data_plt_x86_64::init): New function.
2372         (Output_data_plt_x86_64::add_relocation): New function.
2373         (Output_data_plt_x86_64::reserve_slot): New function.
2374         (Output_data_plt_x86_64::free_list_): New data member.
2375         (Target_x86_64::init_got_plt_for_update): New function.
2376         (Target_x86_64::register_global_plt_entry): New function.
2377         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2378         incremental updates.
2379         (Output_data_plt_x86_64::add_relocation): New function.
2380         * testsuite/object_unittest.cc (Object_test): Set default options.
2381
2382 2011-05-16  Ian Lance Taylor  <iant@google.com>
2383
2384         * options.h (class General_options): Make -i a synonym for -r.
2385
2386 2011-05-16  Ian Lance Taylor  <iant@google.com>
2387
2388         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2389
2390 2011-05-10 Cary Coutant  <ccoutant@google.com>
2391
2392         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2393         strip_all (-s).
2394
2395 2011-05-06  Ian Lance Taylor  <iant@google.com>
2396
2397         * layout.cc (Layout::layout): If the output section flags change,
2398         update the ordering.
2399
2400 2011-04-25 Cary Coutant  <ccoutant@google.com>
2401
2402         * incremental-dump.cc (dump_incremental_inputs): Print local
2403         symbol info for each input file.
2404         * incremental.cc
2405         (Output_section_incremental_inputs::set_final_data_size): Add local
2406         symbol info to input file entries in incremental info.
2407         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2408         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2409         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2410         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2411         implementation.
2412         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2413         (Sized_incr_relobj::do_relocate): Write the local symbols.
2414         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2415         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2416         Adjust size of input file header.
2417         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2418         (Incremental_inputs_reader::get_local_symbol_count): New function.
2419         (Incremental_inputs_reader::get_input_section): Adjust size of input
2420         file header.
2421         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2422         (Sized_incr_relobj::This): New typedef.
2423         (Sized_incr_relobj::sym_size): New const data member.
2424         (Sized_incr_relobj::Local_symbol): New struct.
2425         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2426         (Sized_incr_relobj::do_local_symbol_offset): New function.
2427         (Sized_incr_relobj::local_symbol_count_): New data member.
2428         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2429         (Sized_incr_relobj::local_symbol_index_): New data member.
2430         (Sized_incr_relobj::local_symbol_offset_): New data member.
2431         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2432         (Sized_incr_relobj::local_symbols_): New data member.
2433         * object.h (Relobj::output_local_symbol_count): New function.
2434         (Relobj::local_symbol_offset): New function.
2435         (Relobj::do_output_local_symbol_count): New function.
2436         (Relobj::do_local_symbol_offset): New function.
2437         (Sized_relobj::do_output_local_symbol_count): New function.
2438         (Sized_relobj::do_local_symbol_offset): New function.
2439
2440 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2441
2442         * descriptors.cc (set_close_on_exec): New function.
2443         (Descriptors::open): Use set_close_on_exec.
2444         * output.cc (S_ISLNK): Define if not defined.
2445
2446 2011-04-22 Cary Coutant  <ccoutant@google.com>
2447
2448         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2449         global symbol map.
2450         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2451         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2452         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2453         relocations.
2454         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2455         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2456         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2457         * incremental.h
2458         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2459         function.
2460         (Incremental_binary::apply_incremental_relocs): New function.
2461         (Incremental_binary::do_apply_incremental_relocs): New function.
2462         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2463         data member.
2464         (Sized_incremental_binary::add_global_symbol): New function.
2465         (Sized_incremental_binary::global_symbol): New function.
2466         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2467         (Sized_incremental_binary::symbol_map_): New data member.
2468         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2469         * target.h (Sized_target::apply_relocation): New function.
2470         * target-reloc.h (apply_relocation): New function.
2471         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2472
2473 2011-04-22  Doug Kwan  <dougkwan@google.com>
2474
2475         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2476         flag of a SHT_ARM_EXIDX section.
2477         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2478         * testsuite/Makefile.in: Regenerate.
2479         * testsuite/arm_exidx_test.s: New file.
2480         * testsuite/arm_exidx_test.sh: Same.
2481
2482 2011-04-20 Cary Coutant  <ccoutant@google.com>
2483
2484         PR gold/12689
2485         * archive.h (Incremental_archive_entry::Archive_member):
2486         Initialize arg_serial_ (second constructor).
2487
2488 2011-04-17  Ian Lance Taylor  <iant@google.com>
2489
2490         * object.cc (Relocate_info::location): Simplify location string.
2491         * errors.cc (Errors::error_at_location): Don't print program
2492         name.
2493         (Errors::warning_at_location): Likewise.
2494         (Errors::undefined_symbol): Likewise.
2495         * testsuite/debug_msg.sh: Update accordingly.
2496
2497 2011-04-14 Cary Coutant  <ccoutant@google.com>
2498
2499         * gold/layout.cc (Layout::symtab_section_offset): New function.
2500         * gold/layout.h (Layout::symtab_section_offset): New function.
2501         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2502
2503 2011-04-12  Ian Lance Taylor  <iant@google.com>
2504
2505         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2506         with MREMAP_MAYMOVE.
2507         * output.h (class Output_file): Add map_is_allocated_ field.
2508         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2509         not available, provide stubs.  If mremap is not available, #define
2510         it to gold_mremap.
2511         (MREMAP_MAYMOVE): Define if not defined.
2512         (Output_file::Output_file): Initialize map_is_allocated_.
2513         (Output_file::resize): Check map_is_allocated_.
2514         (Output_file::map_anonymous): If mmap fails, use malloc.
2515         (Output_file::unmap): Don't do anything for an anonymous map.
2516         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2517         is not available, provide stubs.
2518         (File_read::View::~View): Use free rather than delete[].
2519         (File_read::make_view): Use malloc rather than new[].  If mmap
2520         fails, use malloc.
2521         (File_read::find_or_make_view): Use malloc rather than new[].
2522         * gold.h: Remove HAVE_REMAP code.
2523         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2524         exists.  Rename mremap to gold_mremap.  If mmap is not available
2525         don't do anything.
2526         * configure, config.in: Rebuild.
2527
2528 2011-04-11  Ian Lance Taylor  <iant@google.com>
2529
2530         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2531         initialize local variable v.
2532
2533 2011-04-11  Cary Coutant  <ccoutant@google.com>
2534
2535         * archive.cc (Archive::include_member): Adjust call to
2536         report_object.
2537         (Add_archive_symbols::run): Track argument serial numbers.
2538         (Lib_group::include_member): Likewise.
2539         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2540         * archive.h (Incremental_archive_entry::Archive_member):
2541         Initialize arg_serial_.
2542         (Archive_member::arg_serial_): New data member.
2543         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2544         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2545         incremental link.
2546         (Sized_dynobj::do_for_all_local_got_entries): New function.
2547         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2548         function.
2549         * fileread.cc (get_mtime): New function.
2550         * fileread.h (get_mtime): New function.
2551         * gold.cc (queue_initial_tasks): Check for incremental update.
2552         (process_incremental_input): New function.
2553         (queue_middle_tasks): Don't force valid target for incremental
2554         update.
2555         * incremental-dump.cc (find_input_containing_global): Adjust
2556         size of symbol info entry.
2557         (dump_incremental_inputs): Dump argument serial number and
2558         in_system_directory flag; bias shndx by 1; print symbol names
2559         when dumping per-file symbol lists; use new symbol info readers.
2560         * incremental.cc
2561         (Output_section_incremental_inputs:update_data_size): New function.
2562         (Sized_incremental_binary::setup_readers): Setup input readers
2563         for each input file; build maps for files added from libraries
2564         and scripts.
2565         (Sized_incremental_binary::check_input_args): New function.
2566         (Sized_incremental_binary::do_check_inputs): Build map of argument
2567         serial numbers to input arguments.
2568         (Sized_incremental_binary::do_file_has_changed): Rename
2569         do_file_is_unchanged to this; compare file modification times.
2570         (Sized_incremental_binary::do_init_layout): New function.
2571         (Sized_incremental_binary::do_reserve_layout): New function.
2572         (Sized_incremental_binary::do_get_input_reader): Remove.
2573         (Sized_incremental_binary::get_symtab_view): New function.
2574         (Incremental_checker::can_incrementally_link_output_file): Remove.
2575         (Incremental_inputs::report_command_line): Exclude --debug options.
2576         (Incremental_inputs::report_archive_begin): Add parameter; track
2577         argument serial numbers; don't put input file entry for archive
2578         before archive members.
2579         (Incremental_inputs::report_archive_end): Put input file entry
2580         for archive after archive members.
2581         (Incremental_inputs::report_object): Add parameter; track argument
2582         serial numbers and in_system_directory flag.
2583         (Incremental_inputs::report_script): Add parameter; track argument
2584         serial numbers.
2585         (Output_section_incremental_inputs::set_final_data_size): Adjust
2586         size of symbol info entry; check for forwarding symbols.
2587         (Output_section_incremental_inputs::write_input_files): Write
2588         in_system_directory flag and argument serial number.
2589         (Output_section_incremental_inputs::write_info_blocks): Map section
2590         indices between incremental info and original input file; store
2591         input section index for each symbol.
2592         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2593         change operator() to visit().
2594         (class Global_got_offset_visitor): Likewise.
2595         (class Global_symbol_visitor_got_plt):
2596         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2597         classes.
2598         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2599         (Sized_incr_relobj::do_read_symbols): New function.
2600         (Sized_incr_relobj::do_layout): New function.
2601         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2602         (Sized_incr_relobj::do_add_symbols): New function.
2603         (Sized_incr_relobj::do_should_include_member): New function.
2604         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2605         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2606         (Sized_incr_relobj::do_section_size): New function.
2607         (Sized_incr_relobj::do_section_name): New function.
2608         (Sized_incr_relobj::do_section_contents): New function.
2609         (Sized_incr_relobj::do_section_flags): New function.
2610         (Sized_incr_relobj::do_section_entsize): New function.
2611         (Sized_incr_relobj::do_section_address): New function.
2612         (Sized_incr_relobj::do_section_type): New function.
2613         (Sized_incr_relobj::do_section_link): New function.
2614         (Sized_incr_relobj::do_section_info): New function.
2615         (Sized_incr_relobj::do_section_addralign): New function.
2616         (Sized_incr_relobj::do_initialize_xindex): New function.
2617         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2618         (Sized_incr_relobj::do_read_relocs): New function.
2619         (Sized_incr_relobj::do_gc_process_relocs): New function.
2620         (Sized_incr_relobj::do_scan_relocs): New function.
2621         (Sized_incr_relobj::do_count_local_symbols): New function.
2622         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2623         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2624         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2625         (Sized_incr_relobj::do_relocate): New function.
2626         (Sized_incr_relobj::do_set_section_offset): New function.
2627         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2628         (Sized_incr_dynobj::do_read_symbols): New function.
2629         (Sized_incr_dynobj::do_layout): New function.
2630         (Sized_incr_dynobj::do_add_symbols): New function.
2631         (Sized_incr_dynobj::do_should_include_member): New function.
2632         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2633         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2634         (Sized_incr_dynobj::do_section_size): New function.
2635         (Sized_incr_dynobj::do_section_name): New function.
2636         (Sized_incr_dynobj::do_section_contents): New function.
2637         (Sized_incr_dynobj::do_section_flags): New function.
2638         (Sized_incr_dynobj::do_section_entsize): New function.
2639         (Sized_incr_dynobj::do_section_address): New function.
2640         (Sized_incr_dynobj::do_section_type): New function.
2641         (Sized_incr_dynobj::do_section_link): New function.
2642         (Sized_incr_dynobj::do_section_info): New function.
2643         (Sized_incr_dynobj::do_section_addralign): New function.
2644         (Sized_incr_dynobj::do_initialize_xindex): New function.
2645         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2646         (make_sized_incremental_object): New function.
2647         (Incremental_library::copy_unused_symbols): New function.
2648         (Incremental_library::do_for_all_unused_symbols): New function.
2649         * incremental.h (enum Incremental_input_flags): New type.
2650         (class Incremental_checker): Remove.
2651         (Incremental_input_entry::Incremental_input_entry): Add argument
2652         serial number.
2653         (Incremental_input_entry::arg_serial): New function.
2654         (Incremental_input_entry::set_is_in_system_directory): New function.
2655         (Incremental_input_entry::is_in_system_directory): New function.
2656         (Incremental_input_entry::arg_serial_): New data member.
2657         (Incremental_input_entry::is_in_system_directory_): New data member.
2658         (class Script_info): Move here from script.h.
2659         (Script_info::Script_info): Add filename parameter.
2660         (Script_info::filename): New function.
2661         (Script_info::filename_): New data member.
2662         (Incremental_script_entry::Incremental_script_entry): Add argument
2663         serial number.
2664         (Incremental_object_entry::Incremental_object_entry): Likewise.
2665         (Incremental_object_entry::add_input_section): Build list of input
2666         sections with map to original shndx.
2667         (Incremental_object_entry::get_input_section_index): New function.
2668         (Incremental_object_entry::shndx_): New data member.
2669         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2670         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2671         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2672         serial number.
2673         (Incremental_inputs::report_archive_begin): Likewise.
2674         (Incremental_inputs::report_object): Likewise.
2675         (Incremental_inputs::report_script): Likewise.
2676         (class Incremental_global_symbol_reader): New class.
2677         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2678         and store flags and input file type.
2679         (Incremental_input_entry_reader::arg_serial): New function.
2680         (Incremental_input_entry_reader::type): Extract type from flags.
2681         (Incremental_input_entry_reader::is_in_system_directory): New function.
2682         (Incremental_input_entry_reader::get_input_section_count): Call
2683         accessor function for type.
2684         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2685         function for type; adjust size of global symbol entry.
2686         (Incremental_input_entry_reader::get_global_symbol_count): Call
2687         accessor function for type.
2688         (Incremental_input_entry_reader::get_object_count): Likewise.
2689         (Incremental_input_entry_reader::get_object_offset): Likewise.
2690         (Incremental_input_entry_reader::get_member_count): Likewise.
2691         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2692         (Incremental_input_entry_reader::get_member_offset): Likewise.
2693         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2694         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2695         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2696         (Incremental_input_entry_reader::get_global_symbol_reader): New
2697         function.
2698         (Incremental_input_entry_reader::get_output_symbol_index): New
2699         function.
2700         (Incremental_input_entry_reader::type_): Remove.
2701         (Incremental_input_entry_reader::flags_): New data member.
2702         (Incremental_inputs_reader::input_file_offset): New function.
2703         (Incremental_inputs_reader::input_file_index): New function.
2704         (Incremental_inputs_reader::input_file): Call input_file_offset.
2705         (Incremental_inputs_reader::input_file_at_offset): New function.
2706         (Incremental_relocs_reader::get_r_type): Reformat.
2707         (Incremental_relocs_reader::get_r_shndx): Reformat.
2708         (Incremental_relocs_reader::get_r_offset): Reformat.
2709         (Incremental_relocs_reader::data): New function.
2710         (Incremental_binary::Incremental_binary): Initialize new data members.
2711         (Incremental_binary::check_inputs): Add cmdline parameter.
2712         (Incremental_binary::file_is_unchanged): Remove.
2713         (Input_reader::arg_serial): New function.
2714         (Input_reader::get_unused_symbol_count): New function.
2715         (Input_reader::get_unused_symbol): New function.
2716         (Input_reader::do_arg_serial): New function.
2717         (Input_reader::do_get_unused_symbol_count): New function.
2718         (Input_reader::do_get_unused_symbol): New function.
2719         (Incremental_binary::input_file_count): New function.
2720         (Incremental_binary::get_input_reader): Change signature to use
2721         index instead of filename.
2722         (Incremental_binary::file_has_changed): New function.
2723         (Incremental_binary::get_input_argument): New function.
2724         (Incremental_binary::get_library): New function.
2725         (Incremental_binary::get_script_info): New function.
2726         (Incremental_binary::init_layout): New function.
2727         (Incremental_binary::reserve_layout): New function.
2728         (Incremental_binary::output_file): New function.
2729         (Incremental_binary::do_check_inputs): New function.
2730         (Incremental_binary::do_file_is_unchanged): Remove.
2731         (Incremental_binary::do_file_has_changed): New function.
2732         (Incremental_binary::do_init_layout): New function.
2733         (Incremental_binary::do_reserve_layout): New function.
2734         (Incremental_binary::do_input_file_count): New function.
2735         (Incremental_binary::do_get_input_reader): Change signature.
2736         (Incremental_binary::input_args_map_): New data member.
2737         (Incremental_binary::library_map_): New data member.
2738         (Incremental_binary::script_map_): New data member.
2739         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2740         new data members.
2741         (Sized_incremental_binary::output_section): New function.
2742         (Sized_incremental_binary::inputs_reader): Add const.
2743         (Sized_incremental_binary::symtab_reader): Add const.
2744         (Sized_incremental_binary::relocs_reader): Add const.
2745         (Sized_incremental_binary::got_plt_reader): Add const.
2746         (Sized_incremental_binary::get_symtab_view): New function.
2747         (Sized_incremental_binary::Inputs_reader): New typedef.
2748         (Sized_incremental_binary::Input_entry_reader): New typedef.
2749         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2750         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2751         (Sized_incremental_binary::do_file_has_changed): New function.
2752         (Sized_incremental_binary::do_init_layout): New function.
2753         (Sized_incremental_binary::do_reserve_layout): New function.
2754         (Sized_input_reader::Inputs_reader): Remove.
2755         (Sized_input_reader::Input_entry_reader): Remove.
2756         (Sized_input_reader::do_arg_serial): New function.
2757         (Sized_input_reader::do_get_unused_symbol_count): New function.
2758         (Sized_input_reader::do_get_unused_symbol): New function.
2759         (Sized_incremental_binary::do_input_file_count): New function.
2760         (Sized_incremental_binary::do_get_input_reader): Change signature;
2761         use index instead of filename.
2762         (Sized_incremental_binary::section_map_): New data member.
2763         (Sized_incremental_binary::input_entry_readers_): New data member.
2764         (class Sized_incr_relobj): New class.
2765         (class Sized_incr_dynobj): New class.
2766         (make_sized_incremental_object): New function.
2767         (class Incremental_library): New class.
2768         * layout.cc (Free_list::num_lists): New static data member.
2769         (Free_list::num_nodes): New static data member.
2770         (Free_list::num_removes): New static data member.
2771         (Free_list::num_remove_visits): New static data member.
2772         (Free_list::num_allocates): New static data member.
2773         (Free_list::num_allocate_visits): New static data member.
2774         (Free_list::init): New function.
2775         (Free_list::remove): New function.
2776         (Free_list::allocate): New function.
2777         (Free_list::dump): New function.
2778         (Free_list::print_stats): New function.
2779         (Layout_task_runner::run): Resize output file for incremental updates.
2780         (Layout::Layout): Initialize new data members.
2781         (Layout::set_incremental_base): New function.
2782         (Layout::init_fixed_output_section): New function.
2783         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2784         incremental updates.
2785         (Layout::create_gold_note): Do not create gold note section for
2786         incremental updates.
2787         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2788         for incremental updates.
2789         (Layout::set_section_offsets): For incremental updates, allocate space
2790         from free list.
2791         (Layout::create_symtab_sections): Layout with offsets relative to
2792         start of section; for incremental updates, allocate space from free
2793         list.
2794         (Layout::create_shdrs): For incremental updates, allocate space from
2795         free list.
2796         (Layout::finish_dynamic_section): For incremental updates, do not
2797         check --as-needed (fixed in subsequent patch).
2798         * layout.h (class Free_list): New class.
2799         (Layout::set_incremental_base): New function.
2800         (Layout::incremental_base): New function.
2801         (Layout::init_fixed_output_section): New function.
2802         (Layout::allocate): New function.
2803         (Layout::incremental_base_): New data member.
2804         (Layout::free_list_): New data member.
2805         * main.cc (main): Print Free_list statistics.
2806         * object.cc (Relobj::finalize_incremental_relocs): Add
2807         clear_counts parameter; clear counts only when clear_counts is set.
2808         (Sized_relobj::Sized_relobj): Initialize new base class.
2809         (Sized_relobj::do_layout): Don't report special sections.
2810         (Sized_relobj::do_for_all_local_got_entries): New function.
2811         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2812         symtab_off to all symbol table offsets.
2813         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2814         * object.h (class Got_offset_list): Move to top of file.
2815         (Object::Object): Allow case where input_file == NULL.
2816         (Object::~Object): Likewise.
2817         (Object::input_file): Assert that input_file != NULL.
2818         (Object::lock): Allow case where input_file == NULL.
2819         (Object::unlock): Likewise.
2820         (Object::is_locked): Likewise.
2821         (Object::token): Likewise.
2822         (Object::release): Likewise.
2823         (Object::is_incremental): New function.
2824         (Object::get_mtime): New function.
2825         (Object::for_all_local_got_entries): New function.
2826         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2827         (Object::set_is_in_system_directory): New function.
2828         (Object::is_in_system_directory): New function.
2829         (Object::do_is_incremental): New function.
2830         (Object::do_get_mtime): New function.
2831         (Object::do_for_all_local_got_entries): New function.
2832         (Object::is_in_system_directory_): New data member.
2833         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2834         (class Sized_relobj_base): New class.
2835         (class Sized_relobj): Derive from Sized_relobj_base.
2836         (class Sized_relobj::Symbols): Redeclare from base class.
2837         (class Sized_relobj::local_got_offset_list): Remove.
2838         (class Sized_relobj::Output_sections): Redeclare from base class.
2839         (class Sized_relobj::do_for_all_local_got_entries): New function.
2840         (class Sized_relobj::write_local_symbols): Add offset parameter.
2841         (class Sized_relobj::local_symbol_offset_): Update comment.
2842         (class Sized_relobj::local_dynsym_offset_): Update comment.
2843         * options.cc (Input_arguments::add_file): Remove const.
2844         * options.h (Input_file_argument::Input_file_argument):
2845         Initialize arg_serial_ (all constructors).
2846         (Input_file_argument::set_arg_serial): New function.
2847         (Input_file_argument::arg_serial): New function.
2848         (Input_file_argument::arg_serial_): New data member.
2849         (Input_arguments::Input_arguments): Initialize file_count_.
2850         (Input_arguments::add_file): Remove const.
2851         (Input_arguments::number_of_input_files): New function.
2852         (Input_arguments::file_count_): New data member.
2853         (Command_line::number_of_input_files): Call
2854         Input_arguments::number_of_input_files.
2855         * output.cc (Output_segment_headers::Output_segment_headers):
2856         Set current size.
2857         (Output_section::Input_section::current_data_size): New function.
2858         (Output_section::Output_section): Initialize new data members.
2859         (Output_section::add_input_section): Don't do merge sections for
2860         an incremental link; allocate space from free list for an
2861         incremental update.
2862         (Output_section::add_output_section_data): Allocate space from
2863         free list for an incremental update.
2864         (Output_section::update_data_size): New function.
2865         (Output_section::set_fixed_layout): New function.
2866         (Output_section::reserve): New function.
2867         (Output_segment::set_section_addresses): Remove const.
2868         (Output_segment::set_section_list_addresses): Remove const; allocate
2869         space from free list for an incremental update.
2870         (Output_segment::set_offset): Adjust size of RELRO segment for an
2871         incremental update.
2872         * output.h (Output_data::current_data_size): Move here from
2873         child classes.
2874         (Output_data::pre_finalize_data_size): New function.
2875         (Output_data::update_data_size): New function.
2876         (Output_section_headers::update_data_size): new function.
2877         (Output_section_data_build::current_data_size): Move to Output_data.
2878         (Output_data_strtab::update_data_size): New function.
2879         (Output_section::current_data_size): Move to Output_data.
2880         (Output_section::set_fixed_layout): New function.
2881         (Output_section::has_fixed_layout): New function.
2882         (Output_section::reserve): New function.
2883         (Output_section::update_data_size): New function.
2884         (Output_section::has_fixed_layout_): New data member.
2885         (Output_section::free_list_): New data member.
2886         (Output_segment::set_section_addresses): Remove const.
2887         (Output_segment::set_section_list_addresses): Remove const.
2888         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2889         New function.
2890         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2891         New function.
2892         * readsyms.cc (Read_symbols::do_read_symbols): Add library
2893         parameter when calling Add_symbols constructor; store argument
2894         serial number for members of a lib group.
2895         (Add_symbols::locks): Allow case where token == NULL.
2896         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2897         (Read_member::~Read_member): New function.
2898         (Read_member::is_runnable): New function.
2899         (Read_member::locks): New function.
2900         (Read_member::run): New function.
2901         (Check_script::~Check_script): New function.
2902         (Check_script::is_runnable): New function.
2903         (Check_script::locks): New function.
2904         (Check_script::run): New function.
2905         (Check_library::~Check_library): New function.
2906         (Check_library::is_runnable): New function.
2907         (Check_library::locks): New function.
2908         (Check_library::run): New function.
2909         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2910         (Add_symbols::library_): New data member.
2911         (class Read_member): New class.
2912         (class Check_script): New class.
2913         (class Check_library): New class.
2914         * reloc.cc (Read_relocs::is_runnable): Allow case where
2915         token == NULL.
2916         (Read_relocs::locks): Likewise.
2917         (Scan_relocs::locks): Likewise.
2918         (Relocate_task::locks): Likewise.
2919         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2920         to clear counters.
2921         (Sized_relobj::incremental_relocs_scan): Fix comment.
2922         (Sized_relobj::do_relocate): Pass output file offset to
2923         write_local_symbols.
2924         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2925         from class declaration.
2926         * script.cc (read_input_script): Allocate Script_info; pass
2927         argument serial number to report_script.
2928         * script.h (class Script_info): Move to incremental.h.
2929         * symtab.cc (Symbol_table::add_from_incrobj): New function.
2930         * symtab.h (Symbol_table::add_from_incrobj): New function.
2931         (Symbol_table::set_file_offset): New function.
2932
2933 2011-04-05  Cary Coutant  <ccoutant@google.com>
2934
2935         * incremental-dump.cc (dump_incremental_inputs): Change signature
2936         to take a Sized_incremental_binary; change caller.  Use readers
2937         in Sized_incremental_binary.
2938         * incremental.cc
2939         (Sized_incremental_binary::find_incremental_inputs_sections):
2940         Rename do_find_incremental_inputs_sections to this.
2941         (Sized_incremental_binary::setup_readers): New function.
2942         (Sized_incremental_binary::do_check_inputs): Check
2943         has_incremental_info_ flag; move setup code to setup_readers;
2944         use input readers.
2945         (Sized_incremental_binary::do_file_is_unchanged): New function.
2946         (Sized_incremental_binary::do_get_input_reader): New function.
2947         * incremental.h (class Incremental_binary): Move to end of file.
2948         (Incremental_binary::file_is_unchanged): New function.
2949         (Incremental_binary::do_file_is_unchanged): New function.
2950         (Incremental_binary::Input_reader): New class.
2951         (Incremental_binary::get_input_reader): New function.
2952         (class Sized_incremental_binary): Move to end of file.
2953         (Sized_incremental_binary::Sized_incremental_binary): Setup the
2954         input section reader classes.
2955         (Sized_incremental_binary::has_incremental_info): New function.
2956         (Sized_incremental_binary::inputs_reader): New function.
2957         (Sized_incremental_binary::symtab_reader): New function.
2958         (Sized_incremental_binary::relocs_reader): New function.
2959         (Sized_incremental_binary::got_plt_reader): New function.
2960         (Sized_incremental_binary::do_file_is_unchanged): New function.
2961         (Sized_incremental_binary::Sized_input_reader): New class.
2962         (Sized_incremental_binary::get_input_reader): New function.
2963         (Sized_incremental_binary::find_incremental_inputs_sections):
2964         Rename do_find_incremental_inputs_sections to this.
2965         (Sized_incremental_binary::setup_readers): New function.
2966         (Sized_incremental_binary::has_incremental_info_): New data member.
2967         (Sized_incremental_binary::inputs_reader_): New data member.
2968         (Sized_incremental_binary::symtab_reader_): New data member.
2969         (Sized_incremental_binary::relocs_reader_): New data member.
2970         (Sized_incremental_binary::got_plt_reader_): New data member.
2971         (Sized_incremental_binary::current_input_file_): New data member.
2972
2973 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
2974
2975         PR gold/12640
2976         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2977         violation.
2978
2979 2011-03-30  Cary Coutant  <ccoutant@google.com>
2980
2981         * archive.cc (Archive::include_member): Adjust call to report_object.
2982         (Add_archive_symbols::run): Add script_info to call to
2983         report_archive_begin.
2984         (Lib_group::include_member): Adjust call to report_object.
2985         (Add_lib_group_symbols::run): Adjust call to report_object.
2986         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2987         blocks.  Add object count for script input files.
2988         * incremental.cc (Incremental_inputs::report_archive_begin): Add
2989         script_info parameter; change all callers.
2990         (Incremental_inputs::report_object): Add script_info parameter;
2991         change all callers.
2992         (Incremental_inputs::report_script): Store backpointer to
2993         incremental info entry.
2994         (Output_section_incremental_inputs::set_final_data_size): Record
2995         additional information for scripts.
2996         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2997         * incremental.h (Incremental_script_entry::add_object): New function.
2998         (Incremental_script_entry::get_object_count): New function.
2999         (Incremental_script_entry::get_object): New function.
3000         (Incremental_script_entry::objects_): New data member; adjust
3001         constructor.
3002         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3003         (Incremental_inputs::report_object): Add script_info parameter.
3004         (Incremental_inputs_reader::get_object_count): New function.
3005         (Incremental_inputs_reader::get_object_offset): New function.
3006         * options.cc (Input_arguments::add_file): Return reference to
3007         new input argument.
3008         * options.h (Input_argument::set_script_info): New function.
3009         (Input_argument::script_info): New function.
3010         (Input_argument::script_info_): New data member; adjust all
3011         constructors.
3012         (Input_file_group::add_file): Return reference to new input argument.
3013         (Input_file_lib::add_file): Likewise.
3014         (Input_arguments::add_file): Likewise.
3015         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3016         * script.cc (Parser_closure::Parser_closure): Add script_info
3017         parameter; adjust all callers.
3018         (Parser_closure::script_info): New function.
3019         (Parser_closure::script_info_): New data member.
3020         (read_input_script): Report scripts earlier to incremental info.
3021         (script_add_file): Set script_info in Input_argument.
3022         (script_add_library): Likewise.
3023         * script.h (Script_options::Script_info): Rewrite class.
3024
3025 2011-03-29  Cary Coutant  <ccoutant@google.com>
3026
3027         * archive.cc (Library_base::should_include_member): Move
3028         method here from class Archive.
3029         (Archive::Archive): Initialize base class.
3030         (Archive::should_include_member): Move to base class.
3031         (Archive::do_for_all_unused_symbols): New function.
3032         (Add_archive_symbols::run): Remove redundant access to
3033         incremental_inputs.
3034         (Lib_group::Lib_group): Initialize base class.
3035         (Lib_group::do_filename): New function.
3036         (Lib_group::include_member): Pass pointer to Lib_group to
3037         report_object.
3038         (Lib_group::do_for_all_unused_symbols): New function.
3039         (Add_lib_group_symbols::run): Report archive information for
3040         incremental links.
3041         * archive.h (class Library_base): New base class.
3042         (class Archive): Derive from Library_base.
3043         (Archive::filename): Move to base class.
3044         (Archive::set_incremental_info): Likewise.
3045         (Archive::incremental_info): Likewise.
3046         (Archive::Should_include): Likewise.
3047         (Archive::should_include_member): Likewise.
3048         (Archive::Armap_entry): Remove.
3049         (Archive::Unused_symbol_iterator): Remove.
3050         (Archive::unused_symbols_begin): Remove.
3051         (Archive::unused_symbols_end): Remove.
3052         (Archive::do_filename): New function.
3053         (Archive::do_get_mtime): New function.
3054         (Archive::do_for_all_unused_symbols): New function.
3055         (Archive::task_): Move to base class.
3056         (Archive::incremental_info_): Likewise.
3057         (class Lib_group): Derive from Library_base.
3058         (Lib_group::do_filename): New function.
3059         (Lib_group::do_get_mtime): New function.
3060         (Lib_group::do_for_all_unused_symbols): New function.
3061         (Lib_group::task_): Move to base class.
3062         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3063         function.
3064         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3065         function.
3066         * incremental.cc (Incremental_inputs::report_archive_begin):
3067         Use Library_base; call library's get_mtime; add incremental inputs
3068         entry before members.
3069         (class Unused_symbol_visitor): New class.
3070         (Incremental_inputs::report_archive_end): Use Library_base; use
3071         visitor class to record unused symbols; don't add incremental inputs
3072         entry after members.
3073         (Incremental_inputs::report_object): Use Library_base.
3074         * incremental.h
3075         (Incremental_archive_entry::Incremental_archive_entry): Remove
3076         unused Archive parameter.
3077         (Incremental_inputs::report_archive_begin): Use Library_base.
3078         (Incremental_inputs::report_archive_end): Likewise.
3079         (Incremental_inputs::report_object): Likewise.
3080         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3081         function.
3082         * object.h (Object::for_all_global_symbols): New function.
3083         (Object::do_for_all_global_symbols): New function.
3084         (Sized_relobj::do_for_all_global_symbols): New function.
3085         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3086         function.
3087         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3088         function.
3089
3090 2011-03-27  Ian Lance Taylor  <iant@google.com>
3091
3092         * archive.cc (Archive::interpret_header): Return -1 if something
3093         goes wrong.  Change callers accordingly.
3094
3095 2011-03-25  Cary Coutant  <ccoutant@google.com>
3096
3097         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3098         * testsuite/Makefile.in: Regenerate.
3099
3100 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3101
3102         * plugin.cc (get_view): New.
3103         (Plugin::load): Pass get_view to the plugin.
3104         (Plugin_manager::get_view): New.
3105
3106 2011-03-21  Ian Lance Taylor  <iant@google.com>
3107
3108         * testsuite/final_layout.sh: Rewrite to not use dc.
3109         * testsuite/relro_test.sh: Fail if dc is not present.
3110
3111 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3112
3113         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3114         Change == to -eq.
3115         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3116         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3117         Change == to -eq.
3118         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3119         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3120
3121 2011-03-14  Ian Lance Taylor  <iant@google.com>
3122
3123         * script-sections.cc (Sort_output_sections::script_compare):
3124         Rename from is_before, change return type.
3125         (Sort_output_sections::operator()): Adjust accordingly.
3126
3127 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3128
3129         PR gold/12572
3130         * testsuite/odr_violation2.cc: Add comment to make all error line
3131         numbers double digits.
3132         * testsuite/debug_msg.sh: Adjust expected errors.
3133
3134 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3135
3136         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3137         but mark earlier ones as non-canonical
3138         (offset_to_iterator): Update search target and example
3139         (do_addr2line): Return extra lines in a vector*
3140         (format_file_lineno): Extract from do_addr2line
3141         (one_addr2line): Add vector* out-param
3142         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3143         when a lineno entry appeared last for its instruction
3144         (Dwarf_line_info): Add vector* out-param
3145         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3146         * symtab.cc (Odr_violation_compare): Include the lineno in the
3147         comparison again.
3148         (linenos_from_loc): New. Combine the canonical line for an
3149         address with its other lines.
3150         (True_if_intersect): New. Helper functor to make
3151         std::set_intersection a query.
3152         (detect_odr_violations): Compare sets of lines instead of just
3153         one line for each function. This became less deterministic, but
3154         has fewer false positives.
3155         * symtab.h: Declarations.
3156         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3157         mix an optimized and non-optimized object in the same binary
3158         (odr_violation2.so): Same.
3159         * testsuite/Makefile.in: Regenerate from Makefile.am.
3160         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3161         * testsuite/debug_msg.sh: Update line numbers and add
3162         assertions.
3163         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3164         non-optimized context.
3165         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3166         isn't inlined, and use OdrDerived in an optimized context.
3167         * testsuite/odr_header1.h: Defines OdrDerived, where
3168         optimization will change the
3169         first-instruction-in-the-destructor's file and line number.
3170         * testsuite/odr_header2.h: Defines OdrBase.
3171
3172 2011-03-09  Ian Lance Taylor  <iant@google.com>
3173
3174         * fileread.cc (File_read::clear_views): Don't delete the whole
3175         file view.
3176
3177 2011-03-08  Ian Lance Taylor  <iant@google.com>
3178
3179         PR gold/12525
3180         * fileread.cc: #include <climits>.
3181         (GOLD_IOV_MAX): Define.
3182         (File_read::read_multiple): Limit number of entries by iov_max.
3183         * fileread.h (class File_read): Always set max_readv_entries to
3184         128.
3185
3186 2011-03-07  Ian Lance Taylor  <iant@google.com>
3187
3188         PR gold/12525
3189         * options.h (class General_options): Add -dy and -dn.
3190
3191 2011-03-02  Cary Coutant  <ccoutant@google.com>
3192
3193         * testsuite/script_test_9.t: Add TLS segment.
3194
3195 2011-03-02  Simon Baldwin  <simonb@google.com>
3196
3197         * configure.ac: Add check for gnu_indirect_function support in
3198         the toolchain building binutils.
3199         * configure: Rebuild.
3200
3201 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3202
3203         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3204         plugin only symbols.
3205         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3206         in plugin files as not needed in the symbol table.
3207
3208 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3209
3210         * output.cc (Output_section::add_input_section): Delay fill
3211         generation for section ordering.
3212
3213 2011-02-09  Ian Lance Taylor  <iant@google.com>
3214
3215         PR gold/12316
3216         * object.h (class Sized_relobj): Remove clear_local_symbols.
3217         * reloc.cc (Sized_relobj::do_relocate): Don't call
3218         clear_local_symbols.
3219
3220 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3221
3222         * plugin.cc (is_visible_from_outside): Return true for symbols
3223         in the -u option.
3224
3225 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3226
3227         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3228         filename.
3229
3230 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3231
3232         * icf.h (is_section_foldable_candidate): Change type of parameter
3233         to std::string.
3234         * icf.cc (Icf::find_identical_sections): Change type of local variable
3235         section_name to be std::string.
3236         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3237
3238 2011-01-25  Ian Lance Taylor  <iant@google.com>
3239
3240         * script.cc (script_add_extern): Rewrite to use
3241         add_symbol_reference.
3242
3243 2011-01-25  Doug Kwan  <dougkwan@google.com>
3244
3245         * icf.cc (get_section_contents): Always lock section's object.
3246
3247 2011-01-24  Ian Lance Taylor  <iant@google.com>
3248
3249         * options.h (class General_options): Accept
3250         --no-detect-odr-violations.
3251
3252 2011-01-24  Ian Lance Taylor  <iant@google.com>
3253
3254         * version.cc (version_string): Bump to 1.11.
3255
3256 2011-01-24  Ian Lance Taylor  <iant@google.com>
3257
3258         * plugin.cc (class Plugin_rescan): Define new class.
3259         (Plugin_manager::claim_file): Set any_claimed_.
3260         (Plugin_manager::save_archive): New function.
3261         (Plugin_manager::save_input_group): New function.
3262         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3263         necessary.
3264         (Plugin_manager::new_undefined_symbol): New function.
3265         (Plugin_manager::rescan): New function.
3266         (Plugin_manager::rescannable_defines): New function.
3267         (Plugin_manager::add_input_file): Set any_added_.
3268         * plugin.h (class Plugin_manager): define new fields rescannable_,
3269         undefined_symbols_, any_claimed_, and any_added_.  Declare
3270         Plugin_rescan as friend.  Declare new functions.
3271         (Plugin_manager::Rescannable): Define type.
3272         (Plugin_manager::Rescannable_list): Define type.
3273         (Plugin_manager::Undefined_symbol_list): Define type.
3274         (Plugin_manager::Plugin_manager): Initialize new fields.
3275         * archive.cc (Archive::defines_symbol): New function.
3276         (Add_archive_symbols::run): Pass archive to plugins if any.
3277         * archive.h (class Archive): Declare defines_symbol.
3278         * readsyms.cc (Input_group::~Input_group): New function.
3279         (Finish_group::run): Pass input_group to plugins if any.
3280         * readsyms.h (class Input_group): Declare destructor.
3281         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3282         any.
3283
3284 2011-01-10  Ian Lance Taylor  <iant@google.com>
3285
3286         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3287         section as relro.
3288         (Layout::set_segment_offsets): Reset increase_relro before calling
3289         set_section_addresses a second time.
3290
3291 2011-01-04  Cary Coutant  <ccoutant@google.com>
3292
3293         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3294         sections before NOBITS sections.
3295
3296 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3297
3298         * version.cc (print_version): Update copyright to 2011.
3299
3300 2010-12-23  Cary Coutant  <ccoutant@google.com>
3301
3302         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3303         of OS to this->add.  Add OD parameter to second form of the function.
3304
3305 2010-12-20  Ian Lance Taylor  <iant@google.com>
3306
3307         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3308         second of two consecutive entries with same offset.
3309
3310 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3311
3312         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3313         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3314         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3315         to avoid unneeded links against $(LDADD).
3316         * testsuite/Makefile.in: Regenerate.
3317
3318 2010-12-15  Ian Lance Taylor  <iant@google.com>
3319
3320         PR gold/12324
3321         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3322         for R_X86_64_32 and R_X86_64_PC32.
3323         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3324         ver_matching_def_pic.o.
3325         (ver_matching_def_pic.o): New target.
3326
3327 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3328
3329         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3330         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3331         Move definition before File_read::View member definitions.
3332         (File_read::View::~View): Initialize and hold lock before
3333         updating current_mapped_bytes.
3334
3335 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3336
3337         * dwarf_reader.cc: Remove outdated comment.
3338         * gold-threads.cc: Fix typo in error message.
3339         * archive.cc: Fix typos in comments.
3340         * archive.h: Likewise.
3341         * arm-reloc-property.cc: Likewise.
3342         * arm-reloc-property.h: Likewise.
3343         * arm-reloc.def: Likewise.
3344         * arm.cc: Likewise.
3345         * attributes.h: Likewise.
3346         * cref.cc: Likewise.
3347         * ehframe.cc: Likewise.
3348         * fileread.h: Likewise.
3349         * gold.h: Likewise.
3350         * i386.cc: Likewise.
3351         * icf.cc: Likewise.
3352         * incremental.h: Likewise.
3353         * int_encoding.cc: Likewise.
3354         * layout.h: Likewise.
3355         * main.cc: Likewise.
3356         * merge.h: Likewise.
3357         * object.cc: Likewise.
3358         * object.h: Likewise.
3359         * options.cc: Likewise.
3360         * readsyms.cc: Likewise.
3361         * reduced_debug_output.cc: Likewise.
3362         * reloc.cc: Likewise.
3363         * script-sections.cc: Likewise.
3364         * sparc.cc: Likewise.
3365         * symtab.h: Likewise.
3366         * target-reloc.h: Likewise.
3367         * target.cc: Likewise.
3368         * target.h: Likewise.
3369         * timer.cc: Likewise.
3370         * timer.h: Likewise.
3371         * x86_64.cc: Likewise.
3372
3373 2010-12-09  Cary Coutant  <ccoutant@google.com>
3374
3375         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3376         stack.
3377         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3378         parameter; change all callers.
3379         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3380         * options.h (warn_execstack): New option.
3381
3382 2010-12-07  Doug Kwan  <dougkwan@google.com>
3383
3384         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3385         like function call relocations.
3386
3387 2010-12-07  Ian Lance Taylor  <iant@google.com>
3388
3389         * archive.cc (Archive::get_elf_object_for_member): Permit
3390         punconfigured to be NULL.
3391         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3392         (Archive::include_member): Pass NULL to get_elf_object_for_member
3393         if we searched for the archive and this is the first included
3394         object.
3395
3396 2010-12-01  Ian Lance Taylor  <iant@google.com>
3397
3398         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3399         track_relocs_type_ field.
3400         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3401         Set track_relocs_type_.
3402         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3403         contents when using RELA relocs.
3404         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3405         reloc_map_.
3406         * reloc.cc (Track_relocs::next_addend): New function.
3407         * reloc.h (class Track_relocs): Declare next_addend.
3408
3409 2010-12-01  Ian Lance Taylor  <iant@google.com>
3410
3411         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3412         virtual destructor.
3413
3414 2010-12-01  Ian Lance Taylor  <iant@google.com>
3415
3416         * README: Update compilers known to work and fail.
3417
3418 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3419
3420         * configure.in: For --enable-gold, handle value `default' instead of
3421         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3422         not the default.
3423         * configure: Regenerate.
3424
3425 2010-11-18  Doug Kwan  <dougkwan@google.com>
3426
3427         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3428         and right_alignment to be zero.  Store result alignment only if it is
3429         greater than existing alignment.
3430
3431 2010-11-16  Cary Coutant  <ccoutant@google.com>
3432
3433         PR gold/12220
3434         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3435         Check for ".zdebug_line".
3436
3437 2010-11-16  Doug Kwan  <dougkwan@google.com>
3438             Cary Coutant  <ccoutant@google.com>
3439
3440         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3441         by reference; adjust all callers.
3442         * output.cc (Output_segment::set_section_addresses): Adjust references
3443         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3444         list is empty.
3445         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3446         end at page boundary.
3447
3448 2010-11-16  Cary Coutant  <ccoutant@google.com>
3449
3450         PR gold/12220
3451         * layout.cc (Layout::choose_output_section): Transform names of
3452         compressed sections even when using a script with a SECTIONS clause.
3453         (Layout::output_section_name): Remove code to transform
3454         compressed debug section names.
3455         * output.cc (Output_section::add_input_section): Use uncompressed
3456         section size when tracking input sections.
3457
3458 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3459
3460         * symtab.h (Symbol::NON_PIC_REF): Remove.
3461         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3462         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3463         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3464         (Symbol::use_plt_offset): Take a flags argument and pass it
3465         directly to needs_dynamic_reloc.  Restrict check for undefined
3466         weak symbols to function calls.
3467         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3468         (Target_arm::Scan::global): Use it.
3469         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3470         (Target_arm::Relocate::relocate): Likewise.
3471         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3472         parameter with an r_type parameter.  Use get_reference_flags
3473         to get the flags.
3474         (Target_arm::Relocate::relocate): Update accordingly.
3475         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3476         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3477         (Target_i386::Scan::global): Likewise.
3478         (Target_i386::Relocate::relocate): Likewise.
3479         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3480         parameter with an r_type parameter.  Use get_reference_flags
3481         to get the flags.
3482         (Target_i386::Relocate::relocate): Update accordingly.
3483         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3484         (Target_powerpc::Scan::global): Use it.
3485         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3486         (Target_powerpc::Relocate::relocate): Likewise.
3487         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3488         (Target_sparc::Scan::global): Use it.
3489         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3490         (Target_sparc::Relocate::relocate): Likewise.
3491         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3492         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3493         (Target_x86_64::Scan::global): Likewise.
3494         (Target_x86_64::Relocate::relocate): Likewise.
3495
3496 2010-11-08  Doug Kwan  <dougkwan@google.com>
3497             Cary Coutant  <ccoutant@google.com>
3498
3499         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3500         (Arm_exidx_merge_section::section_contents_): New data member.
3501         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3502         (Arm_input_section::~Arm_input_section): De-allocate memory.
3503         (Arm_input_section::original_contents_): New data member.
3504         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3505         in parameters instead of calling Object::section_contents without
3506         locking.
3507         (Arm_output_section::group_section): New parameter TASK.  Pass it
3508         to callees that need locking objects.
3509         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3510         to lock EXIDX input sections.  Fix a formatting issue.  Call
3511         Arm_exidx_merged_section::build_contents to create merged section
3512         contents.
3513         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3514         to lock object of stub table owner.
3515         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3516         TEXT_SIZE to initialize data member TEXT_SIZE_.
3517         (Arm_exidx_input_section::addralign): Fix typo in comment.
3518         (Arm_exidx_input_section::text_size): New method.
3519         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3520         that require locking objects.  Lock objects before scanning for stubs
3521         and updating local symbols.
3522         (Arm_input_section<big_endian>::init): Copy contents of original
3523         input section.
3524         (Arm_input_section<big_endian>::do_write): Use saved contents of
3525         original input section instead of calling Object::section_contents
3526         without locking.
3527         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3528         size without calling Object::section_size().
3529         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3530         for size.  Allocate a buffer for merged EXIDX entries.
3531         (Arm_exidx_merged_section::build_contents): New method.
3532         (Arm_exidx_merged_section::do_write): Move merge section contents
3533         building code to Arm_exidx_merged_section::build_contetns.  Write
3534         out contetns in buffer instead of building it on the fly.
3535         (Arm_relobj::make_exidx_input_section): Also pass text section size
3536         to Arm_exidx_input_section constructor.
3537         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3538         (Arm_dynobj::do_read_symbols): Fix memory leak.
3539         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3540         * target.h: (class Task): Add forward declaration.
3541         (Target::relax): Add new parameter TASK and pass it to
3542         Target::do_relax().
3543         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3544
3545 2010-11-05  Cary Coutant  <ccoutant@google.com>
3546
3547         PR gold/10708
3548         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3549         object when reading from the file.
3550         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3551         second layout pass.
3552         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3553         when reading section contents.
3554         (get_section_contents): Likewise.
3555         (icf::find_identical_sections): Likewise.
3556         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3557         object when reading from the file.
3558         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3559         the object when doing deferred section layout.
3560
3561 2010-11-03  Nick Clifton  <nickc@redhat.com>
3562
3563         PR gold/12001
3564         * script.h (class Symbol_assignment: name): New member.  Returns
3565         the name of the symbol.
3566         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3567         Returns true if the given symbol name is on the list of
3568         assignments wating to be processed.
3569         * archive.cc (should_incldue_member): If the symbol is undefined,
3570         check to see if it is on the list of symbols pending assignment.
3571
3572 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3573
3574         * script-sections.cc (Script_sections::find_memory_region): Check
3575         for a NULL output section pointer.
3576
3577 2010-10-29  Doug Kwan  <dougkwan@google.com>
3578
3579         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3580         Output_section::add_relaxed_input_section.
3581         * output.cc (Output_section::add_relaxed_input_section): Add new
3582         arguments LAYOUT and NAME.  Set section order index.
3583         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3584         Copy section order index.
3585         * output.h (Output_section::add_relaxed_input_section): Add new
3586         arguments LAYOUT and NAME.
3587
3588 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3589
3590         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3591         NATIVE_OR_CROSS_LINKER.
3592         * testsuite/Makefile.in: Regenerate.
3593
3594 2010-10-20  Doug Kwan  <dougkwan@google.com>
3595
3596         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3597         without SHF_LINK_ORDER flags.
3598         * layout.cc (Layout::choose_output_section): Do not filter
3599         SHF_LINK_ORDER flag in a relocatable link.
3600
3601 2010-10-17  Cary Coutant  <ccoutant@google.com>
3602
3603         * output.h (Output_segment::set_section_addresses): Change function
3604         signature.  Update all callers.
3605         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3606         sections.
3607         (Output_segment::set_section_addresses): Align after last TLS
3608         section.  Add padding before last relro section instead of after.
3609
3610 2010-10-17  Doug Kwan  <dougkwan@google.com>
3611
3612         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3613         GOT output section to be writable.
3614
3615 2010-10-14  Cary Coutant  <ccoutant@google.com>
3616
3617         * debug.h (DEBUG_INCREMENTAL): New flag.
3618         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3619         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3620         mode.
3621         * incremental.cc (report_command_line): Ignore all forms of
3622         --incremental.
3623         * layout.cc (Layout::Layout): Check parameters for incremental link
3624         mode.
3625         * options.cc (General_options::parse_incremental): New function.
3626         (General_options::parse_no_incremental): New function.
3627         (General_options::parse_incremental_full): New function.
3628         (General_options::parse_incremental_update): New function.
3629         (General_options::incremental_mode_): New data member.
3630         (General_options::finalize): Check incremental_mode_.
3631         * options.h (General_options): Update help text for --incremental.
3632         Add --no-incremental, --incremental-full, --incremental-update.
3633         (General_options::Incremental_mode): New enum type.
3634         (General_options::incremental_mode): New function.
3635         (General_options::incremental_mode_): New data member.
3636         * parameters.cc (Parameters::incremental_mode_): New data member.
3637         (Parameters::set_options): Set incremental_mode_.
3638         (Parameters::set_incremental_full): New function.
3639         (Parameters::incremental): New function.
3640         (Parameters::incremental_update): New function.
3641         (set_parameters_incremental_full): New function.
3642         * parameters.h (Parameters::set_incremental_full): New function.
3643         (Parameters::incremental): New function.
3644         (Parameters::incremental_update): New function.
3645         (Parameters::incremental_mode_): New data member.
3646         (set_parameters_incremental_full): New function.
3647         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3648         incremental link mode.
3649         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3650         (Sized_relobj::do_relocate_sections): Likewise.
3651         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3652         option.
3653         * testsuite/Makefile.in: Regenerate.
3654         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3655
3656 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3657
3658         * script-sections.h (class Script_sections): Make
3659         Sections_elements typedef public.
3660         * script-sections.cc (class Sort_output_sections): Add elements_
3661         field.  Add constructor which sets it; change all callers.
3662         (Sort_output_sections::is_before): New function.
3663         (Sort_output_sections::operator()): Call is_before.
3664         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3665         conditional.
3666         * testsuite/script_test_10.sh: New test. Test script section
3667         order.
3668         * testsuite/script_test_10.t: Likewise.
3669         * testsuite/script_test_10.s: Likewise.
3670         * testsuite/Makefile.am: Wrap the cross linker tests and the
3671         common tests into NATIVE_OR_CROSS_LINKER.
3672         (check_SCRIPTS): Add script_test_10.sh.
3673         (check_DATA): Add script_test_10.stdout.
3674         (script_test_10.o, script_test_10): New targets.
3675         (script_test_10.stdout): New target.
3676         * configure, testsuite/Makefile.in: Regenerate.
3677
3678 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3679
3680         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3681         error for the deprecated relocations.
3682         (Target_arm::Scan::global): Likewise.
3683         (Target_arm::Relocate::relocate): Likewise.
3684
3685 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3686
3687         * fileread.cc (Input_file::find_file): Initialize *found_name
3688         and *namep when using the fallback search for case 4.
3689
3690 2010-10-11  Cary Coutant  <ccoutant@google.com>
3691
3692         * options.h (class General_options): Redefine -z lazy as an alias for
3693         the negation of -z now.
3694
3695 2010-10-11  Ian Lance Taylor  <iant@google.com>
3696
3697         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3698         binding.
3699
3700 2010-10-06  Nick Clifton  <nickc@redhat.com>
3701
3702         * script-sections.cc(class Memory_region): Remove
3703         current_lma_offset_ field.  Rename current_vma_offset_ to
3704         current_offset_.  Add last_section_ field.
3705         (Memory_region::get_current_vma_address): Rename to
3706         get_current_address.
3707         (Memory_region::get_current_lma_address): Delete.
3708         (Memory_region::increment_vma_offset): Rename to
3709         increment_offset.
3710         (Memory_region::increment_lma_offset): Delete.
3711         (Memory_region::attributes_compatible): New method.  Returns
3712         true if the provided section is compatible with the region.
3713         (Memory_region::get_last_section): New method.  Returns the last
3714         section to use the region.
3715         (Memory_region::set_last_section): New method.  Stores the last
3716         section to use the region.
3717         (Script_sections::block_in_region): New method.  Returns true if
3718         a block of memory is contained within a region.
3719         (Script_sections::find_memory_region): New method.  Locates a
3720         memory region to be used to set a VMA or LMA address.
3721         (Output_section_definition::set_section_addresses): Add code to
3722         check for addresses set by memory regions.
3723         (Output_segment::set_section_addresses): Remove memory region
3724         walking code.
3725         (Script_sections::create_segment): Add a warning if a header
3726         segment is created outside of any region.
3727         * script-sections.h (class Script_sections): Add prototypes for
3728         find_memory_region and block_in_region methods.
3729         * testsuite/memory_test.s: Use .long instead of .word.
3730         * testsuite/memory_test.t: Add some more output sections.
3731         * testsuite/memory_test.sh: Update expected output.
3732
3733 2010-10-02  Doug Kwan  <dougkwan@google.com>
3734
3735         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3736         defintion to symtab.h
3737         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3738         declaration to defintion.
3739
3740 2010-10-01  Nick Clifton  <nickc@redhat.com>
3741
3742         * expression.cc (eval): Replace dummy argument with NULL.
3743         (eval_maybe_dot): Check for a NULL result section pointer.
3744         (Symbol_expression::value): Likewise.
3745         (Dot_expression::value): Likewise.
3746         (BINARY_EXPRESSION): Likewise.
3747         (Max_expression::value): Likewise.
3748         (Min_expression::value): Likewise.
3749         (Absolute_expression::value): Likewise.
3750         (Addr_expression::value_from_output_section): Likewise.
3751         (Loaddddr_expression::value_from_output_section): Likewise.
3752         (Segment_start_expression::value): Likewise.
3753         * script-sections.cc
3754         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3755         argument with NULL.
3756         (Sections_elememt_dot_assignment::set_section_addresses):
3757         Likewise.
3758         (Output_data_expression::do_write_to_buffer): Likewise.
3759         (Output_section_definition::finalize_symbols): Likewise.
3760         (Output_section_definition::set_section_addresses): Likewise.
3761
3762 2010-09-30  Doug Kwan  <dougkwan@google.com>
3763
3764         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3765
3766 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3767
3768         * target.h (Target::can_icf_inline_merge_sections): New virtual
3769         function.
3770         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3771         virtual function.
3772         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3773         virtual function.
3774         * icf.cc (get_section_contents): Inline merge sections only when
3775         target allows it.
3776
3777 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3778
3779         * configure: Regenerate.
3780
3781 2010-09-17  Ian Lance Taylor  <iant@google.com>
3782
3783         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3784         * testsuite/Makefile.am (memory_test.o): New target.
3785         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3786         memory_test.t.
3787         * testsuite/Makefile.in: Rebuild.
3788
3789 2010-09-17  Doug Kwan  <dougkwan@google.com>
3790
3791         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3792         defintion if relocation uses GOT entries of the symbol.
3793         * testsuite/icf_safe_test.sh: Fix test.
3794         * testsuite/icf_safe_so_test.sh: Fix test.
3795
3796 2010-09-16  Cary Coutant  <ccoutant@google.com>
3797
3798         * script_sections.cc (class Memory_region): Remove "NULL" from
3799         vector initializations.
3800
3801 2010-09-15  Cary Coutant  <ccoutant@google.com>
3802
3803         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3804         Resolve forwarding symbols.
3805
3806 2010-09-15  Doug Kwan  <dougkwan@google.com>
3807
3808         * gold/testsuite/script_test_3.t: Add ARM special sections.
3809         * gold/testsuite/script_test_4.t: Same.
3810         * gold/testsuite/script_test_5.t: Same.
3811         * gold/testsuite/script_test_6.t: Same.
3812         * gold/testsuite/script_test_7.t: Same.
3813         * gold/testsuite/script_test_7.t: Same.
3814         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3815
3816 2010-09-14  Cary Coutant  <ccoutant@google.com>
3817
3818         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3819         (Target_x86_64::Relocate::relocate_tls): Replace check for
3820         saw_tls_block_reloc_ with test for executable section.
3821
3822 2010-09-12  Cary Coutant  <ccoutant@google.com>
3823
3824         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3825         position-independent executables to shared libraries need dynamic
3826         relocations.
3827         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3828         position-independent executables.
3829         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3830         * testsuite/Makefile.in: Regenerate.
3831
3832 2010-09-10  Nick Clifton  <nickc@redhat.com>
3833
3834         PR gold/11997
3835         * testsuite/memory_test.t: Discard any sections that are not
3836         needed.
3837
3838 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
3839
3840         PR gold/11996
3841         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3842         "This::" to work around a bug in gcc 4.2.
3843
3844         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3845
3846 2010-09-09  Rafael Espindola  <espindola@google.com>
3847
3848         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3849         sections with different PF_X flags in the same segment.
3850         (Layout::find_first_load_seg): Search all segments to find the first
3851         one.
3852         * options.h (rosegment): New.
3853
3854 2010-09-08  Rafael Espindola  <espindola@google.com>
3855
3856         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3857
3858 2010-09-08  Doug Kwan  <dougkwan@google.com>
3859
3860         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3861         (Arm_relobj::do_relocate_sections): Add new parameter for output
3862         file to match the parent.
3863         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3864         of local symbols instead of input values.  Update code to track
3865         changes in gold::relocate_section.
3866         * object.cc (Sized_relobj::compute_final_local_value): New methods.
3867         (Sized_relobj::compute_final_local_value_internal): New methods.
3868         (Sized_relobj::do_finalize_local_symbols): Move code from loop
3869         body into private version of Sized_relobj::compute_final_local_value.
3870         Call the inline method.
3871         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
3872         merged symbol value if there is one.
3873         (Symbol_value::has_output_value): New method defintiion.
3874         (Sized_relobj::Compute_final_local_value_status): New enum type.
3875         (Sized_relobj::compute_final_local_value): New methods.
3876         (Sized_relobj::compute_final_local_value_internal): New methods.
3877         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3878         and arm_cortex_a8.sh.
3879         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3880         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3881         New tests.
3882         * Makefile.in: Regenerate.
3883         * testsuite/arm_bl_out_of_range.s: Update test.
3884         * testsuite/thumb_bl_out_of_range.s: Ditto.
3885         * testsuite/thumb_blx_out_of_range.s: Ditto.
3886         * testsuite/arm_branch_out_of_range.sh: New file.
3887         * testsuite/arm_cortex_a8.sh: Ditto.
3888         * testsuite/arm_cortex_a8_b.s: Ditto.
3889         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3890         * testsuite/arm_cortex_a8_b_local.s: Ditto.
3891         * testsuite/arm_cortex_a8_bl.s: Ditto.
3892         * testsuite/arm_cortex_a8_blx.s: Ditto.
3893         * testsuite/arm_cortex_a8_local.s: Ditto.
3894         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3895         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3896
3897 2010-09-08  Rafael Espindola  <espindola@google.com>
3898
3899         * Makefile.am (memory_test.stdout): Run readelf with -W.
3900         * Makefile.in: Regenerate.
3901         * testsuite/memory_test.sh: Make the regexps accept both 32 and
3902         64 bit output.
3903
3904 2010-09-08  Rafael Espindola  <espindola@google.com>
3905
3906         * script-sections.cc (Script_sections::add_memory_region): Convert
3907         field precision to int.
3908         * script.cc (script_set_section_region, script_set_section_region):
3909         Convert field precision to int.
3910
3911 2010-09-08  Rafael Espindola  <espindola@google.com>
3912
3913         * arm.cc (do_finalize_sections): Create the __exidx_start and
3914         __exdix_end symbols even when the section is missing.
3915
3916 2010-09-08  Nick Clifton  <nickc@redhat.com>
3917
3918         * README: Remove claim that MEMORY is not supported.
3919         * expression.cc (script_exp_function_origin)
3920         (script_exp_function_length): Move from here to ...
3921         * script.cc: ... here.
3922         (script_set_section_region, script_add_memory)
3923         (script_parse_memory_attr, script_include_directive): New
3924         functions.
3925         * script-sections.cc
3926         (class Memory_region): New class.
3927         (class Output_section_definition): Add set_memory_region,
3928         set_section_vma, set_section_lma and get_section_name methods.
3929         (class Script_Sections): Add add_memory_region,
3930         find_memory_region, find_memory_region_origin,
3931         find_memory_region_length and set_memory_region methods.
3932         Have set_section_addresses method walk the list of set memory
3933         regions.
3934         Extend the print methos to display memory regions.
3935         * script-sections.h: Add prototypes for new methods.
3936         Add enum for MEMORY region attributes.
3937         * yyscript.y: Add support for parsing MEMORY regions.
3938         * script-c.h: Add prototypes for new functions.
3939         * testsuite/Makefile.am: Add test of MEMORY region functionality.
3940         * testsuite/Makefile.in: Regenerate.
3941         * testsuite/memory_test.sh: New script.
3942         * testsuite/memory_test.s: New assembler source file.
3943         * testsuite/memory_test.t: New linker script.
3944
3945 2010-08-27  Doug Kwan  <dougkwan@google.com>
3946
3947         * gold/resolve.cc (Symbol_table::should_override): Let a weak
3948         reference override an existing dynamic weak reference.
3949         * testsuite/Makefile.am: Add new test dyn_weak_ref.
3950         * testsuite/Makefile.in: Regenerate.
3951         * testsuite/dyn_weak_ref.sh: New file.
3952         * testsuite/dyn_weak_ref_1.c: Ditto.
3953         * testsuite/dyn_weak_ref_2.c: Ditto.
3954
3955 2010-08-27  Ian Lance Taylor  <iant@google.com>
3956
3957         * incremental.h (class Incremental_input_entry): Add virtual
3958         destructor.
3959
3960 2010-08-27  Ian Lance Taylor  <iant@google.com>
3961
3962         * testsuite/start_lib_test_3.c: Mark t3 as used.
3963
3964 2010-08-27  Nick Clifton  <nickc@redhat.com>
3965
3966         * options.cc (version_script): Fix small typo in previous
3967         whitespace tidyup.
3968
3969 2010-08-25  Nick Clifton  <nickc@redhat.com>
3970
3971         * archive.cc: Formatting fixes: Remove whitespace between
3972         typename and following asterisk.  Remove whitespace between
3973         function name and opening parenthesis.
3974         * archive.h: Likewise.
3975         * arm.cc: Likewise.
3976         * attributes.cc: Likewise.
3977         * attributes.h: Likewise.
3978         * common.cc: Likewise.
3979         * copy-relocs.cc: Likewise.
3980         * dirsearch.h: Likewise.
3981         * dynobj.cc: Likewise.
3982         * ehframe.cc: Likewise.
3983         * ehframe.h: Likewise.
3984         * expression.cc: Likewise.
3985         * fileread.cc: Likewise.
3986         * fileread.h: Likewise.
3987         * gc.h: Likewise.
3988         * gold-threads.cc: Likewise.
3989         * gold.cc: Likewise.
3990         * i386.cc: Likewise.
3991         * icf.h: Likewise.
3992         * incremental-dump.cc: Likewise.
3993         * incremental.cc: Likewise.
3994         * layout.cc: Likewise.
3995         * layout.h: Likewise.
3996         * main.cc: Likewise.
3997         * merge.cc: Likewise.
3998         * merge.h: Likewise.
3999         * object.cc: Likewise.
4000         * object.h: Likewise.
4001         * options.cc: Likewise.
4002         * options.h: Likewise.
4003         * output.cc: Likewise.
4004         * output.h: Likewise.
4005         * plugin.cc: Likewise.
4006         * plugin.h: Likewise.
4007         * powerpc.cc: Likewise.
4008         * reloc.cc: Likewise.
4009         * script-c.h: Likewise.
4010         * script-sections.cc: Likewise.
4011         * script.cc: Likewise.
4012         * stringpool.cc: Likewise.
4013         * symtab.cc: Likewise.
4014         * symtab.h: Likewise.
4015         * target.cc: Likewise.
4016         * timer.cc: Likewise.
4017         * timer.h: Likewise.
4018         * version.cc: Likewise.
4019         * x86_64.cc: Likewise.
4020
4021 2010-08-24  Nick Clifton  <nickc@redhat.com>
4022
4023         PR 11899
4024         * layout.cc (segment_precedes): Sort segments by their physical
4025         addresses, if they have been set.
4026
4027 2010-08-23  Cary Coutant  <ccoutant@google.com>
4028
4029         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4030         symbols data.
4031         (Lib_group::include_member): Unlock object after deleting its
4032         symbols data.
4033         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4034         the bug fixed here.
4035
4036 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4037             Cary Coutant  <ccoutant@google.com>
4038
4039         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4040         constructor, and set_blocker.
4041         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4042         readsyms_blocker_.
4043         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4044         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4045         * testsuite/Makefile.am (start_lib_test): New test case.
4046         * testsuite/Makefile.in: Regenerate.
4047         * testsuite/start_lib_test_main.c: New file.
4048         * testsuite/start_lib_test_1.c: New file.
4049         * testsuite/start_lib_test_2.c: New file.
4050         * testsuite/start_lib_test_3.c: New file.
4051
4052 2010-08-19  Ian Lance Taylor  <iant@google.com>
4053
4054         * Makefile.in: Rebuild with automake 1.11.1.
4055         * aclocal.m4: Likewise.
4056         * testsuite/Makefile.in: Likewise.
4057
4058 2010-08-19  Ian Lance Taylor  <iant@google.com>
4059
4060         PR 10893
4061         * i386.cc (class Output_data_plt_i386): Update declarations.
4062         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4063         local_ifuncs_ fields.
4064         (Target_i386::do_plt_section_for_global): New function.
4065         (Target_i386::do_plt_section_for_local): New function.
4066         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4067         parameter; change all callers.  Initialize global_ifuncs_ and
4068         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4069         __rel_iplt_end.
4070         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4071         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4072         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4073         symbols.
4074         (Target_i386::make_plt_section): New function, broken out of
4075         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4076         (Target_i386::make_plt_entry): Call make_plt_section.
4077         (Target_i386::make_local_ifunc_plt_entry): New function.
4078         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4079         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4080         R_386_IRELATIVE to switch.
4081         (Target_i386::Scan::global): Likewise.
4082         (Target_i386::Relocate::relocate): Likewise.
4083         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4084         switch.
4085         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4086         (Target_x86_64::do_plt_section_for_global): New function.
4087         (Target_x86_64::do_plt_section_for_local): New function.
4088         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4089         parameter; change all callers.  If doing a static link define
4090         __rela_iplt_start and __rela_iplt_end.
4091         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4092         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4093         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4094         to point to .plt.
4095         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4096         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4097         switch.
4098         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4099         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4100         R_X86_64_IRELATIVE to switch.
4101         (Target_x86_64::Scan::global): Likewise.
4102         (Target_x86_64::Relocate::relocate): Likewise.
4103         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4104         switch.
4105         * target.h (class Target): Add plt_section_for_global and
4106         plt_section_for_local functions.  Add do_plt_section_for_global
4107         and do_plt_section_for_local virtual functions.
4108         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4109         clarifying comments.
4110         (Symbol::use_plt_offset): Handle IFUNC symbol.
4111         * object.cc (Sized_relobj::Sized_relobj): Initialize
4112         local_plt_offsets_.
4113         (Sized_relobj::local_has_plt_offset): New function.
4114         (Sized_relobj::local_plt_offset): New function.
4115         (Sized_relobj::set_local_plt_offset): New function.
4116         (Sized_relobj::do_count): Handle IFUNC symbol.
4117         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4118         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4119         is_ifunc_symbol functions.
4120         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4121         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4122         local_plt_offsets_ field.
4123         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4124         * output.h (class Output_section_data): Add non-const
4125         output_section function.
4126         (class Output_data_got): Update declarations.
4127         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4128         Add use_plt_offset parameter to global and local constructors.
4129         Change all callers.  Change local_sym_index_ field to 31 bits.
4130         Change GSYM_CODE and CONSTANT_CODE accordingly.
4131         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4132         doing a static link don't set sh_link field.
4133         (Output_data_got::Got_entry::write): Use PLT offset if
4134         appropriate.
4135         (Output_data_got::add_global_plt): New function.
4136         (Output_data_got::add_local_plt): New function.
4137         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4138         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4139         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4140         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4141         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4142         IFUNC conditional.
4143         * testsuite/ifunc-sel.h: New file.
4144         * testsuite/ifuncmain1.c: New file.
4145         * testsuite/ifuncmain1vis.c: New file.
4146         * testsuite/ifuncmod1.c: New file.
4147         * testsuite/ifuncdep2.c: New file.
4148         * testsuite/ifuncmain2.c: New file.
4149         * testsuite/ifuncmain3.c: New file.
4150         * testsuite/ifuncmod3.c: New file.
4151         * testsuite/ifuncmain4.c: New file.
4152         * testsuite/ifuncmain5.c: New file.
4153         * testsuite/ifuncmod5.c: New file.
4154         * testsuite/ifuncmain6pie.c: New file.
4155         * testsuite/ifuncmod6.c: New file.
4156         * testsuite/ifuncmain7.c: New file.
4157         * configure, testsuite/Makefile.in: Rebuild.
4158
4159 2010-08-18  Ian Lance Taylor  <iant@google.com>
4160
4161         * incremental.cc
4162         (Output_section_incremental_inputs::write_input_files): Add cast
4163         to avoid signed/unsigned comparison warning.
4164         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4165
4166 2010-08-12  Cary Coutant  <ccoutant@google.com>
4167
4168         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4169
4170 2010-08-13  Ian Lance Taylor  <iant@google.com>
4171
4172         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4173
4174 2010-08-12  Cary Coutant  <ccoutant@google.com>
4175             Doug Kwan  <dougkwan@google.com>
4176
4177         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4178         defintion overrides non-weak undef, remember that the original undef
4179         is not weak.
4180         * symtab.cc (Symbol_table::sized_write_global): For undef without
4181         an original weak binding, set binding to global in output.
4182         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4183         * testsuite/Makefile.in: Regenerate.
4184         * testsuite/strong_ref_weak_def.sh: New file.
4185         * testsuite/strong_ref_weak_def_1.c: Ditto.
4186         * testsuite/strong_ref_weak_def_2.c: Ditto.
4187
4188 2010-08-12  Cary Coutant  <ccoutant@google.com>
4189
4190         * testsuite/incremental_test.sh: Rewrite.
4191         * testsuite/incremental_test_1.c: Rewrite.
4192         * testsuite/incremental_test_2.c: Rewrite.
4193
4194 2010-08-12  Cary Coutant  <ccoutant@google.com>
4195
4196         * arm.cc (Target_arm::got_size): Add const.
4197         (Target_arm::got_entry_count): New function.
4198         (Target_arm::plt_entry_count): New function.
4199         (Target_arm::first_plt_entry_offset): New function.
4200         (Target_arm::plt_entry_size): New function.
4201         (Output_data_plt_arm::entry_count): New function.
4202         (Output_data_plt_arm::first_plt_entry_offset): New function.
4203         (Output_data_plt_arm::get_plt_entry_size): New function.
4204         * i386.cc (Target_i386::got_size): Add const.
4205         (Target_i386::got_entry_count): New function.
4206         (Target_i386::plt_entry_count): New function.
4207         (Target_i386::first_plt_entry_offset): New function.
4208         (Target_i386::plt_entry_size): New function.
4209         (Output_data_plt_i386::entry_count): New function.
4210         (Output_data_plt_i386::first_plt_entry_offset): New function.
4211         (Output_data_plt_i386::get_plt_entry_size): New function.
4212         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4213         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4214         * incremental.cc: Include target.h.
4215         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4216         parameter.  Adjust all callers.  Find incremental_got_plt section.
4217         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4218         section.
4219         (Output_section_incremental_inputs::set_final_data_size): Calculate
4220         size of incremental_got_plt section.
4221         (Output_section_incremental_inputs::do_write): Write the
4222         incremental_got_plt section.
4223         (Got_plt_view_info): New struct.
4224         (Local_got_offset_visitor): New class.
4225         (Global_got_offset_visitor): New class.
4226         (Global_symbol_visitor_got_plt): New class.
4227         (Output_section_incremental_inputs::write_got_plt): New function.
4228         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4229         Add parameter.  Adjust all callers.
4230         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4231         (Incremental_inputs::got_plt_section): New function.
4232         (Incremental_inputs::got_plt_section_): New data member.
4233         (Incremental_got_plt_reader): New class.
4234         * layout.cc (Layout::create_incremental_info_sections): Add the
4235         incremental_got_plt section.
4236         * object.h (Got_offset_list::get_list): New function.
4237         (Got offset_list::for_all_got_offsets): New function.
4238         (Sized_relobj::local_got_offset_list): New function.
4239         * powerpc.cc (Target_powerpc::got_size): Add const.
4240         (Target_powerpc::got_entry_count): New function.
4241         (Target_powerpc::plt_entry_count): New function.
4242         (Target_powerpc::first_plt_entry_offset): New function.
4243         (Target_powerpc::plt_entry_size): New function.
4244         (Output_data_plt_powerpc::entry_count): New function.
4245         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4246         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4247         * sparc.cc (Target_sparc::got_size): Add const.
4248         (Target_sparc::got_entry_count): New function.
4249         (Target_sparc::plt_entry_count): New function.
4250         (Target_sparc::first_plt_entry_offset): New function.
4251         (Target_sparc::plt_entry_size): New function.
4252         (Output_data_plt_sparc::entry_count): New function.
4253         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4254         (Output_data_plt_sparc::get_plt_entry_size): New function.
4255         * symtab.h (Symbol::got_offset_list): New function.
4256         (Symbol_table::for_all_symbols): New function.
4257         * target.h (Sized_target::got_entry_count): New function.
4258         (Sized_target::plt_entry_count): New function.
4259         (Sized_target::plt_entry_size): New function.
4260         * x86_64.cc (Target_x86_64::got_size): Add const.
4261         (Target_x86_64::got_entry_count): New function.
4262         (Target_x86_64::plt_entry_count): New function.
4263         (Target_x86_64::first_plt_entry_offset): New function.
4264         (Target_x86_64::plt_entry_size): New function.
4265         (Output_data_plt_x86_64::entry_count): New function.
4266         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4267         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4268
4269 2010-08-12  Cary Coutant  <ccoutant@google.com>
4270
4271         * archive.cc: Include incremental.h.
4272         (Archive::Archive): Initialize incremental_info_.
4273         (Archive::include_member): Record archive members in incremental info.
4274         (Add_archive_symbols::run): Record begin and end of an archive in
4275         incremental info.
4276         (Lib_group::include_member): Record objects in incremental info.
4277         * archive.h (Incremental_archive_entry): Forward declaration.
4278         (Archive::set_incremental_info): New member function.
4279         (Archive::incremental_info): New member function.
4280         (Archive::Unused_symbol_iterator): New class.
4281         (Archive::unused_symbols_begin): New member function.
4282         (Archive::unused_symbols_end): New member function.
4283         (Archive::incremental_info_): New data member.
4284         * incremental-dump.cc (find_input_containing_global): New function.
4285         (dump_incremental_inputs): Dump new incremental info sections.
4286         * incremental.cc: Include symtab.h.
4287         (Output_section_incremental_inputs): New class.
4288         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4289         new incremental info sections.
4290         (Sized_incremental_binary::do_check_inputs): Likewise.
4291         (Incremental_inputs::report_archive): Remove.
4292         (Incremental_inputs::report_archive_begin): New function.
4293         (Incremental_inputs::report_archive_end): New function.
4294         (Incremental_inputs::report_object): New function.
4295         (Incremental_inputs::finalize_inputs): Remove.
4296         (Incremental_inputs::report_input_section): New function.
4297         (Incremental_inputs::report_script): Rewrite.
4298         (Incremental_inputs::finalize): Do nothing but finalize string table.
4299         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4300         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4301         (Incremental_inputs::create_data_sections): New function.
4302         (Incremental_inputs::relocs_entsize): New function.
4303         (Output_section_incremental_inputs::set_final_data_size): New function.
4304         (Output_section_incremental_inputs::do_write): New function.
4305         (Output_section_incremental_inputs::write_header): New function.
4306         (Output_section_incremental_inputs::write_input_files): New function.
4307         (Output_section_incremental_inputs::write_info_blocks): New function.
4308         (Output_section_incremental_inputs::write_symtab): New function.
4309         * incremental.h (Incremental_script_entry): Forward declaration.
4310         (Incremental_object_entry): Forward declaration.
4311         (Incremental_archive_entry): Forward declaration.
4312         (Incremental_inputs): Forward declaration.
4313         (Incremental_inputs_header_data): Remove.
4314         (Incremental_inputs_header): Remove.
4315         (Incremental_inputs_header_write): Remove.
4316         (Incremental_inputs_entry_data): Remove.
4317         (Incremental_inputs_entry): Remove.
4318         (Incremental_inputs_entry_write): Remove.
4319         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4320         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4321         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4322         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4323         Likewise.
4324         (Incremental_input_entry): New class.
4325         (Incremental_script_entry): New class.
4326         (Incremental_object_entry): New class.
4327         (Incremental_archive_entry): New class.
4328         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4329         (Incremental_inputs::report_inputs): Remove.
4330         (Incremental_inputs::report_archive): Remove.
4331         (Incremental_inputs::report_archive_begin): New function.
4332         (Incremental_inputs::report_archive_end): New function.
4333         (Incremental_inputs::report_object): Change prototype.
4334         (Incremental_inputs::report_input_section): New function.
4335         (Incremental_inputs::report_script): Change prototype.
4336         (Incremental_inputs::get_reloc_count): New function.
4337         (Incremental_inputs::set_reloc_count): New function.
4338         (Incremental_inputs::create_data_sections): New function.
4339         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4340         (Incremental_inputs::inputs_section): New function.
4341         (Incremental_inputs::symtab_section): New function.
4342         (Incremental_inputs::relocs_section): New function.
4343         (Incremental_inputs::get_stringpool): Add const.
4344         (Incremental_inputs::command_line): Add const.
4345         (Incremental_inputs::inputs): Remove.
4346         (Incremental_inputs::command_line_key): New function.
4347         (Incremental_inputs::input_file_count): New function.
4348         (Incremental_inputs::input_files): New function.
4349         (Incremental_inputs::relocs_entsize): New function.
4350         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4351         (Incremental_inputs::finalize_inputs): Remove.
4352         (Incremental_inputs::Input_info): Remove.
4353         (Incremental_inputs::lock_): Remove.
4354         (Incremental_inputs::inputs_): Change type.
4355         (Incremental_inputs::inputs_map_): Remove.
4356         (Incremental_inputs::current_object_entry_): New data member.
4357         (Incremental_inputs::inputs_section_): New data member.
4358         (Incremental_inputs::symtab_section_): New data member.
4359         (Incremental_inputs::relocs_section_): New data member.
4360         (Incremental_inputs::reloc_count_): New data member.
4361         (Incremental_inputs_reader): New class.
4362         (Incremental_symtab_reader): New class.
4363         (Incremental_relocs_reader): New class.
4364         * layout.cc (Layout::finalize): Move finalization of incremental info
4365         and creation of incremental info sections to follow finalization of
4366         symbol table.  Set offsets for postprocessing sections.
4367         (Layout::create_incremental_info_sections): Call
4368         Incremental_inputs::create_data_sections.  Add incremental symtab
4369         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4370         sections to layout after input sections.
4371         * layout.h (struct Timespec): Forward declaration.
4372         (Layout::incremental_inputs): Add const.
4373         (Layout::create_incremental_info_sections): Add parameter.
4374         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4375         * object.cc: Include incremental.h.
4376         (Relobj::finalize_incremental_relocs): New function.
4377         (Sized_relobj::do_layout): Record input sections in incremental info.
4378         * object.h (Object::output_section): New function.
4379         (Object::output_section_offset): Moved from Relobj.
4380         (Object::get_incremental_reloc_base): New function.
4381         (Object::get_incremental_reloc_count): New function.
4382         (Object::do_output_section): New function.
4383         (Object::do_output_section_offset): Moved from Relobj.
4384         (Object::do_get_incremental_reloc_base): New function.
4385         (Object::do_get_incremental_reloc_count): New function.
4386         (Object::Object): Initialize new data members.
4387         (Relobj::output_section): Renamed do_output_section and moved to
4388         protected.
4389         (Relobj::output_section_offset): Moved to Object.
4390         (Relobj::do_get_incremental_reloc_base): New function.
4391         (Relobj::do_get_incremental_reloc_count): New function.
4392         (Relobj::allocate_incremental_reloc_counts): New function.
4393         (Relobj::count_incremental_reloc): New function.
4394         (Relobj::finalize_incremental_relocs): New function.
4395         (Relobj::next_incremental_reloc_index): New function.
4396         (Relobj::reloc_counts_): New data member.
4397         (Relobj::reloc_bases_): New data member.
4398         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4399         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4400         (Sized_relobj::incremental_relocs_scan): New function.
4401         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4402         (Sized_relobj::incremental_relocs_write): New function.
4403         (Sized_relobj::incremental_relocs_write_reltype): New function.
4404         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4405         incremental link.
4406         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4407         archives and object files elsewhere.
4408         (Add_symbols::run): Report object files here.
4409         (Finish_group::run): Report end of archive at end of group.
4410         * reloc.cc: Include layout.h, incremental.h.
4411         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4412         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4413         (Sized_relobj::incremental_relocs_scan): New function.
4414         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4415         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4416         (Sized_relobj::incremental_relocs_write): New function.
4417         (Sized_relobj::incremental_relocs_write_reltype): New function.
4418         * script.cc (read_input_script): Rewrite test for incremental link.
4419         Change call to Incremental_inputs::report_script.
4420         * symtab.h (Symbol_table::first_global_index): New function.
4421         (Symbol_table::output_count): New function.
4422
4423 2010-08-12  Doug Kwan  <dougkwan@google.com>
4424
4425         * arm.cc (Target_arm::merge_object_attributes): Check command line
4426         options --no-wchar-size-warning and --no-enum-size-warning.
4427         * options.h (General_options): Add ld-compatible options
4428         --no-enum-size-warning and --no-wchar-size-warning.
4429
4430 2010-08-04  Ian Lance Taylor  <iant@google.com>
4431
4432         * x86_64.cc (Target_x86_64::Scan::local): Use
4433         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4434         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4435         (Target_x86_64::Scan::global): Likewise.
4436         (Target_x86_64::Relocate::relocate): Likewise.
4437         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4438         Likewise.
4439
4440 2010-08-03  Cary Coutant  <ccoutant@google.com>
4441
4442         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4443         to reserve space in merged_strings vector. Keep total input size
4444         for stats.
4445         (Output_merge_string::do_print_merge_stats): Print total input size.
4446         * merge.h (Output_merge_string): Add input_size_ field.
4447         * stringpool.cc (Stringpool_template::string_length): Move
4448         implementations out of Stringpool_template class and place in
4449         stringpool.h.
4450         * stringpool.h (string_length): Move out of Stringpool_template.
4451
4452 2010-08-03  Ian Lance Taylor  <iant@google.com>
4453
4454         PR 11712
4455         * layout.cc (relaxation_loop_body): If address of load segment is
4456         set, adjust address to include headers if possible.
4457
4458 2010-08-03  Ian Lance Taylor  <iant@google.com>
4459
4460         * version.cc (version_string): Bump to 1.10.
4461
4462 2010-08-03  Ian Lance Taylor  <iant@google.com>
4463
4464         PR 11805
4465         * layout.h (enum Output_section_order): Define.
4466         (class Layout): Update declarations.
4467         * layout.cc (Layout::get_output_section): Add order parameter.
4468         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4469         is_first_non_relro parameters.  Change all callers.
4470         (Layout::choose_output_section): Likewise.
4471         (Layout::add_output_section_data): Likewise.
4472         (Layout::make_output_section): Likewise.  Set order.
4473         (Layout::default_section_order): New function.
4474         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4475         * output.cc (Output_section::Output_section): Initialize order_.
4476         Don't initialize deleted fields.
4477         (Output_segment::Output_segment): Don't initialize deleted
4478         fields.
4479         (Output_segment::add_output_section_to_load): New function
4480         replacing add_output_section.  Change all callers to call this or
4481         add_output_section_to_nonload.
4482         (Output_segment::add_output_section_to_nonload): New function.
4483         (Output_segment::remove_output_section): Rewrite.
4484         (Output_segment::add_initial_output_data): Likewise.
4485         (Output_segment::has_any_data_sections): Likewise.
4486         (Output_segment::is_first_section_relro): Likewise.
4487         (Output_segment::maximum_alignment): Likewise.
4488         (Output_segment::has_dynamic_reloc): New function replacing
4489         dynamic_reloc_count.  Change all callers.
4490         (Output_segment::has_dynamic_reloc_list): New function replacing
4491         dynamic_reloc_count_list.  Change all callers.
4492         (Output_segment::set_section_addresses): Rewrite.
4493         (Output_segment::set_offset): Rewrite.
4494         (Output_segment::find_first_and_last_list): Remove.
4495         (Output_segment::set_tls_offsets): Rewrite.
4496         (Output_segment::first_section_load_address): Likewise.
4497         (Output_segment::output_section_count): Likewise.
4498         (Output_segment::section_with_lowest_load_address): Likewise.
4499         (Output_segment::write_section_headers): Likewise.
4500         (Output_segment::print_sections_to_map): Likewise.
4501         * output.h (class Output_data): Remove dynamic_reloc_count_
4502         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4503         (Output_data::add_dynamic_reloc): Rewrite.
4504         (Output_data::has_dynamic_reloc): New function.
4505         (Output_data::dynamic_reloc_count): Remove.
4506         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4507         is_last_relro_, is_first_non_relro_, is_interp_,
4508         is_dynamic_linker_section_ fields.  Add order and set_order
4509         functions.  Remove is_relro_local, set_is_relro_local,
4510         is_last_relro, set_is_last_relro, is_first_non_relro,
4511         set_is_first_non_relro functions, is_interp, set_is_interp,
4512         is_dynamic_linker_section, and set_is_dynamic_linker_section
4513         functions.
4514         (class Output_segment): Change Output_data_list from std::list to
4515         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4516         output_bss_ fields.  Update declarations.
4517
4518 2010-08-02  Ian Lance Taylor  <iant@google.com>
4519
4520         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4521         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4522         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4523
4524 2010-08-02  Ian Lance Taylor  <iant@google.com>
4525
4526         PR 11855
4527         * script.cc (Script_options::Script_options): Initialize
4528         symbol_definitions_ and symbol_references_.
4529         (Script_options::add_symbol_assignment): Update
4530         symbol_definitions_ and symbol_references_.
4531         (Script_options::add_symbol_reference): New function.
4532         (script_symbol): New function.
4533         * script.h (class Script_options): Add symbol_definitions_ and
4534         symbol_references_ fields.
4535         (Script_options::referenced_const_iterator): New type.
4536         (Script_options::referenced_begin): New function.
4537         (Script_options::referenced_end): New function.
4538         (Script_options::is_referenced): New function.
4539         (Script_options::any_unreferenced): New function.
4540         * script-c.h (script_symbol): Declare.
4541         * yyscript.y (exp): Call script_symbol.
4542         * symtab.cc: Include "script.h".
4543         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4544         Change all callers.  Check symbols referenced by scripts.
4545         (Symbol_table::add_undefined_symbols_from_command_line): Add
4546         layout parameter.  Change all callers.
4547         (Symbol_table::do_add_undefined_symbols_from_command_line):
4548         Likewise.  Break out loop body.  Check symbols referenced by
4549         scripts.
4550         (Symbol_table::add_undefined_symbol_from_command_line): New
4551         function broken out of
4552         do_add_undefined_symbols_from_command_line.
4553         * symtab.h (class Symbol_table): Update declarations.
4554         * archive.cc: Include "layout.h".
4555         (Archive::should_include_member): Add layout parameter.  Change
4556         all callers.  Check for symbol mentioned in expression.
4557         * archive.h (class Archive): Update declaration.
4558         * object.cc (Sized_relobj::do_should_include_member): Add layout
4559         parameter.
4560         * object.h (Object::should_include_member): Add layout parameter.
4561         Change all callers.
4562         (Object::do_should_include_member): Add layout parameter.
4563         (class Sized_relobj): Update declaration.
4564         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4565         parameter.
4566         * dynobj.h (class Sized_dynobj): Update declaration.
4567         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4568         layout parameter.
4569         * plugin.h (class Sized_pluginobj): Update declaration.
4570
4571 2010-08-02  Ian Lance Taylor  <iant@google.com>
4572
4573         PR 11866
4574         * output.cc (Output_segment::set_offset): Search for the first and
4575         last sections rather than assuming that the list is in order.
4576         (Output_segment::find_first_and_last_list): New function.
4577         * output.h (class Output_segment): Update declarations.
4578         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4579         (relro_strip_test_SOURCES): New variable.
4580         (relro_strip_test_DEPENDENCIES): New variable.
4581         (relro_strip_test_LDFLAGS): New variable.
4582         (relro_strip_test_LDADD): New variable.
4583         (relro_strip_test.so): New target.
4584
4585 2010-08-02  Ian Lance Taylor  <iant@google.com>
4586
4587         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4588         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4589         (Target_i386::got_tlsdesc_section): New function.
4590         (Target_i386::got_section): Create space for GOT entries for
4591         TLSDESC relocations.
4592         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4593         R_386_TLS_GOTDESC.
4594         (Target_i386::Scan::global): Likewise.
4595         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4596         using TLSDESC GOT.
4597         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4598         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4599         (Target_x86_64::got_tlsdesc_section): New function.
4600         (Target_x86_64::got_section): Create space for GOT entries for
4601         TLSDESC relocations.
4602         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4603         R_386_TLS_GOTDESC.
4604         (Target_x86_64::Scan::global): Likewise.
4605         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4606         using TLSDESC GOT.
4607
4608 2010-08-02  Ian Lance Taylor  <iant@google.com>
4609
4610         * testsuite/final_layout.sh: Use dc to convert from hex to
4611         decimal.
4612
4613 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4614
4615         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4616         paramter to the call to gold::gc_process_relocs.
4617         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4618         paramter to the call to gold::gc_process_relocs.
4619         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4620         parameter to the call to gold::gc_process_relocs.
4621         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4622         template parameter to the call to gold::gc_process_relocs.
4623         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4624         paramter to the call to gold::gc_process_relocs.
4625         * gc.h (get_embedded_addend_size): New function.
4626         (gc_process_relocs): Save the size of the reloc for use by ICF.
4627         * icf.cc (get_section_contents): Get the addend from the text section
4628         for SHT_REL relocation sections.
4629         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4630         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4631         * int_encoding.h (read_from_pointer): New overloaded function.
4632         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4633         * testsuite/icf_sht_rel_addend_test.sh: New file.
4634         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4635         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4636
4637 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4638
4639         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4640         * Makefile.in: Regenerate.
4641         * testsuite/Makefile.in: Regenerate.
4642
4643 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4644
4645         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4646         * gold/testsuite/debug_msg.cc: Likewise.
4647         * gold/testsuite/odr_violation1.cc
4648         * gold/testsuite/odr_violation2.cc
4649
4650 2010-07-21  Cary Coutant  <ccoutant@google.com>
4651
4652         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4653         string, and length fields.
4654         (Output_merge_string::Merged_strings_list): New type.
4655         (Output_merge_string::Merged_strings_lists): New typedef.
4656         (Output_merge_string): Replace merged_strings_ with
4657         merged_strings_lists_.
4658         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4659         Merged_strings_list per input object and section.  Don't store pointer
4660         to the string.  Don't store length with each merged string entry.
4661         (Output_merge_string::finalize_merged_data): Loop over list of merged
4662         strings lists.  Recompute length of each merged string.
4663
4664 2010-07-15  Cary Coutant  <ccoutant@google.com>
4665
4666         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4667         here.
4668
4669 2010-07-14  Ian Lance Taylor  <iant@google.com>
4670
4671         * descriptors.cc (Descriptors::open): Report correct name in error
4672         message.
4673
4674 2010-07-13  Doug Kwan  <dougkwan@google.com>
4675
4676         * arm.cc (Arm_input_section::Arm_input_section): For a
4677         SHT_ARM_EXIDX section, always keeps the input sections.
4678         (Arm_input_section::set_exidx_section_link): New method.
4679         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4680         has_errors_ to false.
4681         (Arm_exidx_input_section::has_errors,
4682         Arm_exidx_input_section::set_has_errors): New methods.
4683         (Arm_exidx_input_section::has_errors_): New data member.
4684         (Arm_relobj::get_exidx_shndx_list): New method.
4685         (Arm_output_section::append_text_sections_to_list): Do not skip
4686         section without SHF_EXECINSTR.
4687         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4688         errors.
4689         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4690         section header.  Make error messages more verbose.  Check for
4691         a non-executable section linked to an EXIDX section.
4692         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4693         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4694         check that there is no deferred EXIDX section if we exit early.
4695         Instead of not making an EXIDX section in case of an error, make one
4696         and set the has_errors flag of it.
4697         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4698         in a relocatable link.
4699         (Target_arm::do_relax): Look for the EXIDX output section instead of
4700         assuming that it is called .ARM.exidx.
4701         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4702         section list.  Do not check for SHF_EXECINSTR section flags but
4703         skip any input section with errors.
4704         * output.cc (Output_section::Output_section): Initialize
4705         always_keeps_input_sections_ to false.
4706         (Output_section::add_input_section): Check for
4707         always_keeps_input_sections_.
4708         *  output.h (Output_section::always_keeps_input_sections,
4709         Output_section::set_always_keeps_input_sections): New methods.
4710         (Output_section::always_keeps_input_sections): New data member.
4711
4712 2010-07-13  Rafael Espindola  <espindola@google.com>
4713
4714         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4715         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4716
4717 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4718             Ian Lance Taylor  <iant@google.com>
4719
4720         * output.h (Output_section_lookup_maps::add_merge_section):
4721         Correct check of whether value was inserted.
4722         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4723         (Output_section_lookup_maps::add_relaxed_input_section):
4724         Likewise.
4725         * arm.cc (Target_arm::got_section): Remove used local os.
4726         * i386.cc (Target_i386::got_section): Likewise.
4727         * x86_64.cc (Target_x86_64::got_section): Likewise.
4728         * sparc.cc (Target_sparc::got_section): Likewise.
4729         (Target_sparc::relocate): Remove unused local have_got_offset.
4730         * powerpc.cc (Target_powerpc::relocate): Likewise.
4731
4732 2010-07-13  Ian Lance Taylor  <iant@google.com>
4733
4734         * compressed_output.cc (zlib_decompress): Fix signature in
4735         !HAVE_ZLIB_H case.
4736
4737         * archive.cc (Archive::include_member): Unlock an external member
4738         of a thin archive.  Don't bother to delete an object we know is
4739         NULL.
4740
4741 2010-07-12  Cary Coutant  <ccoutant@google.com>
4742
4743         * compressed_output.cc (zlib_decompress): New function.
4744         (get_uncompressed_size): New function.
4745         (decompress_input_section): New function.
4746         * compressed_output.h (get_uncompressed_size): New function.
4747         (decompress_input_section): New function.
4748         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4749         Handle compressed debug sections.
4750         * layout.cc (is_compressed_debug_section): New function.
4751         (Layout::output_section_name): Map compressed section names to
4752         canonical names.
4753         * layout.h (is_compressed_debug_section): New function.
4754         (is_debug_info_section): Recognize compressed debug sections.
4755         * merge.cc: Include compressed_output.h.
4756         (Output_merge_data::do_add_input_section): Handle compressed
4757         debug sections.
4758         (Output_merge_string::do_add_input_section): Handle compressed
4759         debug sections.
4760         * object.cc: Include compressed_output.h.
4761         (Sized_relobj::Sized_relobj): Initialize new data members.
4762         (build_compressed_section_map): New function.
4763         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4764         * object.h (Object::section_is_compressed): New method.
4765         (Object::do_section_is_compressed): New method.
4766         (Sized_relobj::Compressed_section_map): New type.
4767         (Sized_relobj::do_section_is_compressed): New method.
4768         (Sized_relobj::compressed_sections_): New data member.
4769         * output.cc (Output_section::add_input_section): Handle compressed
4770         debug sections.
4771         * reloc.cc: Include compressed_output.h.
4772         (Sized_relobj::write_sections): Handle compressed debug sections.
4773
4774 2010-07-08  Cary Coutant  <ccoutant@google.com>
4775
4776         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4777         weak when resolving to a dynamic def.
4778         (Symbol_table::should_override): Add adjust_dyndef flag; set it
4779         for weak undef/dynamic def cases. Adjust callers.
4780         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4781         undef_binding_weak_.
4782         (Symbol_table::sized_write_globals): Adjust symbol binding.
4783         (Symbol_table::sized_write_symbol): Add binding parameter.
4784         * symtab.h (Symbol::set_undef_binding): New method.
4785         (Symbol::is_undef_binding_weak): New method.
4786         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4787         (Symbol_table::should_override): Add new parameter.
4788         (Symbol_table::sized_write_symbol): Add new parameter.
4789
4790         * testsuite/weak_undef_file1.cc: Add new test case.
4791         * testsuite/weak_undef_file2.cc: Fix header comment.
4792         * testsuite/weak_undef_test.cc: Add new test case.
4793
4794 2010-06-29  Doug Kwan  <dougkwan@google.com>
4795
4796         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4797         Initialize USE_SYMBOL_.
4798         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4799         definition.
4800         (Arm_reloc_property::uses_symbol_): New data member declaration.
4801         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4802         uses symbol value and symbol is undefined but not weakly undefined.
4803
4804 2010-06-28  Rafael Espindola  <espindola@google.com>
4805
4806         * plugin.cc (Plugin::load): Use dlerror.
4807
4808 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
4809
4810         * symtab.cc (detect_odr_violations): When reporting an ODR
4811         violation, report an object where the symbol is defined.
4812
4813 2010-06-25  Doug Kwan  <dougkwan@google.com>
4814
4815         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4816         (Target_arm::section_may_have_icf_unsafe_pointers): New method
4817         definition.
4818         (Target_arm::Scan::local_reloc_may_be_function_pointer,
4819         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4820         target hook to detect function points.
4821         (Target_arm::Scan::possible_function_pointer_reloc): New method.
4822         * icf.h (Icf::check_section_for_function_pointers): Change type of
4823         parameter SECTION_NAME to const reference to std::string.  Use
4824         target hook to determine if section may have unsafe pointers.
4825         * target.h (Target::section_may_have_icf_unsafe_pointers): New
4826         method definition.
4827
4828 2010-06-21  Rafael Espindola  <espindola@google.com>
4829
4830         * fileread.cc (Input_file::find_fie): New
4831         (Input_file::open): Use Input_file::find_fie.
4832         * fileread.h (Input_file::find_fie): New
4833         * plugin.cc (set_extra_library_path): New.
4834         (Plugin::load): Add set_extra_library_path to the transfer vector.
4835         (Plugin_manager::set_extra_library_path): New.
4836         (Plugin_manager::add_input_file): Use the extra search path if set.
4837         (set_extra_library_path(): New.
4838         * plugin.h (Plugin_manager): Add set_extra_library_path and
4839         extra_search_path_.
4840
4841 2010-06-19  Cary Coutant  <ccoutant@google.com>
4842
4843         * layout.cc (gdb_sections): Add .debug_types.
4844         (lines_only_debug_sections): Likewise.
4845
4846 2010-06-18  Rafael Espindola  <espindola@google.com>
4847
4848         * plugin.cc (add_input_file,add_input_library)
4849         (Plugin_manager::add_input_file): Make filename arguments const.
4850         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4851         const.
4852
4853 2010-06-16  Doug Kwan  <dougkwan@google.com>
4854
4855         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4856         .ARM.attributes section if we have not merged any input
4857         attributes sections.
4858
4859 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4860
4861         * arm.cc: Allow combining objects with no EABI version
4862         information.
4863
4864 2010-06-15  Rafael Espindola  <espindola@google.com>
4865
4866         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4867
4868 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4869
4870         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4871         (struct iovec): Correct !HAVE_READV definition.
4872
4873 2010-06-10  Cary Coutant  <ccoutant@google.com>
4874
4875         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4876         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4877         reloc sections.
4878         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4879
4880         PR 11683
4881         * symtab.h (Symbol::is_placeholder): New member function.
4882         * target-reloc.h (relocate_section): Check for placeholder symbols.
4883
4884         * testsuite/Makefile.am (plugin_test_8): New test.
4885         (plugin_test_9): New test.
4886         * testsuite/Makefile.in: Regenerate.
4887
4888 2010-06-09  Nick Clifton  <nickc@redhat.com>
4889
4890         * yyscript.y (input_list_element): Allow strings prefixed with
4891         the '-' character.  Treat these as libraries.
4892         * script.cc (script_add_library): New function.  Adds a library
4893         specified by "-l<name>" found in an input script.
4894         * script-c.h: Add prototype for script_add_library.
4895
4896 2010-06-07  Doug Kwan  <dougkwan@google.com>
4897
4898         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4899         Restrict stub-group size to be within long conditional branch
4900         range when working around cortex-A8 erratum.
4901
4902 2010-06-07  Damien Diederen  <dd@crosstwine.com>
4903
4904         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4905         #ifdef typo.
4906
4907 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
4908
4909         PR gold/11658
4910         * output.cc
4911         (Output_section::Input_section_sort_entry::compare_section_ordering):
4912         Change to return non-zero correctly.
4913         (Output_section::Input_section_sort_section_order_index_compare
4914         ::operator()): Change to fix ambiguity in comparisons.
4915
4916 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
4917
4918         * gold.h (is_wildcard_string): New function.
4919         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4920         (Layout::layout_eh_frame): Ditto.
4921         (Layout::find_section_order_index): New method.
4922         (Layout::read_layout_from_file): New method.
4923         * layout.h (Layout::find_section_order_index): New method.
4924         (Layout::read_layout_from_file): New method.
4925         (Layout::input_section_position_): New private member.
4926         (Layout::input_section_glob_): New private member.
4927         * main.cc (main): Call read_layout_from_file here.
4928         * options.h (--section-ordering-file): New option.
4929         * output.cc (Output_section::input_section_order_specified_): New
4930         member.
4931         (Output_section::Output_section): Initialize new member.
4932         (Output_section::add_input_section): Add new parameter.
4933         Keep input sections when --section-ordering-file is used.
4934         (Output_section::set_final_data_size): Sort input sections when
4935         section ordering file is specified.
4936         (Output_section::Input_section_sort_entry): Add new parameter.
4937         Check sorting type.
4938         (Output_section::Input_section_sort_entry::compare_section_ordering):
4939         New method.
4940         (Output_section::Input_section_sort_compare::operator()): Change to
4941         consider section_order_index.
4942         (Output_section::Input_section_sort_init_fini_compare::operator()):
4943         Change to consider section_order_index.
4944         (Output_section::Input_section_sort_section_order_index_compare
4945         ::operator()): New method.
4946         (Output_section::sort_attached_input_sections): Change to sort
4947         according to section order when specified.
4948         (Output_section::add_input_section<32, true>): Add new parameter.
4949         (Output_section::add_input_section<64, true>): Add new parameter.
4950         (Output_section::add_input_section<32, false>): Add new parameter.
4951         (Output_section::add_input_section<64, false>): Add new parameter.
4952         * output.h (Output_section::add_input_section): Add new parameter.
4953         (Output_section::input_section_order_specified): New
4954         method.
4955         (Output_section::set_input_section_order_specified): New method.
4956         (Input_section::Input_section): Initialize section_order_index_.
4957         (Input_section::section_order_index): New method.
4958         (Input_section::set_section_order_index): New method.
4959         (Input_section::section_order_index_): New member.
4960         (Input_section::Input_section_sort_section_order_index_compare): New
4961         struct.
4962         (Output_section::input_section_order_specified_): New member.
4963         * script-sections.cc (is_wildcard_string): Delete and move modified
4964         method to gold.h.
4965         (Output_section_element_input::Output_section_element_input): Modify
4966         call to is_wildcard_string.
4967         (Output_section_element_input::Input_section_pattern
4968         ::Input_section_pattern): Ditto.
4969         (Output_section_element_input::Output_section_element_input): Ditto.
4970         * testsuite/Makefile.am (final_layout): New test case.
4971         * testsuite/Makefile.in: Regenerate.
4972         * testsuite/final_layout.cc: New file.
4973         * testsuite/final_layout.sh: New file.
4974
4975 2010-06-01  Rafael Espindola  <espindola@google.com>
4976
4977         * plugin.cc (Plugin::load): Pass the output name to the plugin.
4978
4979 2010-06-01  Rafael Espindola  <espindola@google.com>
4980
4981         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4982         visibility of symbols.
4983
4984 2010-05-27  Doug Kwan  <dougkwan@google.com>
4985
4986         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4987         from start of output section instead of address for a local symbol
4988         in a merged or relaxed section when doing a relocatable link.
4989
4990 2010-05-26  Rafael Espindola  <espindola@google.com>
4991
4992        PR 11604
4993         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4994         adding sections the garbage collector removed.
4995         * gold/testsuite/Makefile.am: Add test.
4996         * gold/testsuite/Makefile.in: Regenerate.
4997         * gold/testsuite/plugin_test_7.sh: New.
4998         * gold/testsuite/plugin_test_7_1.c: New.
4999         * gold/testsuite/plugin_test_7_2.c: New.
5000
5001 2010-05-26  Rafael Espindola  <espindola@google.com>
5002
5003         * script-sections.cc (Output_section_definition::set_section_addresses):
5004         Check for --section-start.
5005
5006 2010-05-26  Doug Kwan  <dougkwan@google.com>
5007
5008         * arm.cc (Arm_scan_relocatable_relocs): New class.
5009         (Target_arm::relocate_special_relocatable): New method.
5010         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5011         (Arm_relocate_functions::thumb_branch_common): Same.
5012         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5013         instead of Default_scan_relocatable_relocs.
5014         * target-reloc.h (relocate_for_relocatable): Let target handle
5015         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5016         * target.h (Sized_target::relocate_special_relocatable): New method.
5017
5018 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5019
5020         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5021
5022 2010-05-23  Doug Kwan  <dougkwan@google.com>
5023
5024         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5025         instead of a cast.
5026         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5027         with a direct branch, not a conditional branch, to a stub.
5028         * merge.cc (Output_merge_base::record_input_section): New method
5029         defintion.
5030         (Output_merge_data::do_add_input_section): Record input section if
5031         keeps-input-sections flag is set.
5032         (Output_merge_string::do_add_input_section): Ditto.
5033         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5034         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5035         INPUT_SECTIONS_.
5036         (Output_merge_base::keeps_input_sections,
5037         Output_merge_base::set_keeps_input_sections,
5038         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5039         method definitions.
5040         (Output_merge_base::Input_sections): New type declaration.
5041         (Output_merge_base::input_sections_begin,
5042         Output_merge_base::input_sections_end,
5043         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5044         (Output_merge_base::bool keeps_input_sections_,
5045         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5046         Output_merge_base::input_sections_): New data members.
5047         (Output_merge_data::do_set_keeps_input_sections): New method
5048         defintion.
5049         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5050         * output.cc (Output_section::Input_section::relobj): Move method
5051         defintion from class declaration to here and handle merge sections.
5052         (Output_section::Input_section::shndx): Ditto.
5053         (Output_section::Output_section): Remove initializations of removed
5054         data members and initialize new data member LOOKUP_MAPS_.
5055         (Output_section::add_input_section): Set keeps-input-sections flag
5056         for a newly created merge output section as appropriate.  Adjust code
5057         to use Output_section_lookup_maps class.
5058         (Output_section::add_relaxed_input_section): Adjst code for lookup
5059         maps code refactoring.
5060         (Output_section::add_merge_input_section): Add a new parameter
5061         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5062         class.  If adding input section to a newly created merge output
5063         section fails, remove the new merge section.
5064         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5065         Adjust code for use of the Output_section_lookup_maps class.
5066         (Output_section::find_merge_section): Ditto.
5067         (Output_section::build_lookup_maps): New method defintion.
5068         (Output_section::find_relaxed_input_section): Adjust code to use
5069         Output_section_lookup_maps class.
5070         (Output_section::get_input_sections): Export merge sections.  Adjust
5071         code to use Output_section_lookup_maps class.
5072         (Output_section:::add_script_input_section): Adjust code to use
5073         Output_section_lookup_maps class.  Update lookup maps for merge
5074         sections also.
5075         (Output_section::discard_states): Use Output_section_lookup_maps.
5076         (Output_section::restore_states): Same.
5077         * output.h (Merge_section_properties): Move class defintion out of
5078         Output_section.
5079         (Output_section_lookup_maps): New class.
5080         (Output_section::Input_section::is_merge_section): New method
5081         defintion.
5082         (Output_section::Input_section::relobj): Move defintion out of class
5083         defintion.  Declare method only.
5084         (Output_section::Input_section::shndx): Ditto.
5085         (Output_section::Input_section::output_merge_base): New method defintion.
5086         (Output_section::Input_section::u2_.pomb): New union field.
5087         (Output_section::Merge_section_by_properties_map,
5088         Output_section::Output_section_data_by_input_section_map,
5089         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5090         Remove types.
5091         (Output_section::add_merge_input_section): Add new parameter
5092         KEEPS_INPUT_SECTIONS.
5093         (Output_section::build_lookup_maps): New method declaration.
5094         (Output_section::merge_section_map_,
5095         Output_section::merge_section_by_properties_map_,
5096         Output_section::relaxed_input_section_map_,
5097         Output_section::is_relaxed_input_section_map_valid_): Remove data
5098         members.
5099         (Output_section::lookup_maps_): New data member.
5100
5101 2010-05-21  Doug Kwan  <dougkwan@google.com>
5102
5103         PR gold/11619
5104         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5105         avoid a compilation error.
5106
5107 2010-05-19  Rafael Espindola  <espindola@google.com>
5108
5109         * script-sections.cc (Output_section_definition::allocate_to_segment):
5110         Update the phdrs_list even when the output section is NULL.
5111         * testsuite/Makefile.am: Add test.
5112         * testsuite/Makefile.in: Regenerate.
5113         * testsuite/script_test_9.cc: New.
5114         * testsuite/script_test_9.sh: New.
5115         * testsuite/script_test_9.t: New.
5116
5117 2010-05-19  Doug Kwan  <dougkwan@google.com>
5118
5119         * arm.cc (Arm_input_section::original_size): New method.
5120         (Arm_input_section::do_addralign): Add a cast.
5121         (Arm_input_section::do_output_offset): Remove static cast.
5122         (Arm_input_section::original_addralign,
5123          Arm_input_section::original_size_): Change type to uint32_t.
5124         (Arm_input_section::init): Add safe casts for section alignment
5125         and size.
5126         (Arm_input_section::set_final_data_size): Do not set address and
5127         offset of stub table.
5128         (Arm_output_section::fix_exidx_coverage): Change use of of
5129         Output_section::Simple_input_section to that of
5130         Output_section::Input_section.
5131         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5132         except for the first pass.
5133         * output.cc (Output_section::get_input_sections): Change type of
5134         input_sections to std::list<Input_section>.
5135         (Output_section::add_script_input_section): Rename from
5136         Output_section::add_simple_input_section.  Change type of SIS
5137         parameter from Simple_input_section to Input_section.
5138         * output.h (Output_section::Simple_input_section): Remove class.
5139         (Output_section::Input_section): Change class visibility to public.
5140         (Output_section::Input_section::addralign): Use stored alignments
5141         for special input sections if set.
5142         (Output_section::Input_section::set_addralign): New method.
5143         (Output_section::get_input_sections): Change parameter type from
5144         list of Simple_input_section to list of Input_section.
5145         (Output_section::add_script_input_section): Rename from
5146         Output_section::add_simple_input_section. Change first parameter's
5147         type from Simple_input_section to Input_section and remove the
5148         second and third parameters.
5149         * script-sections.cc (Input_section::Input_section_list): Change
5150         type to list of Output_section::Input_section/
5151         (Input_section_info::Input_section_info): Change parameter type of
5152         INPUT_SECTION to Output_section::Input_section.
5153         (Input_section_info::input_section): Change return type.
5154         (Input_section_info::input_section_): Change type to
5155         Output_section::Input_section.
5156         (Output_section_element_input::set_section_addresses): Adjust code
5157         to use Output_section::Input_section instead of
5158         Output_section::Simple_input_section.  Adjust code for renaming
5159         of Output_section::add_simple_input_section.
5160         (Orphan_output_section::set_section_addresses): Ditto.
5161
5162 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5163
5164         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5165         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5166
5167 2010-05-18  Rafael Espindola  <espindola@google.com>
5168
5169         * options.cc (General_options::finalize): Handle -nostdlib.
5170         * options.h (nostdlib): New option.
5171         * script.cc (script_add_search_dir): Handle -nostdlib.
5172
5173 2010-05-12  Doug Kwan  <dougkwan@google.com>
5174
5175         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5176         attributes section only if there no attributes section after merging.
5177         (Target_arm::merge_object_attributes): Move value of
5178         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5179         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5180         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5181         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5182         and arm_attr_merge_7.stdout.
5183         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5184         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5185         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5186         arm_attr_merge_7b.o): New rules.
5187         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5188         arm_attr_merge_7
5189         * testsuite/Makefile.in: Regenerate.
5190         * testsuite/arm_attr_merge.sh: New file.
5191         * testsuite/arm_attr_merge_[67][ab].s: Same.
5192
5193 2010-05-05  Nick Clifton  <nickc@redhat.com>
5194
5195         * po/es.po: Updated Spanish translation.
5196
5197 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5198
5199         * Makefile.am (install-exec-local): Properly install gold as
5200         default cross linker.
5201         * Makefile.in: Regenerated.
5202
5203 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5204             Nick Clifton  <nickc@redhat.com>
5205
5206         * configure.ac (install_as_default): Define and set to false
5207         unless --enable-gold or --enable-gold=both/gold has been
5208         specified.
5209         * configure: Regenerate.
5210
5211         * Makefile.am (install-exec-local): Install the executable as
5212         'ld.gold'.  If install_as_default is true then also install it as
5213         'ld'.
5214         * Makefile.in: Regenerated.
5215
5216 2010-04-24  Ian Lance Taylor  <iant@google.com>
5217
5218         * layout.cc (Layout::layout_reloc): In relocatable link don't
5219         combine reloc sections for grouped sections.
5220
5221 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5222
5223         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5224         sections that are not ordinary to icf.
5225         * icf.cc (get_section_contents): Handle relocation pointing to section
5226         with no object or shndx information.
5227         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5228         * testsuite/Makefile.in: Regenerate.
5229         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5230         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5231
5232 2010-04-22  Ian Lance Taylor  <iant@google.com>
5233
5234         * expression.cc (Expression::Expression_eval_info): Add
5235         result_alignment_pointer field.
5236         (Expression::eval_with_dot): Add result_alignment_pointer
5237         parameter.  Change all callers.
5238         (Expression::eval_maybe_dot): Likewise.
5239         (class Binary_expression): Add alignment_pointer parameter to
5240         left_value and right_value.  Change all callers.
5241         (BINARY_EXPRESSION): Set result alignment.
5242         (class Trinary_expression): Add alignment_pointer parameter to
5243         arg2_value and arg3_value.  Change all callers.
5244         (Trinary_cond::value): Set result alignment.
5245         (Max_expression::value, Min_expression::value): Likewise.
5246         (Align_expression::value): Likewise.
5247         * script-sections.cc (class Sections_element): Add dot_alignment
5248         parameter to set_section_addresses virtual function.  Update
5249         instantiations.
5250         (class Output_section_element): Likewise.
5251         (Script_sections::create_segments): Add dot_alignment parameter.
5252         Change all callers.
5253         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5254         (Script_sections::set_phdrs_clause_addresses): Likewise.
5255         * script-sections.h: Update declarations.
5256         * script.h: Update declarations.
5257         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5258         min_p_align.
5259         * testsuite/script_test_3.t: Set large alignment.
5260         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5261         segment has expected alignment.
5262
5263 2010-04-22  Nick Clifton  <nickc@redhat.com>
5264
5265         * po/gold.pot: Updated by the Translation project.
5266         * po/vi.po: Updated Vietnamese translation.
5267
5268 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5269
5270         * testsuite/Makefile.am (check_PROGRAMS): Add
5271         icf_virtual_function_folding_test.
5272         * testsuite/Makefile.in: Regenerated.
5273
5274 2010-04-15  Andrew Haley  <aph@redhat.com>
5275
5276         * options.h (merge_exidx_entries): New option.
5277         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5278         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5279         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5280         (Target_arm::merge_exidx_entries): New function.
5281         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5282         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5283         to Arm_exidx_fixup constructor.
5284         Add new arg, merge_exidx_entries.
5285         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5286         Arm_output_section::fix_exidx_coverage.
5287
5288 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5289
5290         * icf.cc (get_section_contents): Check for preemptible functions.
5291         Ignore addend when appropriate.
5292         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5293         section folded.
5294         (add_from_relobj): Check for section folded.
5295         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5296         * symtab.h (should_add_dynsym_entry): Add new parameter.
5297         * target-reloc.h (scan_relocs): Check for section folded.
5298         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5299         Check reloc types for function pointers in shared objects.
5300         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5301         case.
5302         (icf_preemptible_functions_test): New test case.
5303         (icf_string_merge_test): New test case.
5304         * testsuite.Makefile.in: Regenerate.
5305         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5306         bar_glob.  Refactor code.
5307         * testsuite/icf_preemptible_functions_test.cc: New file.
5308         * testsuite/icf_preemptible_functions_test.sh: New file.
5309         * testsuite/icf_string_merge_test.cc: New file.
5310         * testsuite/icf_string_merge_test.sh: New file.
5311         * testsuite/icf_virtual_function_folding_test.cc: New file.
5312         * testsuite/icf_virtual_function_folding_test.sh: New file.
5313
5314 2010-04-14  Doug Kwan  <dougkwan@google.com>
5315
5316         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5317         for local symbol recounting if we remove a section due to ICF.
5318         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5319         there are no regular objects in input.
5320
5321 2010-04-13  Doug Kwan  <dougkwan@google.com>
5322
5323         * arm.cc (Arm_input_section::set_final_data_size): Compute
5324         accurate final data size instead of using current data size.
5325
5326 2010-04-09  Doug Kwan  <dougkwan@google.com>
5327
5328         * layout.cc (Layout::choose_output_section): Handle script section
5329         types.
5330         (Layout::make_output_section_for_script): Add section type parameter.
5331         Handle script section types.
5332         * layout.h (Layout::make_output_section_for_script): Add section
5333         type parameter.
5334         * output.cc (Output_section::Output_section): Initialize data member
5335         is_noload_.
5336         (Output_section::do_reset_address_and_file_offset): Do not set address
5337         to 0 if section is a NOLOAD section.
5338         * output.h (Output_section::is_noload): New method.
5339         (Output_section::set_is_noload): Ditto.
5340         (Output_section::is_noload_): New data member.
5341         * script-c.h (Script_section_type): New enum type.
5342         (struct Parser_output_section_header): Add new file section_type.
5343         * script-sections.cc (Sections_element::output_section_name): Add
5344         parameter for returning script section type.
5345         (Output_section_definition::output_section_name): Ditto.
5346         (Output_section_definition::section_type)P; New method.
5347         (Output_section_definiton::script_section_type_name): Ditto.
5348         (Output_section_definition::script_section_type_): New data member.
5349         (Output_section_definition::Output_section_definition): Initialize
5350         data member Output_section_definition::script_section_type_.
5351         (Output_section_definition::create_sections): Pass script section type
5352         to Layout::make_output_section_for_script.
5353         (Output_section_definition::output_section_name): Return script
5354         section type to caller.
5355         (Output_section_definition::set_section_address): Do not advance
5356         dot value and load address if section type is NOLOAD.  Set address
5357         of NOLOAD sections regardless of section flags.
5358         (Output_section_definition::print): Print section type if it is
5359         not SCRIPT_SECTION_TYPE_NONE.
5360         (Output_section_definition::section_type): New method.
5361         (Output_section_definition::script_section_type_name): Ditto.
5362         (Script_sections::output_section_name): Add new parameter
5363         PSECTION_TYPE for returning script section type.  Pass it to
5364         section elements.  Handle discard sections.
5365         (Sort_output_sections::operator()): Handle NOLOAD sections.
5366         * script-sections.h (Script_sections::Section_type): New enum type.
5367         (Script_sections::output_section_name): Add a new parameter for
5368         returning script section type.
5369         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5370         INFO and NOLOAD.
5371         * yyscript.y (union): Add new field SECTION_TYPE.
5372         (COPY, DSECT, INFO, NOLOAD): New tokens.
5373         (opt_address_and_section_type): Change type to output_section_header.
5374         (section_type): New non-terminal
5375         (section_header): Handle section type.
5376         (opt_address_and_section_type): Return section type value.
5377
5378 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5379
5380         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5381         * testsuite/plugin_common_test_2.c (foo): Likewise.
5382
5383 2010-04-08  Doug Kwan  <dougkwan@google.com>
5384
5385         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5386         Output_merge_data.
5387         * output.cc (Output_section::add_merge_input_section): Simplify
5388         code and return status of Output_merge_base::add_input_section.
5389         Update merge section map only if Output_merge_base::add_input_section
5390         returns true.
5391
5392 2010-04-07  Doug Kwan  <dougkwan@google.com>
5393
5394         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5395         if section is marked as containing instructions but has no mapping
5396         symbols.
5397         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5398         correct section index.
5399         (Arm_relobj::find_linked_text_section): Ditto.
5400
5401 2010-04-07  Cary Coutant  <ccoutant@google.com>
5402
5403         * archive.cc (include_member): Destroy Read_symbols_data object before
5404         releasing file.
5405         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5406         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5407         (Read_symbols_data::~Read_symbols_data) New destructor.
5408         (Section_relocs::Section_relocs) New constructor.
5409         (Section_relocs::~Section_relocs) New destructor.
5410         (Read_relocs_data::Read_relocs_data) New constructor.
5411         (Read_relocs_data::~Read_relocs_data) New destructor.
5412         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5413         pointers to NULL after deleting.
5414
5415 2010-04-07  Doug Kwan  <dougkwan@google.com>
5416
5417         * arm.cc: Replace "endianity" with "endianness" in comments.
5418         (Arm_exidx_cantunwind): Ditto.
5419         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5420         (Arm_relobj::merge_flags_and_attributes): New method.
5421         (Arm_relobj::merge_flags_and_attributes_): New data member.
5422         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5423         (Arm_relobj::scan_sections_for_stubs): Ditto.
5424         (Arm_relobj::do_read_symbols): Check to see if we really want to
5425         merge processor-specific flags and attributes.  Exit early if
5426         an object is empty except for section names and the undefined symbol.
5427         (Target_arm::do_finalize_sections): Move check for ELF format to
5428         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5429         attributes from a regular object only when we have determined that
5430         it is aapropriate.  Do not create an .ARM.attributes section in
5431         output if there is no regular input object.
5432         (Target_arm::merge_processor_specific_flags): Check
5433         --warn-mismatch before printing any error.
5434         (Target_arm::merge_object_attributes): Ditto.
5435         * gold.cc (queue_middle_tasks): Handle the case in which there is
5436         no regular object in input.
5437         * options.cc (General_options::parse_EB): New method.
5438         (General_options::parse_EL): Same.
5439         (General_options::General_options): Initialize endianness_.
5440         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5441         New options.
5442         (General_options::Endianness): New enum.
5443         (General_options::endianness): New method.
5444         (General_options::endianness_): New data member.
5445         * parameters.cc (Parameters::set_options): Check target endianness.
5446         (Parameters::set_target_once): Ditto.
5447         (Parameters::check_target_endianness): New method.
5448         (parameters_force_valid_target): If either -EL or -EB is specified,
5449         use it to define endianness of default target.
5450         * parameters.h (Parameters::check_target_endianness): New method
5451         declaration.
5452         * target.h (class Target): Change "endianity" to "endianness"
5453         in comments.
5454
5455 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5456
5457         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5458         * configure: Regenerate.
5459         * Makefile.in: Regenerate.
5460         * testsuite/Makefile.in: Regenerate.
5461
5462 2010-04-06  Cary Coutant  <ccoutant@google.com>
5463
5464         gcc PR lto/42757
5465         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5466         prevailing definitions of common symbols.
5467         * testsuite/plugin_test_6.sh: New test case.
5468         * testsuite/plugin_common_test_1.c: New test case.
5469         * testsuite/plugin_common_test_2.c: New test case.
5470         * testsuite/Makefile.am (plugin_test_6): New test case.
5471         * testsuite/Makefile.in: Regenerate.
5472
5473 2010-04-06  Nick Clifton  <nickc@redhat.com>
5474
5475         * po/vi.po: New Vietnamese translation.
5476
5477 2010-03-30  Doug Kwan  <dougkwan@google.com>
5478
5479         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5480
5481 2010-03-25  Doug Kwan  <dougkwan@google.com>
5482
5483         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5484         to avoid a conversion warning on a 32-bit host.
5485
5486 2010-03-24  Ian Lance Taylor  <iant@google.com>
5487
5488         * testsuite/script_test_3.t: Add a TLS segment.
5489         * testsuite/Makefile.am (check_PROGRAMS): Add
5490         tls_phdrs_script_test.
5491         (tls_phdrs_script_test_SOURCES): Define.
5492         (tls_phdrs_script_test_DEPENDENCIES): Define.
5493         (tls_phdrs_script_test_LDFLAGS): Define.
5494         (tls_phdrs_script_test_LDADD): Define.
5495         * testsuite/Makefile.in: Rebuild.
5496
5497 2010-03-23  Cary Coutant  <ccoutant@google.com>
5498
5499         * fileread.cc (find_or_make_view): Fix comment.
5500
5501 2010-03-23  Ian Lance Taylor  <iant@google.com>
5502
5503         * script-sections.cc (class Orphan_section_placement): Define
5504         PLACE_TLS and PLACE_TLS_BSS.
5505         (Orphan_section_placement::Orphan_section_placement): Initialize
5506         new places.
5507         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5508         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5509         (tls_script_test_SOURCES): Define.
5510         (tls_script_test_DEPENDENCIES): Define.
5511         (tls_script_test_LDFLAGS): Define.
5512         (tls_script_test_LDADD): Define.
5513         * testsuite/Makefile.in: Rebuild.
5514
5515 2010-03-22  Doug Kwan  <dougkwan@google.com>
5516
5517         * arm.cc (Arm_relocate_functions::abs8,
5518         Arm_relocate_functions::abs16): Use correct check for overflow
5519         specified in the ARM ELF specs.
5520         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5521         target of a BLX instruction specially.
5522         (Reloc_stub::stub_type_for_reloc): Ditto.
5523         (Relocate::relocate): Use symbolic names instead of numeric relocation
5524         codes to report error.
5525         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5526         workaround.
5527         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5528         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5529         thumb2_blx_out_of_range.stdout
5530         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5531         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5532         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5533         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5534         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5535         thumb2_blx_in_range, thumb2_blx_in_range.o,
5536         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5537         thumb2_blx_out_of_range.o): New rules.
5538         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5539         thumb2_blx_in_range and thumb2_blx_out_of_range.
5540         * testsuite/Makefile.in: Regenerate.
5541         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5542         * testsuite/thumb_blx_in_range.s: New file.
5543         * testsuite/thumb_blx_out_of_range.s: New file.
5544
5545 2010-03-22  Rafael Espindola  <espindola@google.com>
5546
5547         * archive.cc (Should_include): Move to archive.h.
5548         (should_include_member): Make it a member of Archive.
5549         (Lib_group): New.
5550         (Add_lib_group_symbols): New.
5551         * archive.h: Include options.h.
5552         (Archive_member): Moved from Archive.
5553         (Should_include): Moved from archive.cc.
5554         (Lib_group): New.
5555         (Add_lib_group_symbols): New.
5556         * dynobj.cc (do_should_include_member): New.
5557         * dynobj.h (do_should_include_member): New.
5558         * gold.cc (queue_initial_tasks): Update call to queue.
5559         * main.cc (main): Print lib group stats.
5560         * object.cc (do_should_include_member): New.
5561         * object.h: Include archive.h.
5562         (Object::should_include_member): New.
5563         (Object::do_should_include_member): New.
5564         (Sized_relobj::do_should_include_member): New.
5565         * options.cc (General_options::parse_start_lib): New.
5566         (General_options::parse_end_lib): New.
5567         (Input_arguments::add_file): Handle lib groups.
5568         (Input_arguments::start_group): Check we are not in a lib.
5569         (Input_arguments::start_lib): New.
5570         (Input_arguments::end_lib): New.
5571         * options.h (General_options): Add start_lib and end_lib.
5572         (Input_argument::lib_): New.
5573         (Input_argument::lib): New.
5574         (Input_argument::is_lib): New.
5575         (Input_file_lib): New.
5576         (Input_arguments::in_lib_): New.
5577         (Input_arguments::in_lib): New.
5578         (Input_arguments::start_lib): New.
5579         (Input_arguments::end_lib_): New.
5580         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5581         in unused members as preempted.
5582         (Sized_pluginobj::do_should_include_member): New.
5583         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5584         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5585         return the blocker.
5586         (Read_symbols::do_whole_lib_group): New.
5587         (Read_symbols::do_lib_group): New.
5588         (Read_symbols::do_read_symbols): Handle lib groups.
5589         (Read_symbols::get_name): Handle lib groups.
5590         * readsyms.h (Read_symbols): Add an archive member pointer.
5591         (Read_symbols::do_whole_lib_group): New.
5592         (Read_symbols::do_lib_group): New.
5593         (Read_symbols::member_): New.
5594         * script.cc (read_input_script): Update call to queue_soon.
5595
5596 2010-03-19  Doug Kwan  <dougkwan@google.com>
5597
5598         * arm.cc (Stub_table::Stub_table): Initialize new data members
5599         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5600         (Stub_table::add_reloc_stub): Assign stub offset and update
5601         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5602         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5603         New data members.
5604         (Stub_table::update_data_size_and_addralign): Use
5605         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5606         instead of going over all reloc stubs.
5607         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5608         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5609         Stringpool_template::offset_ to size of Stringpool_char.
5610         (Stringpool_template::new_key_offset): Remove code to initialize
5611         Stringpool_template::offset_.
5612         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5613         Stringpool_template::offset_ to zero.
5614
5615 2010-03-15  Doug Kwan  <dougkwan@google.com>
5616
5617         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5618         offset_.
5619         (Stringpool_template::new_key_offset): New method.
5620         (Stringpool_template::add_string): Assign offsets when adding new
5621         strings.
5622         (Stringpool_template::set_string_offsets): Do not set string offsets
5623         when not optimizing.
5624         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5625         member size_.
5626         (Chunked_vector::clear): Clear size_.
5627         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5628         (Chunked_vector::size): Return size_.
5629         (Chunked_vector::push_back): Use size_ to find insert position.
5630         (Chunked_vector::size_): New data member.
5631         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5632         (Stringpool_template::new_key_offset): New method declaration.
5633         (Stringpool_template::offset_): New data member.
5634
5635 2010-03-15   Rafael Espindola  <espindola@google.com>
5636
5637         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5638         Add_symbols' constructor.
5639         * readsyms.h (Add_symbols): Remove the input_group member.
5640
5641 2010-03-10  Ian Lance Taylor  <iant@google.com>
5642
5643         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5644         target to ask whether a reference to a symbol requires a stack
5645         split.
5646         * target.h (Target::is_call_to_non_split): New function.
5647         (Target::do_is_call_to_non_split): Declare virtual function.
5648         * target.cc: Include "symtab.h".
5649         (Target::do_is_call_to_non_split): New function.
5650         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5651
5652 2010-03-10  Cary Coutant  <ccoutant@google.com>
5653
5654         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5655         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5656         (File_read::open[2]): Add whole_file_view_ to list of views.
5657         (File_read::make_view): Remove test of whole_file_view_.
5658         (File_read::find_or_make_view): Create whole_file_view_ if
5659         necessary.
5660         (File_read::clear_views): Replace bool parameter with enum;
5661         adjust all callers.  Don't delete views with permanent data;
5662         do delete cached views and views from archives if
5663         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5664         if clearing the corresponding view.
5665         * fileread.h (File_read::Clear_views_mode): New enum.
5666         (File_read::View::is_permanent_view): New method.
5667         (File_read::clear_views): Replace bool parameter
5668         with enum; adjust all callers.
5669         * options.h (General_options): Change keep_files_mapped option;
5670         add map_whole_files.
5671         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5672         releasing the file.
5673         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5674         the file.
5675
5676 2010-03-10  David S. Miller  <davem@davemloft.net>
5677
5678         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5679
5680 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5681
5682         * icf.cc (get_section_contents): Add '@' marker after processing the
5683         merge reloc.
5684
5685 2010-03-08  Doug Kwan  <dougkwan@google.com>
5686
5687         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5688         due to a conversion warning.
5689         (Arm_relobj::update_output_local_symbol_count): Check for local
5690         symbol with unset output index.
5691
5692 2010-03-05  Ian Lance Taylor  <iant@google.com>
5693
5694         * options.h (class General_options): Add --spare-dynamic-tags.
5695         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5696         --spare-dynamic-tags.
5697
5698 2010-03-05  Ian Lance Taylor  <iant@google.com>
5699
5700         * incremental.cc: Include "libiberty.h".
5701
5702 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5703
5704         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5705         function, is_info_ member.
5706         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5707         (Versions::Versions): Update caller.
5708         (Versions::define_base_version): Likewise.
5709         (Versions::add_def): Likewise.
5710
5711 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5712
5713         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5714         (Scan::possible_function_pointer_reloc): New function.
5715         (Scan::local_reloc_may_be_function_pointer): Change to call
5716         possible_function_pointer_reloc.
5717         (Scan::global_reloc_may_be_function_pointer): Ditto.
5718         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5719         relocations in ".data.rel.ro._ZTV" section.
5720         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5721         * testsuite/icf_safe_so_test.cc: Ditto.
5722         * testsuite/icf_safe_test.cc: Ditto.
5723         * testsuite/icf_safe_test.sh: Ditto.
5724
5725 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5726             Ian Lance Taylor  <iant@google.com>
5727
5728         * target-reloc.h (relocate_section): Check the symbol table index
5729         for -1U before setting the local symbol index.
5730         (scan_relocatable_relocs): If copying the relocation, record that
5731         the local symbol is required.
5732         * object.h (Symbol_value::is_output_symtab_index_set): New
5733         function.
5734         (Symbol_value::may_be_discarded_from_output_symtab): New
5735         function.
5736         (Symbol_value::has_output_symtab_entry): New function.
5737         (Symbol_value::needs_output_symtab_entry): Remove.
5738         (Symbol_value::output_symtab_index): Make sure the symbol index is
5739         set.
5740         (Symbol_value::set_output_symtab_index): Make sure the symbol
5741         index is not set.  Make sure the new index is valid.
5742         (Symbol_value::set_must_have_output_symtab_entry): New function.
5743         (Symbol_value::has_output_dynsym_entry): New function.
5744         (Symbol_value::set_output_dynsym_index): Make sure the new index
5745         is valid.
5746         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5747         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5748         local symbol if permitted.
5749         (Sized_relobj::do_finalize_local_symbols): Call
5750         is_output_symtab_index_set rather than needs_output_symtab_entry.
5751         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5752         rather than needs_output_symtab_entry.  Call
5753         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5754         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5755         is_output_symtab_index_set rather than needs_output_symtab_entry.
5756         * testsuite/discard_locals_relocatable_test.c: New file.
5757         * testsuite/discard_locals_test.sh: Test -r.
5758         * testsuite/Makefile.am (check_DATA): Add
5759         discard_locals_relocatable_test1.syms,
5760         discard_local_relocatable_test2.syms.
5761         (MOSTLYCLEANFILES): Likewise.  Also add
5762         discard_locals_relocatable_test1.lout and
5763         discard_locals_relocatable_test2.out.
5764         (discard_locals_relocatable_test1.syms): New target.
5765         (discard_locals_relocatable_test.o): New target.
5766         (discard_locals_relocatable_test1.out): New target.
5767         (discard_locals_relocatable_test2.syms): New target.
5768         (discard_locals_relocatable_test2.out): New target.
5769         (various): Add missing ../ld-new dependencies.
5770         * testsuite/Makefile.in: Rebuild.
5771
5772 2010-03-03  Nick Clifton  <nickc@redhat.com>
5773
5774         * po/fi.po: New Finnish translation.
5775
5776 2010-03-01  Doug Kwan  <dougkwan@google.com>
5777
5778         * layout.cc (Layout::Layout): Force section types of .init_array*,
5779         .preinit_array* and .fini_array* sections.
5780         * output.cc (Output_section::Input_section_sort_entry::has_priority):
5781         Fix check of return value of std::string::find.().
5782         (Output_section::Input_section_sort_compare::operator()): Remove
5783         comment about .init_array.
5784         (Output_section::Input_section_sort_init_fini_compare::operator()):
5785         New method.
5786         (Output_section::sort_attached_input_sections): Handle .init_array
5787         and .fini_array specially.
5788         * output.h (Output_section::Inut_section_sort_compare): Update
5789         comment.
5790         (Output_section::Input_section_sort_init_fini_compare): New struct.
5791
5792 2010-02-26  Doug Kwan  <dougkwan@google.com>
5793
5794         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5795         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5796         * testsuite/debug_msg.sh: Avoid matching source line number for
5797         use of global variable undef_int.
5798
5799 2010-02-26  Doug Kwan  <dougkwan@google.com>
5800
5801         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5802         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5803         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5804         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5805         * options.cc (General_options::General_options): Initialize member
5806         fix_v4bx_.
5807         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5808         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5809         and rm_no_fix_v4bx.stdout
5810         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5811         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5812         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5813         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5814         and arm_no_fix_v4bx.
5815         * Makefile.in: Regenerate.
5816         * testsuite/arm_fix_v4bx.s: New file.
5817         * testsuite/arm_fix_v4bx.sh: Ditto.
5818
5819 2010-02-24  Doug Kwan  <dougkwan@google.com>
5820
5821         * arm.cc (Target_arm::got_section): Make the .got section the first
5822         non RELRO section in the data segment.
5823         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5824         suffixes of section names.
5825
5826 2010-02-24  Doug Kwan  <dougkwan@google.com>
5827
5828         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5829         flags and attributes merging if an input file is a binary file.
5830         * fileread.cc (Input_file::open): Record format of original file.
5831         * fileread.h (Input_file::Format): New enum type.
5832         (Input_file::Input_file): Initialize data member format_.
5833         (Input_file::format): New method definition.
5834         (Input_file::format_):: New data member.
5835
5836 2010-02-24  Doug Kwan  <dougkwan@google.com>
5837
5838         * arm.cc (Arm_output_data_got): New class.
5839         (ARM_TCB_SIZE): New constant
5840         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5841         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5842         If user uses a script with a SECTIONS clause, issue only a warning
5843         for a misplaced EXIDX input section.  Otherwise, issue an error.
5844         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5845         garbage collection.
5846         (Target_arm::got_mode_index_entry): Handle static linking.
5847         (Target_arm::Scan::local): Ditto.
5848         (Target_arm::Scan::global): Ditto.
5849         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
5850         all incorrectly implemented relocations.
5851         (Target_arm::fix_exidx_coverage): Pass layout to
5852         Arm_output_section::fix_exidx_coverage.
5853         * layout.cc (Layout::section_name_mapping): Remove trailing dots
5854         from ".ARM.exidx." and ".ARM.extab.".
5855
5856 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5857
5858         * arm.cc (Target_arm::do_finalize_sections): Create attribute
5859         section if it does not already exist.
5860         * attributes.cc (Attributes_section_data::Attributes_section_data):
5861         Don't crash if size is zero.
5862
5863 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5864             Ian Lance Taylor  <iant@google.com>
5865
5866         * gold.cc (queue_middle_tasks): If no input files were opened,
5867         exit.
5868         * workqueue.h (Task_function::Task_function): Assert that there is
5869         a blocker.
5870
5871 2010-02-22  Doug Kwan  <dougkwan@google.com>
5872
5873         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5874         * icf.cc (get_section_contents): Cast snprintf arguments to long long
5875         types to avoid warnings due to different uint64_t implementations
5876         on different hosts.
5877
5878 2010-02-21  Doug Kwan  <dougkwan@google.com>
5879
5880         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5881         handling of the maximum backward branch offset.
5882         (Arm_relocate_functions::thumb_branch_common): Ditto.
5883         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5884         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5885         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5886         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5887         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5888         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5889         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5890         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5891         thumb_bl_out_of_range thumb_bl_out_of_range.o,
5892         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5893         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5894         thumb2_bl_out_of_range.o): New rules.
5895         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5896         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5897         thumb2_bl_out_of_range
5898         * testsuite/Makefile.in: Regenerate.
5899         * testsuite/arm_bl_in_range.s: New file.
5900         * testsuite/arm_bl_out_of_range.s: Ditto.
5901         * testsuite/arm_branch_in_range.sh: Ditto.
5902         * testsuite/arm_branch_range.t: Ditto.
5903         * testsuite/thumb2_branch_range.t: Ditto.
5904         * testsuite/thumb_bl_in_range.s: Ditto.
5905         * testsuite/thumb_bl_out_of_range.s: Ditto.
5906         * testsuite/thumb_branch_range.t: Ditto.
5907
5908 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
5909
5910         * gc.h (gc_process_relocs): Change vectors to point to the new list.
5911         Add reloc offset information.
5912         * icf.cc (get_section_contents): Change iterators to point to the new
5913         vectors. Add reloc offset information to the contents.
5914         * icf.h (Icf::Sections_reachable_info): New typedef.
5915         (Icf::Sections_reachable_list): New typedef.
5916         (Icf::Offset_info): New typedef.
5917         (Icf::Reloc_info): New struct typedef.
5918         (Icf::Reloc_info_list): New typedef.
5919         (Icf::symbol_reloc_list): Delete method.
5920         (Icf::addend_reloc_list): Delete method.
5921         (Icf::section_reloc_list): Delete method.
5922         (Icf::reloc_info_list): New method.
5923         (Icf::reloc_info_list_): New member.
5924
5925 2010-02-19  Doug Kwan  <dougkwan@google.com>
5926
5927         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5928         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5929         * arm.cc (Arm_relocation_functions): New forward declaration.
5930         (Target_arm::Target_arm): Initialize new data members
5931         got_mod_index_offset_ and tls_base_symbol_defined_.
5932         (Target_arm::Relocate::relocate_tls): New method.
5933         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5934          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5935         New methods.
5936         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5937         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5938         (Target_arm::got_mod_index_offset_,
5939         Target_arm::tls_base_symbol_defined_): New data members.
5940         (Target_arm::Scan::local, Target::Scan::global,
5941         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5942         relocations.
5943
5944 2010-02-18  Doug Kwan  <dougkwan@google.com>
5945
5946         * arm.cc (Arm_relobj::find_linked_text_section): New method.
5947         (Arm_relobj::make_exidx_input_section): Pass section index of linked
5948         text section as a parameter becuase some broken tools may not set
5949         the link in section header.
5950         (Target_arm::has_got_section): New method.
5951         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5952         without any mapping symbol as data only.  Remove warning.
5953         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5954         link in its section header, try to discover the link by inspecting the
5955         REL31 relocation at the beginning of the section.
5956         (Target_arm::Scan::check_non_pic): Report name of offending relocation
5957         in error message.
5958         (Target_arm::Scan::global): Treat any reference to the symbol
5959         _GLOBAL_OFFSET_TABLE_ as a GOT access.
5960
5961 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
5962
5963         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5964         (Scan::global_reloc_may_be_function_pointer): New function.
5965         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5966         (Scan::global_reloc_may_be_function_pointer): New function.
5967         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5968         (Scan::global_reloc_may_be_function_pointer): New function.
5969         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5970         (Scan::global_reloc_may_be_function_pointer): New function.
5971         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5972         (Scan::global_reloc_may_be_function_pointer): New function.
5973         (Scan::possible_function_pointer_reloc): New function.
5974         (Target_x86_64::can_check_for_function_pointers): New function.
5975         * gc.h (gc_process_relocs): Scan relocation types to determine if
5976         function pointers were taken for targets that support it.
5977         * icf.cc (Icf::find_identical_sections): Include functions for
5978         folding in safe ICF whose pointer is not taken.
5979         * icf.h (Secn_fptr_taken_set): New typedef.
5980         (fptr_section_id_): New member.
5981         (section_has_function_pointers): New function.
5982         (set_section_has_function_pointers): New function.
5983         (check_section_for_function_pointers): New function.
5984         * options.h: Fix comment for safe ICF option.
5985         * target.h (can_check_for_function_pointers): New function.
5986         * testsuite/Makefile.am: Add icf_safe_so_test test case.
5987         Modify icf_safe_test for X86-64.
5988         * testsuite/Makefile.in: Regenerate.
5989         * testsuite/icf_safe_so_test.cc: New file.
5990         * testsuite/icf_safe_so_test.sh: New file.
5991         * testsuite/icf_safe_test.cc (kept_func_3): New function.
5992         (main): Change to take pointer to function kept_func_3.
5993         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5994         folding is done correctly for X86-64.
5995
5996 2010-02-12  David S. Miller  <davem@davemloft.net>
5997
5998         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5999         is_symbolless parameter.
6000         (Output_reloc<SHT_REL>::is_symbolless): New.
6001         (Output_reloc<SHT_REL>::is_symbolless_): New.
6002         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6003         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6004         (Output_reloc<SHT_RELA>::is_symbolless): New.
6005         (Output_data_reloc::add_global): Handle is_symbolless.
6006         (Output_data_reloc::add_global_relative): Likewise.
6007         (Output_data_reloc::add_local): Likewise.
6008         (Output_data_reloc::add_local_relative): Likewise.
6009         (Output_data_reloc::add_symbolless_global_addend): New.
6010         (Output_data_reloc::add_symbolless_local_addend): New.
6011         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6012         is_symbolless.
6013         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6014         instead of ->is_relative_
6015         (Output_reloc::write): Likewise.
6016         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6017         (Output_reloc::write_rel): Simplify.
6018
6019         * sparc.cc (Target_sparc::Scan::local): Use
6020         ->add_symbolless_local_addend as needed.
6021         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6022         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6023         based upon relocation offset.
6024
6025 2010-02-11  Doug Kwan  <dougkwan@google.com>
6026
6027         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6028         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6029         beginning of function.
6030         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6031         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6032         parameter is_32bit in calls to should_apply_static_reloc.
6033         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6034         (check_DATA): Add arm_abs_global.stdout.
6035         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6036         arm_abs_global.stdout): New rules.
6037         (MOSTLLYCLEANFILES): Add arm_abs_global
6038         * Makefile.in: Regenerate.
6039         * testsuite/arm_abs_global.s: New file.
6040         * testsuite/arm_abs_global.sh: Ditto.
6041         * testsuite/arm_abs_lib.s: Ditto.
6042
6043 2010-02-11  Ian Lance Taylor  <iant@google.com>
6044
6045         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6046         Read_relocs task.
6047         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6048         Allocate_commons_task first.
6049         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6050         task, rather than symtab_lock_.
6051         (Gc_process_relocs::~Gc_process_relocs): New function.
6052         (Gc_process_relocs::is_runnable): Check this_blocker_.
6053         (Gc_process_relocs::locks): Use next_blocker_ rather than
6054         blocker_.
6055         (Scan_relocs::~Scan_relocs): New function.
6056         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6057         symtab_lock_.
6058         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6059         next_blocker_.
6060         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6061         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6062         constructor accordingly.
6063         (class Gc_process_relocs): Likewise.
6064         (class Scan_relocs): Likewise.
6065         * common.h (class Allocate_commons_task): Remove symtab_lock_
6066         field, and corresponding constructor parameter.
6067         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6068         symtab_lock_.
6069         (Allocate_commons_task::locks): Likewise.
6070
6071 2010-02-11  Ian Lance Taylor  <iant@google.com>
6072
6073         * gold-threads.h (class Once): Define.
6074         (class Initialize_lock): Rewrite as child of Once.
6075         * gold-threads.cc (class Once_initialize): Define.
6076         (once_pointer_control): New static variable.
6077         (once_pointer, once_arg): New static variables.
6078         (c_run_once): New static function.
6079         (Once::Once, Once::run_once, Once::internal_run): New functions.
6080         (class Initialize_lock_once): Remove.
6081         (initialize_lock_control): Remove.
6082         (initialize_lock_pointer): Remove.
6083         (initialize_lock_once): Remove.
6084         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6085         (Initialize_lock::initialize): Rewrite.
6086         (Initialize_lock::do_run_once): New function.
6087         * archive.cc (Archive::interpret_header): Only clear name if it is
6088         not already empty.
6089         * fileread.cc: Include "gold-threads.h"
6090         (file_counts_lock): New static variable.
6091         (file_counts_initialize_lock): Likewise.
6092         (File_read::release): Only increment counts when using --stats.
6093         Use a lock around the increment.
6094         * parameters.cc (class Set_parameters_target_once): Define.
6095         (set_parameters_target_once): New static variable.
6096         (Parameters::Parameters): Move here from parameters.h.
6097         (Parameters::set_target): Rewrite.
6098         (Parameters::set_target_once): New function.
6099         (Parameters::clear_target): Move here and rewrite.
6100         * parameters.h (class Parameters): Update declarations.  Add
6101         set_parameters_target_once_ field.
6102         (Parameters::Parameters): Move to parameters.cc.
6103         (Parameters::clear_target): Likewise.
6104         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6105         task.
6106         (Start_group::~Start_group): New function.
6107         (Start_group::is_runnable): New function.
6108         (Start_group::locks, Start_group::run): New functions.
6109         (Finish_group::run): Change saw_undefined to size_t.
6110         * readsyms.h (class Start_group): Define.
6111         (class Finish_group): Change saw_undefined_ field to size_t.
6112         (Finish_group::Finish_group): Remove saw_undefined and
6113         this_blocker parameters.  Change all callers.
6114         (Finish_group::set_saw_undefined): New function.
6115         (Finish_group::set_blocker): New function.
6116         * symtab.h (class Symbol_table): Change saw_undefined to return
6117         size_t.  Change saw_undefined_ field to size_t.
6118         * target-select.cc (Set_target_once::do_run_once): New function.
6119         (Target_selector::Target_selector): Initialize set_target_once_
6120         field.  Don't initialize lock_ and initialize_lock_ fields.
6121         (Target_selector::instantiate_target): Rewrite.
6122         (Target_selector::set_target): New function.
6123         * target-select.h (class Set_target_once): Define.
6124         (class Target_selector): Update declarations.  Make
6125         Set_target_once a friend.  Remove lock_ and initialize_lock_
6126         fields.  Add set_target_once_ field.
6127
6128 2010-02-10  Ian Lance Taylor  <iant@google.com>
6129
6130         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6131         queueing any tasks.
6132         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6133         (queue_middle_tasks): Add all blockers before queueing any tasks.
6134         (queue_final_tasks): Likewise.
6135         * token.h (Task_token::add_blockers): New function.
6136         * object.h (Input_objects::number_of_relobjs): New function.
6137
6138 2010-02-10  Ian Lance Taylor  <iant@google.com>
6139
6140         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6141         shared, not if not position independent.
6142         * x86_64.cc (Relocate::relocate_tls): Likewise.
6143         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6144         (tls_pie_pic_test): New target.
6145         * testsuite/Makefile.in: Rebuild.
6146
6147         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6148         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6149         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6150         * testsuite/Makefile.in: Rebuild.
6151
6152 2010-02-09  David S. Miller  <davem@davemloft.net>
6153
6154         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6155         R_SPARC_RELATIVE using ->add_local_relative().
6156         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6157
6158         * output.h (Output_data_dynamic::add_section_size): New method
6159         that takes two Output_data objects.
6160         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6161         entry param.  Handle it in initializers.
6162         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6163         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6164         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6165         arg.
6166         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6167         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6168         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6169         for dynrel_includes_plt.
6170         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6171         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6172         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6173         before .rela.plt
6174         (Target_sparc::do_finalize_sections): Update to pass true for
6175         dynrel_includes_plt.
6176         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6177         output before .rela.plt
6178         (Target_powerpc::do_finalize_sections): Update to pass true for
6179         dynrel_includes_plt when 32-bit.
6180
6181 2010-02-08  Doug Kwan  <dougkwan@google.com>
6182
6183         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6184         method.
6185         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6186         Arm_relobj::scan_section_for_cortex_a8_stubs,
6187         Arm_relobj::do_relocation_section): Instead of calling
6188         Output_section::output_address, use faster
6189         Arm_relobj::simple_input_section_output_address.
6190
6191 2010-02-08  David S. Miller  <davem@davemloft.net>
6192
6193         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6194         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6195         relocation helper function.
6196
6197         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6198         just like R_SPARC_GOT{10,13,22}.
6199         (Target_sparc::Scan::local): Likewise.
6200         (Target_sparc::Relocate:relocate): Likewise.
6201
6202 2010-02-06  Ian Lance Taylor  <iant@google.com>
6203
6204         * configure.ac: Rewrite targetobjs duplicate removal code to use
6205         only shell constructs.
6206         * configure: Rebuild.
6207
6208 2010-02-05  Doug Kwan  <dougkwan@google.com>
6209
6210         PR 11247
6211         * arm.cc (Arm_relobj::section_is_scannable): New method.
6212         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6213         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6214
6215 2010-02-04  Doug Kwan  <dougkwan@google.com>
6216
6217         PR 11247
6218         * arm-reloc-property.cc (cstdio): Include.
6219         * configure.ac (targetobjs): Remove duplicates.
6220         * configure: Regenerate.
6221         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6222         big and little endian version for a given address size.
6223
6224 2010-02-03  Doug Kwan  <dougkwan@google.com>
6225
6226         * arm-reloc-property.cc
6227         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6228         definition.
6229         * arm-reloc-property.h
6230         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6231         New method definition.
6232         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6233         declaration.
6234         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6235         overflow to N.
6236         (GOT_PREL): Change implemented to Y.
6237         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6238         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6239         (Arm_relocate_functions::movw_abs_nc): Remove method.
6240         (Arm_relocate_functions::movt_abs): Ditto.
6241         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6242         (Arm_relocate_functions::thm_movt_abs): Ditto.
6243         (Arm_relocate_functions::movw_rel_nc): Ditto.
6244         (Arm_relocate_functions::movw_rel): Ditto.
6245         (Arm_relocate_functions::movt_rel): Ditto.
6246         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6247         (Arm_relocate_functions:thm_movw_rel): Ditto.
6248         (Arm_relocate_functions:thm_movt_rel): Ditto.
6249         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6250         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6251         New method definitions.
6252         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6253         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6254         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6255         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6256         (Target_arm::Relocate::relocate): Check for non-static or
6257         unimplemented relocation code and exit early.  Change calls to
6258         Target_arm::reloc_uses_thumb_bit and
6259         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6260         instead.  Refactor code to handle similar relocations to increase
6261         code sharing.  Remove check for unsupported relocation code in switch
6262         statement.
6263         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6264         relocation property table to find out size.  Change error message to
6265         print out the name of a relocation code instead of the numeric value.
6266         (Target_arm::scan_reloc_for_stub): Use relocation property table
6267         instead of calling Target_arm::reloc_uses_thumb_bit().
6268
6269 2010-02-02  Doug Kwan  <dougkwan@google.com>
6270
6271         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6272         types of relaxed input section.
6273
6274 2010-02-02  Doug Kwan  <dougkwan@google.com>
6275
6276         * Makefile.am (HFILES): Add arm-reloc-property.h.
6277         (DEFFILES): New.
6278         (TARGETSOURCES): Add arm-reloc-property.cc
6279         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6280         (libgold_a_SOURCES): $(DEFFILES)
6281         * Makefile.in: Regenerate.
6282         * arm-reloc-property.cc: New file.
6283         * arm-reloc-property.h: New file.
6284         * arm-reloc.def: New file.
6285         * arm.cc: Update comments.
6286         (arm-reloc-property.h): New included header.
6287         (arm_reloc_property_table): New global variable.
6288         (Target_arm::do_select_as_default_target): New method definition.
6289         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6290         arm-reloc-property to targ_extra_obj.
6291         * parameters.cc (set_parameters_target): Call
6292         Target::select_as_default_target().
6293         * target.h (Target::select_as_default_target): New method definition.
6294         (Target::do_select_as_default_target): Same.
6295
6296 2010-02-01  Doug Kwan  <dougkwan@google.com>
6297
6298         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6299         first_output_text_section_.
6300         (Arm_exidx_fixup::first_output_text_section): New method definition.
6301         (Arm_exidx_fixup::first_output_text_section_): New data member.
6302         (Arm_exidx_fixup::process_exidx_section): Record the first text
6303         output section seen.
6304         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6305         and entsize in output section header.
6306
6307 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6308
6309         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6310         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6311         (Arm_relocate_functions::thm_alu11): New Method.
6312         (Arm_relocate_functions::thm_pc8): New Method.
6313         (Arm_relocate_functions::thm_pc12): New Method.
6314         (Target_arm::Scan::local): Handle the relocations.
6315         (Target_arm::Scan::global): Likewise.
6316         (Target_arm::Relocate::relocate): Likewise.
6317         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6318
6319 2010-01-29  Doug Kwan  <dougkwan@google.com>
6320
6321         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6322         of relocation types as ld.
6323
6324 2010-01-29  Doug Kwan  <dougkwan@google.com>
6325
6326         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6327         to public.
6328         (Arm_relocate_functions::thumb_branch_common): Ditto.
6329         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6330         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6331         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6332         Arm_relocate_functions::jump24): Remove.
6333         (Target_arm::Relocate::relocate): Adjust code to call
6334         Arm_relocation_functions::arm_branch_common and
6335         Arm_relocation_functions::thumb_branch_common instead of their removed
6336         wrappers.  Merge switch-cases together to reduce source code size.
6337
6338 2010-01-29  Doug Kwan  <dougkwan@google.com>
6339
6340         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6341         output_local_symbol_count_needs_update_.
6342         (Arm_relobj::output_local_symbol_count_needs_update,
6343          Arm_relobj::set_output_local_symbol_count_needs_update,
6344          Arm_relobj::update_output_local_symbol_count): New methods.
6345         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6346         member.
6347         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6348         of pointed function as in a R_ARM_PREL31 relocation.
6349         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6350         for output local symbol count updating.
6351         (Target_arm::do_relax): Update output local symbol counts in objects
6352         if necessary.
6353         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6354
6355 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6356
6357         * arm.cc: Added support for the ARM relocations:
6358         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6359         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6360         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6361         movw_prel_nc).
6362         (Arm_relocate_functions::movw_rel): New method.
6363         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6364         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6365         thm_movw_prel_nc).
6366         (Arm_relocate_functions::thm_movw_rel): New method.
6367         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6368         thm_movt_prel).
6369         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6370         relocations.
6371         (Target_arm::Scan::global): Likewise.
6372         (Target_arm::Relocate::relocate): Likewise.
6373         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6374         Likewise.
6375
6376 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6377
6378         * arm.cc: Added support for ARM group relocations.
6379         (Target_arm::reloc_needs_sym_origin): New method.
6380         (Arm_relocate_functions::calc_grp_kn): New method.
6381         (Arm_relocate_functions::calc_grp_residual): New method.
6382         (Arm_relocate_functions::calc_grp_gn): New method.
6383         (Arm_relocate_functions::arm_grp_alu): New Method.
6384         (Arm_relocate_functions::arm_grp_ldr): New Method.
6385         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6386         (Arm_relocate_functions::arm_grp_ldc): New Method.
6387         (Target_arm::Scan::local): Handle the ARM group relocations.
6388         (Target_arm::Scan::global): Likewise.
6389         (Target_arm::Relocate::relocate): Likewise.
6390         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6391         Likewise.
6392
6393 2010-01-26  Doug Kwan  <dougkwan@google.com>
6394
6395         * arm.cc (set): Include.
6396         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6397         pointer type.
6398         (Arm_output_section::Text_section_list): New type.
6399         (Arm_output_section::append_text_sections_to_list): New method.
6400         (Arm_output_section::fix_exidx_coverage): Ditto.
6401         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6402         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6403         Relobj::set_section_offset() instead of
6404         Sized_relobj::invalidate_section_offset().
6405         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6406         parameter for section headers. Ignore relocation sections for
6407         unallocated sections and EXIDX sections.
6408         (Target_arm::fix_exidx_coverage): New method.
6409         (Target_arm::output_section_address_less_than): New type.
6410         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6411         linked text section instead of the EXIDX section.
6412         (Arm_output_section::create_stub_group): Add an assertion to check
6413         that this is not an EXIDX output section.
6414         (Arm_output_section::append_text_sections_to_list): New method.
6415         (Arm_output_section::fix_exidx_coverage): Ditto.
6416         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6417         Arm_relobj::section_needs_reloc_stub_scanning.
6418         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6419         first pass.
6420         (Target_arm::fix_exidx_coverage): New method.
6421         * object.h (Relobj::set_output_section): New method.
6422         (Sized_relobj::invalidate_section_offset): Remove method.
6423         (Sized_relobj::do_invalidate_section_offset): Remove method.
6424         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6425
6426 2010-01-25  Doug Kwan  <dougkwan@google.com>
6427
6428         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6429         Fix warning due to signed and unsigned comparison on a 32-bit host.
6430
6431 2010-01-22  Doug Kwan  <dougkwan@google.com>
6432
6433         * arm.cc (Target_arm::do_relax): Record an output section for section
6434         offset adjustment it contains any stub table that has changed.
6435         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6436         offsets in an output section if necessary.
6437         * output.cc (Output_section::Output_section): Initialize
6438         section_offsets_need_adjustments_.
6439         (Output_section::add_input_section_for_script): Renamed to
6440         Output_section::add_simple_input_section.
6441         (Output_section::save_states): Add a comment.
6442         (Output_section::discard_states): New method defintion.
6443         (Output_section::adjust_section_offsets): Same.
6444         * output.h (Output_section::add_input_section_for_script): Renamed to
6445         Output_section::add_simple_input_section.
6446         (Output_section::discard_states): New method declaration.
6447         (Output_section::adjust_section_offsets): Same.
6448         (Output_section::section_offsets_need_adjustment,
6449         Output_section::set_section_offsets_need_adjustment): New method
6450         definitions.
6451         (Output_section::section_offsets_need_adjustment_): New data member.
6452         * script-sections.cc
6453         (Output_section_element_input::set_section_address): Adjust code for
6454         renaming of Output_section::add_input_section_for_script.
6455         (Orphan_output_section::set_section_address): Same.
6456
6457 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6458
6459         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6460         Fix_v4bx enum values .
6461         * gold/options.h (General_options): New option definitions.
6462         (General_options::fix_v4bx): New method.
6463         (General_options::Fix_v4bx): New enum.
6464         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6465         (General_options::parse_fix_v4bx_interworking): New method.
6466
6467 2010-01-22  Doug Kwan  <dougkwan@google.com>
6468
6469         * arm.cc (Arm_exidx_fixup): New class.
6470
6471 2010-01-21  Doug Kwan  <dougkwan@google.com>
6472
6473         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6474         classes.
6475         (Arm_exidx_section_offset_map): New type.
6476
6477 2010-01-21  Doug Kwan  <dougkwan@google.com>
6478
6479         * arm.cc (Arm_exidx_input_section): New class.
6480         (Arm_relobj::exidx_input_section_by_link,
6481         Arm_relobj::exidx_input_section_by_shndx,
6482         Arm_relobj::make_exidx_input_section): New methods.
6483         (read_arm_attributes_section): Remove.
6484         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6485         information about them.
6486         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6487         to here.
6488
6489 2010-01-20  Doug Kwan  <dougkwan@google.com>
6490
6491         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6492         Input_section_specifier to Section_id.
6493         (Target_arm::new_arm_input_section: Adjust code for change of key
6494         type.
6495         (Target_arm::find_arm_input_section): Ditto.
6496         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6497         (Section_id): Remove.
6498         (Garbage_collection::Section_id_hash): Remove.
6499         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6500         (Section_id): Remove.
6501         (Icf::Section_id_hash): Remove.
6502         * object.h (Section_id, Const_section_id, Section_id_hash,
6503         Const_section_id_hash): New type definitions.
6504         * output.cc (Output_section::add_relaxed_input_section): Change to
6505         use Const_section_id instead of Input_section_specifier as key type.
6506         (Output_section::add_merge_input_section): Ditto.
6507         (Output_section::build_relaxation_map): Change to use Section_id
6508         instead of Input_section_specifier as key type.
6509         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6510         Ditto.
6511         (Output_section::convert_input_sections_to_relaxed_sections): Change
6512         to use Const_section_id instead of Input_section_specifier as key type.
6513         (Output_section::find_merge_section): Ditto.
6514         (Output_section::find_relaxed_input_section): Ditto.
6515         * output.h (Input_section_specifier): Remove class.
6516         (Output_section::Output_section_data_by_input_section_map): Change
6517         key type to Const_section_id.
6518         (Output_section::Output_relaxed_input_section_by_input_section_map):
6519         Ditto.
6520         (Output_section::Relaxation_map): Change key type to Section_id.
6521
6522 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6523
6524         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6525         (class Arm_v4bx_stub): New class.
6526         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6527         (Stub_factory::make_arm_v4bx_stub): New method.
6528         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6529         (Stub_table::empty): Handle v4bx stubs.
6530         (Stub_table::add_arm_v4bx_stub): New method.
6531         (Stub_table::find_arm_v4bx_stub): New method.
6532         (Arm_relocate_functions::v4bx): New method.
6533         (Target_arm::fix_v4bx): New method.
6534         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6535         (Stub_table::relocate_stubs): Likewise.
6536         (Stub_table::do_write): Likewise.
6537         (Stub_table::update_data_size_and_addralign): Likewise.
6538         (Stub_table::finalize_stubs):  Likewise.
6539         (Target_arm::Scan::local): Likewise.
6540         (Target_arm::Scan::global): Likewise.
6541         (Target_arm::do_finalize_sections): Likewise.
6542         (Target_arm::Relocate::relocate): Likewise.
6543         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6544         Likewise.
6545         (Target_arm::scan_reloc_for_stub): Likewise.
6546         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6547
6548 2010-01-19  Ian Lance Taylor  <iant@google.com>
6549
6550         * output.cc (Output_section_headers::do_sized_write): Write large
6551         segment count to sh_info field.
6552         (Output_file_header::do_sized_write): For large segment count,
6553         write PN_XNUM to e_phnum field.
6554
6555 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6556
6557         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6558         (Arm_relocate_functions::thm_jump8): New function.
6559         (Arm_relocate_functions::thm_jump11): New function.
6560         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6561         R_ARM_THM_JUMP11.
6562         (Target_arm::Scan::global): Likewise.
6563         (Target_arm::Relocate::relocate): Likewise.
6564         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6565         Likewise.
6566
6567 2010-01-14  Doug Kwan  <dougkwan@google.com>
6568
6569         * arm.cc (map, utility): Include headers.
6570         (Target_arm::apply_cortex_a8_workaround): New method.
6571         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6572         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6573         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6574         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6575         the --[no-]fix-cortex-a8 command line options.
6576         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6577         (Target_arm::relocate_stub): Use addend in instruction template.
6578         * options.h (DEFINE_bool): Set the user-set flag.
6579         (General_options): Add --[no-]-fix-cortex options.
6580         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6581         : Update fast look-up map after conversion.
6582
6583 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6584
6585         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6586         in the first pass of do_layout.
6587
6588 2010-01-13  Doug Kwan  <dougkwan@google.com>
6589
6590         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6591         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6592         apparent compiler problem of not folding static constant integral
6593         data members of elfcpp::Elf_sizes<32>.
6594
6595 2010-01-13  Doug Kwan  <dougkwan@google.com>
6596
6597         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6598         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6599         Arm_relobj::scan_section_for_cortex_a8_erratum,
6600         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6601         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6602         sections to scan for relocation stubs into a new method
6603         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6604         relocation and Cortex-A8 stub scanning.
6605         (Target_arm::do_relax): Force stubs to be after stubbed sections
6606         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6607         the beginning of a new relaxation pass.  Update a comment.
6608         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6609
6610 2010-01-12  Ian Lance Taylor  <iant@google.com>
6611
6612         * target-reloc.h (visibility_error): New inline function.
6613         (relocate_section): Call visibility_error.
6614         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6615         (MOSTLYCLEANFILES): Likewise.
6616         (protected_4_pic.o, protected_3.err): New targets.
6617         * testsuite/protected_4.cc: New file.
6618
6619 2010-01-12  Doug Kwan  <dougkwan@google.com>
6620
6621         * arm.cc (Cortex_a8_reloc): New class.
6622         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6623         and cortex_a8_relocs_info_.
6624         (Target_arm::fix_cortex_a8): New method definition.
6625         (Target_arm::Cortex_a8_relocs_info): New type.
6626         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6627         New data member declarations.
6628         (Target_arm::scan_reloc_for_stub): Record information about
6629         relocations for THUMB branches that might be exempted from the
6630         Cortex-A8 workaround.
6631         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6632         at the beginning of a relaxation pass.
6633
6634 2010-01-12  Doug Kwan  <dougkwan@google.com>
6635
6636         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6637         (Arm_relobj::Mapping_symbol_position,
6638          Arm_reloj::Mapping_symbol_position_less,
6639          Arm_relobj::Mapping_symbols_info): New types.
6640         (Target_arm::is_mapping_symbol_name): New method definition.
6641         (Arm_relobj::do_count_local_symbols): Save information about mapping
6642         symbols.
6643
6644 2010-01-11  Doug Kwan  <dougkwan@google.com>
6645
6646         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6647         Arm_relocate_functions::thumb32_branch_upper,
6648         Arm_relocate_functions::thumb32_branch_lower,
6649         Arm_relocate_functions::thumb32_cond_branch_offset,
6650         Arm_relocate_functions::thumb32_cond_branch_upper,
6651         Arm_relocate_functions::thumb32_cond_branch_lower,
6652         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6653         branch offset encoding.
6654         (Arm_relocate_functions::thumb_branch_common): Use new branch
6655         offset encoding methods to avoid code duplication.
6656         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6657         (Stub_addend_reader::operator()): Use new branch encoding method
6658         to avoid code duplication.
6659
6660 2010-01-11  Doug Kwan  <dougkwan@google.com>
6661
6662         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6663         (Target_arm::do_finalize_sections): Define special EXIDX section
6664         symbols only if referenced.
6665         * gc.h (Garbage_collection::add_reference): New method.
6666         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6667         code duplication.
6668
6669 2010-01-11  Ian Lance Taylor  <iant@google.com>
6670
6671         * script.cc (Version_script_info::build_expression_list_lookup):
6672         Change complaing about duplicate wildcard match from error to
6673         warning.
6674
6675         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6676         of 2009-12-30.
6677         (Version_script_info::Version_script_info): Initialize globs_,
6678         default_version_, default_is_global_, and exact_.  Don't
6679         initialize globals_ or locals_.
6680         (Version_script_info::build_lookup_tables): Build local symbols
6681         first.
6682         (Version_script_info::unquote): New function.
6683         (Version_script_info::add_exact_match): New function.
6684         (Version_script_info::build_expression_list_lookup): Remove lookup
6685         parameter.  Add is_global parameter.  Change all callers.  Handle
6686         wildcard pattern specially.  Unquote pattern.  Call
6687         add_exact_match.
6688         (Version_script_info::get_name_to_match): New function.
6689         (Version_script_info::get_symbol_version): New function.
6690         (Version_script_info::get_symbol_version_helper): Remove.
6691         (Version_script_info::check_unmatched_names): Call unquote.
6692         * script.h (class Version_script_info): Change get_symbol_version
6693         to be non-inline and add is_global parameter; change all callers.
6694         Rewrite symbol_is_local.  Update declarations.  Define struct
6695         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6696         Remove globals_ and locals_ members.  Add exact_, globs_,
6697         default_version_, is_global_.
6698         (Version_script_info::Glob): Remove pattern, add expression and
6699         is_global.  Update constructor.  Change all callers.
6700         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6701         default version.
6702         (Versions::symbol_section_contents): If a symbol is undefined, or
6703         defined in a dynamic object, set the version index to
6704         VER_NDX_LOCAL.
6705         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6706         symbol_is_local.
6707         (Symbol_table::add_from_pluginobj): Likewise.
6708         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6709
6710 2010-01-11  Doug Kwan  <dougkwan@google.com>
6711
6712         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6713         (incremental_dump_LDADD): Add linking option for libintl.
6714         * Makefile.in: Regenerate.
6715
6716 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6717
6718         PR gold/11144
6719         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6720         instead of -Ds.
6721         * testsuite/Makefile.in: Regenerated.
6722
6723 2010-01-10  Doug Kwan  <dougkwan@google.com>
6724
6725         * options.h (DEFINE_var): Use parentheses around argument varname__
6726         in macro body to avoid any unintended subsequent substitutions.
6727
6728 2010-01-10  Ian Lance Taylor  <iant@google.com>
6729
6730         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6731         candidates before doing symbol resolution.
6732
6733         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6734         ODR candidates if only one is weak.
6735
6736 2010-01-08  Ian Lance Taylor  <iant@google.com>
6737
6738         * script.cc (Version_script_info::build_expression_list_lookup):
6739         Don't warn about ambiguous version, just record the ambiguity.
6740         (Version_script_info::get_symbol_version_helper): Give error if
6741         version is ambiguous.
6742
6743 2010-01-08  Doug Kwan  <dougkwan@google.com>
6744
6745         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6746           prev_data_size_ and prev_addralign_.  Remove initializer for
6747           deleted data member has_been_changed_.
6748           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6749           to determine if the table is empty.
6750           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6751           Remove.
6752           (Stub_table::add_reloc_stub): Define method in class definition
6753           instead of just declaring it there.
6754           (Stub_table::add_cortex_a8_stub): New method definition.
6755           (Stub_table::update_data_size_and_addralign): Ditto.
6756           (Stub_table::finalize_stubs): Ditto.
6757           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6758           (Stub_table::do_addralign_): Return address alignment in the
6759           (Stub_table::do_reset_address_and_file_offset): Define method in
6760           class definition instead of declaring it there.  Set current data
6761           size to be the data size of the previous pass.
6762           (Stub_table::set_final_data_size): Use current data size as the
6763           final data size.
6764           (Stub_table::relocate_stub): Change parameter type of stub from
6765           Reloc_stub pointer to Stub pointer.
6766           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6767           (Stub_table::Cortex_a8_stub_list): New typedef.
6768           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6769            Stub_table::prev_addralign_): New data member.
6770           (Arm_relobj::Arm_relobj): Initialize data member
6771           section_has_cortex_a8_workaround_.
6772           (Arm_relobj::section_has_cortex_a8_workaround,
6773            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6774            definitions.
6775           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6776           declarations.
6777           (Target_arm::relocate_stub): Change parameter type of stub from
6778           Reloc_stub pointer to Stub pointer.
6779           (Insn_template::size, Insn_template::alignment): Handle
6780           THUMB16_SPECIAL_TYPE.
6781           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6782            Stub_table::update_data_size_and_addralign,
6783            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6784           definitions.
6785           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6786           (Stub_table::do_write): Ditto.
6787           (Target_arm::do_relax): Adjust code for changes in Stub_table.
6788
6789 2010-01-08  Ian Lance Taylor  <iant@google.com>
6790
6791         PR 11108
6792         * symtab.h (class Symbol): Remove fields is_target_special_ and
6793         has_plt_offset_.  Add field is_defined_in_discarded_section_.
6794         (Symbol::is_defined_in_discarded_section): New function.
6795         (Symbol::set_is_defined_in_discarded_section): New function.
6796         (Symbol::has_plt_offset): Rewrite.
6797         (Symbol::set_plt_offset): Verify that new offset is not -1U.
6798         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6799         Don't initialize is_target_special_ or has_plt_offset_.
6800         Initialize is_defined_in_discarded_section_.
6801         (Symbol_table::add_from_relobj): If appropriate, set
6802         is_defined_in_discarded_section.
6803         * resolve.cc (Symbol::override_base_with_special): Don't test
6804         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
6805         * target-reloc.h (relocate_section): Do special handling for
6806         symbols defined in discarded sections for global symbols as well
6807         as local symbols.
6808
6809 2010-01-08  Ian Lance Taylor  <iant@google.com>
6810
6811         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6812         the SHT_SYMTAB case.
6813
6814 2010-01-08  Ian Lance Taylor  <iant@google.com>
6815
6816         * object.cc (Sized_relobj::do_layout): Don't get confused if
6817         layout_eh_frame returns NULL.
6818
6819 2010-01-08  Ian Lance Taylor  <iant@google.com>
6820
6821         PR 11084
6822         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6823         dynamic symbol table, use the normal symbol table.
6824         (Sized_dynobj::do_read_symbols): Remove assertion about type of
6825         symbol table.
6826
6827 2010-01-08  Ian Lance Taylor  <iant@google.com>
6828
6829         PR 11072
6830         * layout.cc (Layout::include_section): Remove .gnu_debuglink
6831         sections.
6832
6833 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
6834
6835         * version.cc (print_version): Change to "Copyright 2010".
6836
6837 2010-01-08  Ian Lance Taylor  <iant@google.com>
6838
6839         PR 10287
6840         PR 11063
6841         * i386.cc (class Target_i386): Change return type of plt_section
6842         to be non-const.
6843         (class Output_data_plt_i386): Add tls_desc_rel_ field.
6844         (Output_data_plt_i386::Output_data_plt_i386): Initialize
6845         tls_desc_rel_ field.
6846         (Output_data_plt_i386::rel_tls_desc): New function.
6847         (Target_i386::rel_tls_desc_section): New function.
6848         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6849         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6850         R_386_TLS_DESC reloc in rel_tls_desc_section.
6851         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6852         Define struct Tlsdesc_info.
6853         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6854         (Target_x86_64::do_reloc_symbol_index): New function.
6855         (Target_x86_64::add_tlsdesc_info): New function.
6856         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6857         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6858         tlsdesc_rel_ field.
6859         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
6860         all callers.
6861         (Output_data_plt_x86_64::rela_tlsdesc): New function.
6862         (Target_x86_64::rela_tlsdesc_section): New function.
6863         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6864         handling.
6865         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6866         (Target_x86_64::do_reloc_addend): New function.
6867         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6868         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6869         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
6870         (Output_reloc::type): New function.
6871         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6872         (Output_reloc::is_target_specific): New function.
6873         (Output_reloc::target_arg): New function.
6874         (class Output_reloc) [SHT_RELA]: Add four new constructors for
6875         absolute relocs and target specific relocs.
6876         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6877         add_target_specific.
6878         (class Output_data_reloc) [SHT_RELA]: Likewise.
6879         * output.cc (Output_reloc::Output_reloc): Add four new versions
6880         for absolute relocs and target specific relocs.
6881         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6882         (Output_reloc::get_symbol_index): Likewise.
6883         (Output_reloc::local_section_offset): Check that local_sym_index_
6884         is not TARGET_CODE or 0.
6885         (Output_reloc::symbol_value): Likewise.
6886         (Output_reloc::write) [SHT_RELA]: Call target for target specific
6887         reloc.
6888         * target.h (class Target): Add reloc_symbol_index and reloc_addend
6889         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
6890         functions.
6891         * layout.cc (add_target_dynamic_tags): Use output section for
6892         DT_PLTRELSZ and DT_JMPREL.
6893
6894 2010-01-07  Ian Lance Taylor  <iant@google.com>
6895
6896         PR 11061
6897         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6898         function.
6899         (class Output_data_reloc_generic): Define.
6900         (class Output_data_reloc_base): Change base class to
6901         Output_data_reloc_generic.  Change add() method to call
6902         bump_relative_reloc_count for a relative reloc.  Remove
6903         sort_relocs_ field.
6904         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6905         to sort_relocs().
6906         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6907         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
6908         appropriate.
6909         * layout.h (class Layout): Update declaration.
6910
6911 2010-01-07  Ian Lance Taylor  <iant@google.com>
6912
6913         * output.h (class Output_data): Add const version of
6914         output_section and do_output_section.
6915         (class Output_section_data): Add const version of
6916         do_output_section.
6917         (class Output_section): Likewise.
6918         * layout.cc (Layout::add_target_dynamic_tags): New function.
6919         * layout.h (class Layout): Update declarations.
6920         * arm.cc (Target_arm::do_finalize_sections): Use
6921         add_target_dynamic_tags.
6922         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6923         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6924         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6925         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6926
6927 2010-01-07  Ian Lance Taylor  <iant@google.com>
6928
6929         PR 11042
6930         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6931         object as needed.
6932
6933 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
6934             Ian Lance Taylor  <iant@google.com>
6935
6936         PR 11019
6937         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6938         Xindex::read_symtab_xindex.
6939
6940 2010-01-07  Doug Kwan  <dougkwan@google.com>
6941
6942         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6943         (Insn_template::thumb16_bcond_insn): New method declaration.
6944         (Insn_template): Fix spelling.
6945         (Stub::thumb16_special): New method declaration.
6946         (Stub::do_write): Define virtual method which was previously pure
6947         virtual.
6948         (Stub::do_thumb16_special): New method declaration.
6949         (Stub::do_fixed_endian_write): New template member.
6950         (Reloc_stub::do_write): Remove.
6951         (Reloc_stub::do_fixed_endian_write): Remove.
6952         (Cortex_a8_stub): New class definition.
6953         (Stub_factory::make_cortex_a8_stub): New method definition.
6954         (Stub_factory::Stub_factory): Add missing static storage class
6955         qualifier for elf32_arm_stub_a8_veneer_blx.
6956
6957 2010-01-07  Ian Lance Taylor  <iant@google.com>
6958
6959         PR 10980
6960         * options.h (class General_options): Add --warn-unresolved-symbols
6961         and --error-unresolved-symbols.
6962         * errors.cc (Errors::undefined_symbol): Implement
6963         --warn-unresolved-symbols.
6964
6965         * options.h (class General_options): Add -z text and -z textoff.
6966         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6967
6968 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
6969
6970         * gc.h (Garbage_collection::Cident_section_map): New typedef.
6971         (Garbage_collection::cident_sections): New function.
6972         (Garbage_collection::add_cident_section): New function.
6973         (Garbage_collection::cident_sections_): New member.
6974         (gc_process_relocs): Add references to sections whose names are C
6975         identifiers.
6976         * gold.h (cident_section_start_prefix): New constant.
6977         (cident_section_stop_prefix): New constant.
6978         (is_cident): New function.
6979         * layout.cc (Layout::define_section_symbols): Replace string constants
6980         with the newly defined constants.
6981         * object.cc (Sized_relobj::do_layout): Track sections whose names are
6982         C identifiers.
6983         * testsuite/Makefile.am: Add gc_orphan_section_test.
6984         * testsuite/Makefile.in: Regenerate.
6985         * testsuite/gc_orphan_section_test.cc: New file.
6986         * testsuite/gc_orphan_section_test.sh: New file.
6987
6988 2010-01-06  Ian Lance Taylor  <iant@google.com>
6989
6990         PR 10980
6991         * options.h (class General_options): Add --warn-shared-textrel.
6992         * layout.cc (Layout::finish_dynamic_section): Implement
6993         --warn-shared-textrel.
6994
6995         PR 10980
6996         * options.h (class General_options): Add --warn-multiple-gp.
6997
6998 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6999
7000         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7001         $(THREADSLIB) and $(LIBDL).
7002         * Makefile.in: Rebuild.
7003
7004 2010-01-06  Ian Lance Taylor  <iant@google.com>
7005
7006         PR 10980
7007         * options.cc (General_options::parse_section_start): New function.
7008         (General_options::section_start): New function.
7009         (General_options::General_options): Initialize all members.
7010         * options.h: Include <map>
7011         (class General_options): Add --section-start.  Add section_starts_
7012         member.
7013         * layout.cc (Layout::attach_allocated_section_to_segment): If
7014         --section-start was used, set the address of the segment.  Remove
7015         local sort_sections.
7016         (Layout::relaxation_loop_body): If the address of the load segment
7017         has been set by --section-start, don't use it.
7018         * output.h (Output_segment::update_flags_for_output_section): New
7019         function.
7020         * output.cc (Output_segment::add_output_section): Call
7021         update_flags_for_output_section.
7022
7023 2010-01-05  Ian Lance Taylor  <iant@google.com>
7024
7025         PR 10980
7026         * options.h (class General_options): Add --undefined-version.
7027         * script.cc (struct Version_expression): Add was_matched_by_symbol
7028         field.
7029         (Version_script_info::matched_symbol): New function.
7030         (Version_script_info::get_symbol_version_helper): Call
7031         matched_symbol.
7032         (Version_script_info::check_unmatched_names): New function.
7033         * script.h (class Version_script_info): Update declarations.
7034         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7035
7036         * options.h (class General_options): Use DEFINE_bool_alias for
7037         allow_multiple_definition.
7038         * resolve.cc (Symbol_table::should_override): Don't test
7039         allow_multiple_definition.
7040
7041         PR 10980
7042         * options.h (class General_options): Add --cref.
7043         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7044         until after printing cref table.
7045         * cref.cc: Include "symtab.h".
7046         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7047         (Cref_table_compare::operator()): New function.
7048         (Cref_inputs::gather_cref): New function.
7049         (filecol): New static const.
7050         (Cref_inputs::print_cref): New function.
7051         (Cref::print_cref): New function.
7052         * cref.h: Include <cstdio>.
7053         (class Cref): Update declarations.
7054         * mapfile.h (Mapfile::file): New function.
7055         * object.h (class Object): Define Symbols.  Declare virtual
7056         do_get_global_symbols.
7057         (Object::get_global_symbols): New function.
7058         * object.cc (Input_objects::add_object): Pass object to cref_ if
7059         --cref.
7060         (Input_objects::archive_start): Likewise.
7061         (Input_objects::archive_stop): Likewise.
7062         (Input_objects::print_cref): New function.
7063         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7064         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7065         --cref.
7066         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7067         function.
7068         * plugin.h (class Sized_pluginobj): Update declarations.
7069
7070 2010-01-05  Ian Lance Taylor  <iant@google.com>
7071
7072         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7073         to is_default_version.  Rename insdef to insdefault.
7074         (Symbol_table::add_from_relobj): Rename def to is_default_version
7075         and local to is_forced_local.
7076         (Symbol_table::add_from_pluginobj): Likewise.
7077         (Symbol_table::add_from_dynobj): Likewise.
7078         (Symbol_table::define_special_symbol): Rename insdef to
7079         insdefault.
7080
7081 2010-01-04  Ian Lance Taylor  <iant@google.com>
7082
7083         PR 10980
7084         * options.h (class General_options): Add
7085         --allow-multiple-definition and -z muldefs.
7086         * resolve.cc (Symbol_table::should_override): Don't warn about a
7087         multiple symbol definition if --allow-multiple-definition or -z
7088         muldefs.
7089
7090         PR 10980
7091         * options.h (class General_options): Add --add-needed and
7092         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7093         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7094         error if --copy-dt-needed-entries aka --add-needed is used and
7095         would cause a change in behaviour.
7096
7097         PR 10980
7098         * options.h (class General_options): Add -G as a short version of
7099         --shared.  Add no-op options -assert, -g, and -i.
7100
7101 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7102
7103         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7104         check for .text or .gnu.linkonce.t sections.
7105         * icf.cc (Icf::find_identical_sections): Ditto.
7106         Change the detection for mangled function name within the section
7107         name.
7108         * icf.h (is_section_foldable_candidate): New function.
7109
7110 2009-12-30  Ian Lance Taylor  <iant@google.com>
7111
7112         PR 10980
7113         * options.h (class General_options): Permit two dashes with
7114         --retain-symbols-file.
7115
7116 2009-12-30  Ian Lance Taylor  <iant@google.com>
7117
7118         PR 10979
7119         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7120         don't put the file header and segment headers in the text
7121         segment.
7122
7123         PR 10979
7124         * common.cc (Sort_commons::operator()): Stabilize sort when both
7125         entries are NULL.
7126         (Symbol_table::do_allocate_commons_list): When allocating common
7127         symbols, skip a symbol which is no longer common.
7128         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7129         an object before checking its type.
7130         * testsuite/common_test_2.c: New file.
7131         * testsuite/common_test_3.c: New file.
7132         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7133         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7134         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7135         (common_test_2_pic.o, common_test_2.so): New targets.
7136         (common_test_3_pic.o, common_test_3.so): New targets.
7137         * testsuite/Makefile.in: Rebuild.
7138
7139         PR 10979
7140         * script.cc (read_input_script): If we see a new SECTIONS clause,
7141         and we have added an input section, give an error.
7142         * layout.h (class Layout): Add have_added_input_section function.
7143         Add have_added_input_section_ field.
7144         * layout.cc (Layout::Layout): Initialize
7145         have_added_input_section_.
7146         (Layout::layout): Set have_added_input_section_.
7147         (Layout::layout_eh_frame): Likewise.
7148
7149 2009-12-30  Ian Lance Taylor  <iant@google.com>
7150
7151         PR 10931
7152         * options.h (class General_options): Add --sort-common option.
7153         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7154         * common.cc (Sort_common): Add sort_order parameter to
7155         constructor.  Add sort_order_ field.
7156         (Sort_commons::operator): Check sort_order_.
7157         (Symbol_table::allocate_commons): Determine the sort order.
7158         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7159         Change all callers.
7160         (Symbol_table::do_allocate_commons_list): Likewise.
7161
7162 2009-12-30  Ian Lance Taylor  <iant@google.com>
7163
7164         PR 10916
7165         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7166         symbols from this object, don't change the visibility of an
7167         undefined symbol.
7168         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7169
7170 2009-12-30  Ian Lance Taylor  <iant@google.com>
7171
7172         PR 10861
7173         * script.h (class Version_script_info): Define Language enum.
7174         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7175         new fields globals_, locals_, and is_finalized_.
7176         * script.cc: Various formatting fixes.
7177         (class Parser_closure): Change language_stack_ from a vector of
7178         std::string to one of Version_script_info::Language.  Adjust all
7179         uses accordingly.
7180         (class Lazy_demangler): Remove.
7181         (struct Version_expression): Change language from std::string to
7182         Version_script_info::Language.
7183         (Version_script_info::Version_script_info): New function.
7184         (Version_script_info::~Version_script_info): Don't call clear.
7185         (Version_script_info::finalize): New function.
7186         (Version_script_info::build_lookup_tables): New function.
7187         (Version_script_info::build_expression_list_lookup): New
7188         function.
7189         (Version_script_info::get_symbol_version_helper): Rewrite to use
7190         lookup tables.
7191         (Version_script_info::print_expression_list): Adjust to use
7192         Version_script_info::Language.
7193         (script_push_lex_into_version_mode): Check that the version script
7194         has not been finalized.
7195         (version_script_push_lang): Change language string to
7196         Version_script_info::Language.
7197         * options.cc (Command_line::version_script): New function.
7198         * options.h (class General_options): Add finalize_dynamic_list
7199         function.  Change version_script from declaration to definition.
7200         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7201         * testsuite/version_script.map: Remove duplicate def of foo.
7202         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7203         version_script.map.
7204         * testsuite/Makefile.in: Rebuild.
7205
7206 2009-12-30  Ian Lance Taylor  <iant@google.com>
7207
7208         PR 10843
7209         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7210         if the input symbol index is 0, make the output symbol index 0.
7211
7212 2009-12-30  Ian Lance Taylor  <iant@google.com>
7213
7214         PR 10670
7215         * options.h (class General_options): Add -x/--discard-all.
7216         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7217         --discard-all.  If the local symbol needs a dynamic entry, check
7218         that before handling --discard-locals.
7219
7220 2009-12-30  Ian Lance Taylor  <iant@google.com>
7221
7222         PR 10450
7223         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7224         flags to PF_R.
7225         (Output_segment::add_output_section): Don't change the flags if
7226         the type is PT_TLS.
7227
7228         PR 10450
7229         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7230         GNU hash table if they need a dynamic value.  Otherwise, don't add
7231         them if they are defined in a dynamic object or are forced local.
7232
7233 2009-12-29  Ian Lance Taylor  <iant@google.com>
7234
7235         PR 10450
7236         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7237         .gnu.hash table for a 32-bit target.
7238
7239         PR 10450
7240         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7241         regular and a dynamic object only needs a dynamic symbol table
7242         entry if it is externally visible.
7243
7244         PR 10450
7245         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7246         constructor.  Add global_offset_table_ field.
7247         (Target_i386::got_section): Set global_offset_table_.
7248         (Target_i386::do_finalize_sections): Set global_offset_table_
7249         size.
7250         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7251         in constructor.  Add global_offset_table_ field.
7252         (Target_x86_64::got_section): Set global_offset_table_.
7253         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7254         size.
7255
7256         * layout.cc (Layout::Layout): Initialize increase_relro_.
7257         (Layout::get_output_section): Add is_relro, is_last_relro, and
7258         is_first_non_relro parameters.  Change all callers.
7259         (Layout::choose_output_section): Likewise.
7260         (Layout::add_output_section_data): Likewise.
7261         (Layout::make_output_section): Likewise.
7262         (Layout::set_segment_offsets): Clear increase_relro when using a
7263         linker script.
7264         * layout.h (class Layout): Add increase_relro method.  Add
7265         increase_relro_ field.  Update declarations.
7266         * output.cc (Output_section::Output_section): Initialize
7267         is_last_relro_ and is_first_non_relro_.
7268         (Output_segment::add_output_section): Group relro sections is
7269         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7270         (Output_segment::maximum_alignment): Remove relro handling.
7271         (Output_segment::set_section_addresses): Add increase_relro
7272         parameter.  Change all callers.  Add initial alignment to align
7273         relro sections on separate page.  Remove old relro handling.
7274         (Output_segment::set_section_list_addresses): Remove in_relro
7275         parameter.  Change all callers.
7276         (Output_segment::set_offset): Add increase parameter.  Change all
7277         callers.  Remove old relro handling.
7278         * output.h (class Output_section): Add new methods: is_last_relro,
7279         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7280         Add is_last_relro_ and is_first_non_relro_ fields.
7281         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7282         Create separate .got.plt section.  Call increase_relro.
7283         * x86_64.cc (Target_x86_64::got_section): Likewise.
7284         * testsuite/relro_script_test.t: Add .got.plt.
7285
7286         PR 10450
7287         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7288         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7289         (Layout::finalize): Call set_dynamic_symbol_size.
7290         (Layout::set_dynamic_symbol_size): New function.
7291         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7292         set_dynamic_symbol_size.
7293
7294         PR 10450
7295         * output.h (class Output_section): Add is_entsize_zero_ field.
7296         * output.cc (Output_section::Output_section): Initialize
7297         is_entsize_zero_.
7298         (Output_section::set_entsize): If two different entsizes are
7299         requested, force it to zero.
7300         (Output_section::add_input_section): Set flags for .debug_str
7301         before updating section flags.  Set entsize.
7302         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7303         and SHF_STRING if all input sections have those flags.
7304
7305 2009-12-29   Rafael Espindola  <espindola@google.com>
7306
7307         * main.cc (main): Fix the sys time reporting.
7308         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7309         reporting.
7310
7311 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7312
7313         * options.cc (General_options::parse_version): Allow -v to exit
7314         without an error if there is nothing to link.
7315
7316 2009-12-29  Ian Lance Taylor  <iant@google.com>
7317
7318         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7319         using a version of gcc before 4.1.
7320         * configure: Rebuild.
7321
7322 2009-12-28  Chris Demetriou  <cgd@google.com>
7323
7324         * attributes.cc (Output_attributes_section_data::do_write): Use
7325         std::vector::front rather than std::vector::data.
7326
7327 2009-12-28  Ian Lance Taylor  <iant@google.com>
7328
7329         * symtab.h (class Symbol_table): Add enum Defined.
7330         * resolve.cc (Symbol_table::should_override): Add defined
7331         parameter.  Change all callers.  Test whether object is NULL
7332         before calling a method on it.
7333         (Symbol_table::report_resolve_problem): Add defined parameter.
7334         Change all callers.
7335         (Symbol_table::should_override_with_special): Likewise.
7336         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7337         parameter.  Change all callers.
7338         (Symbol_table::do_define_in_output_data): Likewise.
7339         (Symbol_table::define_in_output_segment): Likewise.
7340         (Symbol_table::do_define_in_output_segment): Likewise.
7341         (Symbol_table::define_as_constant): Likewise.
7342         (Symbol_table::do_define_as_constant): Likewise.
7343         * script.h (class Symbol_assignment): Add is_defsym parameter to
7344         constructor; change all callers.
7345         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7346         parameter.  Change all callers.  Add is_defsym_ field.
7347         (class Parser_closure): Add parsing_defsym parameter to
7348         constructor; change all callers.  Add parsing_defsym accessor
7349         function.  Add parsing_defsym_ field.
7350
7351 2009-12-28  Ian Lance Taylor  <iant@google.com>
7352
7353         * gold.cc (queue_middle_tasks): Fix formatting.
7354         * object.cc (Relobj::is_section_name_included): Likewise.
7355
7356 2009-12-23  Ian Lance Taylor  <iant@google.com>
7357
7358         * i386.cc (Target_i386::do_calls_non_split): Recognize
7359         -fsplit-stack prologue for a function with a static chain.
7360         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7361         -fsplit-stack prologue when using %r11.
7362
7363 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7364
7365         * options.cc (General_options::parse_version): Make -v continue and do
7366         the link like GNU ld does.
7367
7368 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7369
7370         * Makefile.am (CCFILES): Add timer.cc.
7371         (HFILES): Add timer.h.
7372         * configure.ac: Check for sysconf and times.
7373         * main.cc: include timer.h.
7374         (main): Use Timer instead of get_run_time.
7375         * timer.cc: New.
7376         * timer.h: New.
7377         * workqueue.cc: include timer.h.
7378         (Workqueue::find_and_run_task):
7379         Report user, sys and wall time.
7380         * Makefile.in: Regenerate.
7381         * config.in: Regenerate.
7382         * configure: Regenerate.
7383
7384 2009-12-16  Doug Kwan  <dougkwan@google.com>
7385
7386         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7387         sections.
7388         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7389         relaxed input sections.
7390         * output.cc (Output_section::find_relaxed_input_section): Change
7391         return type to Output_relaxed_input_section pointer.  Adjust code
7392         for new type of relaxed_input_section_map_.
7393         * output.h (Output_section::find_relaxed_input_section): Change
7394         return type to Output_relaxed_input_section pointer.
7395         (Output_section::Output_relaxed_input_section_by_input_section_map):
7396         New type.
7397         (Output_section::relaxed_input_section_map_): Change type to
7398         Output_section::Output_relaxed_input_section_by_input_section_map.
7399         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7400         input section.
7401
7402 2009-12-15  Ian Lance Taylor  <iant@google.com>
7403
7404         * layout.cc (Layout::create_shstrtab): Only write out after input
7405         sections if we are compressing debug sections.
7406
7407 2009-12-15  Ian Lance Taylor  <iant@google.com>
7408
7409         * archive.cc (Archive::add_symbols): Only look up a symbol without
7410         a version if there is, in fact, a version.
7411
7412 2009-12-14  Ian Lance Taylor  <iant@google.com>
7413
7414         Revert -Wshadow changes, all changes from:
7415         2009-12-11  Doug Kwan  <dougkwan@google.com>
7416         2009-12-11  Nick Clifton  <nickc@redhat.com>
7417         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7418
7419 2009-12-11  Doug Kwan  <dougkwan@google.com>
7420
7421         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7422         due to -Wshadow.
7423         * attributes.cc (Object_attribute::size): Ditto.
7424         (Attributes_section_data::size): Ditto.
7425         (Attributes_section_data::Attributes_section_data): Ditto.
7426         (Output_attributes_section_data::do_write): Ditto.
7427         * attributes.h (Object_attribute::set_type): Ditto.
7428         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7429
7430 2009-12-11  Nick Clifton  <nickc@redhat.com>
7431
7432         * archive.cc: Fix shadowed variable warnings.
7433         * arm.cc: Likewise.
7434         * compressed_output.cc: Likewise.
7435         * compressed_output.h: Likewise.
7436         * configure: Likewise.
7437         * dwarf_reader.cc: Likewise.
7438         * dynobj.cc: Likewise.
7439         * dynobj.h: Likewise.
7440         * ehframe.cc: Likewise.
7441         * ehframe.h: Likewise.
7442         * errors.cc: Likewise.
7443         * expression.cc: Likewise.
7444         * fileread.cc: Likewise.
7445         * fileread.h: Likewise.
7446         * freebsd.h: Likewise.
7447         * i386.cc: Likewise.
7448         * icf.cc: Likewise.
7449         * incremental.h: Likewise.
7450         * layout.cc: Likewise.
7451         * layout.h: Likewise.
7452         * mapfile.cc: Likewise.
7453         * merge.cc: Likewise.
7454         * merge.h: Likewise.
7455         * object.cc: Likewise.
7456         * object.h: Likewise.
7457         * options.h: Likewise.
7458         * output.cc: Likewise.
7459         * output.h: Likewise.
7460         * parameters.cc: Likewise.
7461         * plugin.cc: Likewise.
7462         * powerpc.cc: Likewise.
7463         * reduced_debug_output.cc: Likewise.
7464         * reduced_debug_output.h: Likewise.
7465         * reloc.cc: Likewise.
7466         * reloc.h: Likewise.
7467         * resolve.cc: Likewise.
7468         * script-sections.cc: Likewise.
7469         * script.cc: Likewise.
7470         * script.h: Likewise.
7471         * sparc.cc: Likewise.
7472         * symtab.cc: Likewise.
7473         * symtab.h: Likewise.
7474         * target-select.cc: Likewise.
7475         * target-select.h: Likewise.
7476         * token.h: Likewise.
7477         * workqueue.cc: Likewise.
7478         * workqueue.h: Likewise.
7479         * x86_64.cc: Likewise.
7480
7481 2009-12-10  Doug Kwan  <dougkwan@google.com>
7482
7483         * arm.cc (attributes.h): New include.
7484         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7485         (Arm_relobj::~Arm_relobj): Delete object pointed by
7486         attributes_section_data_.
7487         (Arm_relobj::attributes_section_data): New method definition.
7488         (Arm_relobj::attributes_section_data_): New data member declaration.
7489         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7490         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7491         attributes_section_data_.
7492         (Arm_dynobj::attributes_section_data): New method definition.
7493         (Arm_dynobj::attributes_section_data_): New data member declaration.
7494         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7495         initialization value of may_use_blx_ to false.
7496         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7497         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7498         object attributes to compute results instead of hard-coding.
7499         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7500         Target_arm::get_secondary_compatible_arch,
7501         Target_arm::set_secondary_compatible_arch
7502         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7503         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7504         New method declarations.
7505         (Target_arm::get_aeabi_object_attribute): New method definition.
7506         (Target_arm::attributes_section_data_): New data member declaration.
7507         (read_arm_attributes_section): New template definition.
7508         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7509         (Arm_dynobj::do_read_symbols): Ditto.
7510         (Target_arm::do_finalize_sections): Merge attributes sections from
7511         input.  Check for BLX use after attributes section merging.
7512         Fix __exidx_start and __exidx_end visibility.  Create an
7513         .ARM.attributes section if necessary.
7514         (Target_arm::get_secondary_compatible_arch,
7515         Target_arm::set_secondary_compatible_arch,
7516         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7517         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7518         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7519         New method definitions.
7520
7521 2009-12-09  Ian Lance Taylor  <iant@google.com>
7522
7523         * plugin.cc (Plugin::load): Don't cast from void* to a function
7524         pointer.
7525
7526 2009-12-09  Ian Lance Taylor  <iant@google.com>
7527
7528         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7529         information fields.
7530
7531 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7532
7533         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7534         Replace two_file_shared_1.so with two_file_shared_2.so.
7535         * testsuite/Makefile.in: Regenerated.
7536
7537 2009-12-08  Doug Kwan  <dougkwan@google.com>
7538
7539         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7540         (HFILES): Add attributes.h and int_encoding.h.
7541         * Makefile.in: Regenerate.
7542         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7543         function definitions to int_encoding.cc
7544         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7545         prototypes to int_encoding.h
7546         * reduced_debug_output.cc (int_encoding.h): New include.
7547         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7548         function definitions to int_encoding.cc
7549         (insert_into_vector, read_from_pointer): Move template definitions to
7550         int_encoding.h
7551         * attributes.cc: New file.
7552         * attributes.h: New file.
7553         * int_encoding.cc: New file.
7554         * int_encoding.h: New file.
7555
7556 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7557
7558         PR gold/11055
7559         * incremental-dump.cc (dump_incremental_inputs): New.
7560         (main): Use dump_incremental_inputs.
7561
7562 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7563
7564         PR gold/10893
7565         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7566         checking elfcpp::STT_FUNC.
7567         (Target_i386::Relocate::relocate): Likewise.
7568         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7569
7570         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7571         symbols from shared libraries into normal FUNC symbols.
7572
7573         * symtab.h (Symbol): Add is_func and use it.
7574
7575 2009-12-05  Doug Kwan  <dougkwan@google.com>
7576
7577         * arm.cc (Target_arm::arm_info): Initialize new fields
7578         attributes_section and attributes_vendor.
7579         * i386.cc (Target_i386::i386_info): Same.
7580         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7581         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7582         fields attributes_section and attributes_vendor.
7583         * sparc.cc (Target_sparc::sparc_info): Same.
7584         * target.h (Target::attributes_section, Target::attributes_vendor,
7585         Target::is_attributes_section, Target::attribute_arg_type,
7586         Target::attributes_order): New method definitions.
7587         (Target::Target_info::attributes_section,
7588         Target::Target_info::attributes_vendor): New fields.
7589         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7590         virtual method definitions.
7591         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7592         attributes_section and attributes_vendor.
7593         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7594
7595 2009-12-05  Doug Kwan  <dougkwan@google.com>
7596
7597         * arm.cc: Update comments about interworking and stub generation.
7598         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7599         considered as non-PIC.
7600         (Arm_relocate_functions::base_abs): Fix formatting.
7601         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7602         of function to use GOT entry address instead of offset.
7603         (Target_arm::Scan::global): Issue an error if a symbol would need a
7604         PLT does not get one because it is untyped.  Remove code to create
7605         dynamic symbols for relative branches.
7606         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7607         takes unsigned integer instead of boolean.
7608
7609 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7610
7611         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7612         (two_file_test_LDADD): Likewise.
7613         (common_test_1_LDADD): Likewise.
7614         (exception_test_LDADD) Likewise.
7615         (weak_test_LDADD): Likewise.
7616         (many_sections_test_LDADD): Likewise.
7617         (initpri1_LDADD): Likewise.
7618         (script_test_1_LDADD): Likewise.
7619         (script_test_2_LDADD): Likewise.
7620         (justsyms_LDADD): Likewise.
7621         (binary_test_LDADD): Likewise.
7622         (large_LDADD): Likewise.
7623         * testsuite/Makefile.in: Regenerated.
7624
7625 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7626
7627         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7628         (Symbol_table::override_with_special): Likewise.
7629         (Symbol_table::add_from_object): Likewise.
7630
7631 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7632
7633         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7634         Don't set the data_offset twice.
7635
7636 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7637
7638         * testsuite/Makefile.in: Regenerate.
7639
7640 2009-12-03  Doug Kwan  <dougkwan@google.com>
7641
7642         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7643         (Target_arm::do_finalize_sections): Add parameter for symbol table
7644         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7645         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7646         parameter for symbol table pointer.
7647         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7648         an additional parameter for a pointer to symbol table.
7649         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7650         parameter for a symbol table pointer.
7651         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7652         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7653         Ditto.
7654         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7655         parameter for a symbol table pointer.
7656
7657 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7658
7659         * incremental.cc (Incremental_inputs_header)
7660         (Incremental_inputs_header_write, Incremental_inputs_entry)
7661         (Incremental_inputs_entry_write): Move ...
7662         * incremental.h (Incremental_inputs_header)
7663         (Incremental_inputs_header_write, Incremental_inputs_entry)
7664         (Incremental_inputs_entry_write): here.
7665
7666 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7667
7668         * incremental.cc (make_sized_incremental_binary): Set the target.
7669         Error if it is incompatible.
7670         * output.h (Output_file): Add filename method.
7671
7672 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7673
7674         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7675         from the get_* methods.
7676
7677 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7678
7679         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7680         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7681         Write 0 for the data_offset of scripts.
7682
7683 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7684
7685         * testsuite/Makefile.am: Add the incremental_test.sh test.
7686         * testsuite/incremental_test.sh: New.
7687         * testsuite/incremental_test_1.c: New.
7688         * testsuite/incremental_test_2.c: New.
7689
7690 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7691
7692        * incremental-dump.cc (main): Fix typos.
7693
7694 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7695
7696         PR gold/11025
7697         * incremental-dump.cc (main): Use llu to print 64 bit values.
7698
7699 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7700             H.J. Lu  <hongjiu.lu@intel.com>
7701
7702         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7703         $(LIBDL).
7704         (incremental_dump_LDADD): Likewise.
7705         * Makefile.in: Regenerated.
7706
7707 2009-11-25  Doug Kwan  <dougkwan@google.com>
7708
7709         Revert:
7710
7711         2009-11-25  Doug Kwan  <dougkwan@google.com>
7712
7713                 * arm.cc (Target_arm::Target_arm): Move method definition
7714                 outside of class definition.  Add code to handle
7715                 --target1-rel, --target1-abs and --target2= options.
7716                 (Target_arm::get_reloc_reloc_type): Change method to be
7717                 non-static and const.
7718                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7719                 New data member declaration.
7720                 (Target_arm::Scan::local, Target_arm::Scan::global,
7721                 Target_arm::Relocate::relocate,
7722                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7723                 Adjust call to Target_arm::get_real_reloc_type.
7724                 (Target_arm::get_real_reloc_type): Use command line options
7725                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7726                 * options.h (--target1-rel, --target1-abs, --target2): New
7727                 ARM-only options.
7728
7729 2009-11-25  Doug Kwan  <dougkwan@google.com>
7730
7731         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7732         class definition.  Add code to handle --target1-rel, --target1-abs
7733         and --target2= options.
7734         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7735         and const.
7736         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7737         member declaration.
7738         (Target_arm::Scan::local, Target_arm::Scan::global,
7739         Target_arm::Relocate::relocate,
7740         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7741         call to Target_arm::get_real_reloc_type.
7742         (Target_arm::get_real_reloc_type): Use command line options to
7743         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7744         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7745         options.
7746
7747 2009-11-25  Doug Kwan  <dougkwan@google.com>
7748
7749         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7750         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7751         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7752         formatting.
7753         (Arm_relocate_functions::thm_call): Replace body with a call to
7754         Arm_relocate_functions::thumb_branch_common.
7755         (Arm_relocate_functions::thm_jump24,
7756         Arm_relocate_functions::thm_xpc22): New method definitions.
7757         (Arm_relocate_functions::thumb_branch_common): New method definition.
7758         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7759         operator.
7760         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7761         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7762
7763 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7764
7765         * Makefile.am: Build incremental-dump
7766         * Makefile.in: Regenerate.
7767         * incremental-dump.cc: New.
7768         * incremental.cc (Incremental_inputs_header_data,
7769         Incremental_inputs_entry_data): Move to incremental.h
7770         * incremental.h: (Incremental_inputs_header_data,
7771         Incremental_inputs_entry_data): Move from incremental.cc
7772
7773 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7774
7775         * incremental.cc (Incremental_inputs_header,
7776         Incremental_inputs_header_write, Incremental_inputs_entry,
7777         Incremental_inputs_entry_write): Add a typedef with the data type.
7778
7779 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7780
7781         * incremental.cc (Incremental_inputs_header,
7782         Incremental_inputs_header_write, Incremental_inputs_entry,
7783         Incremental_inputs_entry_write): Update comment about which
7784         type has the filed descriptions.
7785
7786 2009-11-15  Doug Kwan  <dougkwan@google.com>
7787
7788         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7789         (Arm_relocate_functions::arm_branch_common): Change method defintion
7790         in class definition to a method declaration and update list of formal
7791         parameters.
7792         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7793         Arm_relocation_functions::jump24): Adjust call to
7794         Arm_relocate_functions::arm_branch_common.  Update list of formal
7795         parameters.
7796         (Arm_relocate_functions::xpc25): New method definition.
7797         (Arm_relocate_functions::arm_branch_common): Move method defintion
7798         out from class definition.  Use stubs for mode-switching and extending
7799         branch ranges.
7800         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7801         specially.  Change code to enable use of stubs in ARM branches.
7802
7803 2009-11-10  Doug Kwan  <dougkwan@google.com>
7804
7805         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7806         in method declaration.
7807         (Target_arm::relocate_stub): New method declaration.
7808         (Target_arm::default_target): Change to return a pointer instead of
7809         a const reference.
7810         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7811         Target_arm::default_target.
7812         (Arm_Relobj::do_relocate_sections): Remove options paramater in
7813         method definition.
7814         (Target_arm::relocate_section): Adjust view.
7815         (Target_arm::relocate_stub): New method definition.
7816
7817 2009-11-10  Doug Kwan  <dougkwan@google.com>
7818
7819         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7820         a format warning.
7821         * incremental.cc (open_incremental_binary): Initialized local
7822         variables to avoid warnings.
7823         * object.cc (make_elf_object): Ditto.
7824         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7825         a format warning.
7826
7827 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
7828
7829         PR gold/10930
7830         * testsuite/plugin_test.c: Include "config.h".
7831
7832 2009-11-09  Doug Kwan  <dougkwan@google.com>
7833
7834         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7835         (arm_symbol_value): Remove.
7836         (Arm_relocate_functions::arm_branch_common,
7837         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7838         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7839         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7840         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7841         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7842         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7843         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7844         Arm_relocate_functions::thm_mobw_abs_nc,
7845         Arm_relocate_functions::thm_mov_abs,
7846         Arm_relocate_functions::movw_prel_nc,
7847         Arm_relocate_functions::thm_movt_abs,
7848         Arm_relocate_functions::movt_prel,
7849         Arm_relocate_functions::thm_movw_prel_nc,
7850         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7851         (Target_arm::Relocate::relocate): Only decompose address into two
7852         parts if relocation type uses the thumb-bit and pass the actual
7853         bit instead of a flag indicating that the thumb-bit is used.  Adjust
7854         calls to methods in Arm_relocate_functions for this change.
7855
7856 2009-11-08  Ian Lance Taylor  <iant@google.com>
7857
7858         PR 10925
7859         * reloc.cc: Instantiate
7860         Sized_relobj::initialize_input_to_output_maps and
7861         Sized_relobj:free_input_to_output_maps.
7862
7863 2009-11-06  Ian Lance Taylor  <iant@google.com>
7864
7865         PR 10876
7866         * defstd.cc (in_segment): Set only_if_ref true for "end".
7867
7868 2009-11-06  Doug Kwan  <dougkwan@google.com>
7869
7870         * arm.cc (class Reloc_stub): Correct a comment.
7871         (Target_arm::Target_arm): Initialize arm_input_section_map_.
7872         (Target_arm::scan_section_for_stubs): New method declaration.
7873         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7874         Change methods from private to protected.
7875         (Target_arm::do_may_relax): New method definition.
7876         (Target_arm::do_relax, Target_arm::group_sections,
7877         Target_arm::scan_reloc_for_stub,
7878         Target_arm::scan_reloc_section_for_stubs): New method declarations.
7879         (Target_arm::arm_input_section_map_): New data member declaration.
7880         (Target_arm::scan_reloc_for_stub,
7881         Target_arm::scan_reloc_section_for_stubs,
7882         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7883         Target_arm::do_relax): New method definitions.
7884
7885 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
7886
7887         * configure.ac: Check for (struct stat)::st_mtim
7888         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7889         * config.in: Regenerate.
7890         * configure: Regenerate.
7891
7892 2009-11-05  Ian Lance Taylor  <iant@google.com>
7893
7894         PR 10910
7895         * output.cc (Output_segment::add_output_section): Add missing
7896         return statement.
7897
7898 2009-11-04  Ian Lance Taylor  <iant@google.com>
7899
7900         PR 10880
7901         * object.h (class Object): Add is_needed and set_is_needed
7902         methods.  Add is_needed_ field.  Make bool fields into bitfields.
7903         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7904         defined in a dynamic object and referenced by a regular object,
7905         set is_needed for the dynamic object.
7906         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7907         if the file is marked with as_needed and it is not needed.
7908
7909 2009-11-04  Ian Lance Taylor  <iant@google.com>
7910
7911         PR 10887
7912         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7913         tags if data is discarded by linker script.
7914         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7915         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7916         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7917         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7918
7919 2009-11-04  Ian Lance Taylor  <iant@google.com>
7920
7921         * layout.cc (Layout::get_output_section): Add is_interp and
7922         is_dynamic_linker_section parameters.  Change all callers.
7923         (Layout::choose_output_section): Likewise.
7924         (Layout::make_output_section): Likewise.
7925         (Layout::add_output_section_data): Add is_dynamic_linker_section
7926         parameter.  Change all callers.
7927         * layout.h (class Layout): Update declarations.
7928         * output.h (class Output_section): Add is_interp, set_is_interp,
7929         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7930         Add is_interp_, is_dynamic_linker_section_ fields.  Change
7931         generate_code_fills_at_write_ to a bitfield.
7932         * output.cc (Output_section::Output_sections): Initialize new
7933         fields.
7934         (Output_segment::add_output_section): Add do_sort parameter.
7935         Change all callers.
7936
7937 2009-11-03  Ian Lance Taylor  <iant@google.com>
7938
7939         PR 10860
7940         * options.h (class General_options): Add --warn-common.
7941         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7942         merging two common symbols.
7943         (Symbol_table::should_override): Handle --warn-common when merging
7944         a common symbol with a defined symbol.  Use report_resolve_problem
7945         for multiple definitions.
7946         (Symbol_table::report_resolve_problem): New function.
7947         * symtab.h (class Symbol_table): Declare report_resolve_problem.
7948
7949 2009-11-03  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7952         stub_factory_.
7953         (Target_arm::stub_factory): New method definition.
7954         (Target_arm::new_arm_input_section,
7955         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7956         Target_arm::reloc_uses_thumb_bit): New method declarations.
7957         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7958         New type definitions.
7959         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7960         member declarations.
7961         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7962         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7963         New method definitions.
7964
7965 2009-11-03  Ian Lance Taylor  <iant@google.com>
7966
7967         * options.h (class General_options): Add --warn_constructors.
7968
7969 2009-11-03  Ian Lance Taylor  <iant@google.com>
7970
7971         PR 10893
7972         * defstd.cc (in_section): Add entries for __rel_iplt_start,
7973         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7974
7975 2009-11-03  Ian Lance Taylor  <iant@google.com>
7976
7977         PR 10895
7978         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7979         --msgid-bugs-address.
7980         (install-pdf): New target.
7981         (install-data_yes): Look up one directory to find mkinstalldirs.
7982
7983 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
7984
7985         * po/Make-in (.po.gmo): Don't generate .gmo files in source
7986         tree.
7987
7988 2009-10-30  Doug Kwan  <dougkwan@google.com>
7989
7990         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7991
7992 2009-10-30  Doug Kwan  <dougkwan@google.com>
7993
7994         * arm.cc (Stub_addend_reader): New struct template definition
7995         and partial specializations.
7996         (Stub_addend_reader::operator()): New method definition for a
7997         partially specialized template.
7998
7999 2009-10-30  Doug Kwan  <dougkwan@google.com>
8000
8001         * arm.cc (Arm_relobj::processor_specific_flags): New method
8002         definition.
8003         (Arm_relobj::do_read_symbols): New method declaration.
8004         (Arm_relobj::processor_specific_flags_): New data member declaration.
8005         (Arm_dynobj): New class definition.
8006         (Target_arm::do_finalize_sections): Add input_objects parameter.
8007         (Target_arm::do_adjust_elf_header): New method declaration.
8008         (Target_arm::are_eabi_versions_compatible,
8009         (Target_arm::merge_processor_specific_flags): New method declaration.
8010         (Target_arm::do_make_elf_object): New overloaded method definitions
8011         and declaration.
8012         (Arm_relobj::do_read_symbols): New method definition.
8013         (Arm_dynobj::do_read_symbols): Ditto.
8014         (Target_arm::do_finalize_sections): Add input_objects parameters.
8015         Merge processor-specific flags from all input objects.
8016         (Target_arm::are_eabi_versions_compatible,
8017         Target_arm::merge_processor_specific_flags,
8018         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8019         New method definitions.
8020         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8021         Input_objects pointer type parameter.
8022         * layout.cc (Layout::finalize): Pass input objects to target's.
8023         finalize_sections function.
8024         * output.cc (Output_file_header::do_sized_write): Set ELF file
8025         header's processor-specific flags.
8026         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8027         Input_objects pointer type parameter.
8028         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8029         * target.h (Input_objects): New forward class declaration.
8030         (Target::processor_specific_flags,
8031         Target::are_processor_specific_flags_sect): New method definitions.
8032         (Target::finalize_sections): Add input_objects parameter.
8033         (Target::Target): Initialize processor_specific_flags_ and
8034         are_processor_specific_flags_set_.
8035         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8036         parameter.
8037         (Target::set_processor_specific_flags): New method definition.
8038         (Target::processor_specific_flags_,
8039         Target::are_processor_specific_flags_set_): New data member
8040         declarations.
8041         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8042         Input_objects pointer type parameter.
8043
8044 2009-10-30  Doug Kwan  <dougkwan@google.com>
8045
8046         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8047
8048 2009-10-28  Ian Lance Taylor  <iant@google.com>
8049
8050         * object.h (class Relobj): Drop options parameter from
8051         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8052         do_scan_relocs, do_relocate.  Change all callers.
8053         (class Sized_relobj): Drop options parameters from
8054         do_gc_process_relocs, do_scan_relocs, do_relocate,
8055         do_relocate_sections, relocate_sections, emit_relocs_scan,
8056         emit_relocs_scan_reltype.  Change all callers.
8057         (struct Relocate_info): Remove options field and all references to
8058         it.
8059         * reloc.h (class Read_relocs): Remove options constructor
8060         parameter and options_ field.  Change all callers.
8061         (class Gc_process_relocs, class Scan_relocs): Likewise.
8062         (class Relocate_task): Likewise.
8063         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8064         all callers.
8065         (scan_relocatable_relocs): Likewise.
8066         * target.h (class Sized_target): Remove options parameter from
8067         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8068         all callers.
8069         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8070         callers.
8071         * arm.cc: Update functions to remove options parameters.
8072         * i386.cc: Likewise.
8073         * powerpc.cc: Likewise.
8074         * sparc.cc: Likewise.
8075         * x86_64.cc: Likewise.
8076         * testsuite/testfile.cc: Likewise.
8077
8078 2009-10-28  Doug Kwan  <dougkwan@google.com>
8079
8080         * arm.cc (Arm_relobj): New class definition.
8081         (Arm_relobj::scan_sections_for_stubs,
8082         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8083         New method definitions.
8084
8085 2009-10-28  Cary Coutant  <ccoutant@google.com>
8086
8087         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8088         (Plugin::cleanup_done_): New member.
8089         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8090         (Plugin_manager::cleanup_done_): Remove.
8091         (Plugin_manager::add_input_file): Edit error message.
8092         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8093         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8094
8095 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8096
8097         * fileread.cc: (File_read::View::~View): Use the new
8098         data_ownership_ filed.
8099         (File_read::~File_read): Dispose the new whole_file_view_.
8100         (File_read::open): Mmap the whole file if needed.
8101         (File_read::open): Use whole_file_view_ instead of contents_.
8102         (File_read::find_view): Use whole_file_view_ if applicable.
8103         (File_read::do_read): Use whole_file_view_ instead of contents_.
8104         (File_read::make_view): Use whole_file_view_ instead of contents_,
8105         update File_read::View::View call.
8106         (File_read::find_or_make_view): Update File_read::View::View
8107         call.
8108         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8109         remove contents_
8110         (File_read::View::Data_ownership): New enum.
8111         (File_read::View::View): Replace bool mapped_ with Data_ownership
8112         argument.
8113         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8114         (File_read::View::data_ownership_): New field.
8115         (File_read::contents_): Remove (replaced by whole_file_view_).
8116         (File_read::whole_file_view_): New field.
8117         * options.h (class General_options): Add --keep-files-mapped.
8118
8119 2009-10-27  Cary Coutant  <ccoutant@google.com>
8120
8121         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8122         * testsuite/Makefile.am (plugin_test_5): New test case.
8123         * testsuite/Makefile.in: Regenerate.
8124
8125 2009-10-25  Doug Kwan  <dougkwan@google.com>
8126
8127         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8128         from private to protected to allow access by child class.
8129         (Sized_relobj::do_relocate_sections): New method declaration.
8130         (Sized_relobj::relocate_sections): Virtualize.
8131         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8132         Sized_relobj::relocate_sections.  Instantiate template explicitly
8133         for different target sizes and endianity.
8134
8135 2009-10-24  Doug Kwan  <dougkwan@google.com>
8136
8137         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8138         (Arm_input_section::as_arm_input_section): New method.
8139         (Arm_output_section): New class definition.
8140         (Arm_output_section::create_stub_group,
8141         Arm_output_section::group_sections): New method definitions.
8142
8143 2009-10-22  Doug Kwan  <dougkwan@google.com>
8144
8145         * arm.cc (Arm_input_section): New class definition.
8146         (Arm_input_section::init, Arm_input_section:do_write,
8147         Arm_input_section::set_final_data_size,
8148         Arm_input_section::do_reset_address_and_file_offset): New method
8149         definitions.
8150
8151 2009-10-21  Doug Kwan  <dougkwan@google.com>
8152
8153         * arm.cc (Stub_table, Arm_input_section): New forward class
8154         declarations.
8155         (Stub_table): New class defintion.
8156         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8157         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8158         New method definition.
8159
8160 2009-10-21  Doug Kwan  <dougkwan@google.com>
8161
8162         * arm.cc: Update copyright comments.
8163         (Target_arm): New forward class template declaration.
8164         (Arm_address): New type.
8165         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8166         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8167         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8168         constants.
8169         (Insn_template): Same.
8170         (DEF_STUBS): New macro.
8171         (Stub_type): New enum type.
8172         (Stub_template): New class definition.
8173         (Stub): Same.
8174         (Reloc_stub): Same.
8175         (Stub_factory): Same.
8176         (Target_arm::Target_arm): Initialize may_use_blx_ and
8177         should_force_pic_veneer_.
8178         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8179         Target_arm::should_force_pic_veneer,
8180         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8181         Target_arm::using_thumb_only, Target_arm:;default_target): New
8182         method defintions.
8183         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8184         New data member declarations.
8185         (Insn_template::size, Insn_template::alignment): New method defintions.
8186         (Stub_template::Stub_template): New method definition.
8187         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8188         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8189         (Stub_factory::Stub_factory): New method definition.
8190         * gold.h (string_hash): New template.
8191         * output.h (Input_section_specifier::hash_value): Use
8192         gold::string_hash.
8193         (Input_section_specifier::string_hash): Remove.
8194         * stringpool.cc (Stringpool_template::string_hash): Use
8195         gold::string_hash.
8196
8197 2009-10-20  Doug Kwan  <dougkwan@google.com>
8198
8199         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8200         symbols of relaxed input sections.
8201         * output.h (Output_section::find_relaxed_input_section): Make
8202         method public.
8203
8204 2009-10-16  Doug Kwan  <dougkwan@google.com>
8205
8206         * dynobj.cc (Versions::Versions): Initialize version_script_.
8207         Only insert base version symbol definition for a shared object
8208         if version script defines any version versions.
8209         (Versions::define_base_version): New method definition.
8210         (Versions::add_def): Check that base version is not needed.
8211         (Versions::add_need): Define base version lazily.
8212         * dynobj.h (Versions::define_base_version): New method declaration.
8213         (Versions::needs_base_version_): New data member declaration.
8214         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8215         (check_DATA): Add no_version_test.stdout.
8216         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8217         New make rules.
8218         * testsuite/Makefile.in: Regenerate.
8219         * testsuite/no_version_test.c: New file.
8220         * testsuite/no_version_test.sh: Ditto.
8221
8222 2009-10-16  Doug Kwan  <dougkwan@google.com>
8223
8224         * expression.cc (class Segment_start_expression): New class definition.
8225         (Segment_start_expression::value): New method definition.
8226         (script_exp_function_segment_start): Return a new
8227         Segment_start_expression.
8228         * gold/script-c.h (script_saw_segment_start_expression): New function
8229         prototype.
8230         * script-sections.cc (Script_sections::Script_sections): Initialize
8231         SAW_SEGMENT_START_EXPRESSION_ to false.
8232         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8233         and -Tbbs options to specify section addresses if given in
8234         command line and no SEGMENT_START expression is seen in a script.
8235         * script-sections.h (Script_sections::saw_segment_start_expression,
8236         Script_sections::set_saw_segment_start_expression): New method
8237         definition.
8238         (Script_sections::saw_segment_start_expression_): New data member
8239         declaration.
8240         * script.cc (script_saw_segment_start_expression): New function.
8241         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8242         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8243         script_test_7.sh and script_test_8.sh.
8244         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8245         script_test_8.stdout.
8246         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8247         (script_test_6, script_test_6.stdout, script_test_7,
8248         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8249         * Makefile.in: Regenerate.
8250         * testsuite/script_test_6.sh: New file.
8251         * testsuite/script_test_6.t: Same.
8252         * testsuite/script_test_7.sh: Same.
8253         * testsuite/script_test_7.t: Same.
8254         * testsuite/script_test_8.sh: Same.
8255
8256 2009-10-16  Doug Kwan  <dougkwan@google.com>
8257
8258         * output.cc (Output_segment::set_section_list_address): Cast
8259         expressions to unsigned long long type to avoid format warnings.
8260
8261 2009-10-15  Ian Lance Taylor  <iant@google.com>
8262
8263         * script.cc (Script_options::add_symbol_assignment): Always add a
8264         dot assignment to script_sections_.
8265         * script-sections.cc (Script_sections::add_dot_assignment):
8266         Initialize if necessary.
8267
8268         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8269         program headers with no load segment if there is a linker script.
8270
8271         * layout.cc (Layout::set_segment_offsets): Align the file offset
8272         to the segment aligment for -N or -n with no load segment.
8273         * output.cc (Output_segment::add_output_section): Don't crash if
8274         the first section is a TLS section.
8275         (Output_segment::set_section_list_addresses): Print an error
8276         message if the address moves backward in a linker script.
8277         * script-sections.cc
8278         (Output_section_element_input::set_section_addresses): Don't
8279         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8280         (Orphan_output_section::set_section_addresses): Likewise.
8281
8282 2009-10-15  Doug Kwan  <dougkwan@google.com>
8283
8284         * layout.cc (Layout::finish_dynamic_section): Generate tags
8285         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8286         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8287         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8288
8289 2009-10-14  Ian Lance Taylor  <iant@google.com>
8290
8291         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8292         fields.
8293         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8294         data_shdr fields of relinfo.
8295         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8296         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8297         R_386_TLS_LDO_32, adjust based on section flags.
8298         (Target_i386::Relocate::fix_up_ldo): Remove.
8299
8300 2009-10-13  Ian Lance Taylor  <iant@google.com>
8301
8302         Add support for -pie.
8303         * options.h (class General_options): Add -pie and
8304         --pic-executable.
8305         (General_options::output_is_position_independent): Test -pie.
8306         (General_options::output_is_executable): Return true if not shared
8307         and not relocatable.
8308         (General_options::output_is_pie): Remove.
8309         * options.cc (General_options::finalize): Reject incompatible uses
8310         of -pie.
8311         * gold.cc (queue_middle_tasks): A -pie link is not static.
8312         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8313         * symtab.cc (Symbol::final_value_is_known): Return false if
8314         output_is_position_independent.
8315         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8316         output_is_position_independent.
8317         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8318         output_is_position_independent.
8319         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8320         output_is_position_independent.
8321         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8322         two_file_pie_test.
8323         (basic_pie_test.o, basic_pie_test): New targets.
8324         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8325         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8326         (two_file_pie_test): New target.
8327         * testsuite/Makefile.in: Rebuild.
8328         * README: Remove note saying that -pie is not supported.
8329
8330 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8331
8332         * options.h (class General_options): Add -init and -fini.
8333         * layout.cc (Layout::finish_dynamic_section): Emit
8334         given init and fini functions.
8335
8336 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8337
8338         * gc.h (gc_process_relocs): Check if icf is enabled using new
8339         function.
8340         * gold.cc (queue_initial_tasks): Likewise.
8341         (queue_middle_tasks): Likewise.
8342         * object.cc (do_layout): Likewise.
8343         * symtab.cc (is_section_folded): Likewise.
8344         * main.cc (main): Likewise.
8345         * reloc.cc (Read_relocs::run): Likewise.
8346         (Sized_relobj::do_scan_relocs): Likewise.
8347         * icf.cc (is_function_ctor_or_dtor): New function.
8348         (Icf::find_identical_sections): Check if function is ctor or dtor when
8349         safe icf is chosen.
8350         * options.h (General_options::icf): Change option to be an enum.
8351         (Icf_status): New enum.
8352         (icf_enabled): New method.
8353         (icf_safe_folding): New method.
8354         (set_icf_status): New method.
8355         (icf_status_): New variable.
8356         * (options.cc) (General_options::finalize): Set icf_status_.
8357         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8358         icf_test and icf_keep_unique_test to use the --icf enum flag.
8359         * testsuite/icf_safe_test.sh: New file.
8360         * testsuite/icf_safe_test.cc: New file.
8361
8362 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8363
8364         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8365         includes to gc.h and icf.h.
8366         * arm.cc: Include gc.h.
8367         * gold.cc: Likewise.
8368         * i386.cc: Likewise.
8369         * powerpc.cc: Likewise.
8370         * sparc.cc: Likewise.
8371         * x86_64.cc: Likewise.
8372         * gc.h: Include icf.h.
8373
8374 2009-10-11  Ian Lance Taylor  <iant@google.com>
8375
8376         * plugin.cc: Include "gold.h" before other header files.
8377
8378 2009-10-10  Chris Demetriou  <cgd@google.com>
8379
8380         * options.h (Input_file_argument::Input_file_type): New enum.
8381         (Input_file_argument::is_lib_): Replace with...
8382         (Input_file_argument::type_): New member.
8383         (Input_file_argument::Input_file_argument): Take Input_file_type
8384         'type' rather than boolean 'is_lib' as second argument.
8385         (Input_file_argument::is_lib): Use type_.
8386         (Input_file_argument::is_searched_file): New function.
8387         (Input_file_argument::may_need_search): Handle is_searched_file.
8388         * options.cc (General_options::parse_library): Support -l:filename.
8389         (General_options::parse_just_symbols): Update for Input_file_argument
8390         changes.
8391         (Command_line::process): Likewise.
8392         * archive.cc (Archive::get_file_and_offset): Likewise.
8393         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8394         * script.cc (read_script_file, script_add_file): Likewise.
8395         * fileread.cc (Input_file::Input_file): Likewise.
8396         (Input_file::will_search_for): Handle is_searched_file.
8397         (Input_file::open): Likewise.
8398         * readsyms.cc (Read_symbols::get_name): Likewise.
8399         * testsuite/Makefile.am (searched_file_test): New test.
8400         * testsuite/Makefile.in: Regenerate.
8401         * testsuite/searched_file_test.cc: New file.
8402         * testsuite/searched_file_test_lib.cc: New file.
8403
8404 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8405             Ian Lance Taylor  <iant@google.com>
8406
8407         * descriptor.cc: Include <cstdio> and "binary-io.h".
8408         (Descriptors::open): Open the files in binary mode always.
8409         * script.cc (Lex::get_token): Treat \r as whitespace.
8410
8411 2009-10-09  Ian Lance Taylor  <iant@google.com>
8412
8413         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8414
8415 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8416             Ian Lance Taylor  <iant@google.com>
8417
8418         * configure.ac: Check for readv function also.
8419         * fileread.cc (readv): Define if not HAVE_READV.
8420         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8421         does not exist.
8422         * config.in: Regenerate.
8423         * configure: Regenerate.
8424
8425 2009-10-09  Doug Kwan  <dougkwan@google.com>
8426
8427         * layout.cc (Layout::make_output_section): Call target hook to make
8428         ordinary output section.
8429         (Layout::finalize): Adjust parameter list of call the
8430         Target::may_relax().
8431         * layout.h (class Layout::section_list): New method.
8432         * merge.h (Output_merge_base::entsize): Change visibility to public.
8433         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8434         New methods.
8435         (Output_merge_string::do_is_string): New method.
8436         * object.cc (Sized_relobj::do_setup): renamed from
8437         Sized_relobj::set_up.
8438         * object.h (Sized_relobj::adjust_shndx,
8439         Sized_relobj::initializ_input_to_output_maps,
8440         Sized_relobj::free_input_to_output_maps): Change visibilities to
8441         protected.
8442         (Sized_relobj::setup): Virtualize.
8443         (Sized_relobj::do_setup): New method declaration.
8444         (Sized_relobj::invalidate_section_offset,
8445         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8446         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8447         * options.cc (parse_int): New function.
8448         * options.h (parse_int): New declaration.
8449         (DEFINE_int): New macro.
8450         (stub_group_size): New option.
8451         * output.cc (Output_section::Output_section): Initialize memebers
8452         merge_section_map_, merge_section_by_properties_map_,
8453         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8454         (Output_section::add_input_section): Handled deferred code-fill
8455         generation and remove an old comment.
8456         (Output_section::add_relaxed_input_section): New method definition.
8457         (Output_section::add_merge_input_section): Use merge section by
8458         properties map to speed to search.  Update merge section maps
8459         as appropriate.
8460         (Output_section::build_relaxation_map): New method definition.
8461         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8462         Same.
8463         (Output_section::relax_input_section): Renamed to
8464         Output_section::convert_input_sections_to_relaxed_sections and change
8465         interface to take a vector of pointers to relaxed sections.
8466         (Output_section::find_merge_section,
8467         Output_section::find_relaxed_input_section): New method definitions.
8468         (Output_section::is_input_address_mapped,
8469         Output_section::output_offset, Output_section::output_address):
8470         Use output section data maps to speed up searching.
8471         (Output_section::find_starting_output_address): Add comments.
8472         (Output_section::do_write,
8473         Output_section::write_to_postprocessing_buffer): Do code-fill
8474         generation as appropriate.
8475         (Output_section::get_input_sections): Invalidate relaxed input section
8476         map.
8477         (Output_section::restore_states): Adjust type of checkpoint .
8478         Invalidate relaxed input section map.
8479         * output.h (Output_merge_base): New class declaration.
8480         (Input_section_specifier): New class defintion.
8481         (class Output_relaxed_input_section) Change base class to
8482         Output_section_data_build.
8483         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8484         base class initializer.
8485         (Output_section::add_relaxed_input_section): New method declaration.
8486         (Output_section::Input_section): Change visibility to protected.
8487         (Output_section::Input_section::relobj,
8488         Output_section::Input_section::shndx): Handle relaxed input sections.
8489         Output_section::input_sections) Change visibility to protected.  Also
8490         define overload to return a non-const pointer.
8491         (Output_section::Merge_section_properties): New class defintion.
8492         (Output_section::Merge_section_by_properties_map,
8493         Output_section::Output_section_data_by_input_section_map,
8494         Output_section::Relaxation_map): New types.
8495         (Output_section::relax_input_section): Rename method to
8496         Output_section::convert_input_sections_to_relaxed_sections and change
8497         interface to take a vector of relaxed section pointers.
8498         (Output_section::find_merge_section,
8499         Output_section::find_relaxed_input_section,
8500         Output_section::build_relaxation_map,
8501         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8502         New method declarations.
8503         (Output_section::merge_section_map_
8504         Output_section::merge_section_by_properties_map_,
8505         Output_section::relaxed_input_section_map_,
8506         Output_section::is_relaxed_input_section_map_valid_,
8507         Output_section::generate_code_fills_at_write_): New data members.
8508         * script-sections.cc
8509         (Output_section_element_input::set_section_addresses): Call
8510         current_data_size and addralign methods of relaxed input sections.
8511         (Orphan_output_section::set_section_addresses): Call current_data_size
8512         and addralign methods of relaxed input sections.
8513         * symtab.cc (Symbol_table::compute_final_value): Extract template
8514         from the body of Symbol_table::sized_finalize_symbol.
8515         (Symbol_table::sized_finalized_symbol): Call
8516         Symbol_table::compute_final_value.
8517         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8518         (Symbol_table::compute_final_value): New templated method declaration.
8519         * target.cc (Target::do_make_output_section): New method defintion.
8520         * target.h (Target::make_output_section): New method declaration.
8521         (Target::relax): Add more parameters for input objects, symbol table
8522         and layout.  Adjust call to do_relax.
8523         (Target::do_make_output_section): New method declaration.
8524         (Target::do_relax): Add parameters for input objects, symbol table
8525         and layout.
8526
8527 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8528
8529         * pread.c: Include stdio.h.
8530
8531 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8532
8533         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8534         defined.
8535
8536 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8537
8538         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8539         Change read_shndx type to unsigned int.
8540         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8541         int.
8542         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8543         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8544         Change read_shndx type to unsigned int.
8545         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8546         int.
8547         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8548         * layout.cc (Layout::create_symtab_sections): Cast the result of
8549         local_symcount * symsize to off_t in the gold_assert.
8550
8551 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8552
8553         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8554         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8555         R_ARM_BASE_ABS.
8556         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8557         (Arm_relocate_functions::thm_abs5): New function.
8558         (Arm_relocate_functions::abs12): New function.
8559         (Arm_relocate_functions::abs16): New function.
8560         (Arm_relocate_functions::base_abs): New function.
8561         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8562         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8563         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8564         R_ARM_BASE_ABS.
8565         (Scan::global): Likewise.
8566         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8567         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8568         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8569         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8570         R_ARM_BASE_ABS.
8571
8572 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8573
8574         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8575         (Arm_relocate_functions::movt_prel): New function.
8576         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8577         (Arm_relocate_functions::thm_movt_prel): New function.
8578         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8579         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8580         (Scan::global, Relocate::relocate): Likewise.
8581         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8582
8583 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8584
8585         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8586         Incremental_checker.
8587         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8588         unsigned int.
8589         (class Incremental_inputs_header): New class.
8590         (Incremental_inputs_header_writer): Edit comment.
8591         (Incremental_inputs_entry): New class.
8592         (Incremental_inputs_entry_writer): Edit comment.
8593         (Sized_incremental_binary::do_find_incremental_inputs_section):
8594         Add *strtab_shndx parameter, fill it.
8595         (Sized_incremental_binary::do_check_inputs): New method.
8596         (Incremental_checker::can_incrementally_link_output_file): Use
8597         Sized_incremental_binary::check_inputs.
8598         (Incremental_inputs::report_command_line): Save command line in
8599         command_line_.
8600         * incremental.h:
8601         (Incremental_binary::find_incremental_inputs_section): New
8602         method.
8603         (Incremental_binary::do_find_incremental_inputs_section): Add
8604         strtab_shndx parameter.
8605         (Incremental_binary::do_check_inputs): New pure virtual method.
8606         (Sized_incremental_binary::do_check_inputs): Declare.
8607         (Incremental_checker::Incremental_checker): Add incremental_inputs
8608         parameter, use it to initialize incremental_inputs_.
8609         (Incremental_checker::incremental_inputs_): New field.
8610         (Incremental_checker::command_line): New method.
8611         (Incremental_checker::inputs): New method.
8612         (Incremental_checker::command_line_): New field.
8613
8614 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8615
8616         * incremental.cc: Include <cstdarg> and "target-select.h".
8617         (vexplain_no_incremental): New function.
8618         (explain_no_incremental): New function.
8619         (Incremental_binary::error): New method.
8620         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8621         method.
8622         (make_sized_incremental_binary): New function.
8623         (open_incremental_binary): New function.
8624         (can_incrementally_link_file): Add checks if output is ELF and has
8625         inputs section.
8626         * incremental.h: Include "elfcpp_file.h" and "output.h".
8627         (Incremental_binary): New class.
8628         (Sized_incremental_binary): New class.
8629         (open_incremental_binary): Declare.
8630         * object.cc (is_elf_object): Use
8631         elfcpp::Elf_recognizer::is_elf_file.
8632         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8633         * output.h (Output_file::filesize): New method.
8634
8635 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8636
8637         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8638         New function.
8639         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8640         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8641         function.
8642         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8643         function.
8644         (Arm_relocate_functions::movw_abs_nc): New function.
8645         (Arm_relocate_functions::movt_abs): New function.
8646         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8647         (Arm_relocate_functions::thm_movt_abs): New function.
8648         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8649         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8650         (Scan::global): Likewise.
8651         (Relocate::relocate): Likewise.
8652         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8653
8654 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8655
8656         * arm.cc (Arm_relocate_functions::got_prel) New function.
8657         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8658         (Relocate::relocate): Likewise.
8659         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8660
8661 2009-10-06  Ian Lance Taylor  <iant@google.com>
8662
8663         * options.h (class General_options): Define
8664         split_stack_adjust_size parameter.
8665         * object.h (class Object): Add uses_split_stack_ and
8666         has_no_split_stack_ fields.  Add uses_split_stack and
8667         has_no_split_stack accessor functions.  Declare
8668         handle_split_stack_section.
8669         (class Reloc_symbol_changes): Define.
8670         (class Sized_relobj): Define Function_offsets.  Declare
8671         split_stack_adjust, split_stack_adjust_reltype, and
8672         find_functions.
8673         * object.cc (Object::handle_split_stack_section): New function.
8674         (Sized_relobj::do_layout): Call handle_split_stack_section.
8675         * dynobj.cc (Sized_dynobj::do_layout): Call
8676         handle_split_stack_section.
8677         * reloc.cc (Sized_relobj::relocate_sections): Call
8678         split_stack_adjust for executable sections in split_stack
8679         objects.  Pass reloc_map to relocate_section.
8680         (Sized_relobj::split_stack_adjust): New function.
8681         (Sized_relobj::split_stack_adjust_reltype): New function.
8682         (Sized_relobj::find_functions): New function.
8683         * target-reloc.h: Include "object.h".
8684         (relocate_section): Add reloc_symbol_changes parameter.  Change
8685         all callers.
8686         * target.h (class Target): Add calls_non_split method.  Declare
8687         do_calls_non_split virtual method.  Declare match_view and
8688         set_view_to_nop.
8689         * target.cc: Include "elfcpp.h".
8690         (Target::do_calls_non_split): New function.
8691         (Target::match_view): New function.
8692         (Target::set_view_to_nop): New function.
8693         * gold.cc (queue_middle_tasks): Give an error if mixing
8694         split-stack and non-split-stack objects with -r.
8695         * i386.cc (Target_i386::relocate_section): Add
8696         reloc_symbol_changes parameter.
8697         (Target_i386::do_calls_non_split): New function.
8698         * x86_64.cc (Target_x86_64::relocate_section): Add
8699         reloc_symbol_changes parameter.
8700         (Target_x86_64::do_calls_non_split): New function.
8701         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8702         parameter.
8703         * powerpc.cc (Target_powerpc::relocate_section): Add
8704         reloc_symbol_changes parameter.
8705         * sparc.cc (Target_sparc::relocate_section): Add
8706         reloc_symbol_changes parameter.
8707         * configure.ac: Call AM_CONDITIONAL for the default target.
8708         * configure: Rebuild.
8709         * testsuite/Makefile.am (TEST_AS): New variable.
8710         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8711         (check_DATA): Add split_i386 and split_x86_64 files.
8712         (SPLIT_DEFSYMS): Define.
8713         (split_i386_[1234n].o): New targets.
8714         (split_i386_[124]): New targets.
8715         (split_i386_[1234r].stdout): New targets.
8716         (split_x86_64_[1234n].o): New targets.
8717         (split_x86_64_[124]): New targets.
8718         (split_x86_64_[1234r].stdout): New targets.
8719         (MOSTLYCLEANFILES): Add new executables.
8720         * testsuite/split_i386.sh: New file.
8721         * testsuite/split_x86_64.sh: New file.
8722         * testsuite/split_i386_1.s: New file.
8723         * testsuite/split_i386_2.s: New file.
8724         * testsuite/split_i386_3.s: New file.
8725         * testsuite/split_i386_4.s: New file.
8726         * testsuite/split_i386_n.s: New file.
8727         * testsuite/split_x86_64_1.s: New file.
8728         * testsuite/split_x86_64_2.s: New file.
8729         * testsuite/split_x86_64_3.s: New file.
8730         * testsuite/split_x86_64_4.s: New file.
8731         * testsuite/split_x86_64_n.s: New file.
8732         * testsuite/testfile.cc (Target_test): Update relocation_section
8733         function.
8734         * testsuite/Makefile.in: Rebuild.
8735
8736 2009-10-06  Ian Lance Taylor  <iant@google.com>
8737
8738         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8739         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8740         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8741         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8742         the address on ldo_addrs_.
8743         (Target_i386::Relocate::fix_up_ldo): New function.
8744
8745 2009-10-06   Rafael Espindola  <espindola@google.com>
8746
8747         * plugin.cc (add_input_library): New.
8748         (Plugin::load): Add add_input_library to tv.
8749         (Plugin_manager::add_input_file): Add the is_lib argument.
8750         (add_input_file): Update call to Plugin_manager::add_input_file.
8751         (add_input_library): New.
8752         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8753
8754 2009-09-30  Doug Kwan  <dougkwan@google.com>
8755
8756         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8757         symbol and call Symbol::may_need_copy_reloc to determine if
8758         a copy reloc is needed.
8759         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8760         nocopyreloc is given in command line.
8761         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8762         given in command line.
8763         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8764         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8765         of the removed Target_i386::may_need_copy_reloc.
8766         * options.h (copyreloc): New option with default value false.
8767         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8768         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8769         instead of the removed Target_powerpc::may_need_copy_reloc.
8770         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8771         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8772         instead of the removed Target_sparc::may_need_copy_reloc.
8773         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8774         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8775         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8776         instead of the removed Target_x86_64::may_need_copy_reloc.
8777
8778 2009-09-30  Ian Lance Taylor  <iant@google.com>
8779
8780         * object.h (class Object): Remove target_ field, and target,
8781         sized_target, and set_target methods.
8782         (Object::sized_target): Remove.
8783         (class Sized_relobj): Update declarations.  Remove sized_target.
8784         * object.cc (Sized_relobj::setup): Remove target parameter.
8785         Change all callers.
8786         (Input_objects::add_object): Don't do anything with the target.
8787         (make_elf_sized_object): Add punconfigured parameter.  Change all
8788         callers.  Set or test parameter target.
8789         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8790         Change all callers.
8791         * parameters.cc (Parameters::set_target): Change parameter type to
8792         be non-const.
8793         (Parameters::default_target): Remove.
8794         (set_parameters_target): Change parameter type to be non-const.
8795         (parameters_force_valid_target): New function.
8796         (parameters_clear_target): New function.
8797         * parameters.h (class Parameters): Update declarations.  Remove
8798         default_target method.  Add sized_target and clear_target
8799         methods.  Change target_ to be non-const.
8800         (set_parameters_target): Update declaration.
8801         (parameters_force_valid_target): Declare.
8802         (parameters_clear_target): Declare.
8803         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8804         as NULL if we aren't searching.
8805         (Add_symbols::run): Don't check for compatible target.
8806         * fileread.cc (Input_file::open_binary): Call
8807         parameters_force_valid_target.
8808         * gold.cc (queue_middle_tasks): Likewise.
8809         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
8810         set_target on object.
8811         * dynobj.h (class Sized_dynobj): Update declarations.
8812         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8813         make_elf_object returns NULL.
8814         (Archive::include_member): Don't check whether object target is
8815         compatible.
8816         * output.cc (Output_section::add_input_section): Get target from
8817         parameters.
8818         (Output_section::relax_input_section): Likewise.
8819         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8820         parameters.
8821         (Sized_relobj::do_scan_relocs): Likewise.
8822         (Sized_relobj::relocate_sections): Likewise.
8823         * resolve.cc (Symbol_table::resolve): Likewise.
8824         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
8825         parameter.  Change all callers.
8826         (Symbol_table::add_from_object): Get target from parameters.
8827         (Symbol_table::add_from_relobj): Don't check object target.
8828         (Symbol_table::add_from_dynobj): Likewise.
8829         (Symbol_table::define_special_symbol): Get target from
8830         parameters.
8831         * symtab.h (class Symbol_table): Update declaration.
8832         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8833         parameter.  Change all callers.  Clear parameter target.
8834         (Binary_test): Test target here.
8835         * testsuite/object_unittest.cc (gold_testsuite): Remove
8836         target_test_pointer parameter.  Change all callers.
8837         (Object_test): Test target here.
8838
8839 2009-09-26  Ian Lance Taylor  <iant@google.com>
8840
8841         * testsuite/initpri1.c: Don't try to use constructor priorities if
8842         compiling with gcc before 4.3.
8843
8844 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
8845
8846         * testsuite/retain_symbols_file_test.sh (check_present): Change
8847         output file name to retain_symbols_file_test.stdout.
8848         (check_absent): Likewise.
8849
8850 2009-09-18  Craig Silverstein  <csilvers@google.com>
8851
8852         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8853         * options.cc: Include <cerrno> and <fstream>.
8854         (General_options::finalize): Parse -retain-symbols-file tag.
8855         * options.h: New flag.
8856         (General_options): New method should_retain_symbol, new
8857         variable symbols_to_retain.
8858         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8859         should_retain_symbol map.
8860         * testsuite/Makefile.am (retain_symbols_file_test): New test.
8861         * testsuite/Makefile.in: Regenerate.
8862         * testsuite/retain_symbols_file_test.sh: New file.
8863
8864 2009-09-18  Nick Clifton  <nickc@redhat.com>
8865
8866         * po/es.po: Updated Spanish translation.
8867
8868 2009-09-17  Doug Kwan  <dougkwan@google.com>
8869
8870         * debug.h (DEBUG_RELAXATION): New constant.
8871         (DEBUG_ALL): Add DEBUG_RELAXATION.
8872         (debug_string_to_enum): Add relaxation debug option.
8873         * layout.cc
8874         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8875         Layout::Relaxation_debug_check::read_sections,
8876         Layout::Relaxation_debug_check::read_sections): New method definitions.
8877         (Layout::Layout): Initialize data members
8878         record_output_section_data_from_scrips_,
8879         script_output_section_data_list_ and relaxation_debug_check_.
8880         (Layout::save_segments, Layout::restore_segments,
8881         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8882         Layout::relaxation_loop_body): New method definitions.
8883         (Layout::finalize): Support relaxation.  Move section layout code to
8884         Layout::relaxation_loop_body.
8885         (Layout::set_asection_address_from_script): Move code for orphan
8886         section placement out.
8887         (Layout::place_orphan_sections_in_script): New method definition.
8888         * layout.h (Output_segment_headers, Output_file_header):
8889         New forward class declarations.
8890         (Layout::~Layout): Define.
8891         (Layout::new_output_section_data_from_script): New method definition.
8892         (Layout::place_orphan_sections_in_script): New method declaration.
8893         (Layout::Segment_states): New type declaration.
8894         (Layout::save_segments, Layout::restore_segments,
8895         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8896         Layout::relaxation_loop_body): New method declarations.
8897         (Layout::Output_section_data_list): New type declaration.
8898         (Layout::Relaxation_debug_check): New class definition.
8899         (Layout::record_output_section_data_from_script_,
8900         Layout::script_output_section_data_list_, Layout::segment_states_,
8901         Layout::relaxation_debug_check_): New data members.
8902         * output.cc: (Output_section_headers::do_size): New method definition.
8903         (Output_section_headers::Output_section_headers): Move size
8904         computation to Output_section_headers::do_size.
8905         (Output_segment_headers::do_size): New method definition.
8906         (Output_file_header::Output_file_header): Move size computation to
8907         Output_file_header::do_size and call it.
8908         (Output_file_header::do_size): New method definition.
8909         (Output_data_group::Output_data_group): Adjust call to
8910         Output_section_data.
8911         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8912         (Output_symtab_xindex::do_write): Add array bound check.
8913         (Output_section::Input_section::print_to_mapfile): Handle
8914         RELAXED_INPUT_SECTION_CODE.
8915         (Output_section::Output_section): Initialize data member checkpoint_.
8916         (Output_section::~Output_section): Delete checkpoint object pointed
8917         by checkpoint_.
8918         (Output_section::add_input_section): Always add an Input_section if
8919         relaxing.
8920         (Output_section::add_merge_input_section): Add assert.
8921         (Output_section::relax_input_section): New method definition.
8922         (Output_section::set_final_data_size): Set load address to zero for
8923         an unallocated section.
8924         (Output_section::do_address_and_file_offset_have_reset_values):
8925         New method definition.
8926         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8927         Handle relaxed input section.
8928         (Output_section::sort_attached_input_sections): Checkpoint input
8929         section list lazily.
8930         (Output_section::get_input_sections): Change type of input_sections to
8931         list of Simple_input_section pointers.  Checkpoint input section list
8932         lazily.  Also handle relaxed input sections.
8933         (Output_section::add_input_section_for_script): Take a reference to
8934         a Simple_input_section object instead of Relobj pointer and section
8935         index as parameter.  Handle relaxed input sections.
8936         (Output_section::save_states, Output_section::restore_states): New
8937         method definitions.
8938         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8939         (Output_data::is_data_size_fixed): New method definition.
8940         (Output_data::reset_addresss_and_file_offset): Do not reset data size
8941         if it is fixed.
8942         (Output_data::address_and_file_offset_have_reset_values): New method
8943         definition.
8944         (Output_data::do_address_and_file_offset_have_reset_values): New method
8945         definition.
8946         (Output_data::set_data_size): Check that data size is not fixed.
8947         (Output_data::fix_data_size): New method definition.
8948         (Output_data::is_data_size_fixed_): New data member.
8949         (Output_section_headers::set_final_data_size): New method definition.
8950         (Output_section_headers::do_size): New method declaration.
8951         (Output_segment_headers::set_final_data_size): New method definition.
8952         (Output_segment_headers::do_size): New method declaration.
8953         (Output_file_header::set_final_data_size)::New method definition.
8954         (Output_file_header::do_size)::New method declaration.
8955         (Output_section_data::Output_section_data): Add new parameter
8956         is_data_size_fixed and use it to fix data size.
8957         (Output_data_const::Output_data_const): Adjust call to base class
8958         constructor and fix data size.
8959         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8960         base class constructor and fix data size.
8961         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8962         base class constructor and fix data size.
8963         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8964         class constructor and fix data size.
8965         (Output_data_group::set_final_data_size): New method definition.
8966         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8967         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8968         class constructor and fix data size.
8969         (Output_relaxed_input_section): New class definition.
8970         (Output_section::Simple_input_section): New class definition.
8971         (Output_section::get_input_sections): Adjust parameter list.
8972         (Output_section::add_input_section_for_script): Same.
8973         (Output_section::save_states, Output_section::restore_states,
8974         Output_section::do_address_and_file_offset_have_reset_values,
8975         (Output_section::Input_section::Input_section): Handle
8976         RELAXED_INPUT_SECTION_CODE.  Add new overload for
8977         Output_relaxed_input_section.
8978         (Output_section::Input_section::is_input_section,
8979         Output_section::Input_section::set_output_section): Handle relaxed
8980         input section.
8981         (Output_section::Input_section::is_relaxed_input_section,
8982         Output_section::Input_section::output_section_data,
8983         Output_section::Input_section::relaxed_input_section): New method
8984         definitions.
8985         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8986         value.
8987         (Output_section::Input_section::u1_): Update comments.
8988         (Output_section::Input_section::u2_): Add new union member poris.
8989         (Output_section::Checkpoint_output_section): New classs definition.
8990         (Output_section::relax_input_section): New method declaration.
8991         (Output_section::checkpoint_): New data member.
8992         (Output_segment): Update comments.
8993         (Output_segment::Output_segment): Un-privatize copy constructor.
8994         (Output_segment::operator=): Un-privatize.
8995         * script-sections.cc (Output_section_element::Input_section_list):
8996         Change element type to Output_section::Simple_input_section.
8997         (Output_section_element_dot_assignment::set_section_addresses):
8998         Register output section data for relaxation clean up.
8999         (Output_data_exression::Output_data_expression): Adjust call to base
9000         constructor to fix data size.
9001         (Output_section_element_data::set_section_addresses): Register
9002         Output_data_expression object for relaxation clean up.
9003         (struct Input_section_info): Replace Relobj pointer and section index
9004         pair with Output_section::Simple_input_section and Convert struct to a
9005         class.
9006         (Input_section_sorter::operator()): Adjust access to
9007         Input_section_info data member to use accessors.
9008         (Output_section_element_input::set_section_addresses): Use layout
9009         parameter.  Adjust code to use Output_section::Simple_input_section
9010         and Input_secction_info classes.  Register filler for relaxation
9011         clean up.
9012         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9013         and section index pair with Output_section::Simple_input_section
9014         class.  Adjust code accordingly.
9015         (Phdrs_element::release_segment): New method definition.
9016         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9017         segment list.
9018         (Script_sections::release_segments): New method definition.
9019         * gold/script-sections.h (Script_sections::release_segments): New
9020         method declaration.
9021         * gold/target.h (Target::may_relax, Target::relax,
9022         Target::do_may_relax, Target::do_relax): New method definitions.
9023
9024 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9025
9026         * arm.cc (has_signed_unsigned_overflow): New function.
9027         (Arm_relocate_functions::abs8): New function.
9028         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9029         (Target_arm::Scan::global): Likewise.
9030         (Target_arm::relocate::relocate): Likewise.
9031         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9032         Likewise.
9033
9034 2009-09-16  Cary Coutant  <ccoutant@google.com>
9035
9036         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9037         * testsuite/Makefile.in: Regenerate.
9038
9039 2009-09-11  Nick Clifton  <nickc@redhat.com>
9040
9041         * po/gold.pot: Updated by the Translation project.
9042
9043 2009-09-08  Cary Coutant  <ccoutant@google.com>
9044
9045         * output.cc (Output_file::open): Add execute permission to empty file.
9046         * testsuite/Makefile.am (permission_test): New test.
9047         * testsuite/Makefile.in: Regenerate.
9048
9049 2009-09-02  Ian Lance Taylor  <iant@google.com>
9050
9051         * output.cc (Output_file::resize): Call map_no_anonymous rather
9052         than map.
9053
9054 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9055
9056         * gold.cc: Include "incremental.h".
9057         (queue_initial_tasks): Call Incremental_checker methods.
9058         * incremental.cc: Include "output.h".
9059         (Incremental_checker::can_incrementally_link_output_file): New
9060         method.
9061         * incremental.h (Incremental_checker): New class.
9062
9063         * output.cc (Output_file::open_for_modification): New method.
9064         (Output_file::map_anonymous): Changed return type to bool.  Record
9065         map in base_ field.
9066         (Output_file::map_no_anonymous): New method, broken out of map.
9067         (Output_file::map): Use map_no_anonymous and map_anonymous.
9068         * output.h (class Output_file): Update declarations.
9069
9070 2009-08-24  Cary Coutant  <ccoutant@google.com>
9071
9072         * options.h (Command_line::Pre_options): New class.
9073         (Command_line::pre_options): New member.
9074         * options.cc (gold::options::ready_to_register): New variable.
9075         (One_option::register_option): Do nothing if not registering options.
9076         Assert if same short option registered twice.
9077         (General_options::General_options): Turn off option registration when
9078         done constructing.
9079         (Command_line::Pre_options::Pre_options): New constructor.
9080
9081 2009-08-24  Cary Coutant  <ccoutant@google.com>
9082
9083         * options.h (General_options::no_keep_memory): Remove incorrect
9084         short option.
9085
9086 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9087
9088         * Makefile.am (am__skiplex, am__skipyacc): New.
9089         * Makefile.in: Regenerate.
9090
9091 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9092
9093         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9094         (INCLUDES): ... this.
9095         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9096         (AM_CPPFLAGS): Renamed from ...
9097         (INCLUDE): ... this.
9098         * Makefile.in, testsuite/Makefile.in: Regenerate.
9099
9100         * Makefile.in: Regenerate.
9101         * aclocal.m4: Likewise.
9102         * config.in: Likewise.
9103         * configure: Likewise.
9104         * testsuite/Makefile.in: Likewise.
9105
9106         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9107         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9108         * Makefile.in: Regenerate.
9109         * testsuite/Makefile.in: Regenerate.
9110
9111 2009-08-19  Cary Coutant  <ccoutant@google.com>
9112
9113         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9114         symbols in shared libraries overridden by hidden or internal symbols
9115         in the main program.
9116
9117 2009-08-19  Chris Demetriou  <cgd@google.com>
9118
9119         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9120         checking source file names in error messages.
9121
9122 2009-08-18  Doug Kwan  <dougkwan@google.com>
9123
9124         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9125         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9126         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9127         an elfcpp::Ehdr as parameter.
9128         * object.cc (Object::set_target): Remove the version that looks up
9129         a target and sets it.
9130         (Sized_relobj::setup): Take a Target object instead of
9131         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9132         (make_elf_sized_object): Find target and ask target to
9133         make an ELF object.
9134         * object.h: (Object::set_target): Remove the version that looks up
9135         a target and sets it.
9136         (Sized_relobj::setup): Take a Target object instead of
9137         an elfcpp:Ehdr as parameter.
9138         * target.cc: Include dynobj.h.
9139         (Target::do_make_elf_object_implementation): New.
9140         (Target::do_make_elf_object): New.
9141         * target.h (Target::make_elf_object): New template declaration.
9142         (Target::do_make_elf_object): New method declarations.
9143         (Target::do_make_elf_object_implementation): New template declaration.
9144
9145 2009-08-14  Ian Lance Taylor  <iant@google.com>
9146
9147         * gold.h (FUNCTION_NAME): Define.
9148         (gold_unreachable): Use FUNCTION_NAME.
9149
9150 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9151
9152         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9153         symbol in the --keep-unique list is not found.
9154
9155 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9156
9157         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9158         been maked as --keep-unique.
9159         (Icf::unfold_section): New function.
9160         * icf.h (Icf::unfold_section): New function.
9161         * options.h (General_options::keep_unique): New option.
9162         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9163         * testsuite/Makefile.in: Regenerate.
9164         * testsuite/icf_keep_unique_test.sh: New file.
9165         * testsuite/icf_keep_unique_test.cc: New file.
9166
9167 2009-08-12  Cary Coutant  <ccoutant@google.com>
9168
9169         PR 10471
9170         * resolve.cc (Symbol_table::resolve): Check for references from
9171         dynamic objects to hidden and internal symbols.
9172         * testsuite/Makefile.am (hidden_test.sh): New test.
9173         * testsuite/Makefile.in: Regenerate.
9174         * testsuite/hidden_test.sh: New script.
9175         * testsuite/hidden_test_1.c: New test source.
9176         * testsuite/hidden_test_main.c: New test source.
9177
9178 2009-08-11  Doug Kwan  <dougkwan@google.com>
9179
9180         * arm.cc: Update comments.
9181         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9182         segment to locate the .ARM.exidx section if present.
9183
9184 2009-08-09  Doug Kwan  <dougkwan@google.com>
9185
9186         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9187         patch.
9188
9189 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9190         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9191         compiler warnings.
9192
9193 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9194
9195         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9196         valid tls_segment only for non-debug-section relocations.
9197         * testsuite/Makefile.am: Add gc_tls_test.
9198         * testsuite/Makefile.in: Regenerate.
9199         * testsuite/gc_tls_test.cc: New file.
9200         * testsuite/gc_tls_test.sh: New file.
9201
9202 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9203
9204         * icf.cc: New file.
9205         * icf.h: New file.
9206         * Makefile.am (CCFILES): Add icf.cc.
9207         (HFILES): Add icf.h
9208         * Makefile.in: Regenerate.
9209         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9210         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9211         section, symbol and addend information for the relocs.
9212         * gold.cc (queue_middle_tasks): Call identical code folding.
9213         * gold.h: Add defines for multimap.
9214         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9215         to the call of finalize_local_symbols.
9216         * main.cc (main): Create object of class Icf.
9217         * object.cc (Sized_relobj::do_layout): Allow this function to be
9218         called twice during icf.
9219         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9220         to sections marked as identical by icf.
9221         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9222         when available.
9223         (Sized_relobj::do_section_entsize): New function.
9224         * object.h (Object::section_entsize): New function.
9225         (Object::do_section_entsize): New pure virtual function.
9226         (Relobj::finalize_local_symbols): Add new parameter.
9227         (Relobj::do_section_entsize): New function.
9228         * options.h (General_options::icf): New option.
9229         (General_options::icf_iterations): New option.
9230         (General_options::print_icf_sections): New option.
9231         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9232         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9233         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9234         icf.
9235         * symtab.cc (Symbol_table::is_section_folded): New function.
9236         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9237         to sections marked as identical by icf.
9238         * symtab.h (Symbol_table::set_icf): New function.
9239         (Symbol_table::icf): New function.
9240         (Symbol_table::is_section_folded): New function.
9241         (Symbol_table::icf_): New data member.
9242         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9243         * testsuite/Makefile.am: Add commands to build icf_test.
9244         * testsuite/Makefile.in: Regenerate.
9245         * testsuite/icf_test.sh: New file.
9246         * testsuite/icf_test.cc: New file.
9247
9248 2009-07-24  Chris Demetriou  <cgd@google.com>
9249
9250         * layout.cc (is_compressible_debug_section): Fix incorrect
9251         comment about compressed section names.
9252
9253 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9254
9255         PR 10419
9256         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9257
9258 2009-07-16  Ian Lance Taylor  <iant@google.com>
9259
9260         PR 10400
9261         * layout.h: #include <map>.
9262         (class Kept_section): Change from struct to class.  Add accessors
9263         and setters.  Add section size to Comdat_group mapping.  Change
9264         Comdat_group to std::map.  Add is_comdat_ field.  Add
9265         linkonce_size field in union.
9266         (class Layout): Update declaration of find_or_add_kept_section.
9267         Don't declare find_kept_object.
9268         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9269         parameter.  Add object, shndx, is_comdat, and is_group_name
9270         parameters.  Change all callers.  Adjust for new Kept_section.
9271         (Layout::find_kept_object): Remove.
9272         * object.cc (Sized_relobj::include_section_group): Update use of
9273         Kept_section.  Rename secnum to shndx.  Only record
9274         Kept_comdat_section if sections are the same size.
9275         (Sized_relobj::include_linkonce_section): Update use of
9276         Kept_section.  Only record Kept_comdat_section if sections are the
9277         same size.  Set size of linkonce section.
9278         (Sized_relobj::map_to_kept_section): Update call to
9279         get_kept_comdat_section.
9280         * object.h (class Sized_relobj): Rename fields in
9281         Kept_comdat_section to drop trailing underscores; change object
9282         field to Relobj*.  Change Kept_comdat_section_table to store
9283         struct rather than pointer.
9284         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9285         Add kept_object and kept_shndx parameters.  Change all callers.
9286         (Sized_relobj::get_kept_comdat_section): Change return type to
9287         bool.  Add kept_object and kept_shndx parameters.  Change all
9288         callers.
9289         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9290         Layout::find_or_add_kept_section.
9291
9292 2009-07-09  Ian Lance Taylor  <iant@google.com>
9293
9294         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9295         Reserve space in the hash table.
9296
9297 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9298
9299         * fileread.cc (File_read::get_mtime): New method.
9300         * fileread.h (Timespec): New structure.
9301         (File_read::get_mtime): New method.
9302         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9303         Renamed from timestamp_nsec.
9304         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9305         Elf_Xword.
9306         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9307         timestamp_nsec.
9308         (Incremental_inputs::report_archive): Save mtime; style fix.
9309         (Incremental_inputs::report_obejct): Save mtime; style fix.
9310         (Incremental_inputs::report_script): Save mtime; style fix.
9311         (Incremental_inputs::finalize_inputs): Style fix.
9312         (Incremental_inputs::finalize): Style fix.
9313         (Incremental_inputs::create_input_section_data): Store inputs
9314         mtime.
9315         * incremental.h (Incremental_inputs::report_script): Add mtime
9316         argument.
9317         (Incremental_inputs::Input_info::Input_info): Intialize only one
9318         union member.
9319         (Incremental_inputs::Input_info::archive): Move to nameless
9320         union.
9321         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9322         (Incremental_inputs::Input_info::script): Move to nameless union.
9323         (Incremental_inputs::mtime): New field.
9324         * script.cc (read_input_script): Pass file mtime to
9325         Incremental_input.
9326         * script.h (Script_info::inputs): Style fix.
9327
9328 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9329
9330         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9331         instead of 32.
9332
9333 2009-06-24  Ian Lance Taylor  <iant@google.com>
9334
9335         PR 10156
9336         * layout.cc (Layout::choose_output_section): If we find an
9337         existing section, update the flags.
9338         (Layout::create_notes): New function, broken out of
9339         Layout::finalize.
9340         (Layout::finalize): Don't create note sections.
9341         (Layout::create_note): Don't crash if linker script discards
9342         section.
9343         (Layout::create_gold_note): Likewise.
9344         (Layout::create_build_id): Likewise.  Don't set
9345         after_input_sections on the section.
9346         (Layout::create_executable_stack_info): Remove target parameter.
9347         Change caller.
9348         * layout.h (class Layout): Declare create_notes.  Update
9349         declaration of create_executable_stack_info.
9350         * gold.cc (queue_middle_tasks): Call create_notes.
9351         * output.cc (Output_section::update_flags_for_input_section): Move
9352         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9353         invalid.
9354         * output.h (Output_data::mark_address_invalid): New function.
9355         (class Output_section): Only declare, not define,
9356         update_flags_for_input_section.  Remove set_flags.
9357
9358 2009-06-24  Ian Lance Taylor  <iant@google.com>
9359
9360         * script-sections.cc (Output_section_definition::
9361         set_section_addresses): Rename shadowing local load_address to
9362         laddr.
9363
9364 2009-06-24  Ian Lance Taylor  <iant@google.com>
9365
9366         PR 10244
9367         * reloc.cc (relocate_sections): Skip empty relocation sections.
9368
9369 2009-06-23  Ian Lance Taylor  <iant@google.com>
9370
9371         PR 10156
9372         * layout.cc (Layout::create_note): Use choose_output_section
9373         rather than make_output_section.
9374
9375 2009-06-23  Ian Lance Taylor  <iant@google.com>
9376
9377         PR 10237
9378         * options.cc (General_options::parse_V): Set printed_version_.
9379         (General_options::General_options): Initialize printed_version_.
9380         * options.h (class General_options): Add printed_version_ field.
9381         * gold.cc (queue_initial_tasks): If there are no input files,
9382         don't give a fatal error if we printed the version information.
9383         (queue_middle_tasks): If using -r with a shared object, give a
9384         fatal error rather than an ordinary error.
9385
9386 2009-06-23  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10219
9389         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9390         (Layout::make_output_section): Set have_stabstr_section_ if we see
9391         a .stab*str section.
9392         (Layout::finalize): Call link_stabs_sections.
9393         (Layout::link_stabs_sections): New file.
9394         * layout.h (class Layout): Add have_stabstr_section_ field.
9395         Declare link_stabs_sections.
9396
9397 2009-06-23  Doug Kwan  <dougkwan@google.com>
9398
9399         * Makefile.am (libgold_a_LIBADD): New.
9400         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9401         * Makefile.in: Regenerate.
9402         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9403         * configure: Regenerate.
9404         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9405         * fileread.cc: Include sys/state.h
9406         * gold.h: Declare memmem and strndup if found missing.
9407         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9408
9409 2009-06-23  Ian Lance Taylor  <iant@google.com>
9410
9411         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9412         * configure: Rebuild.
9413
9414 2009-06-23  Ian Lance Taylor  <iant@google.com>
9415
9416         PR 10147
9417         * object.cc (Object::section_contents): Don't try to get a view if
9418         the section has length zero.
9419         (Object::handle_gnu_warning_section): If the section is empty, use
9420         the name of the section as the warning.
9421
9422 2009-06-23  Ian Lance Taylor  <iant@google.com>
9423
9424         PR 10133
9425         * stringpool.h (class Stringpool_template): Add optimize_ field.
9426         (Stringpool_template::set_optimize): New function.
9427         * stringpool.cc (Stringpool_template::Stringpool_template):
9428         Initialize optimize_ field.
9429         (Stringpool_template::set_string_offsets): Test local optimize
9430         fild rather than parameter.
9431         * layout.cc (Layout::Layout): Call set_optimize on the section
9432         name stringpool.
9433
9434 2009-06-22  Ian Lance Taylor  <iant@google.com>
9435
9436         PR 10030
9437         * yyscript.y: Parse TARGET.
9438         * script.cc (script_set_target): New function.
9439         * script-c.h (script_set_target): Declare.
9440         * options.cc (General_options::string_to_object_format): Rename
9441         from string_to_object_format in anonymous namespace.  Change
9442         callers.
9443         * options.h (class General_options): Declare
9444         string_to_object_format.
9445
9446 2009-06-22  Ian Lance Taylor  <iant@google.com>
9447
9448         * script-sections.cc (Script_sections::create_segments): Don't put
9449         program headers in a PT_LOAD segment if -n or -N.
9450
9451 2009-06-22  Ian Lance Taylor  <iant@google.com>
9452
9453         PR 10141
9454         * options.h (class General_options): Add -z lazy and -z now.  Sort
9455         -z options into alphabetical order.
9456         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9457
9458 2009-06-21  Ian Lance Taylor  <iant@google.com>
9459
9460         * layout.cc (Layout::make_output_section): Call
9461         Target::new_output_section.
9462         (Layout::attach_allocated_section_to_segment): Put large section
9463         sections in a separate load segment with the large segment flag
9464         set.
9465         (Layout::segment_precedes): Sort large data segments after other
9466         load segments.
9467         (align_file_offset): New static function.
9468         (Layout::set_segment_offsets): Use align_file_offset.
9469         * output.h (class Output_section): Add is_small_section_ and
9470         is_large_section_ fields.
9471         (Output_section::is_small_section): New function.
9472         (Output_section::set_is_small_section):  New function.
9473         (Output_section::is_large_section): New function.
9474         (Output_section::set_is_large_section): New function.
9475         (Output_section::is_large_data_section): New function.
9476         (class Output_segment): Add is_large_data_segment_ field.
9477         (Output_segment::is_large_data_segment): New function.
9478         (Output_segment::set_is_large_data_segment): New function.
9479         * output.cc (Output_section::Output_section): Initialize new
9480         fields.
9481         (Output_segment::Output_segment): Likewise.
9482         (Output_segment::add_output_section): Add assertion that large
9483         data sections always go in large data segments.  Force small data
9484         sections to the end of the list of data sections.  Force small BSS
9485         sections to the start of the list of BSS sections.  For large BSS
9486         sections to the end of the list of BSS sections.
9487         * symtab.h (class Symbol): Declare is_common_shndx.
9488         (Symbol::is_defined): Check Symbol::is_common_shndx.
9489         (Symbol::is_common): Likewise.
9490         (class Symbol_table): Define enum Commons_section_type.  Update
9491         declarations.  Add small_commons_ and large_commons_ fields.
9492         * symtab.cc (Symbol::is_common_shndx): New function.
9493         (Symbol_table::Symbol_table): Initialize new fields.
9494         (Symbol_table::add_from_object): Put small and large common
9495         symbols in the right list.
9496         (Symbol_table::sized_finalized_symbol): Check
9497         Symbol::is_common_shndx.
9498         (Symbol_table::sized_write_globals): Likewise.
9499         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9500         common symbol lists.  Don't call do_allocate_commons_list if the
9501         list is empty.
9502         (Symbol_table::do_allocate_commons_list): Remove is_tls
9503         parameter.  Add comons_section_type parameter.  Change all
9504         callers.  Handle small and large common symbols.
9505         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9506         Symbol::is_common_shndx.
9507         * resolve.cc (symbol_to_bits): Likewise.
9508         * target.h (Target::small_common_shndx): New function.
9509         (Target::small_common_section_flags): New function.
9510         (Target::large_common_shndx): New function.
9511         (Target::large_common_section_flags): New function.
9512         (Target::new_output_section): New function.
9513         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9514         small_common_section_flags, and large_common_section_flags
9515         fields.
9516         (Target::do_new_output_section): New virtual function.
9517         * arm.cc (Target_arm::arm_info): Initialize new fields.
9518         * i386.cc (Target_i386::i386_info): Likewise.
9519         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9520         Likewise.
9521         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9522         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9523         (Target_x86_64::do_new_output_section): New function.
9524         * configure.ac: Define conditional MCMODEL_MEDIUM.
9525         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9526         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9527         (large_LDFLAGS): Define.
9528         * testsuite/large.c: New file.
9529         * testsuite/testfile.cc (Target_test::test_target_info):
9530         Initialize new fields.
9531         * configure, testsuite/Makefile.in: Rebuild.
9532
9533 2009-06-05  Doug Kwan  <dougkwan@google.com>
9534
9535         * Makefile.am (CCFILES): Add target.cc.
9536         * Makefile.in: Regenerate.
9537         * i386.cc (class Target_i386): Define new virtual method to
9538         override do_is_local_label_name in parent.
9539         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9540         local symbols if --discard-locals or -X is given.
9541         * options.h (class General_options): Declare new options
9542         '--discard-locals' and '-X' for discarding locals.
9543         * target.h (class Target): Define new methods is_local_label_name.
9544         Declare new virtual method do_is_local_label_name.
9545         * target.cc: New file.
9546         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9547         (check_SCRIPTS): Add discard_locals_test.sh.
9548         (check_DATA): Add discard_local_tests.syms.
9549         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9550         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9551         * testsuite/Makefile.in: Regenerate.
9552         * testsuite/discard_locals_test.c: New file.
9553         * testsuite/discard_locals_test.sh: Same.
9554
9555 2009-06-05  Doug Kwan  <dougkwan@google.com>
9556
9557         * object.cc (Sized_relobj::Sized_relobj): Initialize
9558         discarded_eh_frame_shndx_ to -1U.
9559         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9560         section.
9561         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9562         a discarded .eh_frame section.
9563         (Sized_relobj::do_finalize_local_symbols): Ditto.
9564         * object.h (class Sized_relobj): Declare new member
9565         discarded_eh_frame_shndx_.
9566         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9567         (local_labels_test.o, local_labels_test): New rules.
9568         * testsuite/Makefile.in: Regenerate.
9569
9570 2009-06-04  Doug Kwan  <dougkwan@google.com>
9571
9572         * layout.cc (Layout::section_name_mapping): Add mapping for
9573         special ARM sections.
9574
9575 2009-06-03  Doug Kwan  <dougkwan@google.com>
9576
9577         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9578         (utils::has_overflow): Same.
9579
9580 2009-06-03  Ian Lance Taylor  <iant@google.com>
9581
9582         * layout.cc (Layout::section_name_mapping): New array, replacing
9583         Layout::linkonce_mapping.
9584         (Layout::section_name_mapping_count): New variable, replacing
9585         Layout::linkonce_mapping_count.
9586         (Layout::linkonce_output_name): Remove.
9587         (Layout::output_section_name): Rewrite.
9588         * layout.h (class Layout): Rename Linkonce_mapping to
9589         Section_name_mapping, linkonce_mapping to section_name_mapping,
9590         linkonce_mapping_count to section_name_mapping_count.  Don't
9591         declare linkonce_output_name.
9592
9593 2009-06-03  Doug Kwan  <dougkwan@google.com>
9594
9595         * gold/arm.cc (namespace utils): New.
9596         (Target_arm::reloc_is_non_pic): Define new method.
9597         (class Arm_relocate_functions): New.
9598         (Target_arm::Relocate::relocate): Handle relocation types used by
9599         Android.
9600
9601 2009-06-03  Ian Lance Taylor  <iant@google.com>
9602
9603         * arm.cc (Target_arm::scan::global): Use || instead of |.
9604
9605 2009-06-02  Doug Kwan  <dougkwan@google.com>
9606
9607         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9608         issued_non_pic_error_.
9609         (class Target_arm::Scan): Declare new method check_non_pic.
9610         Define new method symbol_needs_plt_entry.
9611         Declare new data member issued_non_pic_error_.
9612         (class Target_arm::Relocate): Declare new method
9613         should_apply_static_reloc.
9614         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9615         (Target_arm::Scan::check_non_pic): Define new method.
9616         (Target_arm::Scan::local): Handle a small subset of reloc types used
9617         by Android.
9618         (Target_arm::Scan::local): Same.
9619         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9620
9621 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9622
9623         * incremental.cc (Incremental_inputs::report_command_line): Filter
9624         out --incremental-* options.
9625
9626 2009-05-29  Doug Kwan  <dougkwan@google.com>
9627
9628         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9629         template class.
9630         (class Target_arm): Update comment.
9631         (Target_arm::Target_arm): Initialize new data members GOT_,
9632         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9633         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9634         and Target_arm::rel_dyn_section.
9635         Declare new_enum Target_arm::Got_type.
9636         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9637         and DYNBSS_.
9638         Update commments for member do_dynsym_value.
9639         (Target_arm::got_size, Target_arm::plt_section,
9640         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9641         new methods inside class defintion.
9642         (Target_arm::got_section): Define new method.
9643         (Target_arm::rel_dyn_section): Same.
9644         (Output_data_plt_arm): New template class.
9645         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9646         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9647         (Output_data_plt_arm::add_entry): Same.
9648         (Output_data_plt_arm::first_plt_entry): Define new
9649         static data member for PLT instruction template.
9650         (Output_data_plt_arm::plt_entry): Same.
9651         (Output_data_plt_arm::do_write): Define new method.
9652         (Target_arm::make_plt_entry): Same.
9653         (Target_arm::do_finalize_sections): Same.
9654         (Target_arm::do_dynsym_value): Same.
9655
9656 2009-05-28  Doug Kwan  <dougkwan@google.com>
9657
9658         * Makefile.am (TARGETSOURCES): Add arm.cc.
9659         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9660         * Makefile.in: Regenerate.
9661         * arm.cc: New file.
9662         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9663
9664 2009-05-26  Doug Kwan  <dougkwan@google.com>
9665
9666         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9667         (General_options::check_excluded_libs): Strip off directories in
9668         archive name before matching like GNU ld does.
9669         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9670         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9671         (exclude_libs_test_LDFLAGS): Add linker option
9672         -Wl,--exclude-libs,libexclude_libs_test_3
9673         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9674         an explicit archive without using -l.
9675         (alt/libexclude_libs_test_3.a): New make rule.
9676         * testsuite/Makefile.in: Regenerate.
9677         * testsuite/exclude_libs_test.c : Declare lib3_default().
9678         (main): Call it.
9679         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9680         * exclude_libs_test_3.c: New file.
9681
9682 2009-05-26  Nick Clifton  <nickc@redhat.com>
9683
9684         * po/id.po: New Indonesian translation.
9685         * po/gold.pot: Updated template file.
9686
9687 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9688
9689         * testsuite/Makefile.am: Add -ffunction-sections to compile
9690         gc_comdat_test files.  Add -Wl,--gc-sections to build
9691         gc_comdat_test.
9692         * testsuite/Makefile.in: Regenerate.
9693         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9694
9695 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9696
9697         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9698         kept comdat section was garbage collected.
9699         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9700         * testsuite/Makefile.in: Regenerate.
9701         * testsuite/gc_comdat_test.sh: New file.
9702         * testsuite/gc_comdat_test_1.cc: New file.
9703         * testsuite/gc_comdat_test_2.cc: New file.
9704
9705 2009-05-19  Doug Kwan  <dougkwan@google.com>
9706
9707         * archive.cc (Archive::Archive): Move constructor from archive.h
9708         to here.  Initialize no_export_.
9709         (Archive::get_elf_object_for_member): Set no_export flag of object.
9710         * archive.h (Archive::Archive): Move constructor body to
9711         archive.cc.
9712         (Archive::no_export): New method.
9713         (Archive::no_export_): New field.
9714         * object.h (Object::Object): Initialize no_export_ to false.
9715         (Object::no_export, Object::set_no_export): New methods.
9716         (Object::no_export_): New field.
9717         * options.cc (General_options::parse_exclude_libs): New method.
9718         (General_options::check_excluded_libs) Same.
9719         * options.h (exclude_libs): New option.
9720         (General_options::check_excluded_libs): New method declaration.
9721         (General_options::excluded_libs_): New field.
9722         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9723         default or protected visibility if an object has no-export flag set.
9724         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9725         (check_SCRIPTS): Add exclude_libs_test.sh.
9726         (check_DATA): Add exclude_libs_test.syms.
9727         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9728         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9729         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9730         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9731         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9732         libexclude_libs_test_2.a): New rules.
9733         * testsuite/Makefile.in: Regenerate.
9734         * testsuite/exclude_libs_test.c: New file.
9735         * testsuite/exclude_libs_test.sh: Ditto.
9736         * testsuite/exclude_libs_test_1.c: Ditto.
9737         * testsuite/exclude_libs_test_2.c: Ditto.
9738
9739 2009-05-15  Ian Lance Taylor  <iant@google.com>
9740
9741         * configure.ac: Check for declarations for cases where libiberty.h
9742         checks HAVE_DECL_xxx.
9743         * configure, config.in: Rebuild.
9744
9745 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9746
9747         * gold.h (Incremental_argument_list): Remove (invalid) forward
9748         declaration.
9749         * incremental.cc (Incremental_inputs::report_achive): New method.
9750         (Incremental_inputs::report_object): New method.
9751         (Incremental_inputs::report_script): New method.
9752         (Incremental_inputs::finalize_inputs): New method.
9753         (Incremental_inputs::finalize): Call finalize_inputs().
9754         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9755         Create inputs entries.
9756         * incremental.h (Incremental_input_type): New enum.
9757         (Incremental_inputs::Incremental_input): Initialize new fields.
9758         (Incremental_inputs::report_inputs): New method.
9759         (Incremental_inputs::report_achive): New method.
9760         (Incremental_inputs::report_object): New method.
9761         (Incremental_inputs::report_script): New method.
9762         (Incremental_inputs::finalize_inputs): New method.
9763         (Incremental_inputs::Input_info): New struct.
9764         (Incremental_inputs::Input_info_map): New typedef.
9765         (Incremental_inputs::lock_): New field.
9766         (Incremental_inputs::Inputs_): New field.
9767         (Incremental_inputs::Inputs_map): New field.
9768         * main.cc (main): Call Incremental_input::report_inputs.
9769         * options.h (Input_argument_list): Typedef moved from
9770         Input_arguments.
9771         (Input_file_group::Files): Remove, use ::Input_argument_list.
9772         (Input_file_group::Input_argument_list): Remove, use
9773         ::Input_argument_list.
9774         * plugin.cc (Plugin_manager::add_input_file): Add error in
9775         incremental build.
9776         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9777         functions.
9778         * script.cc (read_input_script): Call
9779         Incremental_input::report_script.
9780         * script.h (Script_info): New class.
9781
9782 2009-04-27  Ian Lance Taylor  <iant@google.com>
9783
9784         * x86_64.cc (do_adjust_output_section): Set entsize to
9785         plt_entry_size.
9786
9787 2009-04-23  Elliott Hughes  <enh@google.com>
9788
9789         * output.cc (Output_file::close): After short writes, continue
9790         writing from the correct offset in the buffer being written.
9791
9792 2009-04-23  Chris Demetriou  <cgd@google.com>
9793
9794         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9795         * configure: Regenerate.
9796         * config.in: Regenerate.
9797         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9798         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9799
9800 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
9801
9802         * incremental.cc (Incremental_inputs_header_data): Renamed from
9803         Incremental_input_header_data.
9804         (Incremental_inputs_header_data::data_size): New field.
9805         (Incremental_inputs_header_data::put_input_file_count): Renamed
9806         from input_file_count.
9807         (Incremental_inputs_header_data::put_command_line_offset): Renamed
9808         from command_line_offset.
9809         (Incremental_inputs_header_data::put_reserved): Renamed from
9810         put_reserved.
9811         (Incremental_inputs_entry_data): Renamed from
9812         Incremental_input_entry_data.
9813         (Incremental_inputs_entry_data::data_size): New field.
9814         (Incremental_inputs::report_command_line): New method.
9815         (Incremental_inputs::finalize): New method.
9816         (Incremental_inputs::create_incremental_inputs_data): New method.
9817         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9818         * incremental.h: New file.
9819         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9820        (Layout::finalize): Create incremental inputs section in
9821         incremental builds.
9822        (Layout::create_incremental_info_sections): New method.
9823         * layout.h (Layout::incremental_inputs): New method.
9824        (Layout::create_incremental_info_sections): New method.
9825        (Layout::incremental_inputs_): New field.
9826         * main.cc (main): Notify Incremental_input of the command line.
9827
9828 2009-04-01  Ian Lance Taylor  <iant@google.com>
9829             Mikolaj Zalewski  <mikolajz@google.com>
9830
9831         * gold.h (reserve_unordered_map): Define, three versions, one for
9832         each version of Unordered_map.
9833         * layout.cc (Layout::Layout): Remove options parameter.  Add
9834         number_of_input_files parameter.  Don't initialize options_.
9835         Initialize number_of_input_files_ and resized_signatures_.  Move
9836         sections_are_attached_.
9837         (Layout::layout_group): Reserve space for group_signatures_.
9838         (Layout::find_or_add_kept_section): Change name parameter to be a
9839         reference.  Resize signatures_ map when it gets large enough.
9840         (Layout::layout_eh_frame): Use parameters->options() instead of
9841         this->options_.
9842         (Layout::make_output_section): Likewise.
9843         (Layout::attach_allocated_section_to_segment): Likewise.
9844         (Layout::finalize, Layout::create_executable_stack): Likewise.
9845         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9846         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9847         * layout.h (class Layout): Update declarations.  Remove options_
9848         field.  Add number_of_input_files_ and resized_signatures_
9849         fields.  Move sections_are_attached_ field.
9850         * main.cc (main): Pass number of input files to Layout
9851         constructor.  Don't pass options.
9852
9853 2009-03-30  Ian Lance Taylor  <iant@google.com>
9854
9855         * ffsll.c (ffsll): Correct implementation.
9856
9857 2009-03-27  Ian Lance Taylor  <iant@google.com>
9858
9859         * ffsll.c: New file.
9860         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9861         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9862         * ftruncate.c (ftruncate): Declare before definition.
9863         * mremap.c (mremap): Likewise.
9864         * pread.c (pread): Likewise.
9865         * configure, Makefile.in, config.in: Rebuild.
9866
9867         * mremap.c: New file.
9868         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9869         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9870         (mremap): Declare if HAVE_MREMAP is not defined.
9871         * configure, Makefile.in, config.in: Rebuild.
9872
9873 2009-03-27  Cary Coutant  <ccoutant@google.com>
9874
9875         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9876         position independent.
9877         * sparc.cc (Target_sparc::check_non_pic): Likewise.
9878         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9879
9880 2009-03-24  Cary Coutant  <ccoutant@google.com>
9881
9882         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9883         an executable.
9884         (needs_dynamic_reloc): Likewise.
9885
9886 2009-03-24  Ian Lance Taylor  <iant@google.com>
9887
9888         * yyscript.y (file_cmd): Recognize EXTERN.
9889         (extern_name_list, extern_name_list_body): New nonterminals.
9890         * script.cc (script_add_extern): Define.
9891         * script-c.h (script_add_extern): Declare.
9892
9893 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
9894
9895         * object.cc (is_elf_object): Define.
9896         * object.h (is_elf_object): Declare.
9897         * archive.cc (Archive::get_elf_object_for_member): Call
9898         is_elf_object.
9899         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9900
9901 2009-03-24  Elliott Hughes  <enh@google.com>
9902
9903         * output.cc (Output_file::map_anonymous): Define.
9904         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
9905         try an anonymous one.  Report the size if the mmap fails.
9906         * output.h (class Output_file): Declare map_anonymous.
9907
9908 2009-03-24  Ian Lance Taylor  <iant@google.com>
9909
9910         * target-select.cc (instantiate_target): Don't acquire the lock if
9911         the instantiated_target_ field has already been set.
9912
9913 2009-03-23  Ian Lance Taylor  <iant@google.com>
9914
9915         * gold-threads.h (class Initialize_lock): Define.
9916         * gold-threads.cc (class Initialize_lock_once): Define.
9917         (initialize_lock_control): New static variable.
9918         (initialize_lock_pointer): New static variable.
9919         (initialize_lock_once): New static function.
9920         (Initialize_lock::Initialize_lock): Define.
9921         (Initialize_lock::initialize): Define.
9922         * target-select.h: Include "gold-threads.h".
9923         (class Target_selector): Add lock_ and initialize_lock_ fields.
9924         Don't define instantiate_target, just declare it.
9925         * target-select.cc (Target_selector::Target_selector): Initialize
9926         new fields.
9927         (Target_selector::instantiate_target): Define.
9928         * descriptors.h: Include "gold-threads.h".
9929         (class Descriptors): Add initialize_lock_ field.
9930         * descriptors.cc (Descriptors::Descriptors): Initialize new
9931         field.
9932         (Descriptors::open): Use initialize_lock_ field
9933         * errors.h (class Errors): Add initialize_lock_ field.
9934         * errors.cc (Errors::Errors): Initialize new field.
9935         (Errors::initialize_lock): Use initialize_lock_ field.
9936         * powerpc.cc (class Target_selector_powerpc): Remove
9937         instantiated_target_ field.  In do_recognize call
9938         instantiate_target rather than do_instantiate_target.  In
9939         do_instantiate_target just allocate a new target.
9940         * sparc.cc (class Target_selector_sparc): Likewise.
9941
9942         * freebsd.h: New file.
9943         * i386.cc: Include "freebsd.h".
9944         (Target_i386): Derive from Target_freebsd rather than
9945         Sized_target.
9946         (Target_selector_i386): Derive from Target_selector_freebsd rather
9947         than Target_selector.
9948         * x86_64.cc: Include "freebsd.h".
9949         (Target_x86_64): Derive from Target_freebsd rather than
9950         Sized_target.
9951         (Target_selector_x86_64): Derive from Target_selector_freebsd
9952         rather than Target_selector.
9953         * target.h (class Target): Add adjust_elf_header and
9954         do_adjust_elf_header.
9955         * output.cc (Output_file_header:: do_sized_write): Call target
9956         adjust_elf_header routine.
9957         * configure.tgt: Set targ_osabi.
9958         * configure.ac: Define GOLD_DEFAULT_OSABI.
9959         * parameters.cc (Parameters::default_target): Pass
9960         GOLD_DEFAULT_OSABI to select_target.
9961         * target-select.h (class Target_selector): Make instantiate_target
9962         protected rather than private.
9963         * Makefile.am (HFILES): Add freebsd.h.
9964         * configure, Makefile.in, config.in: Rebuild.
9965
9966         * merge.cc (do_add_input_section): Correct pend value.  Change
9967         message about last entry not being null terminated from error to
9968         warning.
9969
9970 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
9971
9972         * incremental.cc: New file.
9973         * Makefile.am (CCFILES): Add incremental.cc.
9974         * Makefile.in: Rebuild.
9975
9976 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
9977
9978         * layout.cc (Layout::output_section_name): Preserve names
9979         of '.note.' sections.
9980
9981 2009-03-19  Ian Lance Taylor  <iant@google.com>
9982
9983         * descriptors.cc (Descriptors::open): Check that the options are
9984         valid before using them.
9985
9986 2009-03-18  Ian Lance Taylor  <iant@google.com>
9987
9988         * script-sections.h: Include <list>.
9989         (class Script_sections): Change Sections_elements from std::vector
9990         to std::list.  Typedef public Elements_iterator.  Add
9991         orphan_section_placement_, data_segment_align_start_, and
9992         saw_data_segment_align_ fields.  Remove data_segment_align_index_
9993         field.
9994         * script-sections.cc (class Orphan_section_placement): New class.
9995         (class Sections_element): Add virtual functions is_relro and
9996         orphan_section_init.  Remove virtual function place_orphan_here.
9997         (class Output_section_definition): Add is_relro and
9998         orphan_section_init.  Remove place_orphan_here.
9999         (class Orphan_output_section): Likewise.
10000         (Script_sections::Script_sections): Update for field changes.
10001         (Script_sections::data_segment_align): Set saw_data_segment_align_
10002         and data_segment_align_start_, not data_segment_align_index.
10003         (Script_sections::data_segment_relro_end): Check
10004         saw_data_segment_align_.  Use data_segment_align_start_ rather
10005         than data_segment_align_index_.
10006         (Script_sections::place_orphan): Rewrite to use
10007         Orphan_section_placement.
10008
10009 2009-03-17  Ian Lance Taylor  <iant@google.com>
10010
10011         * archive.cc (Archive::add_symbols): Check for a version attached
10012         to the symbol name in the archive map.
10013         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10014         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10015         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10016         (ver_test_11.a): New target.
10017         * testsuite/Makefile.in: Rebuild.
10018
10019         * configure.ac: Check for chsize and posix_fallocate.  Replace
10020         ftruncate.
10021         * ftruncate.c: New file, from gnulib.
10022         * output.cc (posix_fallocate): Define dummy version if not
10023         HAVE_POSIX_FALLOCATE.
10024         (Output_file::map): Call posix_fallocate rather than lseek and
10025         write.
10026         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10027         * configure, Makefile.in, config.in: Rebuild.
10028
10029 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10030
10031         * layout.h (Layout::create_note): Add section_name parameter.
10032         * layout.cc (Layout::create_note): Likewise.
10033         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10034
10035 2009-03-17  Ian Lance Taylor  <iant@google.com>
10036
10037         * descriptors.cc: Include "options.h".
10038         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10039         (Descriptors::open): Always use O_CLOEXEC when opening a new
10040         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10041         then set FD_CLOEXEC.
10042
10043         * sparc.cc (class Target_sparc): Add has_got_section.
10044         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10045         make sure we have a GOT section.
10046
10047         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10048         (Target_sparc::Scan::local): Likewise.
10049         (Target_sparc::Scan::global): Likewise.
10050         (Target_sparc::Relocate::relocate): Likewise.
10051         (Target_sparc::Relocate::relocate_tls): Likewise.
10052
10053         * symtab.cc (Symbol_table::define_default_version): New function,
10054         broken out of add_from_object.
10055         (Symbol_table::add_from_object): Call define_default_version.
10056         (Symbol_table::define_special_symbol): Add resolve_oldsym
10057         parameter.  Change all callers.  If the version for a symbol comes
10058         from a version script, resolve it with the symbol with the same
10059         name with no version.  Also add the symbol without a version if
10060         appropriate.
10061         (do_define_in_output_data): If resolving with oldsym, don't delete
10062         sym.
10063         (do_define_in_output_segment): Likewise.
10064         (do_define_as_constant): Likewise.
10065         * symtab.h (class Symbol_table): Update declarations.
10066
10067 2009-03-13  Ian Lance Taylor  <iant@google.com>
10068
10069         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10070         (Read_symbols::requeue): New function.
10071         (Read_symbols::do_read_symbols): If make_elf_object fails because
10072         the target type is not configured, and the file was searched for,
10073         issue a warning and retry with the next directory.
10074         (Add_symbols::run): If the file has an incompatible format, and
10075         it was searched for, requeue the Read_symbols task.  On error,
10076         release the object.
10077         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10078         dirindex parameter to constructor.  Change all callers.  Declare
10079         incompatible_warning and requeue.
10080         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10081         input_argument_ and input_group_ fields.  Add them to
10082         constructor.  Change all callers.
10083         (class Read_script): Add dirindex_ field.  Add it to constructor.
10084         Change all callers.
10085         * archive.cc (Archive::setup): Remove input_objects parameter.
10086         Change all callers.
10087         (Archive::get_file_and_offset): Likewise.
10088         (Archive::read_all_symbols): Likewise.
10089         (Archive::read_symbols): Likewise.
10090         (Archive::get_elf_object_for_member): Remove input_objects
10091         parameter.  Add punconfigured parameter.  Change all callers.
10092         (Archive::add_symbols): Change return type to bool.  Check return
10093         value of include_member.
10094         (Archive::include_all_members): Likewise.
10095         (Archive::include_member): Change return type to bool.  Return
10096         false if first included object has incompatible target.  Set
10097         included_member_ field.
10098         (Add_archive_symbols::run): If add_symbols returns false, requeue
10099         Read_symbols task.
10100         * archive.h (class Archive): Add included_member_ field.
10101         Initialize it in constructor.  Add input_file and searched_for
10102         methods.  Update declarations.
10103         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10104         input_argument_ fields.  Add them to constructor.  Change all
10105         callers.
10106         * script.cc: Include "target-select.h".
10107         (class Parser_closure): Add skip_on_incompatible_target_ and
10108         found_incompatible_target_ fields.  Add
10109         skip_on_incompatible_target parameter to constructor.  Change all
10110         callers.  Add methods skip_on_incompatible_target,
10111         clear_skip_on_incompatible_target, found_incompatible_target, and
10112         set_found_incompatible_target.
10113         (read_input_script): Add dirindex parameter.  Change all callers.
10114         If parser finds an incompatible target, requeue Read_symbols
10115         task.
10116         (script_set_symbol): Clear skip_on_incompatible_target in
10117         closure.
10118         (script_add_assertion, script_parse_option): Likewise.
10119         (script_start_sections, script_add_phdr): Likewise.
10120         (script_check_output_format): New function.
10121         * script.h (read_input_script): Update declaration.
10122         * script-c.h (script_check_output_format): Declare.
10123         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10124         (ignore_cmd): Remove OUTPUT_FORMAT.
10125         * fileread.cc (Input_file::Input_file): Add explicit this.
10126         (Input_file::will_search_for): New function.
10127         (Input_file::open): Add pindex parameter.  Change all callers.
10128         * fileread.h (class Input_file): Add input_file_argument method.
10129         Declare will_search_for.  Update declarations.
10130         * object.cc (make_elf_object): Add punconfigured parameter.
10131         Change all callers.
10132         * object.h (class Object): Make input_file public.  Add
10133         searched_for method.
10134         (make_elf_object): Update declaration.
10135         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10136         restart search.
10137         * dirsearch.h (class Dirsearch): Update declaration.
10138         * options.h (class General_options): Add --warn-search-mismatch.
10139         * parameters.cc (Parameters::is_compatible_target): New function.
10140         * parameters.h (class Parameters): Declare is_compatible_target.
10141         * workqueue.cc (Workqueue::add_blocker): New function.
10142         * workqueue.h (class Workqueue): Declare add_blocker.
10143
10144         * fileread.cc (Input_file::open): Remove options parameter.
10145         Change all callers.
10146         (Input_file::open_binary): Likewise.
10147         * script.cc (read_input_script): Likewise.
10148         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10149         options parameter from constructor.  Change all callers.
10150         (class Read_script): Likewise.
10151         * fileread.h (class Input_file): Update declarations.
10152         * script.h (read_input_script): Update declaration.
10153
10154 2009-03-10  Nick Clifton  <nickc@redhat.com>
10155
10156         * po/es.po: New Spanish translation.
10157
10158 2009-03-06  Cary Coutant  <ccoutant@google.com>
10159
10160         * options.cc (parse_short_option): Keep dash_z from registering itself.
10161
10162 2009-03-03  Ian Lance Taylor  <iant@google.com>
10163
10164         PR 9918
10165         * target-reloc.h (relocate_section): Pass output_section to
10166         relocate.
10167         * i386.cc (Target_i386::should_apply_static_reloc): Add
10168         output_section parameter.  Change all callers.
10169         (Target_i386::Relocate::relocate): Add output_section parameter.
10170         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10171         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10172         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10173         * testsuite/two_file_shared.sh: New script.
10174         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10175         (check_DATA): Add two_file_shared.dbg.
10176         (two_file_shared.dbg): New target.
10177         * testsuite/Makefile.in: Rebuild.
10178
10179 2009-03-01  Ian Lance Taylor  <iant@google.com>
10180
10181         * configure.ac: Check for byteswap.h.
10182         * configure: Rebuild.
10183         * config.in: Rebuild.
10184
10185 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10186
10187         * layout.cc (Layout::find_or_add_kept_section): New function.
10188         (Layout::add_comdat): Removed.
10189         * layout.h (struct Kept_section): Move out of class Layout.
10190         Remove trailing underscores from field names.  Add group_sections
10191         field.  Rename group_ field to is_group.  Change all uses.
10192         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10193         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10194         comdat_groups_ field.
10195         (Sized_relobj::include_section_group): Use
10196         find_or_add_kept_section and Kept_section::group_sections.
10197         (Sized_relobj::include_linkonce_section): Likewise.
10198         * object.cc (class Sized_relobj): Don't define Comdat_group or
10199         Comdat_group_table.  Remove find_comdat_group and
10200         add_comdat_group.  Remove comdat_groups_ field.
10201         * plugin.cc (include_comdat_group): Use
10202         Layout::find_or_add_kept_section.
10203
10204 2009-02-28  Ian Lance Taylor  <iant@google.com>
10205
10206         * README: --gc-sections and map files are now supported.  Document
10207         some build requirements.
10208
10209         PR 6992
10210         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10211         relocatable link set the value of the section symbol to zero.
10212         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10213         relocatable link don't include the section address in the local
10214         symbol value.
10215
10216 2009-02-27  Ian Lance Taylor  <iant@google.com>
10217
10218         PR 6811
10219         * options.h (class Search_directory): Add is_system_directory.
10220         (class General_options): Declare is_in_system_directory.
10221         * options.cc (get_relative_sysroot): Make static.
10222         (get_default_sysroot): Make static.
10223         (General_optoins::is_in_system_directory): New function.
10224         * fileread.cc (Input_file::is_in_system_directory): New function.
10225         * fileread.h (class Input_file): Declare is_in_system_directory.
10226         * object.h (class Object): Add is_in_system_directory.
10227         (class Input_objects): Remove system_library_directory_ field.
10228         * object.cc (Input_objects::add_object): Don't set
10229         system_library_directory_.
10230         (input_objects::found_in_system_library_directory): Remove.
10231         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10232         parameter.  Change all callers.
10233         (Symbol_table::sized_write_globals): Likewise.
10234         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10235         Call Object::is_in_system_directory.
10236         * symtab.h (class Symbol_table): Update declarations.
10237
10238         PR 5990
10239         * descriptors.h (Open_descriptor): Add is_on_stack field.
10240         * descriptors.cc (Descriptors::open): If the descriptor is on the
10241         top of the stack, remove it.  Initialize is_on_stack field.
10242         (Descriptors::release): Only add pod to stack if it is not on the
10243         stack already.
10244         (Descriptors::close_some_descriptor): Clear stack_next and
10245         is_on_stack fields.
10246
10247         PR 7091
10248         * output.cc (Output_section::find_starting_output_address): Rename
10249         from starting_output_address; add PADDR parameter; change return
10250         type.
10251         * output.h (class Output_section): Declare
10252         find_starting_output_address instead of starting_output_address.
10253         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10254         section symbol for which we can't find a merge section.
10255
10256         PR 9836
10257         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10258         hidden or internal, force the symbol to be local.
10259         * resolve.cc (Symbol::override_visibility): Define.
10260         (Symbol::override_base): Use override_visibility.
10261         (Symbol_table::resolve): Likewise.
10262         (Symbol::override_base_with_special): Likewise.
10263         (Symbol_table::override_with_special): If the visibility is hidden
10264         or internal, force the symbol to be local.
10265         * symtab.h (class Symbol): Add set_visibility and
10266         override_visibility.
10267         * testsuite/ver_test_1.sh: New file.
10268         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10269         (check_DATA): Add ver_test_1.syms.
10270         (ver_test_1.syms): New target.
10271         * testsuite/Makefile.in: Rebuild.
10272
10273 2009-02-25  Cary Coutant  <ccoutant@google.com>
10274
10275         * layout.cc (Layout::choose_output_section): Don't rename sections
10276         when using a linker script that has a SECTIONS clause.
10277         * Makefile.in: Regenerate.
10278
10279         * testsuite/Makefile.am (script_test_5.sh): New test case.
10280         * testsuite/Makefile.in: Regenerate.
10281         * testsuite/script_test_5.cc: New file.
10282         * testsuite/script_test_5.sh: New file.
10283         * testsuite/script_test_5.t: New file.
10284
10285 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10286
10287         * archive.cc (Archive::include_member): Update calls to add_symbols.
10288         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10289         the Layout argument.
10290         * dynobj.h (do_add_symbols): Add the Layout argument.
10291         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10292         Layout argument.
10293         * object.h (Object::add_symbols): Add the Layout argument.
10294         (Object::do_add_symbols): Add the Layout argument.
10295         (Sized_relobj::do_add_symbols): Add the Layout argument.
10296         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10297         Unify the two versions.
10298         (Add_plugin_symbols): Remove.
10299         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10300         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10301         (Add_plugin_symbols): Remove.
10302         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10303         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10304         (Add_symbols::run): Make it work with Pulginobj.
10305
10306 2009-02-06  Ian Lance Taylor  <iant@google.com>
10307
10308         * object.cc (Sized_relobj::do_layout): Make info message start
10309         with lower case letter.
10310
10311 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10312
10313         * binary.cc: Fix file comment.
10314
10315         * options.h (enum Incremental_disposition): Define.
10316         (class General_options): Add new options: --incremental,
10317         --incremental_changed, --incremental_unchanged,
10318         --incremental_unknown.  Add incremental_disposition_ and
10319         implicit_incremental_ fields.
10320         (General_options::incremental_disposition): New function.
10321         (class Position_dependent_options): Add incremental_disposition
10322         option.
10323         (Position_dependent_options::copy_from_options): Set incremental
10324         dispositions.
10325         * options.cc (General_options::parse_incremental_changed): New
10326         function.
10327         (General_options::parse_incremental_unchanged): New function.
10328         (General_options::parse_incremental_unknown): New function.
10329         (General_options::General_options): Initialize new fields
10330         incremental_disposition_ and implicit_incremental_.
10331         (General_options::finalize): Check for uasge of --incremental-*
10332         without --incremental.
10333
10334 2009-02-06  Chris Demetriou  <cgd@google.com>
10335
10336         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10337         pointer and to report location as the file name associated with
10338         the symbol.
10339         (gold_undefined_symbol_at_location): New function to replace the
10340         old gold_undefined_symbol functionality.
10341         * target-reloc.h (relocate_section): Update to use
10342         gold_undefined_symbol_at_location.
10343         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10344         Call gold_undefined_symbol function rather than gold_error.
10345         * errors.h (Errors::undefined_symbol): Take location as a
10346         string, rather than calculating it from a relocation.
10347         * errors.cc (Errors::fatal): Print "fatal error:" before the
10348         formatted message.
10349         (Errors::error, Errors::error_at_location): Print "error: "
10350         before the formatted message.
10351         (Errors::undefined_symbol): Take location as a string, rather
10352         than calculating it from a relocation.
10353         (gold_undefined_symbol_at_location): New function akin to
10354         old gold_undefined_symbol, calculates location from relocation.
10355         (gold_undefined_symbol): Change to take only a Symbol pointer
10356         and to report location as the file name associated with the symbol.
10357         * testsuite/debug_msg.sh: Update for changed error messages.
10358         * testsuite/undef_symbol.sh: Likewise.
10359
10360 2009-02-04  Duncan Sands  <baldrick@free.fr>
10361
10362         PR 9812
10363         * reduced_debug_output.h
10364         (Output_reduced_debug_abbrev_section::failed): Use format for
10365         gold_warning.
10366         (Output_reduced_debug_info_section::faild): Likewise.
10367
10368 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10369
10370         * script.cc (Lazy_demangler): New class.
10371         (Version_script_info::get_symbol_version_helper): Demangle a
10372         symbol only once.
10373
10374 2009-01-29  Cary Coutant  <ccoutant@google.com>
10375
10376         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10377         to __tls_get_addr.
10378         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10379
10380 2009-01-28  Ian Lance Taylor  <iant@google.com>
10381
10382         * version.cc (version_string): Bump to 1.9.
10383
10384         * gold.h: Include <cstring> and <stdint.h>.
10385         * version.cc: Include <cstdio>.
10386         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10387         warning.
10388         * reduced_debug_output.cc (insert_into_vector): Rename from
10389         Insert_into_vector; change all callers.  Use Swap_unaligned to
10390         avoid aliasing issue; remove union since it is unnecessary.
10391
10392 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10393
10394         * Makefile.am (CCFILES): Add gc.cc.
10395         (HFILES): Add gc.h.
10396         * Makefile.in: Regenerate.
10397         * gold.cc (Gc_runner): New class.
10398         (queue_initial_tasks): Call garbage collection related tasks
10399         when corresponding options are invoked.
10400         (queue_middle_gc_tasks): New function.
10401         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10402         processed early before laying out sections during garbage collection.
10403         * gold.h (queue_middle_gc_tasks): New function.
10404         (is_prefix_of): Move from "layout.cc".
10405         * i386.cc (Target_i386::gc_process_relocs): New function.
10406         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10407         * main.cc (main): Create object of class "Garbage_collection".
10408         * object.cc (Relobj::copy_symbols_data): New function.
10409         (Relobj::is_section_name_included): New function.
10410         (Sized_relobj::do_layout): Allow this function to be called twice
10411         during garbage collection and defer layout of section during the
10412         first call.
10413         * object.h (Relobj::get_symbols_data): New function.
10414         (Relobj::is_section_name_included): New function.
10415         (Relobj::copy_symbols_data): New function.
10416         (Relobj::set_symbols_data): New function.
10417         (Relobj::get_relocs_data): New function.
10418         (Relobj::set_relocs_data): New function.
10419         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10420         (Relobj::gc_process_relocs): New function.
10421         (Relobj::do_gc_process_relocs): New pure virtual function.
10422         (Relobj::sd_): New data member.
10423         (Sized_relobj::is_output_section_offset_invalid): New function.
10424         (Sized_relobj::do_gc_process_relocs): New function.
10425         * options.h (General_options::gc_sections): Modify to not be a no-op.
10426         (General_options::print_gc_sections): New option.
10427         * plugin.cc (Plugin_finish::run): Remove function call to
10428         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10429         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10430         * reloc.cc (Read_relocs::run): Add task to process relocs and
10431         determine unreferenced sections when doing garbage collection.
10432         (Gc_process_relocs): New class.
10433         (Sized_relobj::do_gc_process_relocs): New function.
10434         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10435         sections that are garbage collected.
10436         * reloc.h (Gc_process_relocs): New class.
10437         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10438         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10439         symbols whose corresponding sections are garbage collected.
10440         (Symbol_table::Symbol_table): Add new parameter for the garbage
10441         collection object.
10442         (Symbol_table::gc_mark_undef_symbols): New function.
10443         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10444         (Symbol_table::gc_mark_dyn_syms): New function.
10445         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10446         as garbage.
10447         (Symbol_table::add_from_object): Likewise.
10448         (Symbol_table::add_from_relobj): When building shared objects, do not
10449         treat externally visible symbols as garbage.
10450         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10451         table information for static and relocatable links.
10452         * symtab.h (Symbol_table::set_gc): New function.
10453         (Symbol_table::gc): New function.
10454         (Symbol_table::gc_mark_undef_symbols): New function.
10455         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10456         (Symbol_table::gc_mark_dyn_syms): New function.
10457         (Symbol_table::gc_): New data member.
10458         * target.h (Sized_target::gc_process_relocs): New pure virtual
10459         function.
10460         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10461         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10462
10463 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10464
10465         * options.h (General_options::gc_sections): Define as a no-op for now.
10466         (General_options::no_keep_memory): Ditto.
10467         (General_options::Bshareable): Define.
10468         * options.cc (General_options::finalize): Honor -Bshareable.
10469
10470 2009-01-20  Andreas Schwab  <schwab@suse.de>
10471
10472         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10473         read the value in the contents, since we don't use it.  Use the
10474         template endianness when writing.
10475         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10476
10477 2009-01-19  Andreas Schwab  <schwab@suse.de>
10478
10479         * configure.tgt (powerpc64-*): Fix targ_obj.
10480
10481 2009-01-15  Ian Lance Taylor  <iant@google.com>
10482
10483         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10484         local symbols when stripping all symbols.
10485
10486 2009-01-14  Cary Coutant  <ccoutant@google.com>
10487
10488         * output.cc (Output_reloc): Add explicit instantiations.
10489
10490 2009-01-14  Cary Coutant  <ccoutant@google.com>
10491
10492         * archive.cc (Archive::get_elf_object_for_member): Remove call
10493         to File_read::claim_for_plugin.
10494         * descriptors.cc (Descriptors::open): Remove reference to
10495         is_claimed.
10496         (Descriptors::claim_for_plugin): Remove.
10497         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10498         (Descriptors::is_claimed): Remove.
10499         (claim_descriptor_for_plugin): Remove.
10500         * fileread.cc (File_read::claim_for_plugin): Remove.
10501         * fileread.h (File_read::claim_for_plugin): Remove.
10502         (File_read::descriptor): Reopen descriptor if necessary.
10503         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10504         (Plugin_manager::all_symbols_read): Add task parameter. Change
10505         all callers.
10506         (Plugin_manager::get_input_file): New function.
10507         (Plugin_manager::release_input_file): New function.
10508         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10509         corresponding data member.
10510         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10511         and pass to base constructor. Change all callers.
10512         (get_input_file, release_input_file): New functions.
10513         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10514         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10515         (Plugin_manager::all_symbols_read): Add task parameter.
10516         (Plugin_manager::get_input_file): New function.
10517         (Plugin_manager::release_input_file): New function.
10518         (Plugin_manager::task_): New data member.
10519         (Pluginobj::Pluginobj): Add filesize parameter.
10520         (Pluginobj::filename): New function.
10521         (Pluginobj::descriptor): New function.
10522         (Pluginobj::filesize): New function.
10523         (Pluginobj::filesize_): New data member.
10524         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10525         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10526         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10527
10528         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10529         with archive libraries.
10530         * testsuite/Makefile.in: Regenerate.
10531         * testsuite/plugin_test.c (struct sym_info): New type.
10532         (get_input_file, release_input_file): New static variables.
10533         (onload): Capture new transfer vector entries.
10534         (claim_file_hook): Stop reading at end of file according to filesize.
10535         Factor out parsing of readelf output into separate function.
10536         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10537         APIs and get the source file name from the symbol table.  Convert
10538         source file name to corresponding object file name.  Print info
10539         message when adding new input files.
10540         (parse_readelf_line): New function.
10541         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10542         * testsuite/plugin_test_2.sh: Likewise.
10543         * testsuite/plugin_test_3.sh: Likewise.
10544         * testsuite/plugin_test_4.sh: New test case.
10545
10546 2009-01-07  Ian Lance Taylor  <iant@google.com>
10547
10548         * version.cc (version_string): Bump to 1.8.
10549
10550 2008-12-23  Cary Coutant  <ccoutant@google.com>
10551
10552         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10553         * plugin.cc (Plugin_manager::finish): Rename as
10554         layout_deferred_objects.  Move cleanup to separate function.
10555         (Plugin_manager::cleanup): New function.
10556         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10557         separately.
10558         * plugin.h (Plugin_manager::finish): Rename as
10559         layout_deferred_objects.
10560         (Plugin_manager::cleanup): New function.
10561         (Plugin_manager::cleanup_done): New field.
10562
10563 2008-12-23  Cary Coutant  <ccoutant@google.com>
10564
10565         * plugin.cc (is_visible_from_outside): New function.
10566         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10567         so we don't return "IR only" status for exported symbols or -r links.
10568
10569         * testsuite/Makefile.am (plugin_test_3): New test case.
10570         * testsuite/Makefile.in: Regenerate.
10571         * testsuite/plugin_test_3.sh: New file.
10572
10573 2008-12-22  Cary Coutant  <ccoutant@google.com>
10574
10575         * object.cc (Sized_relobj::layout_section): New function.
10576         (Sized_relobj::do_layout): Defer layout of input sections until after
10577         plugin has provided replacement files.
10578         (Sized_relobj::do_layout_deferred_sections): New function.
10579         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10580         (Relobj::layout_deferred_sections): New function.
10581         (Relobj::do_layout_deferred_sections): New function.
10582         (Sized_relobj::do_layout_deferred_sections): New function.
10583         (Sized_relobj::layout_section): New function.
10584         (Sized_relobj::Deferred_layout): New structure.
10585         (Sized_relobj::deferred_layout_): New field.
10586         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10587         Change all callers.  Layout deferred sections.
10588         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10589         references.
10590         (Plugin_hook::run): Move code from do_plugin_hook inline.
10591         (Plugin_hook::do_plugin_hook): Remove.
10592         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10593         (Plugin_manager::finish): Renamed, was cleanup.
10594         (Plugin_manager::should_defer_layout): New function.
10595         (Plugin_manager::add_deferred_layout_object): New function.
10596         (Plugin_manager::Deferred_layout_list): New type.
10597         (Plugin_manager::deferred_layout_objects_): New field.
10598         (Plugin_hook::do_plugin_hook): Remove.
10599
10600 2008-12-17  Ian Lance Taylor  <iant@google.com>
10601
10602         * options.h (class General_options): Add --no case for
10603         --export-dynamic.
10604
10605 2008-12-16  Cary Coutant  <ccoutant@google.com>
10606
10607         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10608         vector.
10609         (Plugin_manager::claim_file): Create plugin object even if
10610         plugin did not call the add_symbols callback.
10611         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10612         asking for more symbols than were added.
10613         * testsuite/Makefile.am (plugin_test_1): Add test case with
10614         no global symbols.
10615         (empty.syms): New target.
10616         * testsuite/Makefile.in: Regenerate.
10617         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10618         message. Don't call add_symbols if no globals.
10619         (all_symbols_read_hook): Don't provide replacement for empty
10620         claimed file.
10621
10622 2008-12-12  Ian Lance Taylor  <iant@google.com>
10623
10624         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10625         r_type == 0 for a local symbol with r_sym == 0.
10626         (scan_relocatable_relocs): Pass r_sym to
10627         local_non_section_strategy.
10628         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10629         r_sym parameter.
10630
10631         * configure.ac: Update test for TLS descriptors: they are
10632         supported as of glibc 2.9.
10633         * configure: Rebuild.
10634
10635 2008-12-11  Ian Lance Taylor  <iant@google.com>
10636
10637         PR 7091
10638         * target-reloc.h (Default_scan_relocatable_relocs): For each
10639         function, map r_type == 0 to RELOC_DISCARD.
10640
10641 2008-12-10  Cary Coutant  <ccoutant@google.com>
10642
10643         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10644         object to override a kept COMDAT group from a plugin object.
10645
10646 2008-12-09  Ian Lance Taylor  <iant@google.com>
10647
10648         PR 7088
10649         * yyscript.y (file_cmd): Handle INPUT.
10650
10651         * testsuite/initpri1.c: Change all declarations to be full
10652         prototypes by adding void, to avoid compiler warnings.
10653
10654 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10655
10656         * options.cc (General_options::parse_plugin_opt): New.
10657         (General_options::add_plugin): The argument now is just the filename.
10658         (General_options::add_plugin_option): New.
10659         * options.h (plugin_opt): New.
10660         (add_plugin): Change argument name.
10661         (add_plugin_option): New.
10662         * plugin.cc (Plugin::load): Don't parse the plugin option.
10663         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10664         (Plugin::add_option): New.
10665         (Plugin::args_): Change type.
10666         (Plugin::filename_): New.
10667         (Plugin_manager::add_plugin_option): New.
10668         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10669         * testsuite/Makefile.in: Regenerate.
10670
10671 2008-12-05  Cary Coutant  <ccoutant@google.com>
10672
10673         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10674         Handle --strip-lto-sections option.
10675         * options.h (strip_lto_sections): New option.
10676
10677 2008-12-01  Cary Coutant  <ccoutant@google.com>
10678
10679         * plugin.cc (ld_plugin_message): Change format parameter to const.
10680         Fix mismatch between new[] and delete.
10681
10682 2008-11-14  Cary Coutant  <ccoutant@google.com>
10683
10684         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10685         instead of -1U.
10686
10687 2008-11-05  Craig Silverstein  <csilvers@google.com>
10688
10689         * options.cc (General_options::parse_dynamic_list): New function.
10690         * options.h (General_options): New flags dynamic_list,
10691         dynamic_list_data, dynamic_list_cpp_new, and
10692         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10693         (General_options::in_dynamic_list): New function.
10694         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10695         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10696         (Lex::can_continue_name): Likewise.
10697         (yylex): Likewise.
10698         (read_script_file): New parameter script_options.
10699         (read_dynamic_list): New function.
10700         (Script_options::define_dynamic_list): New function.
10701         (dynamic_list_keyword_parsecodes): New variable.
10702         (dynamic_list_keywords): New variable.
10703         * script.h (Script_options::define_dynamic_list): New function
10704         prototype.
10705         (read_dynamic_list): New function prototype.
10706         * symtab.cc (strprefix): New macro.
10707         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10708         dynamic_list_data, dynamic_list_cpp_new, and
10709         dynamic_list_cpp_typeinfo.
10710         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10711         (dynamic_list_expr): New rule.
10712         (dynamic_list_nodes): Likewise.
10713         (dynamic_list_node): Likewise.
10714         * testsuite/Makefile.am (dynamic_list): New test.
10715         * testsuite/Makefile.in: Regenerated.
10716         * testsuite/dynamic_list.t: New file.
10717         * testsuite/dynamic_list.sh: New file.
10718
10719 2008-11-05  Craig Silverstein  <csilvers@google.com>
10720
10721         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10722         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10723         (t11_last): Likewise.
10724         * testsuite/ver_test_6.c (main): Likewise.
10725
10726 2008-10-07  Cary Coutant  <ccoutant@google.com>
10727
10728         * options.c (General_options::finalize): Add check for -static and
10729         -shared.
10730         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10731         is not empty.
10732
10733 2008-10-02  Cary Coutant  <ccoutant@google.com>
10734
10735         * plugin.cc (make_sized_plugin_object): Fix conditional
10736         compilation to work when not all targets are enabled.
10737
10738 2008-09-29  Cary Coutant  <ccoutant@google.com>
10739
10740         * archive.cc (Archive::get_file_and_offset): Use filename instead
10741         of name to get library path.
10742         (Archive::include_member): Unlock external member of a thin archive.
10743
10744         * testsuite/Makefile.am (TEST_AR): New variable.
10745         (thin_archive_test_1): New test.
10746         (thin_archive_test_2): New test.
10747         * testsuite/Makefile.in: Regenerate.
10748         * testsuite/thin_archive_main.cc: New file.
10749         * testsuite/thin_archive_test_1.cc: New file.
10750         * testsuite/thin_archive_test_2.cc: New file.
10751         * testsuite/thin_archive_test_3.cc: New file.
10752         * testsuite/thin_archive_test_4.cc: New file.
10753
10754 2008-09-29  Cary Coutant  <ccoutant@google.com>
10755
10756         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10757         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10758         instead of -1U.
10759         (Sized_relobj::do_finalize_local_symbols): Likewise.
10760         (Sized_relobj::map_to_kept_section): Likewise.
10761         * object.h (Sized_relobj::invalid_address): New constant.
10762         (Sized_relobj::do_output_section_offset): Check for invalid_address
10763         and return -1ULL.
10764         * output.cc (Output_reloc::local_section_offset): Use constant
10765         invalid_address instead of -1U.
10766         (Output_reloc::get_address): Likewise.
10767         (Output_section::output_address): Change -1U to -1ULL.
10768         * output.h (Output_reloc::invalid_address): New constant.
10769         * reloc.cc (Sized_relobj::write_sections): Use constant
10770         invalid_address instead of -1U.
10771         (Sized_relobj::relocate_sections): Likewise.
10772         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10773         values for merge sections.
10774         * target-reloc.h (relocate_for_relocatable): Use constant
10775         invalid_address instead of -1U.
10776
10777 2008-09-19  Cary Coutant  <ccoutant@google.com>
10778
10779         Add plugin functionality for link-time optimization (LTO).
10780         * configure.ac (plugins): Add --enable-plugins option.
10781         * configure: Regenerate.
10782         * config.in: Regenerate.
10783         * Makefile.am (LIBDL): New variable.
10784         (CCFILES): Add plugin.cc.
10785         (HFILES): Add plugin.h.
10786         (ldadd_var): Add LIBDL.
10787         * Makefile.in: Regenerate.
10788
10789         * archive.cc: Include "plugin.h".
10790         (Archive::setup): Don't preread archive symbols when using a plugin.
10791         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
10792         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10793         files.
10794         (Archive::include_member): Add symbols from plugin objects.
10795         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10796         * descriptors.cc (Descriptors::open): Check for file descriptors
10797         abandoned by plugins.
10798         (Descriptors::claim_for_plugin): New function.
10799         * descriptors.h (Descriptors::claim_for_plugin): New function.
10800         (Open_descriptor::is_claimed): New field.
10801         (claim_descriptor_for_plugin): New function.
10802         * fileread.cc (File_read::claim_for_plugin): New function.
10803         * fileread.h (File_read::claim_for_plugin): New function.
10804         (File_read::descriptor): New function.
10805         * gold.cc: Include "plugin.h".
10806         (queue_initial_tasks): Add task to call plugin hooks for generating
10807         new object files.
10808         * main.cc: Include "plugin.h".
10809         (main): Load plugin libraries.
10810         * object.h (Pluginobj): Declare.
10811         (Object::pluginobj): New function.
10812         (Object::do_pluginobj): New function.
10813         (Object::set_target): New function.
10814         * options.cc: Include "plugin.h".
10815         (General_options::parse_plugin): New function.
10816         (General_options::General_options): Initialize plugins_ field.
10817         (General_options::add_plugin): New function.
10818         * options.h (Plugin_manager): Declare.
10819         (General_options): Add --plugin option.
10820         (General_options::has_plugins): New function.
10821         (General_options::plugins): New function.
10822         (General_options::add_plugin): New function.
10823         (General_options::plugins_): New field.
10824         * plugin.cc: New file.
10825         * plugin.h: New file.
10826         * readsyms.cc: Include "plugin.h".
10827         (Read_symbols::do_read_symbols): Check for archive before checking
10828         for ELF file.  Call plugin hooks to claim files.
10829         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10830         from a real object file; force override when processing replacement
10831         files.
10832         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10833         (Symbol::init_base_object): Likewise.
10834         (Symbol::init_base_output_data): Likewise.
10835         (Symbol::init_base_output_segment): Likewise.
10836         (Symbol::init_base_constant): Likewise.
10837         (Symbol::init_base_undefined): Likewise.
10838         (Symbol::output_section): Assert that object is not a plugin.
10839         (Symbol_table::add_from_pluginobj): New function.
10840         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10841         undefined.
10842         (Symbol_table::sized_write_globals): Likewise.
10843         (Symbol_table::add_from_pluginobj): Instantiate template.
10844         * symtab.h (Sized_pluginobj): Declare.
10845         (Symbol::in_real_elf): New function.
10846         (Symbol::set_in_real_elf): New function.
10847         (Symbol::in_real_elf_): New field.
10848         (Symbol_table::add_from_pluginobj): New function.
10849
10850         * testsuite/Makefile.am (AM_CFLAGS): New variable.
10851         (LIBDL): New variable.
10852         (LDADD): Add LIBDL.
10853         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10854         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10855         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10856         (MOSTLYCLEANFILES): Likewise.
10857         * testsuite/Makefile.in: Regenerate.
10858         * testsuite/plugin_test.c: New file.
10859         * testsuite/plugin_test_1.sh: New file.
10860         * testsuite/plugin_test_2.sh: New file.
10861
10862 2008-09-16  Ian Lance Taylor  <iant@google.com>
10863
10864         * target-reloc.h (relocate_section): Check whether a symbol is
10865         defined by the ABI before reporting an undefined symbol error.
10866         * target.h (Target::is_defined_by_abi): Make parameter const.
10867         (Target::do_is_defined_by_abi): Likewise.
10868         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10869         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10870         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10871         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10872         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10873         * testsuite/Makefile.in: Rebuild.
10874
10875         * fileread.cc (make_view): Add casts to avoid warning.
10876
10877 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10878
10879         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10880         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10881
10882 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
10883
10884         * options.h (General_options::output_is_executable): New.
10885         (General_options::output_is_pie): New.
10886         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10887         for shared libraries.
10888         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10889
10890 2008-09-11  Chris Demetriou  <cgd@google.com>
10891
10892         * options.h (origin): New -z option.
10893         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10894         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10895         in DT_FLAGS_1.
10896
10897 2008-09-05  Cary Coutant  <ccoutant@google.com>
10898
10899         * fileread.cc (File_read::make_view): Add check for attempt to map
10900         beyond end of file.
10901
10902 2008-09-05  Cary Coutant  <ccoutant@google.com>
10903
10904         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10905         explicit instantiations.
10906
10907 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
10908
10909         PR gold/6858
10910         * options.cc (General_options::finalize): Allow undefined symbols
10911         in shlibs if linking -shared.
10912
10913         PR gold/6859
10914         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10915         symbols as not needing a dynsym entry.
10916
10917 2008-08-20  Craig Silverstein  <csilvers@google.com>
10918
10919         * fileread.cc (File_read::open): Do not lock the file unless it
10920         was successfully opened.
10921
10922 2008-08-14  Cary Coutant  <ccoutant@google.com>
10923
10924         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10925         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10926         * testsuite/tls_test.cc (struct int128): 128-bit struct
10927         for testing TLS relocs with non-zero addend.
10928         (v12): New TLS variable.
10929         (t12): New test.
10930         (t_last): Add check for v12.
10931         * testsuite/tls_test.h (t12): New function.
10932         * testsuite/tls_test_main.cc (thread_routine): Call new test.
10933
10934 2008-08-13  Ian Lance Taylor  <iant@google.com>
10935
10936         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10937         set tls_segment_ or relro_segment_.
10938         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10939         when appropriate.
10940         * output.h (Output_section::clear_is_relro): New function.
10941         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10942         sections specially even when output_data_ is empty.
10943         (Output_segment::maximum_alignment): When first section is relro,
10944         only force alignment for PT_LOAD segments.
10945         * script.cc (script_data_segment_align): New function.
10946         (script_data_segment_relro_end): New function.
10947         * script-c.h (script_data_segment_align): Declare.
10948         (script_data_segment_relro_end): Declare.
10949         * script-sections.h (class Script_sections): Declare
10950         data_segment_align and data_segment_relro_end.  Add fields
10951         segment_align_index_ and saw_relro_end_.
10952         * script-sections.cc (class Sections_element): Add set_is_relro
10953         virtual function.  Add new bool* parameter to place_orphan_here.
10954         Add get_output_section virtual function.
10955         (class Output_section_definition): Add set_is_relro.  Add new
10956         bool* parameter to place_orphan_here.  Add get_output_section.
10957         Add is_relro_ field.
10958         (Output_section_definition::Output_section_definition): Initialize
10959         evaluated_address_, evaluated_load_address, evaluated_addralign_,
10960         and is_relro_ fields.
10961         (Output_section_definition::place_orphan_here): Add is_relro
10962         parameter.
10963         (Output_section_definition::set_section_addresses): Set relro for
10964         output section.
10965         (Output_section_definition::alternate_constraint): Likewise.
10966         (class Orphan_output_section): Add new bool* parameter to
10967         place_orphan_here.  Add get_output_section.
10968         (Orphan_output_section::place_orphan_here): Add is_relro
10969         parameter.
10970         (Script_sections::Script_sections): Initialize
10971         data_segment_align_index_ and saw_relro_end_.
10972         (Script_sections::data_segment_align): New function.
10973         (Script_sections::data_segment_relro_end): New function.
10974         (Script_sections::place_orphan): Set or clear is_relro.
10975         (Script_sections::set_section_addresses): Force alignment of first
10976         TLS section.
10977         * yyscript.y (exp): Call script_data_segment_align and
10978         script_data_segment_relro_end.
10979         * testsuite/relro_script_test.t: New file.
10980         * testsuite/relro_test.cc (using_script): Declare.
10981         (t1, t2): Test using_script.
10982         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10983         (relro_script_test_SOURCES): Define.
10984         (relro_script_test_DEPENDENCIES): Define.
10985         (relro_script_test_LDFLAGS): Define.
10986         (relro_script_test_LDADD): Define.
10987         (relro_script_test.so): New target.
10988         * testsuite/Makefile.in: Rebuild.
10989
10990 2008-08-06  Cary Coutant <ccoutant@google.com>
10991
10992         * archive.cc (Archive::total_archives, Archive::total_members)
10993         (Archive::total_members_loaded): New variables.
10994         (Archive::setup): Add parameter.  Add option to preread
10995         archive symbols.
10996         (Archive::read_armap): Add counter.
10997         (Archive::get_file_and_offset): New function.
10998         (Archive::get_elf_object_for_member): New function.
10999         (Archive::read_all_symbols): New function.
11000         (Archive::read_symbols): New function.
11001         (Archive::add_symbols): Add counters.
11002         (Archive::include_all_members): Use armap to find members if it's
11003         already built.
11004         (Archive::include_member): Skip reading symbols if already read.
11005         Factored code into Archive::get_file_and_offset and
11006         Archive::get_elf_object_for_member.  Changed call to
11007         Mapfile::report_include_archive_member.
11008         (Archive::print_stats): New function.
11009         * archive.h: Declare Object and Read_symbols_data classes.
11010         (Archive::Archive): Add initializers for new members.
11011         (Archive::setup): Add parameter.
11012         (Archive::print_stats): New function.
11013         (Archive::total_archives, Archive::total_members)
11014         (Archive::total_members_loaded): New variables.
11015         (Archive::get_file_and_offset): New function.
11016         (Archive::get_elf_object_for_member): New function.
11017         (Archive::read_all_symbols): New function.
11018         (Archive::read_symbols): New function.
11019         (Archive::Archive_member): New class.
11020         (Archive::members_): New member.
11021         (Archive::num_members_): New member.
11022         * main.cc: Include archive.h.
11023         (main): Call Archive::print_stats.
11024         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11025         archive parameter; member_name is now the fully-decorated name.
11026         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11027         * options.h: (General_options): Add --preread-archive-symbols option.
11028         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11029         Archive::setup.
11030
11031 2008-08-04  Ian Lance Taylor  <iant@google.com>
11032
11033         * symtab.h (Symbol::use_plt_offset): New function.
11034         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11035         * powerpc.cc (Relocate::relocate): Likewise.
11036         * sparc.cc (Relocate::relocate): Likewise.
11037         * x86_64.cc (Relocate::relocate): Likewise.
11038         * testsuite/weak_plt.sh: New test.
11039         * testsuite/weak_plt_main.cc: New test.
11040         * testsuite/weak_plt_shared.cc: New test.
11041         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11042         (check_PROGRAMS): Add weak_plt.
11043         (check_DATA): Add weak_plt_shared.so.
11044         (weak_plt_main_pic.o, weak_plt): New targets.
11045         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11046         * testsuite/Makefile.in: Rebuild.
11047
11048         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11049         gcctestdir/ld.
11050         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11051         * testsuite/Makefile.in: Rebuild.
11052
11053 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11054
11055         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11056         * Makefile.in: Regenerate.
11057         * po/POTFILES.in: Regenerate.
11058
11059 2008-07-29  Ian Lance Taylor  <iant@google.com>
11060
11061         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11062         symbols before other symbols.
11063         * testsuite/script_test_2.cc (test_addr): Declare.
11064         (test_addr_alias): Declare.
11065         (main): Check that test_addr and test_addr_alias have the right
11066         values.
11067         * testsuite/script_test_2.t: Define test_addr_alias and
11068         test_addr.
11069
11070 2008-07-24  Ian Lance Taylor  <iant@google.com>
11071
11072         PR 5990
11073         * descriptors.cc: New file.
11074         * descriptors.h: New file.
11075         * gold-threads.h (class Hold_optional_lock): New class.
11076         * fileread.cc: Include "descriptors.h".
11077         (File_read::~File_read): Release descriptor rather than closing
11078         it.
11079         (File_read::open) [file]: Call open_descriptor rather than open.
11080         Set is_descriptor_opened_.
11081         (File_read::open) [memory]: Assert that descriptor is not open.
11082         (File_read::reopen_descriptor): New function.
11083         (File_read::release): Release descriptor.
11084         (File_read::do_read): Make non-const.  Reopen descriptor.
11085         (File_read::read): Make non-const.
11086         (File_read::make_view): Reopen descriptor.
11087         (File_read::do_readv): Likewise.
11088         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11089         Update declarations.
11090         * layout.cc: Include "descriptors.h".
11091         (Layout::create_build_id): Use open_descriptor rather than open.
11092         * output.cc: Include "descriptors.h".
11093         (Output_file::open): Use open_descriptor rather than open.
11094         * archive.cc (Archive::const_iterator): Change Archive to be
11095         non-const.
11096         (Archive::begin, Archive::end): Make non-const.
11097         (Archive::count_members): Likewise.
11098         * archive.h (class Archive): Update declarations.
11099         * object.h (Object::read): Make non-const.
11100         * Makefile.am (CCFILES): Add descriptors.cc.
11101         (HFILES): Add descriptors.h.
11102         * Makefile.in: Rebuild.
11103
11104         PR 6716
11105         * gold.h: Always include <clocale>.  Add Solaris workarounds
11106         following code in binutils/sysdep.h.
11107
11108         PR 6048
11109         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11110         this->eh_frame_hdr_ is NULL before using it.
11111
11112         * dynobj.cc (Versions::Versions): Update comment.
11113
11114         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11115         the base version name.
11116
11117         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11118         array size plus one.
11119         (Stringpool_template::set_string_offsets): Subtract one from key
11120         before using it as an array index.
11121         (Stringpool_template::get_offset_with_length): Likewise.
11122         (Stringpool_template::write_to_buffer): Likewise.
11123         * stringpool.h (Stringpool_template::get_offset_from_key):
11124         Likewise.
11125
11126 2008-07-23  Ian Lance Taylor  <iant@google.com>
11127
11128         PR 6658
11129         * object.h (Merged_symbol_value::value): Do our best to handle a
11130         negative addend.
11131
11132         PR 6647
11133         * script.cc (Version_script_info::get_versions): Don't add empty
11134         version tag to return value.
11135         (Version_script_info::get_symbol_version_helper): Change return
11136         type to bool.  Add pversion parameter.  Change all callers.
11137         (script_register_vers_node): Don't require a non-NULL tag.
11138         * script.h (class Version_script_info): Update declarations.
11139         (Version_script_info::get_symbol_version): Change return type to
11140         bool.  Add version parameter.  Change all callers.
11141         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11142         handling.  Handle an empty version from a version script.
11143         (Symbol_table::define_special_symbol): Likewise.
11144         * testsuite/ver_test_10.script: New file.
11145         * testsuite/ver_test_10.sh: New file.
11146         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11147         (check_DATA): Add ver_test_10.syms.
11148         (ver_test_10.syms, ver_test_10.so): New target.
11149         * testsuite/Makefile.in: Rebuild.
11150
11151 2008-07-23  Simon Baldwin  <simonb@google.com>
11152
11153         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11154         to zero for undefined symbols from dynamic libraries.
11155
11156 2008-07-23  Ian Lance Taylor  <iant@google.com>
11157
11158         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11159         Change all callers.
11160         * symtab.h (class Symbol_table): Update declaration.
11161         * testsuite/ver_test_9.cc: New file.
11162         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11163         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11164         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11165         (ver_test_9.so, ver_test_9.o): New targets.
11166         * testsuite/Makefile.in: Rebuild.
11167
11168 2008-07-22  Ian Lance Taylor  <iant@google.com>
11169
11170         * options.h (class General_options): Define --check-sections.
11171         * layout.cc (Layout::set_segment_offsets): Handle
11172         --check-sections.
11173
11174         * options.h (class General_options): Define -n/--nmagic and
11175         -N/--omagic.
11176         * options.cc (General_options::finalize): For -n/--nmagic or
11177         -N/--omagic, set -static.
11178         * layout.cc (Layout::attach_allocated_section_to_segment): If
11179         -N/--omagic, don't put read-only and read-write sections in
11180         different segments.
11181         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11182         finding a read-only segment.
11183         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11184         don't set the minimum segment alignment to the common page size,
11185         and don't set the file offset to the address modulo the page size.
11186         * script-sections.cc (Script_sections::create_segments): If
11187         -n/--omagic, don't put read-only and read-write sections in
11188         different segments.
11189
11190         * cref.cc: New file.
11191         * cref.h: New file.
11192         * options.h (class General_options): Add --print-symbol-counts.
11193         * main.cc (main): Issue defined symbol report if requested.
11194         * archive.cc (Archive::interpret_header): Make into a const member
11195         function.
11196         (Archive::add_symbols): Call Input_objects::archive_start and
11197         archive_stop.
11198         (Archive::const_iterator): Define new class.
11199         (Archive::begin, Archive::end): New functions.
11200         (Archive::include_all_members): Rewrite to use iterator.
11201         (Archive::count_members): New function.
11202         * archive.h (class Archive): Update declarations.
11203         (Archive::filename): New function.
11204         * object.cc: Include "cref.h".
11205         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11206         (Sized_relobj::do_get_global_symbol_counts): New function.
11207         (Input_objects::add_object): Add object to cross-referencer.
11208         (Input_objects::archive_start): New function.
11209         (Input_objects::archive_stop): New function.
11210         (Input_objects::print_symbol_counts): New function.
11211         * object.h: Declare Cref and Archive.
11212         (Object::get_global_symbol_counts): New function.
11213         (Object::do_get_global_symbol_counts): New pure virtual function.
11214         (class Sized_relobj): Add defined_count_ field.  Update
11215         declarations.
11216         (class Input_objects): Add cref_ field.  Update constructor.
11217         Update declarations.
11218         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11219         defined_count_.
11220         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11221         symbol counts.
11222         (Sized_dynobj::do_get_global_symbol_counts): New function.
11223         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11224         defined_count_.  Update declarations.  Define Symbols typedef.
11225         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11226         parameter.  Change all callers.
11227         (Symbol_table::add_from_dynobj): Add sympointers and defined
11228         parameters.  Change all callers.
11229         * symtab.h (class Symbol_table): Update declarations.
11230         * Makefile.am (CCFILES): Add cref.cc.
11231         (HFILES): Add cref.h.
11232         * Makefile.in: Rebuild.
11233
11234 2008-07-22  Simon Baldwin  <simonb@google.com>
11235
11236         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11237         to zero when writing undefined symbols.
11238
11239 2008-07-22  Ian Lance Taylor  <iant@google.com>
11240
11241         * output.cc (Output_section::add_input_section): Don't try to
11242         merge empty merge sections.
11243
11244 2008-07-21  Craig Silverstein  <csilvers@google.com>
11245
11246         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11247         Include symbol version in error message.
11248
11249 2008-07-20  Chris Demetriou  <cgd@google.com>
11250
11251         * configure.ac (gold_cv_c_random_seed): New configured variable.
11252         (RANDOM_SEED_CFLAGS): New substituted variable.
11253         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11254         * configure: Rebuild.
11255         * Makefile.in: Likewise.
11256         * testsuite/Makefile.in: Likewise.
11257
11258 2008-07-18  Ian Lance Taylor  <iant@google.com>
11259
11260         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11261         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11262         * testsuite/ver_test_main.cc (main): Call t4.
11263         (t4, t4_2a): Define.
11264         * testsuite/ver_test_2.cc (t4_2): Define.
11265         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11266         * testsuite/ver_test_4.cc (t4_2a): Define.
11267         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11268         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11269
11270 2008-07-17  Ian Lance Taylor  <iant@google.com>
11271
11272         * dynobj.cc (Versions::add_def): If we give an error about a
11273         missing version, go ahead and create the version anyhow.
11274
11275 2008-07-10  Ian Lance Taylor  <iant@google.com>
11276
11277         Handle output sections with more than 0x7fffffff bytes.
11278         * object.h (class Relobj): Change map_to_output_ to
11279         output_sections_, and just keep a section pointer.  Change all
11280         uses.  Move comdat group support to Sized_relobj.
11281         (Relobj::is_section_specially_mapped): Remove.
11282         (Relobj::output_section): Remove poff parameter.  Change all
11283         callers.
11284         (Relobj::output_section_offset): New function.
11285         (Relobj::set_section_offset): Rewrite.
11286         (Relobj::map_to_output): Remove.
11287         (Relobj::output_sections): New function.
11288         (Relobj::do_output_section_offset): New pure virtual function.
11289         (Relobj::do_set_section_offset): Likewise.
11290         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11291         group support from Relobj.  Update declarations.
11292         (Sized_relobj::get_output_section_offset): New function.
11293         (Sized_relobj::do_output_section_offset): New function.
11294         (Sized_relobj::do_set_section_offset): New function.
11295         * object.cc (Relobj::output_section_address): Remove.
11296         (Sized_relobj::Sized_relobj): Initialize new fields.
11297         (Sized_relobj::include_section_group): Cast find_kept_object to
11298         Sized_relobj.
11299         (Sized_relobj::include_linkonce_section): Likewise.
11300         (Sized_relobj::do_layout): Use separate arrays for output section
11301         and output offset.
11302         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11303         output_sections.
11304         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11305         output_sections and section_offsets.
11306         (Sized_relobj::write_local_symbols): Likewise.
11307         (map_to_kept_section): Compute output address directly.
11308         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11309         output_sections and section_offsets.
11310         (Sized_relobj::write_sections): Likewise.
11311         (Sized_relobj::relocate_sections): Likewise.
11312         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11313         * output.h (class Output_reloc): Update declarations.  Change
11314         u2_.relobj to Sized_relobj*.
11315         (class Output_data_reloc): Change add functions to use
11316         Sized_relobj*.
11317         * output.cc (Output_reloc::Output_reloc): Change relobj to
11318         Sized_relobj*.
11319         (Output_reloc::local_section_offset): Change return type to
11320         Elf_Addr.  Use get_output_section_offset.
11321         (Output_reloc::get_address): Likewise.
11322         (Output_section::is_input_address_mapped): Don't call
11323         is_section_specially_mapped.
11324         (Output_section::output_offset): Likewise.
11325         (Output_section::output_address): Likewise.
11326         (Output_section::starting_output_address): Likewise.
11327         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11328         parameter to Sized_relobj*.
11329         (Copy_relocs::need_copy_reloc): Likewise.
11330         (Copy_relocs::save): Likewise.
11331         * copy-relocs.h (class Copy_relocs): Update declarations.
11332         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11333         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11334         * target-reloc.h (relocate_for_relocatable): Change
11335         offset_in_output_section type to Elf_Addr.  Change code that uses
11336         it as well.
11337         * layout.cc (Layout::layout): Always set *off.
11338         * mapfile.cc (Mapfile::print_input_section): Use
11339         output_section_offset.
11340         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11341         Sized_relobj*.
11342         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11343         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11344         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11345
11346 2008-07-03  Ian Lance Taylor  <iant@google.com>
11347
11348         * layout.cc (Layout::include_section): Do not discard unrecognized
11349         SHT_STRTAB sections.
11350
11351 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11352
11353         * script.cc (Lex::can_continue_name): Make '?' allowable in
11354         version-script names.
11355         * testsuite/version_script.map: Change glob pattern to use '?'
11356
11357 2008-06-30  Manish Singh  <yosh@gimp.org>
11358
11359         PR 6585
11360         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11361         Correct typo.
11362
11363 2008-06-30  Ian Lance Taylor  <iant@google.com>
11364
11365         PR 6660
11366         PR 6682
11367         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11368         versions]: Don't try to read the value in the contents, since we
11369         don't use it.  Use the template endianness when writing.
11370
11371 2008-06-25  Cary Coutant  <ccoutant@google.com>
11372
11373         * fileread.cc (File_read::make_view): Assert on zero-length view.
11374         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11375         symbol table when there are no symbols to read.
11376
11377 2008-06-23  Craig Silverstein  <csilvers@google.com>
11378
11379         * version.cc (version_string): Bump to 1.7
11380
11381 2008-06-18  Craig Silverstein  <csilvers@google.com>
11382
11383         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11384         constant 0xFFFF to type Valtype.
11385         (Powerpc_relocate_functions::rel16_ha): Likewise.
11386
11387 2008-06-17  Ian Lance Taylor  <iant@google.com>
11388
11389         * output.h (Output_section::Input_section): Initialize p2align_ to
11390         zero for Output_section_data constructors.
11391         (Output_section::Input_section::addralign): If not an input
11392         section, return the alignment of the Output_section_data.
11393         * testsuite/copy_test.cc: New file.
11394         * testsuite/copy_test_1.cc: New file.
11395         * testsuite/copy_test_2.cc: New file.
11396         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11397         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11398         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11399         (copy_test_1_pic.o, copy_test_1.so): New targets.
11400         (copy_test_2_pic.o, copy_test_2.so): New targets.
11401         * testsuite/Makefile.in: Rebuild.
11402
11403         * script-sections.cc (Script_sections::place_orphan): Initialize
11404         local variable exact.
11405
11406 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11407
11408         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11409
11410 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11411             David S. Miller  <davem@davemloft.net>
11412
11413         * powerpc.cc: New file.
11414         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11415         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11416         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11417         * Makefile.in: Rebuild.
11418
11419 2008-06-09  Ian Lance Taylor  <iant@google.com>
11420
11421         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11422         <exception>.
11423         (throwing, orig_terminate): New static variables.
11424         (terminate_handler): New static function.
11425         (t2): Set terminate handler.
11426
11427 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11428
11429         PR 6584
11430         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11431         alignment.
11432
11433 2008-05-30  Cary Coutant  <ccoutant@google.com>
11434
11435         * archive.cc (Archive::include_all_members) Correct to step
11436         over symbol table and extended name table in thin archives.
11437
11438 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11439
11440         PR 6407
11441         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11442         calculation.
11443
11444 2008-05-28  Caleb Howe  <cshowe@google.com>
11445
11446         * reduced_debug_output.cc: New file.
11447         * reduced_debug_output.h: New file.
11448         * options.h (class General_options): Add --strip-debug-non-line.
11449         * options.cc (General_options::finalize): Add strip_debug_non_line
11450         to the strip heirarchy.
11451         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11452         fields.
11453         * layout.cc: Include "reduced_debug_output.h".
11454         (Layout::Layout): Initialize new fields.
11455         (line_only_debug_sections): New static array.
11456         (is_lines_only_debug_sections): New static inline function.
11457         (Layout::include_section): Handle --strip-debug-non-line.
11458         (Layout::make_output_section): If --strip-debug-non-line, build
11459         new output sections for .debug_abbrev and .debug_info.
11460         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11461         gold.  Warn about possible overflow.
11462         (read_signed_LEB_128): Likewise.
11463         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11464         (read_signed_LEB_128): Declare.
11465         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11466         (HFILES): Add reduced_debug_output.h.
11467         * Makefile.in: Rebuild.
11468
11469 2008-05-21  Ian Lance Taylor  <iant@google.com>
11470
11471         * mapfile.cc: New file.
11472         * mapfile.h: New file.
11473         * options.h (class General_options): Add -M/--print-map and -Map.
11474         * options.cc (General_options::finalize): Make -M equivalent to
11475         -Map -.
11476         * main.cc: Include <cstdio> and "mapfile.h".
11477         (main): Open mapfile if requested.
11478         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11479         constructor.  Change caller.
11480         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11481         (queue_middle_tasks): Likewise.
11482         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11483         declarations.
11484         * archive.cc: Include "mapfile.h".
11485         (Archive::add_symbols): Add mapfile parameter.  Change all
11486         callers.  Pass mapfile, symbol, and reason to include_member.
11487         (Archive::include_all_members): Add mapfile parameter.  Change all
11488         callers.
11489         (Archive::include_member): Add mapfile, sym, and why parameters.
11490         Change all callers.  Report inclusion to map file.
11491         * archive.h: Include "fileread.h".
11492         (class Archive): Update declarations.
11493         (Archive::file): New const method.
11494         (class Add_archive_symbols): Add mapfile_ field.  Update
11495         constructor.  Change all callers.
11496         * readsyms.h (class Read_symbols): Likewise.
11497         (class Finish_group): Likewise.
11498         (class Read_script): Likewise.
11499         * common.cc: Include "mapfile.h".
11500         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11501         all callers.
11502         (Symbol_table::do_allocate_commons): Likewise.
11503         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11504         symbol allocation to mapfile.
11505         * common.h (class Allocate_commons_task): Add mapfile_ field.
11506         Update constructor.  Change all callers.
11507         * symtab.h (class Symbol_table): Update declarations.
11508         * layout.cc: Include "mapfile.h".
11509         (Layout_task_runner::run): Print information to mapfile.
11510         (Layout::create_gold_note): Change Output_data_fixed_space to
11511         Output_data_zero_fill.
11512         (Layout::create_build_id): Likewise.
11513         (Layout::print_to_mapfile): New function.
11514         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11515         constructor.  Change caller.
11516         (class Layout): Declare print_to_mapfile.
11517         * output.cc (Output_section::Input_section::print_to_mapfile): New
11518         function.
11519         (Output_section::add_input_section): If producing a map, always
11520         add to input_sections_ list.
11521         (Output_section::do_print_to_mapfile): New function.
11522         (Output_segment::print_sections_to_mapfile): New function.
11523         (Output_segment::print_section_list_to_mapfile): New function.
11524         * output.h: Include "mapfile.h".
11525         (Output_data::print_to_mapfile): New function.
11526         (Output_data::do_print_to_mapfile): New virtual function.
11527         (Output_segment_headers::do_print_to_mapfile): New function.
11528         (Output_file_header::do_print_to_mapfile): New function.
11529         (Output_data_const::do_print_to_mapfile): New function.
11530         (class Output_data_const_buffer): Add map_name_ field.  Update
11531         constructor.  Change all callers.  Add do_print_to_mapfile
11532         function.
11533         (class Output_data_fixed_space): Likewise.
11534         (class Output_data_space): Likewise.
11535         (class Output_data_zero_fill): New class.
11536         (Output_data_strtab::do_print_to_mapfile): New function.
11537         (Output_data_reloc_base::do_print_to_mapfile): New function.
11538         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11539         (Output_data_group::do_print_to_mapfile): New function.
11540         (Output_data_got::do_print_to_mapfile): New function.
11541         (Output_data_dynamic::do_print_to_mapfile): New function.
11542         (Output_symtab_xindex::do_print_to_mapfile): New function.
11543         (class Output_section): Declare do_print_to_mapflie.  Declare
11544         print_to_mapfile in Input_section.
11545         (class Output_segment): Declare new functions.
11546         * object.h (Sized_relobj::symbol_count): New function.
11547         * script-sections.cc
11548         (Output_section_element_dot_assignment::set_section_addresses):
11549         Change Output_data_fixed_space to Output_data_zero_fill.
11550         (Output_data_expression::do_print_to_mapfile): New function.
11551         * script.cc (read_input_script): Add mapfile parameter.  Change
11552         all callers.
11553         * script.h (read_input_script): Update declaration.
11554         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11555         (Eh_frame::do_print_to_mapfile): New function.
11556         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11557         (Output_merge_string::do_print_to_mapfile): New function.
11558         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11559         function.
11560         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11561         function.
11562         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11563         function.
11564         * Makefile.am (CCFILES): Add mapfile.cc.
11565         (HFILES): Add mapfile.h.
11566         * Makefile.in: Rebuild.
11567
11568 2008-05-19  Ian Lance Taylor  <iant@google.com>
11569
11570         * options.h (class General_options): Add -z relro.
11571         * layout.cc (Layout::Layout): Initialize relro_segment_.
11572         (Layout::add_output_section_data): Return the output section.
11573         (Layout::make_output_section): Rcognize relro sections and mark
11574         them appropriately.
11575         (Layout::attach_allocated_section_to_segment): Put relro sections
11576         in a PT_GNU_RELRO segment.
11577         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11578         section as relro.
11579         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11580         PT_TLS segments.
11581         (Layout::linkonce_mapping): Map d.rel.ro.local to
11582         .data.rel.ro.local.
11583         (Layout::output_section_name): Us .data.rel.ro.local for any
11584         section which begins with that.
11585         * layout.h (class Layout): Update add_output_section_data
11586         declaration.  Add relro_segment_ field.
11587         * output.cc (Output_section::Output_section): Initialize is_relro_
11588         and is_relro_local_ fields.
11589         (Output_segment::add_output_section): Group relro sections.
11590         (Output_segment::is_first_section_relro): New function.
11591         (Output_segment::maximum_alignment): If there is a relro section,
11592         align the segment to the common page size.
11593         (Output_segment::set_section_addresses): Track whether we are
11594         looking at relro sections.  If the last section is a relro
11595         section, align to the common page size.
11596         (Output_segment::set_section_list_addresses): Add in_relro
11597         parameter.  Change all callers.  Align to the page size when
11598         moving from relro to non-relro section.
11599         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11600         segment.
11601         * output.h (class Output_section): Add is_relro_ and
11602         is_relro_local_ fields.
11603         (Output_section::is_relro): New function.
11604         (Output_section::set_is_relro): New function.
11605         (Output_section::is_relro_local): New function.
11606         (Output_section::set_is_relro_local): New function.
11607         (class Output_segment): Update declarations.
11608         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11609         * sparc.cc (Target_sparc::got_section): Likewise.
11610         * x86_64.cc (Target_x86_64::got_section): Likewise.
11611         * testsuite/relro_test_main.cc: New file.
11612         * testsuite/relro_test.cc: New file.
11613         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11614         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11615         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11616         (relro_test.so, relro_test_pic.o): New targets.
11617         * testsuite/Makefile.in: Rebuild.
11618
11619 2008-05-16  Ian Lance Taylor  <iant@google.com>
11620
11621         * output.cc (Output_segment::add_output_section): Remove front
11622         parameter.
11623         * output.h (class Output_segment): Remove
11624         add_initial_output_section and overloaded add_output_section.
11625         Update declaration of remaining add_output_section.
11626         * layout.cc (Layout::create_interp): Call add_output_section
11627         rather than add_initial_output_section.
11628         (Layout::finish_dynamic_section): Likewise.
11629
11630         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11631         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11632         know the dynamic type.
11633         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11634         field.  Initialize it in constructor.
11635         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11636         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11637         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11638         reloc.
11639
11640         * output.cc (Output_reloc::get_address): Change return type to
11641         Elf_Addr.
11642         * output.h (class Output_reloc): Update get_address declaration.
11643         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11644         for section addresses.
11645
11646 2008-05-09  Ian Lance Taylor  <iant@google.com>
11647
11648         PR 6493
11649         * gold.cc (gold_nomem): Use return value of write.
11650
11651 2008-05-08  Ian Lance Taylor  <iant@google.com>
11652
11653         * symtab.c (Symbol::init_base_output_data): Add version
11654         parameter.  Change all callers.
11655         (Symbol::init_base_output_segment): Likewise.
11656         (Symbol::init_base_constant): Likewise.
11657         (Symbol::init_base_undefined): Likewise.
11658         (Sized_symbol::init_output_data): Likewise.
11659         (Sized_symbol::init_output_segment): Likewise.
11660         (Sized_symbol::init_constant): Likewise.
11661         (Sized_symbol::init_undefined): Likewise.
11662         (Symbol_table::do_define_in_output_data): If the new symbol has a
11663         version, mark it as the default.
11664         (Symbol_table::do_define_in_output_segment): Likewise.
11665         (Symbol_table::do_define_as_constant): Likewise.
11666         * symtab.h (class Symbol): Update declarations.
11667         (class Sized_symbol): Likewise.
11668         * resolve.cc (Symbol::override_version): New function.
11669         (Symbol::override_base): Call override_version.
11670         (Symbol::override_base_with_special): Likewise.
11671         * testsuite/ver_script_8.script: New file.
11672         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11673         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11674         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11675         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11676
11677 2008-05-06  Ian Lance Taylor  <iant@google.com>
11678
11679         PR 6049
11680         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11681         functions.
11682         (class General_options): Remove existing --undefined, and add
11683         --no-undefined instead.  Add new --undefined as synonym for -u.
11684         * archive.cc (Archive::add_symbols): Check whether symbol was
11685         named with -u.
11686         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11687         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11688         all uses.  Add IS_UNDEFINED.  Update declarations to split
11689         different versions of init_base.  Declare init_base_undefined.
11690         (Symbol::is_defined): Handle IS_UNDEFINED.
11691         (Symbol::is_undefined): Likewise.
11692         (Symbol::is_weak_undefined): Call is_undefined.
11693         (Symbol::is_absolute): Handle IS_CONSTANT.
11694         (class Sized_symbol): Update declarations to split different
11695         versions of init.  Declare init_undefined.
11696         (class Symbol_table): Declare new functions.
11697         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11698         Change all callers.
11699         (Symbol::init_base_output_data): Likewise.
11700         (Symbol::init_base_output_segment): Likewise.
11701         (Symbol::init_base_constant): Likewise.
11702         (Symbol::init_base_undefined): New function.
11703         (Sized_symbol::init_object): Rename from init.  Change all
11704         callers.
11705         (Sized_symbol::init_output_data): Likewise.
11706         (Sized_symbol::init_output_segment): Likewise.
11707         (Sized_symbol::init_constant): Likewise.
11708         (Sized_symbol::init_undefined): New function.
11709         (Symbol_table::add_undefined_symbols_from_command_line): New
11710         function.
11711         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11712         function.
11713         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11714         (Symbol::output_section): Likewise.
11715         (Symbol::set_output_section): Likewise.
11716         (Symbol_table::sized_finalize_symbol): Likewise.
11717         (Symbol_table::sized_write_globals): Likewise.
11718         * resolve.cc (Symbol_table::should_override): Likewise.
11719         (Symbol::override_base_with_special): Likewise.
11720
11721         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11722         symbol, change it to have default visibility.
11723         * testsuite/protected_1.cc: New file.
11724         * testsuite/protected_2.cc: New file.
11725         * testsuite/protected_3.cc: New file.
11726         * testsuite/protected_main_1.cc: New file.
11727         * testsuite/protected_main_2.cc: New file.
11728         * testsuite/protected_main_3.cc: New file.
11729         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11730         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11731         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11732         (protected_1.so): New target.
11733         (protected_1_pic.o, protected_2_pic.o): New targets.
11734         (protected_3_pic.o): New target.
11735         (check_PROGRAMS): Add protected_2.
11736         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11737         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11738         * testsuite/Makefile.in: Rebuild.
11739
11740         * options.h (DEFINE_var): Add set_user_set_##varname__.
11741         (DEFINE_bool_alias): New macro.
11742         (class General_options): Define -Bstatic using DEFINE_bool_alias
11743         rather than DEFINE_special.  Add --undefined as an alias for -z
11744         defs.
11745         * options.cc (General_options::parse_Bstatic): Remove.
11746
11747         * options.h (class General_options): Add --fatal-warnings.
11748         * main.cc (main): Implement --fatal-warnings.
11749         * errors.h (Errors::warning_count): New function.
11750
11751         * options.h (class General_options): Add -Bsymbolic-functions.
11752         * symtab.h (Symbol::is_preemptible): Check for
11753         -Bsymbolic-functions.
11754
11755 2008-05-05  Ian Lance Taylor  <iant@google.com>
11756
11757         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11758         as noVARNAME rather than no-VARNAME.
11759         (class General_options): Add option -z combreloc.
11760         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11761         get_address.
11762         (Output_reloc::sort_before) [SHT_REL]: New function.
11763         (Output_reloc::sort_before) [SHT_RELA]: New function.
11764         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11765         Sort_relocs_comparison.
11766         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11767         parameter.  Change all callers.
11768         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11769         sort_relocs parameter.  Change all callers.
11770         * output.cc (Output_reloc::get_address): New function, broken out
11771         of write_rel.
11772         (Output_reloc::write_rel): Call it.
11773         (Output_reloc::compare): New function.
11774         (Output_data_reloc_base::do_write): Optionally sort relocs.
11775
11776         * configure.ac: If targ_extra_obj is set, link it in.
11777         * configure.tgt: Initialize all variables.
11778         (x86_64*): Set targ_extra_obj and targ_extra_size.
11779         * configure: Rebuild.
11780
11781         * object.cc (Sized_relobj::include_section_group): Adjust section
11782         indexes read from group data.  Build vector to pass to
11783         layout_group.
11784         * layout.cc (Layout::layout_group): Add flags and shndxes
11785         parameters.  Remove contents parameter.  Change caller.  Update
11786         explicit instantiations.
11787         * layout.h (class Layout): Update layout_group declaration.
11788         * output.cc (Output_data_group::Output_data_group): Add flags and
11789         input_shndxes parameters.  Remove contents parameter.  Change
11790         caller.
11791         (Output_data_group::do_write): Change input_sections_ to
11792         input_shndxes_.
11793         * output.h (class Output_data_group): Update constructor
11794         declaration.  Rename input_sections_ to input_shndxes_.
11795         * testsuite/many_sections_test.cc: Add template.
11796
11797 2008-04-30  Cary Coutant  <ccoutant@google.com>
11798
11799         * target-reloc.h (relocate_section): Fix dead-pointer bug.
11800
11801         * layout.cc (Layout::include_section): Refactored check for debug
11802         info section.
11803         (Layout::add_comdat): Add new parameters.  Change type
11804         of signature parameter.  Add object and shndx to signatures table.
11805         (Layout::find_kept_object): New function.
11806         * layout.h: Include <cstring>.
11807         (Layout::is_debug_info_section): New function.
11808         (Layout::add_comdat): Add new parameters.
11809         (Layout::find_kept_object): New function.
11810         (Layout::Kept_section): New struct.
11811         (Layout::Signatures): Change type of map range.
11812         * object.cc (Relobj::output_section_address): New function.
11813         (Sized_relobj::include_section_group): Add new parameters.  Change
11814         calls to Layout::add_comdat.  Change to build table of kept comdat
11815         groups and table mapping discarded sections to kept sections.
11816         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
11817         (Sized_relobj::do_layout): Change calls to include_section_group and
11818         include_linkonce_section.
11819         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11820         value to zero when section is discarded.
11821         (Sized_relobj::map_to_kept_section): New function.
11822         * object.h (Relobj::output_section_address): New function.
11823         (Relobj::Comdat_group): New type.
11824         (Relobj::find_comdat_group): New function.
11825         (Relobj::Comdat_group_table): New type.
11826         (Relobj::Kept_comdat_section): New type.
11827         (Relobj::Kept_comdat_section_table): New type.
11828         (Relobj::add_comdat_group): New function.
11829         (Relobj::set_kept_comdat_section): New function.
11830         (Relobj::get_kept_comdat_section): New function.
11831         (Relobj::comdat_groups_): New field.
11832         (Relobj::kept_comdat_sections_): New field.
11833         (Symbol_value::input_value): Update comment.
11834         (Sized_relobj::map_to_kept_section) New function.
11835         (Sized_relobj::include_linkonce_section): Add new parameter.
11836         * target-reloc.h (Comdat_behavior): New type.
11837         (get_comdat_behavior): New function.
11838         (relocate_section): Add code to map a discarded section to the
11839         corresponding kept section when applying a relocation.
11840
11841 2008-04-30  Craig Silverstein  <csilvers@google.com>
11842
11843         * dwarf_reader.cc (next_generation_count): New static var.
11844         (Addr2line_cache_entry): New struct.
11845         (addr2line_cache): New static var.
11846         (Dwarf_line_info::one_addr2line): Added caching.
11847         (Dwarf_line_info::clear_addr2line_cache): New function.
11848         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11849         cache-size parameter.
11850         (Dwarf_line_info::one_addr2line_cache): New function.
11851         * symtab.cc (Symbol_table::detect_odr_violations): Pass
11852         new cache-size argument to one_addr2line(), and clear cache.
11853
11854 2008-04-28  Cary Coutant  <ccoutant@google.com>
11855
11856         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11857         R_386_PC8 relocations.
11858
11859 2008-04-23  Ian Lance Taylor  <iant@google.com>
11860
11861         * object.cc (Sized_relobj::include_section_group): Check for
11862         invalid section group.
11863
11864         * object.cc (make_elf_object): Correct test for 64-bit ELF file
11865         header size.
11866
11867         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11868         than read for file header.
11869         * archive.cc (Archive::include_member): Likewise.
11870
11871 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
11872
11873         * aclocal.m4: Regenerate.
11874         * configure: Regenerate.
11875
11876 2008-04-19  Ian Lance Taylor  <iant@google.com>
11877
11878         * version.cc (version_string): Bump to 1.6.
11879
11880         * testsuite/Makefile.am (many_sections_r_test): New target.
11881         (many_sections_r_test_SOURCES): Remove.
11882         (many_sections_r_test_DEPENDENCIES): Remove.
11883         (many_sections_r_test_LDFLAGS): Remove.
11884         (many_sections_r_test_LDADD): Remove.
11885
11886         * object.cc (Sized_relobj::do_add_symbols): Always pass
11887         local_symbol_count_ to add_from_relobj.
11888
11889         * testsuite/Makefile.am (many_sections_check.h): Only check one in
11890         every thousand variables.
11891         * testsuite/Makefile.in: Rebuild.
11892
11893         * object.cc (Xindex::initialize_symtab_xindex): New function.
11894         (Xindex::read_symtab_xindex): New function.
11895         (Xindex::sym_xindex_to_shndx): New function.
11896         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11897         available.
11898         (Sized_relobj::do_initialize_xindex): New function.
11899         (Sized_relobj::do_read_symbols): Adjust section links.
11900         (Sized_relobj::symbol_section_and_value): Add is_ordinary
11901         parameter.  Change all callers.
11902         (Sized_relobj::include_section_group): Adjust section links and
11903         symbol section indexes.
11904         (Sized_relobj::do_layout): Adjust section links.
11905         (Sized_relobj::do_count_local_symbols): Adjust section links and
11906         symbol section indexes.
11907         (Sized_relobj::do_finalize_local_symbols): Distinguish between
11908         ordinary and special symbols.
11909         (Sized_relobj::write_local_symbols): Add symtab_xindex and
11910         dynsym_xindex parameters.  Change all callers.  Adjust section
11911         links.  Use SHN_XINDEX when needed.
11912         (Sized_relobj::get_symbol_location_info): Adjust section links.
11913         Don't get fooled by special symbols.
11914         * object.h (class Xindex): Define.
11915         (class Object): Add xindex_ parameter.  Declare virtual functoin
11916         do_initialize_xindex.
11917         (Object::adjust_sym_shndx): New function.
11918         (Object::set_xindex): New protected function.
11919         (class Symbol_value): Add is_ordinary_shndx_ field.
11920         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11921         (Symbol_value::value): Assert ordinary section.
11922         (Symbol_value::initialize_input_to_output_map): Likewise.
11923         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11924         Change all callers.
11925         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
11926         all callers.
11927         (class Sized_relobj): Update declarations.
11928         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11929         parameter.  Change all callers.
11930         (Sized_relobj::adjust_shndx): New function.
11931         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11932         field.
11933         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11934         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
11935         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
11936         (Sized_dynobj::read_dynsym_section): Adjust section links.
11937         (Sized_dynobj::read_dynamic): Likewise.
11938         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
11939         section links.
11940         (Sized_dynobj::do_initialize_xindex): New function.
11941         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
11942         do_initialize_xindex.
11943         (Sized_dynobj::adjust_shndx): New function.
11944         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11945         dynsym_xindex_ fields.
11946         (Layout::finalize): Add a call to set_section_indexes before
11947         creating the symtab sections.
11948         (Layout::set_section_indexes): Don't do anything if the section
11949         already has a section index.
11950         (Layout::create_symtab_sections): Add shnum parameter.  Change
11951         caller.  Create .symtab_shndx section if needed.
11952         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
11953         caller.
11954         (Layout::allocated_output_section_count): New function.
11955         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11956         needed.
11957         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11958         fields.  Update declarations.
11959         (Layout::symtab_xindex): New function.
11960         (Layout::dynsym_xindex): New function.
11961         (class Write_symbols_task): Add layout_ field.
11962         (Write_symbols_task::Write_symbols_task): Add layout parameter.
11963         Change caller.
11964         * output.cc (Output_section_headers::Output_section_headers): Add
11965         shstrtab_section parameter.  Change all callers.
11966         (Output_section_headers::do_sized_write): Store overflow values
11967         for section count and section string table section index in
11968         section header zero.
11969         (Output_file_header::do_sized_write): Check for overflow of
11970         section count and section string table section index.
11971         (Output_symtab_xindex::do_write): New function.
11972         (Output_symtab_xindex::endian_do_write): New function.
11973         * output.h (class Output_section_headers): Add shstrtab_section_.
11974         Update declarations.
11975         (class Output_symtab_xindex): Define.
11976         (Output_section::has_out_shndx): New function.
11977         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11978         field.
11979         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11980         Change all callers.
11981         (Sized_symbol::init): Likewise.
11982         (Symbol::output_section): Check for ordinary symbol.
11983         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
11984         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
11985         callers.
11986         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11987         Change all callers.  Simplify handling of symbols from sections
11988         not included in the link.
11989         (Symbol_table::add_from_dynobj): Handle ordinary symbol
11990         distinction.
11991         (Weak_alias_sorter::operator()): Assert that symbols are
11992         ordinary.
11993         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11994         distinction.
11995         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11996         parameters.  Change all callers.
11997         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
11998         symbol distinction.  Use SHN_XINDEX when needed.
11999         (Symbol_table::write_section_symbol): Add symtab_xindex
12000         parameter.  Change all callers.
12001         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12002         SHN_XINDEX when needed.
12003         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12004         declarations.
12005         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12006         (Symbol::is_defined): Check is_ordinary.
12007         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12008         (Symbol::is_absolute, Symbol::is_common): Likewise.
12009         (class Sized_symbol): Update declarations.
12010         (class Symbol_table): Update declarations.
12011         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12012         parameters.  Change all callers.
12013         (Sized_symbol::override): Likewise.
12014         (Symbol_table::override): Likewise.
12015         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12016         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12017         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12018         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12019         to be in an ordinary section.
12020         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12021         object and is_ordinary parameters.  Change all callers.
12022         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12023         Change all callers.  Don't add undefined or non-ordinary symbols
12024         to reloc_map_.
12025         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12026         Change all callers.
12027         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12028         declarations.
12029         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12030         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12031         (Sized_relobj::relocate_sections): Likewise.
12032         * target-reloc.h (scan_relocs): Adjust section symbol index.
12033         (scan_relocatable_relocs): Likewise.
12034         * i386.cc (Scan::local): Check for ordinary symbols.
12035         * sparc.cc (Scan::local): Likewise.
12036         * x86_64.cc (Scan::local): Likewise.
12037         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12038         to symbol_section_and_value.
12039         * testsuite/many_sections_test.cc: New file.
12040         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12041         (check_PROGRAMS): Add many_sections_test.
12042         (many_sections_test_SOURCES): Define.
12043         (many_sections_test_DEPENDENCIES): Define.
12044         (many_sections_test_LDFLAGS): Define.
12045         (BUILT_SOURCES): Add many_sections_define.h.
12046         (many_sections_define.h): New target.
12047         (BUILT_SOURCES): Add many_sections_check.h.
12048         (many_sections_check.h): New target.
12049         (check_PROGRAMS): Add many_sections_r_test.
12050         (many_sections_r_test_SOURCES): Define.
12051         (many_sections_r_test_DEPENDENCIES): Define.
12052         (many_sections_r_test_LDFLAGS): Define.
12053         (many_sections_r_test_LDADD): Define.
12054         (many_sections_r_test.o): New target.
12055         * testsuite/Makefile.in: Rebuild.
12056
12057 2008-04-17  Cary Coutant  <ccoutant@google.com>
12058
12059         * errors.cc (Errors::info): New function.
12060         (gold_info): New function.
12061         * errors.h (Errors::info): New function.
12062         * gold.h (gold_info): New function.
12063         * object.cc (Input_objects::add_object): Print trace output.
12064         * options.cc (options::parse_set): New function.
12065         (General_options::parse_wrap): Deleted.
12066         (General_options::General_options): Deleted initializer.
12067         * options.h (options::String_set): New typedef.
12068         (options::parse_set): New function.
12069         (DEFINE_set): New macro.
12070         (General_options::wrap): Changed to use DEFINE_set. Changed
12071         callers of any_wrap_symbols and is_wrap_symbol.
12072         (General_options::trace, General_options::trace_symbol):
12073         New options.
12074         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12075         (General_options::wrap_symbols_): Deleted.
12076         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12077
12078 2008-04-17  David S. Miller  <davem@davemloft.net>
12079
12080         * options.cc (General_options::parse_V): New function.
12081         * options.h: Add entries for -V and -Qy.
12082
12083 2008-04-17  Ian Lance Taylor  <iant@google.com>
12084
12085         * common.cc (Symbol_table::allocate_commons): Remove options
12086         parameter.  Change caller.
12087         (Symbol_table::do_allocate_commons): Remove options parameter.
12088         Change caller.  Just call do_allocate_commons_list twice.
12089         (Symbol_table::do_allocate_commons_list): New function, broken out
12090         of do_allocate_commons.
12091         * common.h (class Allocate_commons_task): Remove options_ field.
12092         Update constructor.
12093         * symtab.cc (Symbol_table::Symbol_table): Initialize
12094         tls_commons_.
12095         (Symbol_table::add_from_object): Put TLS common symbols on
12096         tls_commons_ list.
12097         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12098         which are IN_OUTPUT_DATA.
12099         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12100         allocate_commons and do_allocate_commons declarations.  Declare
12101         do_allocate_commons_list.
12102         * gold.cc (queue_middle_tasks): Update creation of
12103         Allocate_commons_task to not pass options.
12104         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12105         (TLS_TEST_C_FLAGS): New variable.
12106         (tls_test_c_pic.o): New target.
12107         (tls_test_shared.so): Link in tls_test_c_pic.o.
12108         (tls_test_c_pic_ie.o): New target.
12109         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12110         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12111         (tls_test_c.o): New target.
12112         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12113         (tls_pic_test_LDADD): Likewise.
12114         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12115         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12116         (tls_test_c_gnu2.o): New target.
12117         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12118         tls_test_c_gnu2.o.
12119         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12120         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12121         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12122         * testsuite/tls_test.cc: Include "config.h".
12123         (t_last): Call t11_last.
12124         * testsuite/tls_test.h (t11, t11_last): Declare.
12125         * testsuite/tls_test_c.c: New file.
12126         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12127         * configure.ac: Check for OpenMP support.
12128         * configure, config.in, Makefile.in: Rebuild.
12129         * testsuite/Makefile.in: Rebuild.
12130
12131 2008-04-16  Cary Coutant  <ccoutant@google.com>
12132
12133         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12134         (Target_i386::tls_base_symbol_defined_): New field.
12135         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12136         (Target_i386::Scan::global): Likewise.
12137         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12138         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12139         (Target_x86_64::tls_base_symbol_defined_): New field.
12140         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12141         (Target_x86_64::Scan::global): Likewise.
12142
12143 2008-04-16  Cary Coutant  <ccoutant@google.com>
12144
12145         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12146         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12147         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12148         building shared libraries.
12149         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12150         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12151         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12152         * testsuite/Makefile.in: Rebuild.
12153         * testsuite/weak_undef.h: New file.
12154         * testsuite/weak_undef_file1.cc: Add extra test cases.
12155         * testsuite/weak_undef_file2.cc: Likewise.
12156         * testsuite/weak_undef_test.cc: Likewise.
12157
12158 2008-04-16  David S. Miller  <davem@davemloft.net>
12159
12160         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12161         Add issued_non_pic_error_ field.  Declare check_non_pic.
12162         (Target_sparc::Scan::check_non_pic): New function.
12163         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12164         (Target_sparc::Scan::global): Likewise.
12165
12166         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12167         * configure: Rebuild.
12168
12169         * options.h (DEFINE_enable): New macro.
12170         (new_dtags): New enable option.
12171         (initfirst, interpose, loadfltr, nodefaultlib,
12172         nodelete, nodlopen, nodump): New -z options.
12173         * layout.cc (Layout:finish_dynamic_section): If new
12174         dtags enabled, emit DT_RUNPATH.  Also, emit a
12175         DT_FLAGS_1 containing any specified -z flags.
12176
12177 2008-04-16  Ian Lance Taylor  <iant@google.com>
12178
12179         * copy-relocs.cc: New file.
12180         * copy-relocs.h: New file.
12181         * reloc.cc: Remove Copy_relocs code.
12182         * reloc.h: Likewise.
12183         * reloc-types.h (struct Reloc_types) [both versions]: Add
12184         get_reloc_addend_noerror.
12185         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12186         variants of add_global which take an addend which must be zero.
12187         * i386.cc: Include "copy-relocs.h".
12188         (class Target_i386): Change type of copy_relocs_ to variable,
12189         update initializer.
12190         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12191         Change all callers.
12192         (Target_i386::do_finalize_sections): Change handling of
12193         copy_relocs_.
12194         * sparc.cc: Include "copy-relocs.h".
12195         (class Target_sparc): Change type of copy_relocs_ to variable,
12196         update initializer.
12197         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12198         Change all callers.
12199         (Target_sparc::do_finalize_sections): Change handling of
12200         copy_relocs_.
12201         * x86_64.cc: Include "copy-relocs.h".
12202         (class Target_x86_64): Change type of copy_relocs_ to variable,
12203         update initializer.
12204         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12205         class.  Change all callers.
12206         (Target_x86_64::do_finalize_sections): Change handling of
12207         copy_relocs_.
12208         * Makefile.am (CCFILES): Add copy-relocs.cc.
12209         (HFILES): Add copy-relocs.h.
12210
12211         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12212
12213         * testsuite/script_test_4.sh: Permit leading zeroes.
12214
12215 2008-04-15  Ian Lance Taylor  <iant@google.com>
12216
12217         * script-sections.cc (Script_sections::create_segments): Use
12218         header_size_adjustment even when there is enough room for the
12219         headers.
12220         * testsuite/script_test_4.sh: New file.
12221         * testsuite/script_test_4.t: New file.
12222         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12223         (check_DATA): Add script_test_4.stdout.
12224         (MOSTLYCLEANFILES): Likewise.
12225         (script_test_4): New target.
12226         (script_test_4.stdout): New target.
12227         * testsuite/Makefile.in: Rebuild.
12228
12229         * sparc.cc: Add definitions for Output_data_plt_sparc class
12230         constants.
12231
12232 2008-04-14  David S. Miller  <davem@davemloft.net>
12233
12234         * sparc.cc: New file.
12235         * Makefile.am (TARGETSOURCES): Add sparc.cc
12236         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12237         * configure.tgt: Document targ_extra_size and
12238         targ_extra_big_endian.  Add entries for sparc-* and
12239         sparc64-*.
12240         * configure.ac: Handle targ_extra_size and
12241         targ_extra_big_endian.
12242         * Makefile.in: Rebuild.
12243         * configure: Likewise.
12244         * po/POTFILES.in: Likewise.
12245         * po/gold.pot: Likewise.
12246
12247 2008-04-14  Ian Lance Taylor  <iant@google.com>
12248
12249         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12250         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12251         in the name/type/flags to section mapping.  Don't call
12252         allocate_output_section.
12253         (Layout::choose_output_section): Change parameter from adjust_name
12254         to is_input_section.  Don't permit input sections after sections
12255         are attached to segments.  Don't call allocate_output_section.
12256         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12257         not write_enable_output_section.
12258         (Layout::make_output_section): Don't push to
12259         unattached_section_list_ nor call attach_to_segment.  Call
12260         attach_section_to_segment if sections are attached.
12261         (Layout::attach_sections_to_segments): New function.
12262         (Layout::attach_section_to_segment): New function.
12263         (Layout::attach_allocated_section_to_segment): Rename from
12264         attach_to_segment.  Remove flags parameter.
12265         (Layout::allocate_output_section): Remove function.
12266         (Layout::write_enable_output_section): Remove function.
12267         * layout.h (class Layout): Update for above changes.  Add new
12268         field sections_are_attached_.
12269         * output.h (Output_section::update_flags_for_input_section): New
12270         function.
12271         * output.cc (Output_section::add_input_section): Call
12272         update_flags_for_input_section.
12273         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12274
12275 2008-04-11  Cary Coutant  <ccoutant@google.com>
12276
12277         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12278         thought unnecessary.
12279         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12280
12281 2008-04-11  Ian Lance Taylor  <iant@google.com>
12282
12283         * output.h (class Output_section_data): Remove inline definition
12284         of set_addralign.
12285         * output.cc (Output_section_data::set_addralign): New function.
12286
12287 2008-04-11  Cary Coutant  <ccoutant@google.com>
12288
12289         Add support for TLS descriptors for i386 and x86_64.
12290         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12291         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12292         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12293         GOT_TYPE_TLS_DESC.
12294         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12295         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12296         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12297         relocations.
12298         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12299         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12300         Fix problem with initial-exec relocations.
12301         (Target_i386::Relocate::relocate_tls): Likewise.
12302         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12303         relaxation.
12304         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12305         support for section-plus-offset dynamic table entries.
12306         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12307         (Output_data_dynamic::Dynamic_entry): Add support for
12308         section-plus-offset dynamic table entries.
12309         (Output_data_dynamic::Classification): Likewise.
12310         (Output_data_dynamic::classification_): Renamed offset_.
12311         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12312         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12313         (Target_x86_64::make_plt_section): New function.
12314         (Target_x86_64::reserve_tlsdesc_entries): New function.
12315         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12316         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12317         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12318         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12319         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12320         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12321         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12322         add extra PLT entry for TLS descriptors.
12323         (Output_data_plt_x86_64::got_): New field.
12324         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12325         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12326         fields.
12327         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12328         descriptors.
12329         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12330         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12331         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12332         R_386_TLS_DESC_CALL relocations.
12333         (Target_x86_64::Scan::global): Likewise.
12334         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12335         for TLS descriptors.
12336         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12337         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12338         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12339         GD-to-IE relaxation.
12340         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12341         and TLS_DESCRIPTORS.
12342         * Makefile.in: Rebuild.
12343         * configure: Rebuild.
12344         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12345         (tls_test_shared2.so): New target.
12346         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12347         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12348         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12349         (tls_shared_gd_to_ie_test_LDADD): New variable.
12350         (tls_shared_gnu2_gd_to_ie_test): New target.
12351         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12352         New targets.
12353         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12354         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12355         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12356         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12357         (tls_shared_gnu2_test): New target.
12358         (tls_test_gnu2_shared.so): New target.
12359         (tls_shared_gnu2_test_SOURCES): New variable.
12360         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12361         (tls_shared_gnu2_test_LDFLAGS): New variable.
12362         (tls_shared_gnu2_test_LDADD): New variable.
12363         * testsuite/Makefile.in: Rebuild.
12364         * testsuite/Makefile.
12365
12366 2008-04-11  Ian Lance Taylor  <iant@google.com>
12367
12368         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12369         justsyms.t.
12370         * testsuite/Makefile.in: Rebuild.
12371
12372         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12373         long.
12374         * testsuite/script_test_2.cc (main): Adjust test.
12375
12376 2008-04-11  David S. Miller  <davem@davemloft.net>
12377             Ian Lance Taylor  <iant@google.com>
12378
12379         * options.h (General_options): Add entries for '-Y' and
12380         '-relax'.
12381         * options.cc (General_options:finalize): If -Y was used, add those
12382         entries to the library path instead of the default "/lib" and
12383         "/usr/lib".
12384
12385 2008-04-11  David S. Miller  <davem@davemloft.net>
12386
12387         * testsuite/justsyms.t: Start at 0x100.
12388         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12389         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12390         long.
12391         * testsuite/script_test_2.cc: Adjust string and section length
12392         checks.
12393
12394 2008-04-09  Ian Lance Taylor  <iant@google.com>
12395
12396         PR gold/5996
12397         * script-sections.cc (Sections_element::allocate_to_segment): Add
12398         orphan parameter.
12399         (Output_section_definition::allocate_to_segment): Likewise.
12400         (Orphan_output_section::allocate_to_segment): Likewise.
12401         (Script_sections::attach_sections_using_phdrs_clause): Don't
12402         propagate non-PT_LOAD segments to orphan sections.
12403         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12404         readelf rather than objdump.
12405         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12406         .interp section and PT_INTERP segment are the same size.
12407         * testsuite/Makefile.in: Rebuild.
12408
12409         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12410         aliases for symbols defined in the same object.
12411         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12412         (weak_alias_test_SOURCES): New variable.
12413         (weak_alias_test_DEPENDENCIES): New variable.
12414         (weak_alias_test_LDFLAGS): New variable.
12415         (weak_alias_test_LDADD): New variable.
12416         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12417         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12418         (weak_alias_test_3.o): New target.
12419         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12420         * testsuite/weak_alias_test_main.cc: New file.
12421         * testsuite/weak_alias_test_1.cc: New file.
12422         * testsuite/weak_alias_test_2.cc: New file.
12423         * testsuite/weak_alias_test_3.cc: New file.
12424
12425 2008-04-08  Ian Lance Taylor  <iant@google.com>
12426
12427         * options.h (class General_options): Add --noinhibit-exec option.
12428         * main.cc (main): Check --noinhibit-exec.
12429
12430         * options.h (class General_options): Define --wrap as a special
12431         option.  Add wrap_symbols_ field.
12432         (General_options::any_wrap_symbols): New function.
12433         (General_options::is_wrap_symbol): New function.
12434         * options.cc (General_options::parse_wrap): New function.
12435         (General_options::General_options): Initialize wrap_symbols_.
12436         * symtab.cc (Symbol_table::wrap_symbol): New function.
12437         (Symbol_table::add_from_object): Handle --wrap.
12438         * symtab.h (class Symbol_table): Declare wrap_symbol.
12439         * target.h (Target::wrap_char): New function.
12440         (Target::Target_info): Add wrap_char field.
12441         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12442         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12443         * testsuite/testfile.cc (Target_test::test_target_info):
12444         Likewise.
12445
12446         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12447         there is one.
12448
12449         * layout.h (class Layout): Add added_eh_frame_data_ field.
12450         * layout.cc (Layout::Layout): Initialize new field.
12451         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12452         output section until we find a section we merged successfully.
12453         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12454         that the size be non-zero.
12455
12456         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12457         qualifier.
12458
12459 2008-04-08  Craig Silverstein  <csilvers@google.com>
12460
12461         * configure.ac: Export new conditional variable HAVE_ZLIB.
12462         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12463         on HAVE_ZLIB.
12464         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12465         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12466
12467 2008-04-07  Ian Lance Taylor  <iant@google.com>
12468
12469         * version.cc (version_string): Set to "1.5".
12470
12471         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12472         Add issued_non_pic_error_ field.  Declare check_non_pic.
12473         (Target_x86_64::Scan::check_non_pic): New function.
12474         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12475         (Target_x86_64::Scan::global): Likewise.
12476
12477         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12478         addend parameter.  Change caller.  Handle merge sections.
12479         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12480         Address to Addend.  Don't add in the result of
12481         local_section_offset, pass down the addend and use the returned
12482         value.
12483         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12484         Update declarations of local_section_offset and symbol_value.
12485         * testsuite/two_file_test_1.cc (t18): New function.
12486         * testsuite/two_file_test_2.cc (f18): New function.
12487         * testsuite/two_file_test_main.cc (main): Call t18.
12488         * testsuite/two_file_test.h (t18, f18): Declare.
12489
12490         * configure.ac: Don't test for objdump, c++filt, or readelf.
12491         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12492         conditionals.
12493         (TEST_READELF): New variable.
12494         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12495         (check_PROGRAMS): Add two_file_strip_test.
12496         (two_file_strip_test): New target.
12497         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12498         (two_file_same_shared_strip_test_SOURCES): New variable.
12499         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12500         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12501         (two_file_same_shared_strip_test_LDADD): New variable.
12502         (two_file_shared_strip.so): New target.
12503         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12504         (ver_test_5.syms, ver_test_7.syms): Likewise.
12505         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12506         (strip_test_3.stdout): Use TEST_OBJDUMP.
12507         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12508
12509 2008-04-04  Cary Coutant  <ccoutant@google.com>
12510
12511         * symtab.h (Symbol::is_weak_undefined): New function.
12512         (Symbol::is_strong_undefined): New function.
12513         (Symbol::is_absolute): New function.
12514         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12515         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12516         absolute symbols.
12517         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12518         (weak_undef_test): New target.
12519         * testsuite/Makefile.in: Rebuild.
12520         * testsuite/weak_undef_file1.cc: New file.
12521         * testsuite/weak_undef_file2.cc: New file.
12522         * testsuite/weak_undef_test.cc: New file.
12523
12524 2008-04-03  Craig Silverstein  <csilvers@google.com>
12525
12526         * compressed_output.h (class Output_compressed_section): Use
12527         unsigned buffer.
12528         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12529         add zlib header.
12530         (zlib_compressed_suffix): Removed.
12531         (Output_compressed_section::set_final_data_size): Use unsigned
12532         buffers.
12533         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12534         Fix linker invocation.
12535         (flagstest_o_specialfile_and_compress_debug_sections):
12536         Likewise.
12537         * testsuite/Makefile.in: Regenerated.
12538
12539 2008-04-02  David S. Miller  <davem@davemloft.net>
12540
12541         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12542         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12543
12544 2008-04-02  Craig Silverstein  <csilvers@google.com>
12545
12546         * TODO: New file.
12547
12548 2008-04-02  Ian Lance Taylor  <iant@google.com>
12549
12550         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12551         parameters.  Update for new key type to views_.  Change all
12552         callers.
12553         (File_read::read): Adjust for byteshift in returned view.
12554         (File_read::add_view): New function, broken out of
12555         find_and_make_view.
12556         (File_read::make_view): New function, broken out of
12557         find_and_make_view.
12558         (File_read::find_or_make_view): Add offset and aligned
12559         parameters.  Rewrite accordingly.  Change all callers.
12560         (File_read::get_view): Add offset and aligned parameters.  Adjust
12561         for byteshift in return value.
12562         (File_read::get_lasting_view): Likewise.
12563         * fileread.h (class File_read): Update declarations.
12564         (class File_read::View): Add byteshift_ field.  Add byteshift to
12565         constructor.  Add byteshift method.
12566         * archive.h (Archive::clear_uncached_views): New function.
12567         (Archive::get_view): Add aligned parameter.  Change all callers.
12568         * object.h (Object::get_view): Add aligned parameter.  Change all
12569         callers.
12570         (Object::get_lasting_view): Likewise.
12571
12572         * fileread.cc (File_read::release): Don't call clear_views if
12573         there are multiple objects.
12574         * fileread.h (File_read::clear_uncached_views): New function.
12575         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12576         on the archive.
12577
12578 2008-03-31  Cary Coutant  <ccoutant@google.com>
12579
12580         Add thin archive support.
12581         * archive.cc (Archive::armagt): New const.
12582         (Archive::setup): Remove task parameter and calls to unlock.
12583         (Archive::unlock_nested_archives): New function.
12584         (Archive::read_header): Add nested_off parameter. Change
12585         all callers.
12586         (Archive::interpret_header): Likewise.
12587         (Archive::include_all_members): Change to handle thin
12588         archives.
12589         (Archive::include_member): Likewise.
12590         * archive.h (Archive::Archive): Add new parameters and
12591         initializers.
12592         (Archive::armagt): New const.
12593         (Archive::setup): Remove task parameter.
12594         (Archive::unlock_nested_archives): New function.
12595         (Archive::read_header): Add nested_off parameter.
12596         (Archive::interpret_header): Likewise.
12597         (Archive::Nested_archive_table): New typedef.
12598         (Archive::is_thin_archive_): New field.
12599         (Archive::nested_archives_): New field.
12600         (Archive::options_): New field.
12601         (Archive::dirpath_): New field.
12602         (Archive::task_): New field.
12603         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12604         for thin archives.  Pass additional parameters to
12605         Archive::Archive.  Unlock the archive file after calling
12606         Archive::setup.
12607
12608 2008-03-29  Ian Lance Taylor  <iant@google.com>
12609
12610         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12611         version symbol to be local.
12612         * testsuite/ver_test_4.sh: New file.
12613         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12614         (check_DATA): Add ver_test_4.syms.
12615         (ver_test_4.syms): New target.
12616         * testsuite/Makefile.in: Rebuild.
12617
12618         * output.cc
12619         (Output_section::Input_section_sort_entry::has_priority): New
12620         function.
12621         (Output_section::Input_section_sort_entry::match_file_name): New
12622         function.
12623         (Output_section::Input_section_sort_entry::match_section_name):
12624         Remove.
12625         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12626         Remove.
12627         (Output_section::Input_section_sort_entry::match_section_file):
12628         Remove.
12629         (Output_section::Input_section_sort_compare::operator()): Rewrite
12630         using new Input_section_sort_entry functions.  Sort crtbegin and
12631         crtend first.  Sort sections with no priority before sections with
12632         a priority.
12633         * testsuite/initpri1.c (d3): Check j != 4.
12634         (cd5): New constructor/destructor function.
12635         (main): Check j != 2.
12636
12637         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12638         new symbol when resolving, don't call set_is_default.
12639         * testsuite/ver_test_7.cc: New file.
12640         * testsuite/ver_test_7.sh: New file.
12641         * testsuite/Makefile.am (ver_test_7.so): New target.
12642         (ver_test_7.o): New target.
12643         (check_SCRIPTS): Add ver_test_7.sh.
12644         (check_DATA): Add ver_test_7.syms.
12645         (ver_test_7.syms): New target.
12646
12647 2008-03-28  Ian Lance Taylor  <iant@google.com>
12648
12649         * layout.cc (Layout::layout): If we see an input section with a
12650         name that needs sorting, set the must_sort flag for the output
12651         section.
12652         (Layout::make_output_section): If the name of the output section
12653         indicates that it might require sorting, set the may_sort flag.
12654         * output.h (Output_section::may_sort_attached_input_sections): New
12655         function.
12656         (Output_section::set_may_sort_attached_input_sections): New
12657         function.
12658         (Output_section::must_sort_attached_input_sections): New
12659         function.
12660         (Output_section::set_must_sort_attached_input_sections): New
12661         function.
12662         (class Output_section): Declare Input_section_sort_entry.  Define
12663         Input_section_sort_compare.  Declare
12664         sort_attached_input_sections.  Add new fields:
12665         may_sort_attached_input_sections_,
12666         must_sort_attached_input_sections_,
12667         attached_input_sections_are_sorted_.
12668         * output.cc (Output_section::Output_section): Initialize new
12669         fields.
12670         (Output_section::add_input_section): Add an entry to
12671         input_sections_ if may_sort or must_sort are true.
12672         (Output_section::set_final_data_size): Call
12673         sort_attached_input_sections if necessary.
12674         (Output_section::Input_section_sort_entry): Define new class.
12675         (Output_section::Input_section_sort_compare::operator()): New
12676         function.
12677         (Output_section::sort_attached_input_sections): New function.
12678         * configure.ac: Check whether the compiler supports constructor
12679         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12680         * testsuite/initpri1.c: New file.
12681         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12682         CONSTRUCTOR_PRIORITY.
12683         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12684         (initpri1_LDFLAGS): New variable.
12685         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12686
12687 2008-03-27  Ian Lance Taylor  <iant@google.com>
12688
12689         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12690         * testsuite/common_test_1.c: New file.
12691         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12692         (common_test_1_SOURCES): New variable.
12693         (common_test_1_DEPENDENCIES): New variable.
12694         (common_test_1_LDFLAGS): New variable.
12695
12696         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12697         and commons_ correctly when NAME/VERSION does not override
12698         NAME/NULL.
12699         * testsuite/ver_test_6.c: New file.
12700         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12701         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12702         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12703
12704 2008-03-26  Ian Lance Taylor  <iant@google.com>
12705
12706         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12707         of an undefined symbol from a version script.
12708         * testsuite/Makefile.am (ver_test_5.so): New target.
12709         (ver_test_5.o): New target.
12710         (check_SCRIPTS): Add ver_test_5.sh.
12711         (check_DATA): Add ver_test_5.syms.
12712         (ver_test_5.syms): New target.
12713         * testsuite/ver_test_5.cc: New file.
12714         * testsuite/ver_test_5.script: New file.
12715         * testsuite/ver_test_5.sh: New file.
12716         * Makefile.in, testsuite/Makefile.in: Rebuild.
12717
12718         PR gold/5986
12719         Fix problems building gold with gcc 4.3.0.
12720         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12721         (gold_error_at_location, gold_warning_at_location): Use it.
12722         * configure.ac: Check whether we can compile and use a template
12723         function with a printf attribute.
12724         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12725         when jumping over bytes.
12726         * object.cc: Instantiate Object::read_section_data.
12727         * debug.h: Include <cstring>
12728         * dwarf_reader.cc: Include <algorithm>
12729         * main.cc: Include <cstring>.
12730         * options.cc: Include <cstring>.
12731         * output.cc: Include <cstring>.
12732         * script.cc: Include <cstring>.
12733         * script.h: Include <string>.
12734         * symtab.cc: Include <cstring> and <algorithm>.
12735         * target-select.cc: Include <cstring>.
12736         * version.cc: Include <string>.
12737         * testsuite/testmain.cc: Include <cstdlib>.
12738         * configure, config.in: Rebuild.
12739
12740 2008-03-25  Ian Lance Taylor  <iant@google.com>
12741
12742         * options.cc: Include "../bfd/bfdver.h".
12743         (options::help): Print bug reporting address.
12744
12745         * version.cc (print_version): Adjust output for current value of
12746         BFD_VERSION_STRING.
12747
12748         * NEWS: New file.
12749
12750         * options.cc (options::help): Print list of supported targets.
12751         * target-select.h: Include <vector>.
12752         (class Target_selector): Make machine_, size_, and is_big_endian_
12753         fields const.  Add bfd_name_ and instantiated_target_ fields.
12754         (Target_selector::Target_selector): Add bfd_name parameter.
12755         (Target_selector::recognize): Make non-virtual, call
12756         do_recognize.
12757         (Target_selector::recognize_by_name): Make non-virtual, call
12758         do_recognize_by_name.
12759         (Target_selector::supported_names): New function.
12760         (Target_selector::bfd_name): New function.
12761         (Target_selector::do_instantiate_target): New pure virtual
12762         function.
12763         (Target_selector::do_recognize): New virtual function.
12764         (Target_selector::do_recognize_by_name): New virtual function.
12765         (Target_selector::instantiate_target): New private function.
12766         (supported_target_names): Declare.
12767         * target-select.cc (Target_selector::Target_selector): Update for
12768         new parameter and fields.
12769         (select_target_by_name): Check that the name matches before
12770         calling recognize_by_name.
12771         (supported_target_names): New function.
12772         * i386.cc (class Target_selector_i386): Update Target_selector
12773         constructor call.  Remove recognize and recognize_by_name.  Add
12774         do_instantiate_target.
12775         * x86_64.cc (class Target_selector_x86_64): Likewise.
12776         * testsuite/testfile.cc (class Target_selector_test): Update for
12777         changes to Target_selector.
12778
12779         * README: Rewrite, with some notes on unsupported features.
12780
12781 2008-03-24  Cary Coutant  <ccoutant@google.com>
12782
12783         * i386.cc (Target_i386::Got_type): New enum declaration.
12784         (Target_i386::Scan::local): Updated callers of Output_data_got
12785         member functions.
12786         (Target_i386::Scan::global): Likewise.
12787         (Target_i386::Relocate::relocate): Likewise.
12788         (Target_i386::Relocate::relocate_tls): Likewise.
12789         * object.h (Got_offset_list): New class.
12790         (Sized_relobj::local_has_got_offset): Added got_type parameter.
12791         (Sized_relobj::local_got_offset): Likewise.
12792         (Sized_relobj::set_local_got_offset): Likewise.
12793         (Sized_relobj::local_has_tls_got_offset): Removed.
12794         (Sized_relobj::local_tls_got_offset): Removed.
12795         (Sized_relobj::set_local_tls_got_offset): Removed.
12796         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12797         * output.cc (Output_data_got::add_global): Added got_type parameter.
12798         (Output_data_got::add_global_with_rel): Likewise.
12799         (Output_data_got::add_global_with_rela): Likewise.
12800         (Output_data_got::add_global_pair_with_rel): New function.
12801         (Output_data_got::add_global_pair_with_rela): New function.
12802         (Output_data_got::add_local): Added got_type parameter.
12803         (Output_data_got::add_local_with_rel): Likewise.
12804         (Output_data_got::add_local_with_rela): Likewise.
12805         (Output_data_got::add_local_pair_with_rel): New function.
12806         (Output_data_got::add_local_pair_with_rela): New function.
12807         (Output_data_got::add_global_tls): Removed.
12808         (Output_data_got::add_global_tls_with_rel): Removed.
12809         (Output_data_got::add_global_tls_with_rela): Removed.
12810         (Output_data_got::add_local_tls): Removed.
12811         (Output_data_got::add_local_tls_with_rel): Removed.
12812         (Output_data_got::add_local_tls_with_rela): Removed.
12813         * output.h (Output_data_got::add_global): Added got_type parameter.
12814         (Output_data_got::add_global_with_rel): Likewise.
12815         (Output_data_got::add_global_with_rela): Likewise.
12816         (Output_data_got::add_global_pair_with_rel): New function.
12817         (Output_data_got::add_global_pair_with_rela): New function.
12818         (Output_data_got::add_local): Added got_type parameter.
12819         (Output_data_got::add_local_with_rel): Likewise.
12820         (Output_data_got::add_local_with_rela): Likewise.
12821         (Output_data_got::add_local_pair_with_rel): New function.
12822         (Output_data_got::add_local_pair_with_rela): New function.
12823         (Output_data_got::add_global_tls): Removed.
12824         (Output_data_got::add_global_tls_with_rel): Removed.
12825         (Output_data_got::add_global_tls_with_rela): Removed.
12826         (Output_data_got::add_local_tls): Removed.
12827         (Output_data_got::add_local_tls_with_rel): Removed.
12828         (Output_data_got::add_local_tls_with_rela): Removed.
12829         * resolve.cc (Symbol::override_base_with_special): Removed
12830         reference to has_got_offset_ field.
12831         * symtab.cc (Symbol::init_fields): Replaced initialization
12832         of got_offset_ with got_offsets_.  Removed initialization
12833         of has_got_offset_
12834         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12835         (Symbol::got_offset): Likewise.
12836         (Symbol::set_got_offset): Likewise.
12837         (Symbol::has_tls_got_offset): Removed.
12838         (Symbol::tls_got_offset): Removed.
12839         (Symbol::set_tls_got_offset): Removed.
12840         (Symbol::got_offset_): Removed.
12841         (Symbol::tls_mod_got_offset_): Removed.
12842         (Symbol::tls_pair_got_offset_): Removed.
12843         (Symbol::got_offsets_): New field.
12844         (Symbol::has_got_offset): Removed.
12845         (Symbol::has_tls_mod_got_offset): Removed.
12846         (Symbol::has_tls_pair_got_offset): Removed.
12847         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12848         (Target_x86_64::Scan::local): Updated callers of Output_data_got
12849         member functions.
12850         (Target_x86_64::Scan::global): Likewise.
12851         (Target_x86_64::Relocate::relocate): Likewise.
12852         (Target_x86_64::Relocate::relocate_tls): Likewise.
12853
12854 2008-03-25  Ben Elliston  <bje@au.ibm.com>
12855
12856         * yyscript.y: Fix spelling error in comment.
12857
12858 2008-03-24  Ian Lance Taylor  <iant@google.com>
12859
12860         * options.h (class General_options): Define build_id option.
12861         * layout.h (class Layout): Declare write_build_id, create_note,
12862         create_build_id.  Add build_id_note_ member.
12863         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12864         "libiberty.h", "md5.h", "sha1.h".
12865         (Layout::Layout): Initialize eh_frame_data_,
12866         eh_frame_hdr_section_, and build_id_note_.
12867         (Layout::finalize): Call create_build_id.
12868         (Layout::create_note): New function, broken out of
12869         Layout::create_gold_note.
12870         (Layout::create_gold_note): Call create_note.
12871         (Layout::create_build_id): New function.
12872         (Layout::write_build_id): New function.
12873         (Close_task_runner::run): Call write_build_id.
12874
12875         * x86_64.cc: Correct license to GPLv3.
12876
12877 2008-03-23  Ian Lance Taylor  <iant@google.com>
12878
12879         * options.cc: Include "demangle.h".
12880         (parse_optional_string): New function.
12881         (parse_long_option): Handle takes_optional_argument.
12882         (parse_short_option): Update dash_z initializer.  Handle
12883         takes_optional_argument.
12884         (General_options::General_options): Initialize do_demangle_.
12885         (General_options::finalize): Set do_demangle_.  Handle demangling
12886         style.
12887         * options.h (parse_optional_string): Declare.
12888         (struct One_option): Add optional_arg field.  Update constructor.
12889         Update call constructor calls.  Add takes_optional_argument
12890         function.
12891         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
12892         (DEFINE_optional_string): Define.
12893         (General_options::demangle): Change from DEFINE_bool to
12894         DEFINE_optional_string.
12895         (General_options::no_demangle): New function.
12896         (General_options::do_demangle): New function.
12897         (General_options::set_do_demangle): New function.
12898         (General_options::execstack_status_): Move definition to end of
12899         class definition.
12900         (General_options::static_): Likewise.
12901         (General_options::do_demangle_): New field.
12902         * object.cc (big_endian>::get_symbol_location_info): Call
12903         Options::do_demangle, not Options::demangle.
12904         * symtab.cc (demangle): Likewise.
12905
12906 2008-03-22  Ian Lance Taylor  <iant@google.com>
12907
12908         * gold.h: Include <cstddef> and <sys/types.h>
12909         * options.h: Include <cstring>.
12910
12911 2008-03-21  Ian Lance Taylor  <iant@google.com>
12912
12913         * Added source code to GNU binutils.